cancel
Showing results for 
Search instead for 
Did you mean: 

CMD16 timeout on STM32F746G-Discovery

aaron2399
Associate II
Posted on February 04, 2016 at 20:41

Hello!

I am running tests on an SD card plugged into my STM32F746G-Discovery board. I am using the STM32F7xx_HAL_Driver and the BSP utilities provided for the Discovery board to access the SD card.

When I use DMA for transfers to the SD card (

BSP_SD_WriteBlocks_DMA()

), everything works as expected and the tests pass without error. However, when I transfer in polling mode (

BSP_SD_WriteBlocks()

), after a few hundred I/O operations, I run into the following error: in 

HAL_SD_WriteBlocks()

, after issuing a CMD16 (

SD_CMD_SET_BLOCKLEN

), I get a command timeout error (

SD_CMD_RSP_TIMEOUT

). If I backup and try the CMD16 again, it timeouts again (even if I try 50 times).

This problem happens on multiple SD cards. The error does not occur in the same place every time; it may be on the 420th iteration or the 460th (etc), but it does happen every time I run through the tests. Is this a hardware issue? Or a driver bug? Or possibly a configuration problem on my part?

#stm32f746discovery-sd-card #sdio-sdhc-stm32 #stm32f7
1 REPLY 1
aaron2399
Associate II
Posted on February 04, 2016 at 22:16

I'm also getting the same error (timeout after CMD16) from BSP_SD_ReadBlocks() when using FatFs with the SD driver provided by ST Micro (sd_diskio.c). Again, it doesn't happen at a predictable time; many reads pass successfully before it fails.

So it's looking like this is an issue with either the board or the driver.