hi,
I'm thinking about optimizing my sensor data logging on SD card application code.
The sensor is connected to a USART, and it's data is read by DMA USART RX, and saved in buffer in SRAM, and the CPU takes SRAM data and send them to SD card connected on SPI.
So I'm thinking about the following setting:
void init_hmatrix(void) { union { unsigned long scfg; avr32_hmatrix_scfg_t SCFG; } u_avr32_hmatrix_scfg; // For the internal-flash HMATRIX slave, use last master as default. u_avr32_hmatrix_scfg.scfg = AVR32_HMATRIX.scfg[AVR32_HMATRIX_SLAVE_FLASH]; u_avr32_hmatrix_scfg.SCFG.defmstr_type = AVR32_HMATRIX_DEFMSTR_TYPE_LAST_DEFAULT; AVR32_HMATRIX.scfg[AVR32_HMATRIX_SLAVE_FLASH] = u_avr32_hmatrix_scfg.scfg; // it seems the following PBA slave setting does slows down microSD card logging. // For the PBA HMATRIX slave, use last master as default. u_avr32_hmatrix_scfg.scfg = AVR32_HMATRIX.scfg[AVR32_HMATRIX_SLAVE_PBA]; u_avr32_hmatrix_scfg.SCFG.defmstr_type = AVR32_HMATRIX_DEFMSTR_TYPE_LAST_DEFAULT; AVR32_HMATRIX.scfg[AVR32_HMATRIX_SLAVE_PBA] = u_avr32_hmatrix_scfg.scfg; // it seems the following SRAM slave setting doesn't change microSD card logging speed. // For the SRAM HMATRIX slave, use last master as default. u_avr32_hmatrix_scfg.scfg = AVR32_HMATRIX.scfg[AVR32_HMATRIX_SLAVE_SRAM]; u_avr32_hmatrix_scfg.SCFG.defmstr_type = AVR32_HMATRIX_DEFMSTR_TYPE_LAST_DEFAULT; AVR32_HMATRIX.scfg[AVR32_HMATRIX_SLAVE_SRAM] = u_avr32_hmatrix_scfg.scfg; }
in my case, the DMA master should only connects to SRAM slave, and CPU data master should only connects to PBA slave, so there should be no conflict, right?
but the test result shows that enabling PBA slave setting do slows down SD card writting speed a little, why?