MCUBOOT and bonding

Hi,

We have some problems with Zephyr MCUBOOT when doing FOTA over BLE.

Our device has characteristics protected with LESC.


When device is bonded, the update fails in one of the last stages.
Everything seems correct while doing FOTA. The image is uploaded and swapped (and the updated image even starts up and works).
But when we do a power cycle or reset device with HW pin, the image is reverted back to the old version.

When we do the same without bonding, everything works fine.

We use Android tablet with nRF Connect installed, and PCA10056 (nRF52840) with a modified Pheripheral lbs example.
The example is modified to have FOTA and the Nordic LED Button Service characteristics protected with LESC.

NCS is 2.6.0


Currently we can come around this by remove bonding before we update, but this is not too good for a customer to do.

Is there a configuration we have missed?

Regards, Jan

  • Hi, you may be overwriting the user space storage (or wherever you're storing the bonding info). If you disable that, it should work.

  • Hi,

    I agree with the comment you allready got. Could it be that the partition layout has changed? Note that the partition layout needs to stay constant when doign DFU in the field, so you need to use static partitions to getting such problems.

  • Hi,

    Yes, it seems like the settings (where bond information are stored) is overwritten. I need to rebond after FOTA.

    However, the memory report shows a reserved settings_storage area in the upper part of flash (0x000F8000 - 0x000FFFFF).

    But is it still overwritten at DFU?

    The memory report:

    What I am doing to get the behaviour:

    - Build the modified lbs example

    - Erase flash on PCA10056

    - Flash it with the modified lbs example

    - Check debug output

    - Connect with the lbs example and access the Button characteristics, so pairing is triggered

    - Pair and bond

    - Do a little modification for the lbs example and copy it the tablet

    - Do FOTA DFU with nRF Connect from tablet

    - Verify that the modification is installed on PCA10056 (debug output)

    If I now reset the board, the firmware is reverted back to old version, or if I try to access a characteristics, pairing is triggered (then bonding must be bonding deleted)

    I tried to add a pm_static.yml to the project root:

    app:
      address: 0xc200
      end_address: 0x82000
      region: flash_primary
      size: 0x75e00
    mcuboot:
      address: 0x0
      end_address: 0xc000
      placement:
        before:
        - mcuboot_primary
      region: flash_primary
      size: 0xc000
    mcuboot_pad:
      address: 0xc000
      end_address: 0xc200
      placement:
        align:
          start: 0x1000
        before:
        - mcuboot_primary_app
      region: flash_primary
      size: 0x200
    mcuboot_primary:
      address: 0xc000
      end_address: 0x82000
      orig_span: &id001
      - mcuboot_pad
      - app
      region: flash_primary
      sharers: 0x1
      size: 0x76000
      span: *id001
    mcuboot_primary_app:
      address: 0xc200
      end_address: 0x82000
      orig_span: &id002
      - app
      region: flash_primary
      size: 0x75e00
      span: *id002
    mcuboot_secondary:
      address: 0x82000
      end_address: 0xf8000
      placement:
        after:
        - mcuboot_primary
        align:
          start: 0x1000
        align_next: 0x1000
      region: flash_primary
      share_size:
      - mcuboot_primary
      size: 0x76000
    settings_storage:
      address: 0xf8000
      end_address: 0x100000
      region: flash_primary
      size: 0x8000
    sram_primary:
      address: 0x20000000
      end_address: 0x20040000
      region: sram_primary
      size: 0x40000
    

    But that did not change anything. Memory report stays the same, bonding information is still overwritten, and firmware still reverts.

    How do I prevent the overwrite of bonding information?

    Regards, Jan

  • I found the issue:

    nRF Connect -> "Mcu Manager options" had "Erase application settings" enabled.

    When I disabled this setting, bond information is not erased on DFU update anymore.

    Thanks both of you for pointing me in the right direction.

    Regards, Jan

Related