cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 CubeMX FATFS SDIO DMA hangs

dawime
Associate II
Posted on February 20, 2016 at 03:24

I have regular transfers working for read/writes. I am trying to get transfers working with DMA. I am using CubeMX 4.12.

I set it up to have a dma request for both TX and RX (DMA2 Stream 3 and DMA2 Stream 6 respectively).

I modified sd_diskio.c function SD_read to point to BSP_SD_ReadBlocks_DMA instead of BSP_SD_ReadBlocks - But the system hangs in SD_DMA_RxCplt waiting for the transfer to finish.

MX_DMA_Init() is called in the configuration of the initialized peripherals - Any ideas ? Thanks

#no-hablo-hal #je-ne-l''aime-cube
2 REPLIES 2
Posted on February 20, 2016 at 17:09

There's a whole other [DEAD LINK /public/STe2ecommunities/mcu/Lists/STM32Java/AllItems.aspx]forum page dedicated to the trials and tribulations with HAL/Cube.

You really only need one DMA channel/stream for SDIO DMA, as you can only Read or Write in one direction at a time.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
greg239955_stm1
Associate II
Posted on February 25, 2016 at 01:20

Check HAL_SD_MspInit() function.

For me it sets 2 settings incorrectly:

hdma_sdio_tx.Init.Mode = DMA_PFCTRL;    // generator sets DMA_NORMAL

...

hdma_sdio_rx.Init.Mode = DMA_PFCTRL;    // not  DMA_NORMAL;