Skip to main content
Visitor II
January 12, 2024
Question

How to fix error return by SDMMC_GetCmdResp1

  • January 12, 2024
  • 2 replies
  • 1447 views

Dear Sir,

I have interfaced SDHC card 32GB of Sandisk with STM32L452RET6 microcontroller SDMMC1 peripheral in mode - SD 4 bit wide bus. In my device SD card as a Datalogger.

Issue - When my device is working mean data is logging (Data writing in SD card). In this period i have cut SD CMD line and again connected.

In this period - function this SDMMC_GetCmdResp1 return a error.

In working condition - Which routine we have to call to fix this issue???

Please suggest solution for this issue.....

    This topic has been closed for replies.

    2 replies

    Super User
    January 12, 2024

    Hi,

    >In this period i have cut SD CMD line and again connected. <

    This means ...what ? you cut the trace ?

     

    +

    SDcard is working , mount , read dir , read file -> ok ?

    Super User
    January 12, 2024

    I mean, if you're cutting traces, it's expected that an error will occur. Don't cut traces to prevent this from happening.

    If the peripheral gets into a weird state, re-initialize it from the beginning. But you might not need to do anything. You may just need to re-send the command you want.

    SDIO is fairly complicated. The specification has a nice flowchart for the internal state machine and what happens in various error scenarios. What happens will depend on what state it was in when CMD was cut.

    KPras.2Author
    Visitor II
    January 15, 2024

    Dear Sir,

    Thanks for the reply.

    Yes i have cut trace of the CMD line then it instant function returns error.

    This procedure i am doing in debug mode. I have already place break point for the scanning of error. When debugger received error then its code of execution has stop. Then again i have reconnect the CMD trace. And reinitialize 

     MX_SDMMC1_SD_Init();
     MX_FATFS_Init();
     MX_SPI1_Init();  

    MountSDCard (); 

    i am doing re-initialization of the peripheral but SD card not becomes mount. It gives again error. Why it is not mount???