I'm trying to talk to an SD card from an ESP8266, using one of the internal SPI drivers. No matter what I do, the card never responds to the initial CMD0 setup command. I think I'm sending the command correctly, but I never see any activity on MISO. I have:

  • verified connectivity on the MISO line from the microcontroller to the card;
  • tried with multiple cards;
  • tried with multiple card readers;
  • tried at a variety of clock speeds (currently it's set to about 300kHz)
  • verified that the internal pullup resistors on MOSI and MISO are enabled

...and now I'm out of ideas. My suspicion is that there's something subtly wrong I'm doing with the initialisation ritual which is causing the card to never wake up. This is the sort of thing which anyone with experience should be able to tell at a glance from the logic analyser trace, right? So here it is. You can see the remains of the init sync sequence on the left (20 bytes clocked with CS high). Then CS goes low, and there's the 04 00 00 00 00 95 CMD0 packet going out; I would normally expect to see activity on MISO in response, but there's nothing. Pulseview's protocol decoder thinks the command is valid. Is there anything obviously wrong here?

enter image description here


1 Answer 1


I found that there are some tricky details with the initialization of SD cards.

I found the practical information on this site very useful when I went through it a few years ago:

How to Use MMC/SDC

  • \$\begingroup\$ I'm using someone else's SD card library, so I'm relatively sure that the protocol itself is correct. That's a really useful reference, though --- thanks. \$\endgroup\$ Commented Feb 6, 2021 at 11:22
  • \$\begingroup\$ @DavidGiven - there are some subtleties regarding time delays during initialization that are important. \$\endgroup\$ Commented Feb 6, 2021 at 18:44
  • \$\begingroup\$ I have the timing as close as I can manage, and I've compared with the output from another MCU at about the same speed which works --- can you suggest any specific things to check for? \$\endgroup\$ Commented Feb 6, 2021 at 22:44
  • \$\begingroup\$ @DavidGiven just so curious did you fixed this issue eventually? I’ve encountered this problem as well. \$\endgroup\$
    – Travis Su
    Commented Jul 26, 2023 at 21:12
  • \$\begingroup\$ I don't recall, sorry. I may have just kept fiddling with it until it worked. The SD card protocol is simply cursed. \$\endgroup\$ Commented Jul 27, 2023 at 22:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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