cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L476JEY generates RX overrun error when using DMA to read from SD card

PMeht.1
Associate II

I am using STM32L476JEY MCU. SDMMC works fine at 4 MHz clock speed with interrupt enabled and DMA disabled. However when I use DMA to read a block it generates Rx overrun error. When I checked the output buffer it read 4 bytes instead of 512 bytes.

I turned on DMA on SDMMC_Tx and SDMMC_Rx. I also turned on NVIC interrupt for SDMMC1. DMA runs from AHB bus whose speed is 80 MHz.

I wanted to use DMA as 4 MHz is not enough clock speed.

I have used STM32L4+ mcu which has internal DMA for SDMMC and it works fine.

Thank you in advance.

2 REPLIES 2

DMA should work on the regular L4 parts too.

Avoid pointing the debugger are the SDMMC registers, or trying to single step or breakpoint the transfer.

The debugger will break the FIFO operation.

The MicroSD cards should be able to work in 4-bit 25 MHz modes

Perhaps look at CubeL4 examples rather than let CubeMX/IDE build code

STM32Cube_FW_L4_V1.17.2\Projects\32L496GDISCOVERY\Applications\FatFs\FatFs_uSD_DMA_RTOS\Src\sd_diskio_dma_rtos.c

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
PMeht.1
Associate II

I am able to successfully write a block using DMA. However reading a block using DMA still gives me Rx overrun error. I also tried it without debugger attached.