I was trying to initialize a Sandisk Micro SD card, High Capacity, using SPI. CMD0 returns 0x01, which is good. But then CMD8 returns 0x05 as the first 8 bits received, indicating an illegal command, which doesn't make sense because this is SDHC.
I did the following (The clock is at 200kHz. Data is sent MSB first, Data is read MSB first).
- For 100 clock cycles: MOSI = 1; CS = 1
- Next 48 clock cycles: CMD0 is sent through MOSI with CS = 0: 0x400000000095
- Next 8 clock cycles: Read MISO line: 0x01
- Next 48 clock cycles: CMD8 is sent through MOSI: 0x48000001AA0F
- Next 8 clock cycles: Read MISO line: 0x05
I've tried substituting CMD58 in for CMD8 in those steps, and that returned a legal command, so I don't think it is a timing issue. But I can't think of a reason why it would return an illegal command error for CMD8 when this card is SDHC. Can anyone help me with this issue?