# SD Card Reset Issue

I've got an issue where I'm playing around with the SPI commands to get SD card comms working but it seems that if I send something the card doesn't like I get in a condition where it can't reset. Then every time I send the reset command 0x00 it just times out after 0xFFFF tries.

Sequence is like this...

1) Wait 80 clocks

2) Engage CS

3) Send 0xFF for 8 clock delay then 6 bytes command+crc (0x40, 0x00, 0x00, 0x00, 0x00, 0x95)

4) Try to get anything other than 0xFF (0xFFFF attempts)

5) Timeout. Disengage CS. Hit watchdog timeout and the board resets and tries again with no success until I turn the power off and on again.

The issue is that I'm sending something dodgy and it fails to get out of that until I reset the power. I could just presume that when I get my code 100% then it will always be fine, but I want this thing to always work. Do I need to put a power switch on my pcb or is there another way to get out of this condition?

Thanks.

I could put some cards (Samsung OEM SD 2GB) reliably into an error state by reading the rarely used SD_STATUS register in SPI mode. These cards would only work again after a power off.