Zephyr SD card returns "Card never left busy state"

Using the zephyr RTOS I currently want to acces filesystem on a SD card. I wired it correctly and used this example to getting started: https://github.com/zephyrproject-rtos/zephyr/tree/main/samples/subsys/fs/fs_sample

The log returns follwowing error:

[00:00:03.463,989] <inf> sd: Detected SD card
[00:00:05.601,104] <err> sd: Card never left busy state
[00:00:05.601,135] <err> sd: Card init failed
[00:00:05.601,165] <err> main: Storage init ERROR!

Hence, I wired my Logic to get some more details

.

There is definitely some communication, but not as described here: http://elm-chan.org/docs/mmc/mmc_e.html.

Here are the first commands:

name type start_time duration mosi miso

SPI result 1.0015495 3.05e-05 0x40 0xFF

SPI result 1.00158175 3.05e-05 0x00 0xFF

SPI result 1.001614 3.05e-05 0x00 0xFF

SPI result 1.00164625 3.075e-05 0x00 0xFF

SPI result 1.00167875 3.05e-05 0x00 0xFF

SPI result 1.001711 3.05e-05 0x95 0xFF

SPI result 1.0017435 3.05e-05 0xFF 0xFF

SPI result 1.00177575 3.05e-05 0xFF 0x01

SPI result 1.001808 3.05e-05 0xFF 0xFF

SPI result 1.00184025 3.075e-05 0xFF 0xFF

SPI result 1.00187275 3.05e-05 0xFF 0xFF

SPI result 1.001905 3.05e-05 0xFF 0xFF

SPI result 1.00193725 3.05e-05 0xFF 0xFF

SPI result 1.0019695 3.05e-05 0xFF 0xFF

SPI result 1.00200175 3.075e-05 0xFF 0xFF

SPI result 1.00203425 3.05e-05 0xFF 0xFF

SPI result 1.0020665 3.05e-05 0xFF 0xFF

SPI result 1.00209875 3.05e-05 0xFF 0xFF

SPI result 1.00213125 3.05e-05 0xFF 0xFF

SPI result 1.0021635 3.05e-05 0xFF 0xFF

I doubt that the correct frequency is not set properly. But cannot figure out, where it should be.

I formatted the SD card to FAT many time. Always getting the same result.

Parents Reply
  • It should be fatfs on the SD card and the size should not be a problem, I retested with 16GB card and it works the same. I do not think size and label of the card should matter here.

    Unable to see which board you are using? Is this a custom nRF board? Is your SD card slot on the same board or is it an extension card? 

    HorstvanGrass said:
    It has to be a hardware fault.

    Hardfault most of the time throw some logs out which assist in debugging, if you do not see any such logs, then maybe it is something else. Start your program in debugger to reproduce your error and see if you are looping(deadlocked) or asserting somewhere when you halt/pause the debugger.

Children
Related