cancel
Showing results for 
Search instead for 
Did you mean: 

MX_SDIO_SD_Init wrong bus wide initialization

FRugi.1
Associate

I have a STM32F407 with an SD card wired in 4-bytes mode and FATFS middleware to manage the files.

I upgraded to STM32CubeIDE 1.11 two weeks ago, but since then the SD card stopped working. The initialization fails in the SD_WideBus_Enable function, since scr[1] is read as 0 (file stm32f4xx_hal_sd.c).

I noticed that this behavior disappears when I set hsd.Init.BusWide = SDIO_BUS_WIDE_1B in MX_SDIO_SD_Init (file sdio.c). This, however, was changed in SDIO_BUS_WIDE_4B in the newer version of the IDE, breaking the functionality.

I was not able to check whether the SD actually works in 4-bits mode when initialized to SDIO_BUS_WIDE_1B, but I think so, since the HAL_SD_ConfigWideBusOperation gets called with 4 bytes.

So, is it correct to continue using SDIO_BUS_WIDE_1B? If so, how can I preserve it, since every time I let Cube to generate the files the modification gets overwritten?

1 ACCEPTED SOLUTION

Accepted Solutions
Amel NASRI
ST Employee

Hi @FRugi.1​ & @DDi S.1​ ,

An explanation of what was updated is provided by @Ghofrane GSOURI​ in this thread: SDCARD does not work (FR_NOT_READY) when migrating from FW_F4 V1.27.0 to newer FW_F4 V1.27.1.

Could you please refer to it?

-Amel

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

3 REPLIES 3
DDi S.1
Associate III

Hi.

I did it this way and I hope it helps you.

in main.c put the following line:

/* USER CODE BEGIN 2 */

 hsd.Init.BusWide = SDIO_BUS_WIDE_1B;

Amel NASRI
ST Employee

Hi @FRugi.1​ & @DDi S.1​ ,

An explanation of what was updated is provided by @Ghofrane GSOURI​ in this thread: SDCARD does not work (FR_NOT_READY) when migrating from FW_F4 V1.27.0 to newer FW_F4 V1.27.1.

Could you please refer to it?

-Amel

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

thunks, however you are!!