Zephyr nrf52840 SD Card issue

Hi.

1. code path ncs\v2.6.0\zephyr\samples\subsys\fs

2. use 16G SD Card

3. Direct connected SD card to nrf52840_SK (VCC , GND , CS , CLK , MOSI , MISO)

4. The SD Cord use FAT and no any data

Question : Can't access SD card

below is pr.conf

Fullscreen
1
2
3
4
5
6
7
8
9
10
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
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

below is app.overlay (Don't use nrf52840dk_nrf52840.overlay)

Fullscreen
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

below is log

Fullscreen
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Check your complete dts file (in build/zephyr), there is another "disk" type driver. Flashdisk driver cannot handle SD cards AFAIK. The examples try to use either internal or the QSPI flash on the DKs.

    In your own code I recommend to avoid the fs subsystem and to use ff.h directly.

  •  i remove nrf52840dk_nrf52840.overlay , the rebuild code to test , but still can;t work

    below is log

    Fullscreen
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    below is build\dts

    Fullscreen
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • The SD card DTS is missing a few important bits still:

    Fullscreen
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    I believe you need the additional "mmc" node because the SD SPI driver technically supports SDIO devices, too.

    But almost no actual SDIO hardware can work in SPI mode (at least to my knowledge).

  • Hi .

    I modify the DTS file ,then run again , but still can work.

    below is app.overlay
    Fullscreen
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX



    below is DTS

    Fullscreen
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    below is log .

    Fullscreen
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Hi

    I Just change CS pin form P0.21 to P1.12 , then SD card is work now , thank you help

1 2