spi_nor not able to communicate with external flash / jedec id always returning 00 00 00 during boot up.

Spi_nor_capture.sal

The firmware always halts execution during boot after providing these logs:

26/05/22 10:38:33.925  89737.861    13892  0 E: Device id 00 00 00 does not match config 1f 16 01

26/05/22 10:38:33.929  89737.865        4  0 I: Starting bootloader

26/05/22 10:38:33.932  89737.868        3  0 E: Failed to open flash area ID 1 (image 0 slot 1): -19, cannot continue


I'm trying to connect to a 16 Mbit AT25EU0161A Renesas external flash. I probed the SCK, MOSI, CS, and MISO pins; however, I've never managed to see any signal on the MISO pin. 

I've attached the Logic Analyzer's capture for your reference. 


I've even added a 300us delay to create a settle-down time between the CS and the MOSI & SCK pulse, but that also did not work. 



Here are my configurations: 

&spi00 {
	status = "okay";
	cs-gpios = <&gpio2 5 GPIO_ACTIVE_LOW>;
	pinctrl-0 = <&spi00_default>;
	pinctrl-1 = <&spi00_sleep>;
	pinctrl-names = "default", "sleep";

	at25eu0: at25eu0161a@0 {
		compatible = "jedec,spi-nor";
		status = "okay";
		reg = <0>;
		spi-max-frequency = <2000000>;
		jedec-id = [1f 16 01];
		size = <16777216>;
		has-dpd;
		t-enter-dpd = <10000>;
		t-exit-dpd = <35000>;
		partitions {
			compatible = "fixed-partitions";
			#address-cells = <1>;
			#size-cells = <1>;
			slot1_partition: mcuboot_secondary: partition@0 {
				label = "image-1";
				reg = <0x0 0x143000>;
			};
		};
	};
};

	/omit-if-no-ref/ spi00_default: spi00_default {
		group1 {
			psels = <NRF_PSEL(SPIM_SCK, 2, 6)>,
					<NRF_PSEL(SPIM_MOSI, 2, 8)>,
					<NRF_PSEL(SPIM_MISO, 2, 4)>;
		};
	};

	/omit-if-no-ref/ spi00_sleep: spi00_sleep {
		group1 {
			psels = <NRF_PSEL(SPIM_SCK, 2, 6)>,
					<NRF_PSEL(SPIM_MOSI, 2, 8)>,
					<NRF_PSEL(SPIM_MISO, 2, 4)>;
			low-power-enable;
		};
	};


Theser are my prj.conf settings: 
# SPI config
CONFIG_SPI=y
CONFIG_SPI_NOR=y
CONFIG_SPI_NOR_SFDP_RUNTIME=y
CONFIG_SPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096


These are my .conf files for the mcuboot: 
CONFIG_GPIO=y
CONFIG_MULTITHREADING=y
CONFIG_BOOT_MAX_IMG_SECTORS=512

# External SPIM flash for secondary slot
CONFIG_SPI=y
CONFIG_SPI_NRFX=y
CONFIG_SPI_NOR=y
CONFIG_SPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096

CONFIG_PM_OVERRIDE_EXTERNAL_DRIVER_CHECK=y


SPI wiring:
CS -> nRF54L15 P2.05
SCK -> nRF54L15 P2.06
SI/MOSI -> nRF54L15 P2.08
SO/MISO -> nRF54L15 P2.04
HOLD/RESET -> nRF54L15 P2.03 pulled internally high. (also verified on hardware)
WP -> pulled high via an external 10K resistor.

The bootloader is MCUBoot v2.1.0-ncs3-3. The failure happens during MCUBoot/Zephyr spi_nor_configure(), where command 0x9F is sent correctly, but MISO returns 00 00 00 instead of 1F 16 01.

SPI mode is mode 0, SCK 2 MHz. As mentioned above, putting a CS delay did not solve the issue.



Related