This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Bootloader settings - Current bank value

using nRF52832, SDK 15.1, custom made units.

My Obervations - (in bootloader settings) $nrfutil settings display ota46to47.hex

  • when device is flashed "Current bank" value is 0
  • after first attempt of OTA, if it fails - "Current bank" value remains 0

                                         if it succeeds  - "Current bank" value becomes 1

  • after one successful OTA, if multiple success or fail OTA is done - "Current bank" value remains 1

According to documentation -

For a dual bank DFU, after successful firmware activation, the new version is copied to bank 0, therefore the current bank should be bank 0 after any number of successful DFUs right???

why is this not observed in the bootloader settings ? Please correct my understanding if flawed.

  • I'm not 100% sure about this, so take it with a grain of salt. You can test it by yourself.

    The bootloader uses the nrf_dfu_settings struct as a means to know whether a valid application is saved in bank 1. The bootloader then performs a soft-reset, and it checks whether there is a valid app in bank 1 (see nrf_bootloader_fw_activate() in nrf_bootloader_fw_activation.c). Then it proceeds to copy the firmware from bank 1 to bank 0.

    You can follow the code by yourself, maybe the official documentation is not great, but at least the code itself is pretty well self-documented.

    The trick to the bootloader is understanding that the applications are validated and copied on boot, not when the DFU transfer is done.

Related