This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Failure to get SDHC to work with NRF5340DK

Hello, 

I started my prototyping with the 52840DK and the SD Card was working fine. However, with the 5340 dev kit, I cannot get the SPI to work and access the SD Card properly.

I am getting the error : 

00> *** Booting Zephyr OS build v2.6.99-ncs1-1 **
00>
00> [00357896] <err> main: Storage init ERROR!
00> [00715756] <err> fs: fs mount error (-5)
00> Error mounting disk

I am using the overlay below and the standard FatFs sample in the Zephyr directory.

-- Zephyr version: 2.6.99 (C:/Users/pierr/ncs/v1.7.1/zephyr), build: v2.6.99-ncs1-1

Thanks a lot for your help.

Fullscreen
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  

  • I am working through this same exact error on the same board and same Zephyr version. 

    My overlay looks very close to yours with the exception of my pin definitions. Why do you not have cs-gpios set to GPIO_ACTIVE_HIGH like what is in the sample? I tried both ACTIVE_LOW and ACTIVE_HIGH with the same result.

    My SD card is formatted FAT and is a 32GB SDHC.

    .

    I hooked all pins up to a logic analyzer and both MOSI and SCK go high on boot/reset. 

    .

    Here's the project on github: github.com/.../fat_fs

  • My overlay looks very close to yours with the exception of my pin definitions. Why do you not have cs-gpios set to GPIO_ACTIVE_HIGH like what is in the sample? I tried both ACTIVE_LOW and ACTIVE_HIGH with the same result.

    I tried both as well without success as I found both online.

  • Debugging this in Segger I see the problem at disck_access.c in diskaccess_get_di(). The loic with SYS_DLIST_FOR_EACH_NODE(&disk_access_list, node){ } is skipped because disk_access_list has nothing in it.

    It appears disk_access_list is not being populated inside disk_access_register(). I set a breakpoint at the beginning of the function, but it's not being hit.

    Here is the line of code: https://github.com/nrfconnect/sdk-zephyr/blob/main/subsys/disk/disk_access.c#L33

    .

    Here is the value of disk_access_list & disk at the end of disk_access_get_di():

    Side note: "SD" is passed into diskacces_git_di().

  • With the logic analyser, I can see this weird SPI behaviour on the SD Card...

    CS is down.SCK (14) is beating. MOSI and MISO are down.

    I cannot get why SPI is different on the nrf5340 versus the nrf52 series?

  • Here's my output from the logic analyzer after I found I had the analyzer hooked up wrong. Also, my project.

    .fat_fs_171.zip

1 2 3