0
\$\begingroup\$

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?

\$\endgroup\$
  • \$\begingroup\$ does stackoverflow.com/questions/43467866/… help? \$\endgroup\$ – Marcus Müller May 25 '18 at 11:23
  • \$\begingroup\$ No, not really. That seems to be a different problem. In my case cmd13 still works before and after the cmd17 command. \$\endgroup\$ – Hneel May 25 '18 at 12:01
  • \$\begingroup\$ 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. \$\endgroup\$ – Hneel May 30 '18 at 9:54
  • \$\begingroup\$ can you post that as an answer? That way, people can see your problem is solved, and google will lead them to your solution. \$\endgroup\$ – Marcus Müller May 30 '18 at 10:22
1
\$\begingroup\$

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.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.