Communication with SD Card with nRF54L15DK

Hello,

I am trying to communicate with an SD Card with a NRF54L15DK but it doesn't work.
Here is my different files :

&spi21 {
    compatible = "nordic,nrf-spim";
    status = "okay";
    pinctrl-0 = <&spi21_default>;
    pinctrl-names = "default";
    cs-gpios = <&gpio2 5 GPIO_ACTIVE_LOW>;

    sdhc0: sdhc@0 {
        compatible = "zephyr,mmc-spi-slot";
        reg = <0>;
        status = "okay";
        label = "SDHC0";
        spi-max-frequency = <400000>; /* fréquence d'initialisation */
    };
};

&pinctrl {
    spi21_default: spi21_default {
        group1 {
            psels = <NRF_PSEL(SPIM_SCK, 2, 1)>,   /* P2.01 */
                    <NRF_PSEL(SPIM_MOSI, 2, 2)>,  /* P2.02 */
                    <NRF_PSEL(SPIM_MISO, 2, 4)>;  /* P2.04 */
        };
    };
};
# SPI et périphériques
CONFIG_SPI=y
CONFIG_DISK_ACCESS=y

# Système de fichiers
CONFIG_FILE_SYSTEM=y
CONFIG_FAT_FILESYSTEM_ELM=y
CONFIG_FS_FATFS_LFN=y          # (optionnel) support des noms longs
CONFIG_FS_LOG_LEVEL_DBG=y

# Logs et debug
CONFIG_LOG=y
CONFIG_LOG_DEFAULT_LEVEL=3
CONFIG_STDOUT_CONSOLE=y
CONFIG_PRINTK=y

# Stack principale un peu plus grande
CONFIG_MAIN_STACK_SIZE=4096
CONFIG_SPI_NRFX_RAM_BUFFER_SIZE=8
CONFIG_GPIO=y

/*
 * Copyright (c) 2019 Tavish Naruka <[email protected]>
 *
 * SPDX-License-Identifier: Apache-2.0
 */

/* Sample which uses the filesystem API and SDHC driver */

#include <zephyr/kernel.h>
#include <zephyr/device.h>
#include <zephyr/storage/disk_access.h>
#include <zephyr/fs/fs.h>
#include <ff.h>     /* Fournit FATFS, FIL, FRESULT, FR_OK, etc. */
#include <zephyr/logging/log.h>

LOG_MODULE_REGISTER(main);

static int lsdir(const char *path);

static FATFS fat_fs;
/* mounting info */
static struct fs_mount_t mp = {
    .type = FS_FATFS,
    .fs_data = &fat_fs,
};

struct device *gpio0dev;

/*
*  Note the fatfs library is able to mount only strings inside _VOLUME_STRS
*  in ffconf.h
*/
static const char *disk_mount_pt = "/SD:";

void main(void)
{
gpio0dev = DEVICE_DT_GET(DT_NODELABEL(gpio0));
if (!device_is_ready(gpio0dev)) {
    printk("GPIO0 not ready!\n");
}

    /* raw disk i/o */
    do {
        static const char *disk_pdrv = "SD";
        uint64_t memory_size_mb;
        uint32_t block_count;
        uint32_t block_size;

        if (disk_access_init(disk_pdrv) != 0) {
            LOG_ERR("Storage init ERROR!");
            break;
        }

        if (disk_access_ioctl(disk_pdrv,
                DISK_IOCTL_GET_SECTOR_COUNT, &block_count)) {
            LOG_ERR("Unable to get sector count");
            break;
        }
        LOG_INF("Block count %u", block_count);

        if (disk_access_ioctl(disk_pdrv,
                DISK_IOCTL_GET_SECTOR_SIZE, &block_size)) {
            LOG_ERR("Unable to get sector size");
            break;
        }
        printk("Sector size %u\n", block_size);

        memory_size_mb = (uint64_t)block_count * block_size;
        printk("Memory Size(MB) %u\n", (uint32_t)(memory_size_mb >> 20));
    } while (0);

    mp.mnt_point = disk_mount_pt;

    int res = fs_mount(&mp);

    if (res == FR_OK) {
        printk("Disk mounted.\n");
        lsdir(disk_mount_pt);
    } else {
        printk("Error mounting disk.\n");
    }

    while (1) {
        k_sleep(K_MSEC(1000));
    }
}

static int lsdir(const char *path)
{
    int res;
    struct fs_dir_t dirp;
    static struct fs_dirent entry;

    fs_dir_t_init(&dirp);

    /* Verify fs_opendir() */
    res = fs_opendir(&dirp, path);
    if (res) {
        printk("Error opening dir %s [%d]\n", path, res);
        return res;
    }

    printk("\nListing dir %s ...\n", path);
    for (;;) {
        /* Verify fs_readdir() */
        res = fs_readdir(&dirp, &entry);

        /* entry.name[0] == 0 means end-of-dir */
        if (res || entry.name[0] == 0) {
            break;
        }

        if (entry.type == FS_DIR_ENTRY_DIR) {
            printk("[DIR ] %s\n", entry.name);
        } else {
            printk("[FILE] %s (size = %zu)\n",
                entry.name, entry.size);
        }
    }

    /* Verify fs_closedir() */
    fs_closedir(&dirp);

    return res;
}

and it retursn me always this error : [00:00:00.430,124] <dbg> fs: fs_register: fs register 0: 0
*** Booting nRF Connect SDK v2.9.2-4ab7b98fc76f ***
*** Using Zephyr OS v3.7.99-aa34a5632971 ***
[00:00:00.430,166] <err> main: Storage init ERROR!
[00:00:00.430,182] <err> fs: fs mount error (-5)
Error mounting disk

thank you in advance!
Related