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 Reply
  • If the code jumps to top of main when fs_mount is called, there is most likely an error assert leading to the chip restarting. 

    Have you checked if the log shows any errors? You may also set CONFIG_ASSERT_VERBOSE=y in your prj.conf file to enable logging messages from asserts.

    I do not think that the SD card is the reason for this behavior, but if you have another card you can test with, that would be good as well. 

    Are you using the latest nRF Connect SDK release (v2.1.0)? Did you make any modifications to the sample?

Children
No Data
Related