MCUBOOT + SMP + External Flash, Image is flashed to the external flash, but fails to boot.

I am working on using MCUBOOT with external flash (MX25V16066M2I02) using SMP server sample https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.4.0/zephyr/samples/subsys/mgmt/mcumgr/smp_svr/README.html.

I have tested the external flash by using it as QSBI flash and it works as intended.

SMP server sample works well when using internal flash. 

I have added the required configuration and device tree overlay to enable mcuboot on external spi flash, as well as the static partition yml file. I can flash the image to the external flash, however after putting on test mode and restarting the dk, nothing changes the image remains on the pending state. I have also tried confirming the image but still same issue. I have also tired using the built-in QSBI flash same issue.

Note: I am working on nrf connect SDK 2.4 

mcuboot_secondary:
  address: 0x00000
  region: external_flash
  size: 0xf4000

external_partition:
  address: 0xf4000
  end_address: 0xf8000
  region: external_flash
  size: 0x4000

settings_storage:
  address: 0xf8000
  region: external_flash
  size: 0x4000

Static partition file.

&spi1 {
	status = "disabled";
};

&i2c0 {
	status = "disabled";
};


/ {
	chosen {
		nordic,pm-ext-flash = &mx25r64;
	};
};

&pinctrl {
	qspi_default: qspi_default {
		group1 {
			psels = <NRF_PSEL(QSPI_SCK, 0,31)>,
					<NRF_PSEL(QSPI_IO0, 0, 30)>, // mosi
					<NRF_PSEL(QSPI_IO1, 1, 8)>, // miso
					<NRF_PSEL(QSPI_IO2, 0, 26)>, // wps
					<NRF_PSEL(QSPI_IO3, 0, 27)>,//res
					<NRF_PSEL(QSPI_CSN, 1, 10)>;
		};
	};

	qspi_sleep: qspi_sleep {
		group1 {
			psels = <NRF_PSEL(QSPI_SCK, 0, 31)>,
					<NRF_PSEL(QSPI_IO0, 0, 30)>, // mosi
					<NRF_PSEL(QSPI_IO1, 1, 8)>, // miso
					<NRF_PSEL(QSPI_IO2, 0, 26)>, // wps
					<NRF_PSEL(QSPI_IO3, 0, 27)>; //res
					low-power-enable;
		};
		group2 {
			psels = <NRF_PSEL(QSPI_CSN, 1, 10)>;
			low-power-enable;
			bias-pull-up;
		};
	};
};





&qspi {
	status = "okay";
	mx25r64: mx25r6435f@0 {
		compatible = "nordic,qspi-nor";
		reg = <0>;
		/* MX25R64 supports only pp and pp4io */
		writeoc = "pp";
		/* MX25R64 supports all readoc options */
		readoc = "fastread";
		sck-frequency = <8000000>;
		jedec-id = [ c2 20 15  ];
		sfdp-bfp = [ e5 20 f1 ff ff ff ff 03 44 eb 08 6b 08 3b 04 bb ee ff ff ff ff ff 00 ff ff ff 00 ff 0c 20 0f 52 10 d8 00 ff 23 72 f5 00 82 ed 04 cc 44 83 68 44 30 b0 30 b0 f7 c4 d5 5c 00 be 29 ff f0 d0 ff ff  ];

		size = <16777216>;
		has-dpd;
		t-enter-dpd = <10000>;
		t-exit-dpd = <35000>;

	};


};

Overlay file.

# Enable MCUmgr and dependencies.
CONFIG_NET_BUF=y
CONFIG_ZCBOR=y
CONFIG_CRC=y
CONFIG_MCUMGR=y
CONFIG_STREAM_FLASH=y
CONFIG_FLASH_MAP=y

# Some command handlers require a large stack.
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=10240
CONFIG_MAIN_STACK_SIZE=10240

# Ensure an MCUboot-compatible binary is generated.
CONFIG_BOOTLOADER_MCUBOOT=y

# Enable flash operations.
CONFIG_FLASH=y

# Required by the `taskstat` command.
CONFIG_THREAD_MONITOR=y

# Support for taskstat command
CONFIG_MCUMGR_GRP_OS_TASKSTAT=y

# Enable statistics and statistic names.
CONFIG_STATS=y
CONFIG_STATS_NAMES=y

# Enable most core commands.
CONFIG_FLASH=y
CONFIG_IMG_MANAGER=y
CONFIG_MCUMGR_GRP_IMG=y
CONFIG_MCUMGR_GRP_OS=y
CONFIG_MCUMGR_GRP_STAT=y

# Enable logging
CONFIG_LOG=y
CONFIG_MCUBOOT_UTIL_LOG_LEVEL_WRN=y

# Disable debug logging
CONFIG_LOG_MAX_LEVEL=3


CONFIG_NORDIC_QSPI_NOR=y
CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096
CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16


# Other configurations
CONFIG_MULTITHREADING=y
CONFIG_UART_CONSOLE=n

prj.conf file

# Enable the serial MCUmgr transport.
CONFIG_BASE64=y
CONFIG_MCUMGR_TRANSPORT_UART=y
CONFIG_CONSOLE=y

overlay-serial.conf file

mcumgr conn add my_device type="serial" connstring="dev=COM20,baud=115200,mtu=512"

Command used to create the profile.

C:\ncs\v2.4.0\zephyr\samples\basic\blinky\build\zephyr>mcumgr image list -c my_device
Images:
 image=0 slot=0
    version: 0.0.0
    bootable: true
    flags: active confirmed
    hash: b350f73c26233662e6b8220adb29b0279a9838ff8b94fe6f769c0a4870e62fee
Split status: N/A (0)

C:\ncs\v2.4.0\zephyr\samples\basic\blinky\build\zephyr>
C:\ncs\v2.4.0\zephyr\samples\basic\blinky\build\zephyr>mcumgr image upload app_update.bin -c my_device
 51.28 KiB / 51.28 KiB [=======================================================================] 100.00% 1.35 KiB/s 37s
Done

C:\ncs\v2.4.0\zephyr\samples\basic\blinky\build\zephyr>mcumgr image list -c my_device
Images:
 image=0 slot=0
    version: 0.0.0
    bootable: true
    flags: active confirmed
    hash: b350f73c26233662e6b8220adb29b0279a9838ff8b94fe6f769c0a4870e62fee
 image=0 slot=1
    version: 0.0.0
    bootable: true
    flags: pending
    hash: 98f5cc2fc4f6505bb601a5ac984d2bf1911b748cddd2228fa324ed5a3a0210be
Split status: N/A (0)

C:\ncs\v2.4.0\zephyr\samples\basic\blinky\build\zephyr>mcumgr image test 98f5cc2fc4f6505bb601a5ac984d2bf1911b748cddd2228fa324ed5a3a0210be -c my_device
Images:
 image=0 slot=0
    version: 0.0.0
    bootable: true
    flags: active confirmed
    hash: b350f73c26233662e6b8220adb29b0279a9838ff8b94fe6f769c0a4870e62fee
 image=0 slot=1
    version: 0.0.0
    bootable: true
    flags: pending
    hash: 98f5cc2fc4f6505bb601a5ac984d2bf1911b748cddd2228fa324ed5a3a0210be
Split status: N/A (0)

C:\ncs\v2.4.0\zephyr\samples\basic\blinky\build\zephyr>mcumgr image list -c my_device
Images:
 image=0 slot=0
    version: 0.0.0
    bootable: true
    flags: active confirmed
    hash: b350f73c26233662e6b8220adb29b0279a9838ff8b94fe6f769c0a4870e62fee
 image=0 slot=1
    version: 0.0.0
    bootable: true
    flags: pending
    hash: 98f5cc2fc4f6505bb601a5ac984d2bf1911b748cddd2228fa324ed5a3a0210be
Split status: N/A (0)

C:\ncs\v2.4.0\zephyr\samples\basic\blinky\build\zephyr>mcumgr erase -c my_device
Error: unknown command "erase" for "mcumgr"

Did you mean this?
        crash

Run 'mcumgr --help' for usage.

C:\ncs\v2.4.0\zephyr\samples\basic\blinky\build\zephyr>mcumgr image erase -c my_device
Error: 6

C:\ncs\v2.4.0\zephyr\samples\basic\blinky\build\zephyr>

terminal snippet

Related