I'm trying to roll my own SPI SD card management. So far, I can get the card initialised (details of that further down). Once initialised, when I send the Write_Block (CMD24) or Read_Single_Block (CMD17) commands, the SD card always returns 0x04 (illegal command) as an R1 response. Has anyone seen this before?
Some more detailed information about how I setup the card etc:
- I send 74 empty bits to the card with CS high,
- Send CMD0 with CRC 0x95 until I get 0x01 as a response,
- Send CMD8, argument 0x1AA, with CRC 0x87, and get an R1 response of 0x01, R7 response of 0x1AA,
- Send CMD55/ACMD41 until I get an R1 response of 0x00
(I've stepped through all these steps with a debugger to check that I'm getting the responses that I expect)
At this point I send CMD17 or CMD24 and get a response of 0x04. I've tried a few different arguments as addresses, 0x00, 0x01, 0x200, but all with the same result. Anyone got any ideas here?
Thanks in advance.
EDIT: I had another kind of timing issue that caused this - my clock was relatively garbled (one very long pulse, and then 7 short ones for each byte), and that seems to have caused the problem (I'm not sure, since I'm still working through other issues). I'm surprised I managed to get the card to initialise at all.