cancel
Showing results for 
Search instead for 
Did you mean: 

SDCARD does not work (FR_NOT_READY) when migrating from FW_F4 V1.27.0 to newer FW_F4 V1.27.1

DDi S.1
Associate III

As I wrote in the subject, Upgrading STM32CubeMX from version 6.6.1 to 6.7.0 The SDCARD stops working.

During mounting :

  fr=f_mount(&FatFs,"/",1);

  if(fr==FR_OK)

  {

    ...

   ....

 }

returns "FR_NOT_READY"

The micro is an STM32F4, I use SDIO in SD 4 bits Wide bus mode and it has always worked fine.

Regards

Domenico

12 REPLIES 12
TDK
Guru

@Ghofrane GSOURI After the comments you received, are you still under the impression that this is not a bug? As has been explained, SD card must be initialized in 1 bit mode before switching to 4 bits. This is per the SD specification. Could we get it fixed?

10 months later.

If you feel a post has answered your question, please click "Accept as Solution".

@Ghofrane GSOURI

@Amel NASRI 

I think that this is not a bug fix, it was correct and new version introduces a bug
https://community.st.com/t5/stm32cubemx-mcus/sdcard-does-not-work-with-4bits-wide-bus/m-p/602631/highlight/true#M26324

It should initialize with 1B like it was before and it switches to 4B later (the code is generated if choosing 4B mode):

 

  /* Configure SD Bus width (4 bits mode selected) */
  if (sd_state == MSD_OK)
  {
    /* Enable wide operation */
    if (HAL_SD_ConfigWideBusOperation(&hsd, SDIO_BUS_WIDE_4B) != HAL_OK)
    {
      sd_state = MSD_ERROR;
    }
  }

 

It was correct in 6.6.1 version and the bug is introduced in newer versions! Please fix this!
In worst case I guess you could introduce "initialization bus width mode" option in CubeMX?

 

Thank you!

static void MX_SDIO_SD_Init(void)
{
...
/* USER CODE BEGIN SDIO_Init 2 */
hsd.Init.BusWide = SDIO_BUS_WIDE_1B; //add this line, so that the automatic code generetation with STM32CubeIDE does not override the configuration
/* USER CODE END SDIO_Init 2 */
}

 

I confirm this also solves the SDIO issue with STM32F446RE, CubeMX 6.10.0 and STM32F4 package 1.28.0.