Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By hjalfi
#90432 I'm trying to talk to an SD card using HSPI. 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?

Image
User avatar
By davydnorris
#90441 What are you using? A library, NonOS, RTOS, Arduino, your own code?

If not, my suggestion is to get it working with something like an Arduino sketch or a worked SDK example that is known to work to make sure the hardware is all OK, then go back to your own project.

You'll also be able to get logic traces from the working code too, which might help
User avatar
By hjalfi
#90442 My own code. I did want to compare with NodeMCU, but it looks like the autobuilder is down. I'll give the Arduino version a try but I know very little about it.

I have tried swapping out the entire MCU with an MSP430 I have, which is running the same high-level SD card init code, and that one works fine. Unfortunately I can't see anything significantly different between the two logic traces. The problem is that I don't have enough experience to know what 'significant' means here, so I'm looking for someone who can take a look at the logic analyser trace and point out anything which looks wrong.