cancel
Showing results for 
Search instead for 
Did you mean: 

SD Card with STM32F405 and STMCube SDIO driver does not work in 4-bit mode

Posted on January 16, 2015 at 13:27

Hello,

I have double checked all connections of SD card socket to uC on our board. We also have pull-up resistors there.

Required setting of 4-bit access can be seen in the SDIO_CLKCR.WIDBUS register during debugging but function disk_initialize called in f_mount retutns FR_NOT_READY.

Any opinion?

However, it is suspicious that I had to increase the SCLK divider to low the SCLK frequency for a reliable work (in 1-bit mode).

Regards

Ivan

2 REPLIES 2
Posted on January 19, 2015 at 10:03

Hi Ivan,

The 4-bit SD Data Transfer Mode is Mandatory for High-Speed Cards, Optional for Low-Speed ones, so it depends on the used uSD card type. Otherwise, it's better to configure first the 1-bit SD Data Transfer Mode:

hsd.Init.BusWide = SDIO_BUS_WIDE_1B;

And then, just enable wide operation, for the 4-bit SD Data Transfer Mode:

HAL_SD_WideBusOperation_Config(&hsd, SDIO_BUS_WIDE_4B);

0690X00000602x0QAA.jpg 0690X00000602tXQAQ.jpg PS: You can refer to the stm324x9i_eval_sd.c/stm324xg_eval_sd.c BSP drivers, that may help you! Regards, Heisenberg.
Posted on January 26, 2015 at 18:58

Hello Heisenberg,

Late setting of 4-bit mode works (I checked it by scope on SD Card signal D3) but the function

HAL_SD_WideBusOperation_Config

has to be called even after

f_mount

. Unfortunatelly, the file write still does not work reliably due to an interrupt (another issue). Regards Ivan