Hi,
Could assign the air "Access Address" when nRF52840 as BLE Master ?
We wanted to fixed the "Access Address" by every connection.
Jay
Hi,
Could assign the air "Access Address" when nRF52840 as BLE Master ?
We wanted to fixed the "Access Address" by every connection.
Jay
Check out the Softdevice API sd_ble_gap_addr_get() and sd_ble_gap_addr_set().
The easiest way to change the address is to use something like this:
static void change_addr(void) { ret_code_t err_code; ble_gap_addr_t my_addr; err_code = sd_ble_gap_addr_get(&my_addr); APP_ERROR_CHECK(err_code); my_addr.addr[0] = 0xAB; err_code = sd_ble_gap_addr_set(&my_addr); APP_ERROR_CHECK(err_code); }
The reason I use the sd_ble_gap_addr_get() first is that this is a way to fetch an advertising address configuration that is valid, so you don't need to set the advertising address type.
NB: You can not use the same address across different devices. A BLE address should be unique.
Check out the Softdevice API sd_ble_gap_addr_get() and sd_ble_gap_addr_set().
The easiest way to change the address is to use something like this:
static void change_addr(void) { ret_code_t err_code; ble_gap_addr_t my_addr; err_code = sd_ble_gap_addr_get(&my_addr); APP_ERROR_CHECK(err_code); my_addr.addr[0] = 0xAB; err_code = sd_ble_gap_addr_set(&my_addr); APP_ERROR_CHECK(err_code); }
The reason I use the sd_ble_gap_addr_get() first is that this is a way to fetch an advertising address configuration that is valid, so you don't need to set the advertising address type.
NB: You can not use the same address across different devices. A BLE address should be unique.
Hi Edvin,
We wanted to change(fixed) "access Address", not device address.
The access address is handled by the SoftDevice, and you can't change it. I saw one old post about advertising with a custom access address, but this doesn't use the softdevice. It is easier to write applications that will advertise without the softdevice than acting as a BLE master. It is also easier to write an application that will only advertise (without the softdevice) than a BLE slave that supports connection.
So the short answer is that it is not possible to change the access address while using the SoftDevice. Is this something your application needs? Perhaps you can explain the use case, and we can look into other approaches.
BR,
Edvin