Friday, February 8, 2013

SD card timing diagram

YES!!! I got a response back from the SD card!!!!

What I did basically was:

-- wait 128 cycles
-- send 400000000095 (CMD0)
-- send 48000001AA87 (CMD8, requesting 3.3V, check pattern of AA, CRC)
-- received 08000001AA13 (R7, 3.3V accepted, check pattern of AA echoed back, CRC)
Here is some data they don't tell you in the simplified SD card specs.

The relationship between the SD clock and the I/O is shown in this diagram.  I found it quite easy to have an internal clock running at twice the speed of the SD clock in order to achieve this timing.

The main thing to note is that the I/O (ie what you see on the DAT0 line) always changes on the falling edge of the SD clock and is always stable (so it can be read) on the rising edge of the SD clock.  Maybe this is obvious to some, but I agonized over it which is why I am posting it here.

Also, I am pretty sure that the data lines (including CMD) have pull-up resistors on them although I have not had this confirmed.

Also (thanks to Dave Spicer for telling me about this), you need to wait up to 128 clock cycles (may be less, I'd need to experiment) after powering up the SD card before you can send the first command (CMD0) to it.

No comments:

Post a Comment