evandude
New Member
I have been playing around with interfacing an SD card using SPI mode on an 18F2550. I've succeeded in getting through the initialization sequence, but now I think I'm stuck. FYI, I'm bit-banging the SPI interface, and have a logic analyzer hooked up to the 4 SPI lines to verify everything that's going on. I haven't included code here because I'm verifying that what I'm "trying" to do is what's actually happening on the data lines, rather than just trusting the code blindly.
Once the initialization is complete, I'm trying to do a single block read, so I send CMD17 (with address 0x0000, crc 0xFF because I don't have CRC enabled) and wait for the R1 response, which is 0x00 as it should be, and then wait for one of the two possible responses: a start token, or an error token.
The problem is that the start token should be 0xFE, and the error token format has the 3 MSB's as zero. The actual response I get is 0xFC, which fits neither of those descriptions - and then the card holds the data line low, at which point I have to send it hundreds of clock cycles to get it to release it, or reset it.
When I try the SEND_CSD command instead, it does the same thing except it utterly refuses to release the data line unless the PIC is reset.
I can't seem to figure out what's going on... Anyone got any advice? Is there anything I'm forgetting to do, ie - do I need to do anything other than initialize the card and then try to read from it?
Once the initialization is complete, I'm trying to do a single block read, so I send CMD17 (with address 0x0000, crc 0xFF because I don't have CRC enabled) and wait for the R1 response, which is 0x00 as it should be, and then wait for one of the two possible responses: a start token, or an error token.
The problem is that the start token should be 0xFE, and the error token format has the 3 MSB's as zero. The actual response I get is 0xFC, which fits neither of those descriptions - and then the card holds the data line low, at which point I have to send it hundreds of clock cycles to get it to release it, or reset it.
When I try the SEND_CSD command instead, it does the same thing except it utterly refuses to release the data line unless the PIC is reset.
I can't seem to figure out what's going on... Anyone got any advice? Is there anything I'm forgetting to do, ie - do I need to do anything other than initialize the card and then try to read from it?