AnsweredAssumed Answered

MicroSD card problem, bug in the file(stm32f4xx_hal_sd.c) ?

Question asked by mao on Jan 15, 2017
Latest reply on Mar 21, 2018 by Poonam Deoghare

Hello 

I am reporting a bug generated by cubemx in the file stm32f4xx_hal_sd.c.

Please read the thread: microSD card problem , SD MMC Power on issue (STM32L4) 

Here is the thing:

1. Pack version: STM32Cube_FW_F4_V1.13.0, Cubemx 4.16.1. The uSD card I tested is 1GB made in japan.

2. The lib for microSD and file is generated by cubemx wizard.

3. I tested the microSD on the chip STM32F405RGT6 . . 

4. The problem I confronted is that initialization of sd card always fails, but everything goes through smoothly if I reset the chip(via nrst). Weird? Make the story short. Initialization of SD card fails in the function: SD_PowerON(SD_HandleTypeDef *hsd) with error code SD_COM_CRC_FAILED. Note the function is defined in the file: stm32f4xx_hal_sd.c

5. I moved the HAL_Delay(1) to after clock_enable in the function SD_PowerON , everything is working well.

 

I am not sure is this sd card related. Any people has similar problem?

Outcomes