cancel
Showing results for 
Search instead for 
Did you mean: 

How to fix error return by SDMMC_GetCmdResp1

KPras.2
Associate III

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.....

3 REPLIES 3
AScha.3
Chief II

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 ?

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

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.

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

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???