We have deployed a fleet of nRF9160 based devices communicating with AWS. The production code currently deployed is based on SDK 1.9.1.
Previously we have pushed out firmware and modem FOTA updates without issue using AWS.
We have now upgraded to nRFConnect SDK 2.2.0. I seem to be able to push an upgrade from our old code base built upon 1.9.1 to 2.2.0. However, once we have upgraded to 2.2.0 all subsequent app firmware updates seem to fail.
I was hoping on some general guidance on where to look.
A successful upgrade from an app on 1.9.1 (our production code) to an app on 2.2.0 looks like the following: (I note MCUboot indicates the secondary image magic is good.)
I: Downloaded 219628/219628 bytes (100%) I: Download complete I: MCUBoot image upgrade scheduled. Reset device to apply AWS_IOT_EVT_FOTA_DL_PROGRESS, (100%)AWS_IOT_EVT_ERROR, 100 AWS_IOT_EVT_FOTA_DONE FOTA done, rebooting device AWS_IOT_EVT_DISCONNECTED W: connection_poll_start failed, error: -119 aws_iot_connect, error: -119 Next connection retry in 30 seconds þ*** Booting Zephyr OS build v2.7.99-ncs1-1 *** I: Starting bootloader I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3 I: Secondary image: magic=good, swap_type=0x2, copy_done=0x3, image_ok=0x3 I: Boot source: none I: Swap type: test I: Bootloader chainload address offset: 0x10000 I: Jumping to the first image slot *** Booting Zephyr OS build v3.2.99-ncs1 ***
If we then perform an update from the above app to a new app also built on 2.2.0 we get the following (this time the magic is unset?)
I: Downloading: app_update_222.bin [0] ... I: Downloaded 219628/219628 bytes (100%) I: Download complete I: MCUBoot image-0 upgrade scheduled. Reset device to apply AWS_IOT_EVT_FOTA_DL_PROGRESS, (100%)AWS_IOT_EVT_ERROR, 100 AWS_IOT_EVT_FOTA_DONE FOTA done, rebooting device AWS_IOT_EVT_DISCONNECTED þ*** Booting Zephyr OS build v2.7.99-ncs1-1 *** I: Starting bootloader I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3 I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3 I: Boot source: none I: Swap type: none I: Bootloader chainload address offset: 0x10000 I: Jumping to the first image slot *** Booting Zephyr OS build v3.2.99-ncs1 ***
To verify the above image is actually good, we can via SWD load an app+mcuboot based on SDK 2.2.0. In this case (with the upgraded MCUboot, it is happy to take the image and reports the magic is good)
I: Downloading: app_update_222.bin [0] ... I: Downloaded 219628/219628 bytes (100%) I: Download complete I: MCUBoot image-0 upgrade scheduled. Reset device to apply AWS_IOT_EVT_FOTA_DL_PROGRESS, (100%)AWS_IOT_EVT_ERROR, 100 Unknown AWS IoT event type: 6 AWS_IOT_EVT_FOTA_DONE FOTA done, rebooting device AWS_IOT_EVT_DISCONNECTED þ*** Booting Zephyr OS build v3.2.99-ncs1 *** I: Starting bootloader I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3 I: Secondary image: magic=good, swap_type=0x2, copy_done=0x3, image_ok=0x3 I: Boot source: none I: Swap type: test I: Starting swap using move algorithm. I: Bootloader chainload address offset: 0x10000 I: Jumping to the first image slot *** Booting Zephyr OS build v3.2.99-ncs1 ***
To migrate to 2.2.0 we have had to upgrade board files. I have looked at the flash memory map for slot0 and slot1 and they appear to be the same. I was thinking the later app might be writing the new firmware to a different location to what the old MCUboot was expecting. The new MCUboot, built at the same time than the app, probably has the same slot address.
I assume the app writes the new firmware to slot1 and then via some mechanism flags MCUboot to swap at reboot.