MCUBoot Fails to Boot Updated Image on Custom nRF7002 Board (is25lp064 SPI NOR)


Dear Team,

I am experiencing issues updating the firmware image on my custom board based on the nRF7002, using an external SPI NOR flash (is25lp064, 8MB). The board is running nRF Connect SDK v2.9.1. I am able to build and run, and update the new application successfully on the nRF7002DK, but encounter problems when performing an image update on my custom board.

Here's a breakdown of my process and where the issue occurs:

Steps Completed:

  1. Build: Built the application using the following command:
    west build --build-dir build --pristine --board nrf7002dk/nrf5340/cpuapp --sysbuild -- -DCONF_FILE="prj.conf" -DDTC_OVERLAY_FILE="app.overlay"
  2. Initial Flash: Flashed the built application to my custom board.
  3. Image Update: While running the main app (not bootloader), I used Auterm to upload a new application image to slot 1 with the test flag.
  4. Verification: Verified that the image hash reported by Auterm matches the hash report from ```imgtool dumpinfo build/spi/zephyr/zephyr.signed.bin```
  5. Reset: Reset the board to trigger MCUBoot to perform the image swap.

Issue:

  • On reset, MCUBoot logs indicate:
    [00:00:00.299,407] <inf> mcuboot: Starting bootloader
    [00:00:00.306,243] <dbg> mcuboot: boot_slots_compatible: Non-optimal sector distribution, slot0 has 237 usable sectors (240 assigned) but slot1 has 240 assigned
    [00:00:00.321,502] <inf> mcuboot: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    [00:00:00.332,031] <inf> mcuboot: Secondary image: magic=good, swap_type=0x2, copy_done=0x3, image_ok=0x3
    [00:00:00.342,285] <inf> mcuboot: Boot source: none
    [00:00:00.363,220] <inf> mcuboot: Image index: 0, Swap type: test
    [00:00:02.815,612] <err> mcuboot: Image in the secondary slot is not valid!
    [00:00:03.027,984] <inf> mcuboot: Bootloader chainload address offset: 0x10000
    [00:00:03.035,797] <inf> mcuboot: Jumping to the first image slot
    The program then freezes. Attempting to reset and revert to the previous image also fails, with logs showing:
    [00:00:00.250,427] <inf> spi_nor: is25lp064d@0: 8 MiBy flash
    [00:00:00.256,683] <dbg> spi_nor: spi_nor_process_bfp: Erase 4096 with 20
    [00:00:00.264,068] <dbg> spi_nor: spi_nor_process_bfp: Erase 32768 with 52
    [00:00:00.271,575] <dbg> spi_nor: spi_nor_process_bfp: Erase 65536 with d8
    [00:00:00.279,052] <dbg> spi_nor: spi_nor_process_bfp: Page size 256 bytes
    *** Booting MCUboot v2.1.0-dev-12e5ee106034 ***
    *** Using nRF Connect SDK v2.9.1-60d0d6c8d42d ***
    *** Using Zephyr OS v3.7.99-ca954a6216c9 ***
    [00:00:00.299,468] <inf> mcuboot: Starting bootloader
    [00:00:00.306,304] <dbg> mcuboot: boot_slots_compatible: Non-optimal sector distribution, slot0 has 237 usable sectors (240 assigned) but slot1 has 240 assigned
    [00:00:00.321,594] <inf> mcuboot: Primary image: magic=good, swap_type=0x2, copy_done=0x1, image_ok=0x3
    [00:00:00.332,031] <inf> mcuboot: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    [00:00:00.342,376] <inf> mcuboot: Boot source: none
    [00:00:00.362,823] <wrn> mcuboot: Failed reading image headers; Image=0
    [00:00:00.370,269] <err> mcuboot: Image in the primary slot is not valid!
    [00:00:00.377,929] <err> mcuboot: Unable to find bootable image
    This issue does not occur when tested with nRF7002DK (by  #define CONFIG_TEST_DK_BOARD 1 in the overlay fiiles my attached project source code) where the same process works as expected and I were able to update to new firmware

Device and Software Details:

  • Device: Custom nRF7002-based board
  • External Flash: is25lp064 (8MB SPI NOR)
  • nRF Connect SDK Version: v2.9.1

Additional Information:

  • Partition table is attached (debug_data/partition.txt).
  • Full UART logs for the custom board are attached (debug_data/log/custom_board).
  • SPI flash command traces are provided (debug_data/spi_commands).
  • Working build/log for the nRF7002DK is available in (debug_data/log/7002dk_working).

Could you kindly help identify if there are any known issues, misconfigurations, or specific steps I might be missing regarding MCUBoot, partitioning, or image update flow for a custom board with external SPI NOR flash? I am happy to provide any further configuration files or logs as needed. Thank you in advance for your expertise and assistance.

Sincerely,
Thuan.
spi_help.zip

  • Hi Andreas,

    Thank you again for your detailed support and guidance throughout this process.

    I’m happy to report that the issue has been resolved. After adding some read-back validation to the SPI-NOR flash driver for debugging, I discovered that certain sections of the flash were not reading back correctly after a write. This mismatch led to the hash validation failure in the MCUBoot TLV record.

    Once I updated the overlay files and adjusted related configuration values for my custom board and everything started working as expected, including image validation and boot.

    Your suggestions on verifying flash configurations and partitioning were especially helpful — I really appreciate your support.

    Best regards,
    Minh Thuan.

  • Hi,

    Glad to hear that you were able to resolve it and that you found the input helpful and thank you for sharing the verified solution

    I will mark this case as verified/closed and feel free to open new tickets in the future if you have any other inquiries and/or issues!

    Kind regards,
    Andreas

Related