Hi I am trying to get an SD card hooked up to my nrf52840 devkit. I am using nRF Connect v2.6.1 and I was trying to get the sample code working, so I used the sample in ncs/v2.6.1/zephyr/subsys/fs/fs_sample
Unfortunately I get this error when trying to run the program
Here's a capture of what the signals look like talking to the SD card over SPI:
Oddly, the CS line is low during the initial "boot up" phase of the device; however, I thought that the CS line is supposed to be held at high voltage level during this initial boot-up? Even if it is used as active low in later communications (as defined here).
Here is my custom conf file which I've named "nrf52840dk_SDCard.conf"
# # Copyright (c) 2023 Nordic Semiconductor ASA # # SPDX-License-Identifier: Apache-2.0 # CONFIG_NORDIC_QSPI_NOR=n # The erase page size CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 CONFIG_DISK_DRIVERS=y CONFIG_DISK_DRIVER_FLASH=y # There may be no files on internal SoC flash, so this Kconfig # options has ben enabled to create some if listing does not # find in the first place. CONFIG_FS_SAMPLE_CREATE_SOME_ENTRIES=y CONFIG_DISK_ACCESS=y CONFIG_SPI=y CONFIG_DISK_DRIVER_SDMMC=y
Here is my board overlay file:
&spi1 { status = "okay"; cs-gpios = <&gpio0 28 GPIO_ACTIVE_LOW>; sdhc0: sdhc@0 { compatible = "zephyr,sdhc-spi-slot"; reg = <0>; status = "okay"; mmc { compatible = "zephyr,mmc-disk"; status = "okay"; }; spi-max-frequency = <25000000>; }; };
Here is my "prj.conf" file:
CONFIG_DISK_ACCESS=y CONFIG_LOG=y CONFIG_FILE_SYSTEM=y CONFIG_FAT_FILESYSTEM_ELM=y CONFIG_PRINTK=y CONFIG_MAIN_STACK_SIZE=2048 # SD CONFIG_MMC_STACK=y CONFIG_SD_LOG_LEVEL_DEFAULT=y CONFIG_SPI_NRFX_RAM_BUFFER_SIZE=8 CONFIG_SDHC=y CONFIG_SDHC_LOG_LEVEL_DEFAULT=y CONFIG_NRFX_SPI1=y
I'm not really sure what's going on here... I've tried this with 2 different SD cards as well. Is there a bug in Zephyr or am I missing something in my config...? I appreciate any help on what might be going wrong here.
Thank you,
Louis