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

How can we have our new ble_addr (set with sd_ble_gap_addr_set) be the base of the ble_addr (new ble_addr + 1) when we switch to the DFU based bootloader?

While in our application the nRF52840 advertises with the new address we assigned, but when we jump to the bootloader (our bootloader is almost exactly the same as the DFU example) it advertises using the original factory programmed random address - plus 1. I can see places in the SDK code where we could read the UICR - where we store the new address - and set the address with the soft device call, but I don't really want to change the SDK and then have to make sure we are always putting that change back in whenever we update to a newer SDK. Is there a recommended way for us to achieve this?

SDK: 15.3

SD: s140_nrf52_6.1.0

  • Hello,

    You have probably seen the gap_address_change() function in nrf_dfu_ble.c in your bootloader project? I haven't seen the softdevice implementation, but I would guess that sd_ble_gap_addr_get() just reads the address from UICR. If you want to change the address for the bootloader, you must do some changes. You need to make gap_address_change read the same address from wherever you store it, as you do in the application. If you never intend to change it, I can recommend storing it in the CUSTOMER[n] registers in the UICR.

    Remember to increment it by one in the bootloader, like it is already done.

    Best regards,

    Edvin

Related