Hello,
Using the nRF Connect SDK, I have managed to implement serial DFU using external flash and everything is working fine.
Following this example - https://devzone.nordicsemi.com/guides/nrf-connect-sdk-guides/b/software/posts/ncs-dfu#ble_testing
With my own overlays/configs.
I decided to test power loss recovery. If I have power loss during the update download that's absolutely fine. the application will continue the application currently running on the MCU, I can redownload the update if needed.
However,
If I have power loss during the swap, the application halts.
This is the log:
00> *** Booting Zephyr OS build v3.2.99-ncs1 *** 00> I: Starting bootloader 00> I: Primary image: magic=good, swap_type=0x4, copy_done=0x1, image_ok=0x1 00> I: Scratch: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3 00> I: Boot source: none 00> I: Swap type: none 00> I: Bootloader chainload address offset: 0xc000 00> I: Jumping to the first image slot 00> *** Booting Zephyr OS build v3.2.99-ncs1 *** 00> I: Starting bootloader 00> I: Primary image: magic=good, swap_type=0x4, copy_done=0x1, image_ok=0x1 00> I: Scratch: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3 00> I: Boot source: none 00> I: Swap type: none 00> I: Bootloader chainload address offset: 0xc000 00> I: Jumping to the first image slot
Every time I press the reset button on the dev-kit, the above log is repeated. However, if I remove the USB power and plug it back in the original application is able to run. This means the data is not corrupted.
My guess is that the reset button sets a reset flag in a register that MCUBOOT doesn't like and so I get this halt in the program. However a hard reset, clears all the flags allowing the application to run.
if this is the issue, Is there a way to reset this flag in the config menu as currently MCUBOOT dfu is all done in the config and no functions are in main.