SPI Interface for MicroSD Card

Hello,

I am attempting to mount and write to a microSD card via SPI. I am using the Fat_fs example found under "zephyr/samples/subsys/fs/fat_fs" and I am getting an error code of -5 during disk initialization. 

When I run the same code without the card inserted, I get the exact same behavior. So it almost seems like the driver isn't detecting the card at all. I have check that the sd card is FAT formatted and is working on my computer.

Also when using a logic analyzer, I can see that the MISO, MOSI, CS, and SCK signals appear to be working. However, pretty much all responses from the card (such as the CSD) return empty with all zeros. 

Below is the dts, config, and some notes about the board.

* MISO is tied high by an external resistor. 

Thanks in advance for the help

Parents
  • Hi,

    Have you tried using a different GPIO for the MISO pin? By default, P0.10 is used for the NFCT peripheral antenna.

    If you have not set the Kconfig CONFIG_NFCT_PINS_AS_GPIOS, the NFCT pins may not be used for other purposes or peripherals.

    Best regards,
    Jørgen

  • After updating to v2.1.0 I am now getting and error with disk initialization

    After calling, disk_access_init the error happens here in disk_access_get_di(). The disk access list and node appear to be empty so nothing is ever initialized. 

    I actually ran into this same problem when I was using v.2.0.2. I fixed it then by adding these settings to my config file

    Are there more settings I need to define for the newer SDK? 

  • Hi Owain,

    No unfortunately no progress yet on my end. I've run out of things to try at the moment. Are you also using the nrf52833?

  • Hi Drew,

    No I am 5340 based but I just noticed this in the 2.1.0 build log.
    Sounds suspicious. Just looking....


    -- open-amp version: 1.2.0 (C:/Users/Owain/incus/modules/lib/open-amp/open-amp)
    -- Host: Windows/AMD64
    -- Target: Generic/arm
    -- Machine: arm
    -- C_FLAGS : -Wall -Wextra
    -- Looking for include file fcntl.h
    -- Looking for include file fcntl.h - found
    CMake Warning at C:/Users/Owain/incus/zephyr/CMakeLists.txt:831 (message):
    No SOURCES given to Zephyr library: drivers__disk

    Excluding target from build.


    CMake Warning at C:/Users/Owain/incus/zephyr/CMakeLists.txt:1839 (message):
    __ASSERT() statements are globally ENABLED


    -- Configuring done
    --

  • Interesting, I got that exact same message in 2.0.2 and adding these lines to the config file fixed it:

    In 2.1.0 the issue still persists with those settings

  • Looks as if driver subsys has changed and we nolonger are pulling in driver...

    https://github.com/nrfconnect/sdk-zephyr/commit/a79f48548739839cc07274f7bf100351012a287d

  • I think I have it going past my disk init; at least reading number of blocks and block size OK.

    Here my changes to prj.conf and to my dts file; might help you....

Reply
  • I think I have it going past my disk init; at least reading number of blocks and block size OK.

    Here my changes to prj.conf and to my dts file; might help you....

Children