Hey there,
I'm currently working on a K64F based board running freeRTOS tasks. I'm trying to use the SD card for data logging through SPI1, but my data logging service is apparently interrupting the UART interruptions too often.
I'm using KSDK 1.3's fatfs files provided in "..\KSDK_1.3.0\middleware\filesystem\fatfs" with fsl_sdspi_disk and fsl_sdcard_spi (..\KSDK_1.3.0\platform\composite\src\sdcard). Inside the fsl_sdspi_disk I use the EDMA for the SPI1 communication. Because the fatfs gives me a limitation of a minimum transfer block size of 512KB, I had to change the SPI1_IRQHandler in fsl_dspi_edma_irq.c to use DSPI_DRV_IRQHandler(SPI1_IDX) instead of DSPI_DRV_EdmaIRQHandler(SPI1_IDX) - therefore I'm not using the EDMA for receiving data, right?
Because I'm not using EDMA to receive data, due to block size limitation of the fat, I believe that the SPI is interrupting the UART too often - it initializes the sdcard with 700KHz and then it goes to +1MHz. I'd like to know if there's any work around to fully use the EDMA to communicate with an SD card. My application is using three UARTs with baud rates of 4800, 9600 and 19400 bps - those UARTs have polling reception because they receive variable string length.
Best Regards,
Hi,
Regarding your question, Now, you use SPI to transfer data between memory and SD card based on interrupt mechanism without DMA, because of overload of SPI interrupt, some uart interrupt is not serviced.
I do not know why you can not use the spi plus DMA mode, which will decrease the cpu loading.
BR
XiangJun Rong
Hello XiangJun Rong,
I was trying to use SPI with DMA. I ended up changing the SDSPI_DRV_Write and SDSPI_DRV_Read functions in fsl_sdcard_spi.c so that it would send divide a 512B block in two 256B to exchange.
Best Regards,
Denis