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

why bootloader in sdk9 addr[0]+1 ?

In bootloader of sdk9 I find

ble_gap_addr_t addr;

err_code = sd_ble_gap_address_get(&addr);
APP_ERROR_CHECK(err_code);

// Increase the BLE address by one when advertising openly.
addr.addr[0] += 1;

err_code = sd_ble_gap_address_set(BLE_GAP_ADDR_CYCLE_MODE_NONE, &addr);
APP_ERROR_CHECK(err_code);

in function uint32_t dfu_transport_update_start(void). why the address[0] plus 1? Can I chage it to not plus 1? Thanks !

  • This code is executed when the dfu bootloader is unable to load stored peer data from flash. This means that it will require a new connection from the smartphone. The smartphone on the other hand, might have stored bond information. It will therefore try to connect to the dfu with the stored encryption keys.

    By changing its address, the device will appear as a new device to the smartphone. This changing is done in reaction to an error (no peer data), and should not really be removed. You should rather make sure that peer data is stored in your application. See this page about sharing bond info in the infocenter. This and this devzone thread might also be of interest.

Related