Trying to configure an external NOR flash causes the application to crash

I am trying to connect an MX25R6435F NOR flash on a custom PCB to an nRF52832 running nRF Connect SDK v2.8.0 using SPI. I am currently using the devkit devicetree with some modifications in the overlay.

I tried to follow https://devzone.nordicsemi.com/f/nordic-q-a/75393/how-to-get-started-with-zephyr-fs-on-external-nor-flash?focus=true in setting up the configuration, but with some changes in how the pins are set (I tried the way in the question, but presumably it is not possible in newer versions), and there was no property "has-be32k".

Devicetree:

/ {
	/delete-node/ leds;
	/delete-node/ aliases;
};

&spi1_default {
    group1 {
        psels = <NRF_PSEL(SPIM_SCK, 0, 18)>,
            <NRF_PSEL(SPIM_MOSI, 0, 19)>,
            <NRF_PSEL(SPIM_MISO, 0, 21)>;
    };
};

&uicr {
	/delete-property/ gpio-as-nreset;
};

&spi1_sleep {
    group1 {
        psels = <NRF_PSEL(SPIM_SCK, 0, 18)>,
            <NRF_PSEL(SPIM_MOSI, 0, 19)>,
            <NRF_PSEL(SPIM_MISO, 0, 21)>;
        low-power-enable;
    };
};

&spi1 {
	status = "okay";
	cs-gpios = <&gpio0 20 GPIO_ACTIVE_LOW>;
	mx25r: mx25r6435f@0  {
		compatible = "jedec,spi-nor";
        label = "MX25R64";
        reg = <0>;
        spi-max-frequency = <8000000>;
        jedec-id = [c2 28 17];
        size = <67108864>;
        has-dpd;
        t-enter-dpd = <10000>;
        t-exit-dpd = <35000>;
	};
};

Kconfig:

CONFIG_SPI=y
CONFIG_FLASH=y
CONFIG_SPI_NOR=y
CONFIG_SPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096

However, when I add the lines in Kconfig, the firmware does not start. The first thing I do in main() is to set a LED using GPIO, this is never lit.

When debugging, the code never reaches main(), and the VSCode plugin hangs when I attempt to pause execution.

I thought the problem could be related to the MISO pin being the same as the reset pin, but the issue persisted even if I deleted gpio-as-nreset in the Devicetree.

Is there some configuration issue here?

I tried the exact same flash on the nRF5340DK. There, QSPI is used instead of normal SPI like on our board. This works just fine.

Parents
  • I suggest as a sanity check, the spi_flash program. I only have experience with it on the nrf52840 DK , but its a low level simple program. If you can get that to work, you should be able to build from there.
    That said, I pretty much just save a struct of data to flash, so if you don't need a file system. Perhaps you can get away with just writing blocks of data directly to it?
    A M

Reply
  • I suggest as a sanity check, the spi_flash program. I only have experience with it on the nrf52840 DK , but its a low level simple program. If you can get that to work, you should be able to build from there.
    That said, I pretty much just save a struct of data to flash, so if you don't need a file system. Perhaps you can get away with just writing blocks of data directly to it?
    A M

Children
Related