nrf5340 fs_sample on custom GPIOs

I built a custom board with the nrf5340 and a SD card connected to non-standard gpios. My SD card is connected via SPI over the P0.14, P0.15, P0.16, P0.17, respectively for CS, MISO, MOSI, CLK. Since I was not able to mount the SD card on my custom board, I moved to the evaluation kit nrf5340dk. 

On the nrf5340dk I was able to succesfully exectue the example fs_sample on default pins, but when I move to P0.14, P0.15, P0.16, P0.1 there is no way I can make the fs driver to work. 

Here my configuration (I tried several):

Zephyr version: 4.0.99

	spi4_default: spi4_default {
		group1 {
			psels = <NRF_PSEL(SPIM_SCK, 0, 17)>,
				<NRF_PSEL(SPIM_MISO, 0, 15)>,
				<NRF_PSEL(SPIM_MOSI, 0, 16)>;
			//bias-pull-up;
			//nordic,drive-mode = <NRF_DRIVE_H0H1>;
		};
	};

	spi4_sleep: spi4_sleep {
		group1 {
			psels = <NRF_PSEL(SPIM_SCK, 0, 17)>,
				<NRF_PSEL(SPIM_MISO, 0, 15)>,
				<NRF_PSEL(SPIM_MOSI, 0, 16)>;
			low-power-enable;
		};
	};

then I have an overlay file for the fs_sample

&spi4 {
	status = "okay";
	cs-gpios = <&gpio0 14 GPIO_ACTIVE_LOW>; /* D10 */
	pinctrl-0 = <&spi4_default>;
	pinctrl-1 = <&spi4_sleep>;
	pinctrl-names = "default", "sleep";

	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 = <4000000>;
	};
};

/* Enable high drive mode for the SPI3 pins to get a square signal at 8 MHz */
&spi4_default {
	group1 {
		nordic,drive-mode = <NRF_DRIVE_H0H1>;
	};
}

I didn't find any PIN conflict between the network and app cores, and following the documentation and previous posts on the forum I don't find any other possible configuration to add. 

Thanks in advance for the support. 

Parents
  • Hello,

    What is the stack size in the configuration file?

    ''main: Storage init ERROR!''  seems related to stack size. Can you try to se this CONFIG_MAIN_STACK_SIZE=4096 in the config file?

    I am also wondering how the SD card is connected to your device. It's better to make a direct connection to minimize signal integrity issues.

    Does the SD card get proper power? The standard SD card typically requires 3.3V for stable operation.

  • In all the tests above I always compiled with:

    CONFIG_MAIN_STACK_SIZE=4096
    CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096
    also, between the working configuration using default PINs and custom overlay I didn't change anything else than the pin and spi configuration. The power supply line was untouched between the two tests, so for sure it is not the issue. 
Reply Children
No Data
Related