2014-09-14 04:13 AM
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? #camera #dcmi #sdio #dma2015-01-20 06:42 AM
Hi,
In fact, when the uSD is usedthe Camera module must be unplugged, this is due tothe shared pins between the two devices. Try to set the Camera STANDBY pin(to avoid conflict with SDCard detect pin)/* Set the camera STANDBY pin */
BSP_IO_ConfigPin(XSDN_PIN, IO_MODE_OUTPUT);
BSP_IO_WritePin(XSDN_PIN, SET);
Regards,
Heisenberg.
2016-02-07 06:41 AM
Hi.
Check that interrupt priority of SDIO is higher than that of DMA handler.DMA handler waits for SDIO interrupt to set complete flag.