Skip to main content
PMeht.1
Associate
Mar 23, 2023 3:59 PM UTC
Question

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

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.

This topic has been closed for replies.

2 replies

Tesla DeLorean
Guru
Mar 23, 2023 4:23 PM UTC

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 (See Profile) Up vote any posts that you find helpful, it shows what's working..
PMeht.1
PMeht.1Author
Associate
Mar 24, 2023 1:36 PM UTC

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.