1
\$\begingroup\$

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.

\$\endgroup\$

1 Answer 1

4
\$\begingroup\$

Do I need to put a power switch on my pcb or is there another way to get out of this condition?

Short answer: Yes, you need a power switch.

The spec says that cutting the power is the only way to reset the sd card. You would need to do that to switch from SPI back to SD mode for example.

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.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.