AnsweredAssumed Answered

SDIO transfers gets stuck

Question asked by Zhang.Yale on Sep 14, 2014
Latest reply on Feb 7, 2016 by isaev.michael
Hi everyone. I'm having trouble writing images from a camera to a microSD card on my STM32F4 Discovery board. The SD writes keep getting stuck in the HAL
 function, SD_DMA_RxCplt(). I'm using FAT_FS, so even though I'm writing, the file system book keeping still needs to read.

* Wait until SD transfer is complete */
while(hsd->SdTransferCplt == 0)

One huge clue is that this only happens when I set the SD clock to be faster than 1/12 of the AHB speed (168 MhZ). Similarly, if I turn off the DCMI capture interface, I can use any SD clock speed within spec.

This seems to be some issue with DMA. I'm using DMA2 for both the SDIO and camera interface, so could there be FIFO overflows or lost interrupts causing the SD read to never be completed? How can I fix that?

The camera clock is 16MhZ, so the maximum data rate is 16MiB/s (usually much less (< 2 MiB/s) since the images are JPEG). The DMA configuration is circular buffer,  no FIFO, 1 word burst. The SDIO  DMA configuration is FIFO, 4 word burst. I tried changing the camera DMA configuration to 4 word burst, but that didn't help. It also seems 4 word burst transfers for DCMI would be wrong because that would require the FIFO to be full before writing to memory, meaning incoming pixels might be dropped due to the FIFO being full?