AnsweredAssumed Answered

SDHC Error Recovery

Question asked by joe hinkle on Dec 13, 2018
Latest reply on Dec 25, 2018 by joe hinkle

I have a K64 in a commercial application which uses the SDHC to interface with a micro SD card.

 

The code for reading and writing sectors include several "while" loops waiting for flags to be set in the SDHC controller's register to identify completion of the operation.

 

On several SD cards (at customer not at my location) the SDHC code stalls waiting for a completion flag to be set -- which NEVER sets.

 

I have installed timout within these "while loop" code sections to break out after 25 millsecs without the flag being set.

 

My question -- what is the best/robust error recovery method which will result in completion if run again?

 

Right now -- I'm of the mindset the issue is with the SD card since I have replaced the CPU board and the same issue occurs.

 

The current recovery method I have employed is to trap the timeout error at the read/write block functions and force a SDHC initialization again (kick it in the head and do a SDHC reset and initialize the whole system again).

 

My current method seems like an extreme measure because it takes time to perform the initialization process which leads to the customer seeing/hearing the extended time.  

 

I'm attempting recovery this way since I don't know a better way to correct the operational status of the SDHC or the SD card so the read/write operation can be attempted again and complete without error.

 

Any insights or comments - please tell.

 

Thanks.

 

Joe

Outcomes