Electrical – SD card: cmd 17 (read single block) response always 0x01

microchippicsdspi

I'm trying to connect a micro-SD card to a PIC32 controller. At the moment I'm bitbanging the SPI protocol to communicate with the card. (In the near future I will use the proper pins to use real SPI, but for now I have to use this solution). Long story short: I am able to initialise the card and get correct responses for all commands, but when I try to issue the cmd 17 command, it responds with 0x01 (idle) instead of 0x00 (ready) and any subsequent reads all return 0xFF. The token 0xFE never comes. I've tried a lot of different sectors as argument for cmd 17, but that doesn't make a difference.

These are the commannds and responses:

>> (0) 40 00 00 00 00 95 
<< (0) 01 

>> (8) 48 00 00 01 AA 87 
<< (8) 01 00 00 01 AA 

>> (55) 77 00 00 00 00 65 
<< (55) 01 

>> (41) 69 40 00 00 00 77 
<< (41) 01 

>> (58) 7A 00 00 00 00 FD 
<< (58) 01 40 FF 80 00 

>> (16) 50 00 00 02 00 15 
<< (16) 01 

>> (17) 51 00 00 00 00 55 
<< (17) 01 

They all look good to me, except the last one.
(BTW, I'm always using the correct CRC even though I'm aware that it's not neccesary)

The card is powered with 3.3V. The voltage doesn't drop when accessing the card. All lines excepct clk have a 100k pullup resistor.

What could be the reason for cmd 17 not giving the correct response?

Edit: clock frequency is about 145 kHz. Remember it is bitbanged. Could this have any influence on the read command?

Best Answer

Solved! It turns out that also ACMD41 has to respond with 0x00 (ready) instead of 0x01 (idle). In my initialisation routine I have to retry this command until the desired response.