I am trying to get the nRF Connect (Zephyr) fs_sample working with nRF5340 preview DK, but am getting the following errors:
*** Booting nRF Connect SDK d96769faceca ***
[00:00:00.258,697] <err> sd: Card error on CMD0
[00:00:00.258,728] <err> main: Storage init ERROR!
[00:00:00.264,343] <err> sd: Card error on CMD0
[00:00:00.264,343] <err> fs: fs mount error (-5)
Error mounting disk.
[00:00:00.264,404] <err> fs: fs not mounted (mp == 0x20000000)
My proj.conf has:
CONFIG_DISK_ACCESS=y
CONFIG_LOG=y
CONFIG_FILE_SYSTEM=y
CONFIG_FAT_FILESYSTEM_ELM=y
CONFIG_PRINTK=y
CONFIG_MAIN_STACK_SIZE=2048
CONFIG_DISK_DRIVER_SDMMC=y
CONFIG_SPI=y
app.overlay:
&spi4 {
status = "okay";
cs-gpios = <&gpio1 12 GPIO_ACTIVE_LOW>;
pinctrl-0 = <&spi4_default>;
sdhc0: sdhc@0 {
compatible = "zephyr,sdhc-spi-slot";
reg = <0>;
status = "okay";
mmc {
compatible = "zephyr,sdmmc-disk";
status = "okay";
};
spi-max-frequency = <1000000>;
};
};
My complete code for the project is here:
https://github.com/mkvenkit/fs_sample
SD Card Details
1. 8GB SD card formatted with FAT.
2. Waveshare microSD adapter with following connections:
CS - P1.12 - D3
MOSI - P1.13 - CMD
MISO - P1.14 - DO
SCK - P1.15 - CLK
SPI data from logic analyzer:
I have seen other related messages from the forum but I haven't been able to solve the issue. I'd appreciate any help with this. Thanks!