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 Haug,

        By BT Enable and Disable also not working.

        Below is my test flow:

        1. nrf5430 bootup, call bt_enable(), set new ble mac address. start ble adverstising. it work with new ble mac address.

         2. Stop  ble adverstising  and call bt_disable(), it shows Bluetooth disble failed (err -134)

         3.  call bt_id_create(), it shows Creating new ID failed (err -12).

         4. call bt_enable(), Bluetooth init failed (err -120).

Children
Related