Unable to get nRF Connect SDK Zephyr fat_fs sample to mount an SD card using an nRF52840 DK

Hi all,

Apologies for adding another nRF5X DK SD card ticket to the pile, I hope there is not something terribly obvious I have overlooked. I have been trying to interface an SD card using my nRF52480 DK the last few weeks, but cannot seem to get anywhere with what I have been able to find in other threads.

The sample I have been working with is zephyr/samples/subsys/fs/fat_fs FAT Filesystem Sample application. Based on what I found mentioned in this thread, I have my overlay file nrf52840dk_nrf52840.overlay set up as follows:

I have commented out the sck, miso and mosi pin configurations as attempting to do a pristine build with them enabled results in errors and the following build log:

With the overlay as above the build completes and I am able to flash to the DK. The "No SOURCES given to Zephyr library: drivers__disk" warning does however persist, full build log below

Flashing this code to the DK and resetting it gives me these error messages in the nRF Terminal:

*** Booting Zephyr OS build v3.1.99-ncs1-1  ***
Error mounting disk.
[00:00:00.255,065] <err> main: Storage init ERROR!
[00:00:00.255,096] <err> fs: fs mount error (-5)

My prj.conf currently looks as follows, which is copied from fat_fs_modified.zip from the thread mentioned above:


Hardware wise, I have the SD card hooked up to the DK using a module visually identical to this one:

With these connections, based on what I found in the compiled device tree for the spi2_default pin controller:

P0.17 - CS

P0.19 - CLK

P0.20 - MOSI

P0.21 - MISO

As some threads, such as this one, mention some SD cards being unable to operate at the DK VDD voltage, I measured this to be 2.98 V (measured between the 3V3 and GND pins on the SD card module). Changing to an external supply, where I measured the voltage to 3.28 V, did not have any impact on the issue from what I could see. The person starting this thread mentions connecting the module to the 5V pin of the DK, but I have been weary of this due a concern that this would damage the SD card. I should note that these measurements were made with a rather cheap multimeter.

The SD cards I have been testing with are a 32 GB card from hama and a 32 GB card from SanDisk . The latter is missing the Class 10 A1 marking in my case and likely not the same product, as mine is roughly 10 years old. Both are formatted to FAT32 and labeled "SD" using the Windows format tool, with no contents on the SD cards.

Additinally, I am working in VSCode using the v2.1.2 nRF Connect SDK.

Any advice on next steps to resolving this problem would be immensely appreciated.

Many thanks,

Bo