cancel
Showing results for 
Search instead for 
Did you mean: 

SD Command Timeout

carl2399
Associate II
Posted on July 27, 2012 at 02:58

Just curious if any one else has issues with, or has a workaround for an issue I've been experiencing with the SDIO controller on STM32F20x devices.

I'm developing a data logging that writes data to SD card at the rate of about 2K bytes per second. I've got DMA transfer and also multi-block transfers working fine and have verified bulk transfer speeds around 6M bytes per second. 

The problem is that every once in a while (several thousand block writes) I get a command timeout. I've read a fair bit on the web about people having similar issues (typically with SD_CMD_SET_BLOCKLEN). However, if I get rid of ''spurious'' block length setting then the same error just moves to sequentially the next command along (typically SD_CMD_WRITE_SINGLE_BLOCK).

I guess my question is twofold:

1) Is there a known cause? Something that I could maybe detect beforehand.

2) Is there a ''best sequence'' to recover from this state back to normal operations?

4 REPLIES 4
amin23
Associate II
Posted on August 02, 2012 at 09:19

Hi,

Add the following lines after SD_Write function:

status = SD_WaitWriteOperation();

while(SD_GetStatus() != SD_TRANSFER_OK);

if (status == SD_OK)

{

  //OK;

}

else

{

  //ERROR;

}

frankmeyer9
Associate II
Posted on August 02, 2012 at 10:16

The problem is that every once in a while (several thousand block writes) I get a command timeout.

 

Could it possible that the timeout happens if an actual block erase is involved ?

Moritz M
Associate II
Posted on November 21, 2012 at 18:44

Hi CJacobs,

I'm experiencing the same problem (randomly occurring command timeout with SD_CMD_SET_BLOCKLEN) on a STM32F1xx.

Did you find a solution for your problems?

Moritz M
Associate II
Posted on November 22, 2012 at 17:16

so i solved my problem. it was, that the card was still busy when tried to send a new command.