How to change the BLE mac address of NRF5430 at Real Time with NCS SDK?

  I follow below thread and refer to sample code and  the BLE mac address can be changed after system just boot up.

   devzone.nordicsemi.com/.../325131

   But after boot up, I want to change  the BLE mac address again, it doesn't work and the ble MAC address keep unchanged, it is expected?  Is it possible to change the desired BLE mac address at real time without HW reset?

Below is my Sudo code:

nrf5340 boot up,  

bt_enable(NULL);

bt_addr_t addr = {{0xFE, 0xCA, 0xA0, 0xAC, 0xDC, 0xBA}};
ble_set_mac(&addr);

settings_load();

ble_advertise();  //it works with ble addr = {{0xFE, 0xCA, 0xA0, 0xAC, 0xDC, 0xBA}}

ble_Stop_advertise();

bt_addr_t addr = {{0xFE, 0xCA, 0xA0, 0xAC, 0xDC, 0xBB}};
ble_set_mac(&addr);

settings_load();

ble_advertise(); //it doesn't work, ble address cant be changed.

found the ble's mac address is still  = {{0xFE, 0xCA, 0xA0, 0xAC, 0xDC, 0xBA}};

Parents Reply
  • Hi Hieu,

      For my case, NRF5430 is used. so  bt_setup_public_id_addr() doesn't work, becasue cmd  bt_setup_public_id_addr() cann't be issued directly at the applicaion core side.

     I can use ble_set_mac() ---> bt_hci_cmd_send_sync() cmd to change the mac address successffully, but It only can be chnage once after  NRF5430 power on. It is expected or any solution to solve it?

Children
No Data
Related