This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Device bluetooth address (mac?)

In my all projects, I am using this code to obtain and set local device address:

uint64_t deviceId = ((uint64_t)NRF_FICR->DEVICEID[1] << 32) | ((uint64_t)NRF_FICR->DEVICEID[0]);
ble_gap_addr_t gap_addr;
gap_addr.addr_type = BLE_GAP_ADDR_TYPE_PUBLIC;
memcpy(gap_addr.addr, (uint8_t *)&deviceId, 6);
err_code = sd_ble_gap_address_set(BLE_GAP_ADDR_CYCLE_MODE_NONE ,&gap_addr);

In some newer examples, I've seen function sd_ble_gap_address_get() which also returns address, but different than this located in FICR

Which method should I use when setting my local device address?

  • Different like explained here? If not, please edit your question to include the laser markings of the chip, and SoftDevice version.

    Are you sure you want to use Public Device Address? (See Bluetooth Core specification v4.2, Vol 6, Part B, Section 1.3.1 for more information.)

Related