cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L443 don't recognize all types of SD cards

Szabolcs Vass
Associate II
Posted on August 04, 2017 at 10:01

Hello everyone,

I'm working on a project, where I need to store datas on an SD card. I use an STM32L443 microcontroller. The controller communicate with another device through UART communication, and save the datas to the SD card. The program works correctly with a no name SD card (I don't know the manufacturer, because I get it from smoebody). If I change the SD card to a 8GB Sony SD card, or to a Maxell 4GB SD card the controller doesn't recognize the card sometimes. Somtimes recognize, somtimes don't recognize. When I connect to the Debugger and go to debug mode, the program works fine and recognize the cards everytime.

In this situation I don't debug the problem because the problem doesn't present in debug mode. Can You help me? I think that the NRST pin influence it, but if this pin influence why don't influence with the no name SD card?

The project was generated form STM32CubeMx and the programming environment is System Workbench for STM32. I know that similar question exist in this forum, but he answers that I get there, isn't help for me.

Please help me.

Thank You for the answers,

Szabolcs  

#stm32l443 #sd-cards #don't-recognize
2 REPLIES 2
Szabolcs Vass
Associate II
Posted on August 04, 2017 at 10:18

*If the program run free without debugger, and pull down the NRST pin to ground to restart the device, everytime recognize the cards.

Szabolcs Vass
Associate II
Posted on August 04, 2017 at 13:12

I tested with a buzzer that where fail the program. Inside of the SD_PowerON function exist a while loop. When the cards don't recognize this while loop run infinitelly and never go out from there.

   

    /* Send ACMD41 SD_APP_OP_COND with Argument 0x80100000 */

    while(validvoltage == 0)

    {

      if(count++ == SDMMC_MAX_VOLT_TRIAL)

      {

        return HAL_SD_ERROR_INVALID_VOLTRANGE;

      }

      

      /* SEND CMD55 APP_CMD with RCA as 0 */

      errorstate = SDMMC_CmdAppCommand(hsd->Instance, 0);

      if(errorstate != HAL_SD_ERROR_NONE)

      {

        return HAL_SD_ERROR_UNSUPPORTED_FEATURE;

      }

      

      /* Send CMD41 */

      errorstate = SDMMC_CmdAppOperCommand(hsd->Instance, SDMMC_STD_CAPACITY);

      if(errorstate != HAL_SD_ERROR_NONE)

      {

        return HAL_SD_ERROR_UNSUPPORTED_FEATURE;

      }

      

      /* Get command response */

      response = SDMMC_GetResponse(hsd->Instance, SDMMC_RESP1);

      

      /* Get operating voltage*/

      validvoltage = (((response >> 31) == 1) ? 1 : 0);

    }