I am trying to interface an SD card over SPI on nRF54L15 using nRF Connect SDK.
I started from Nordic’s fs_sample, which by default uses SPIM20 on Port 1 pins, and this configuration works correctly (SD card initializes, filesystem mounts, displays files).
However, when I try to use SPIM00 mapped to Port 2 pins keeping everything else the same, SPI initialization fails.
Overlay FIle -:
&pinctrl {
spi00_default: spi00_default {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 2, 1)>,
<NRF_PSEL(SPIM_MOSI, 2, 2)>,
<NRF_PSEL(SPIM_MISO, 2, 4)>;
};
};
spi00_sleep: spi00_sleep {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 2, 1)>,
<NRF_PSEL(SPIM_MOSI, 2, 2)>,
<NRF_PSEL(SPIM_MISO, 2, 4)>;
low-power-enable;
};
};
};
&spi00 {
status = "okay";
compatible = "nordic,nrf-spim";
pinctrl-0 = <&spi00_default>;
pinctrl-1 = <&spi00_sleep>;
pinctrl-names = "default", "sleep";
cs-gpios = <&gpio2 5 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
sdhc0: sdhc@0 {
compatible = "zephyr,sdhc-spi-slot";
reg = <0>;
status = "okay";
mmc {
compatible = "zephyr,sdmmc-disk";
disk-name = "SD";
status = "okay";
};
spi-max-frequency = <24000000>;
};
};prj.conf -:
CONFIG_DISK_ACCESS=y CONFIG_DISK_DRIVER_SDMMC=y CONFIG_FILE_SYSTEM=y CONFIG_FAT_FILESYSTEM_ELM=y CONFIG_LOG=y CONFIG_PRINTK=y CONFIG_LOG_BACKEND_UART=n CONFIG_LOG_BACKEND_RTT=y CONFIG_RTT_CONSOLE=y CONFIG_UART_CONSOLE=n CONFIG_MAIN_STACK_SIZE=2048 CONFIG_USE_SEGGER_RTT=y
Output logs -:
*** Booting My Application v1.0.0-9484be88f466 *** *** Using nRF Connect SDK v3.0.2-89ba1294ac9b *** *** Using Zephyr OS v4.0.99-f791c49f492c *** [00:00:00.059,702] <err> main: Storage init--------- [00:00:00.060,819] <err> spi_nrfx_spim: Failed to initialize nrfx driver: 0bad0004 [00:00:00.060,836] <err> sdhc_spi: Card SCLK init sequence failed [00:00:00.060,841] <err> sd: Could not disable card power via SDHC [00:00:00.060,848] <err> main: Storage init ERROR! [00:00:00.061,964] <err> spi_nrfx_spim: Failed to initialize nrfx driver: 0bad0004 [00:00:00.061,970] <err> sdhc_spi: Card SCLK init sequence failed [00:00:00.061,975] <err> sd: Could not disable card power via SDHC [00:00:00.061,983] <err> fs: fs mount error (-5) Error mounting disk. [00:00:00.062,006] <err> fs: fs not mounted (mp == 0x200004c0)