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

How to change mac in nRF52?

SDK13. S132. I try to change mac by:

void set_addr (void) 

{

static ble_gap_addr_t m_central_addr;

m_central_addr.addr_type     = BLE_GAP_ADDR_TYPE_RANDOM_STATIC;
m_central_addr.addr[0] = 0xfd;
m_central_addr.addr[1] = 0x71;
m_central_addr.addr[2] = 0x5f;
m_central_addr.addr[3] = 0x45;
m_central_addr.addr[4] = 0x2b;
m_central_addr.addr[5] = 0x46; // 2MSB must be set 11

sd_ble_gap_addr_set(&m_central_addr);

}

But no result success. When I should call this function? Before which?

Parents
  • Hi,

    As stated in your code snippet, the 2MSB must be set 11. You are using 0x46, that is in binary 01000110, i.e. the 2MSB is 01. Try to set it to 0xC6 instead.

    m_central_addr.addr[5] = 0xC6; // 2MSB must be set 11
    

    Call your function set_addr(), after ble_stack_init()

  • For a Random static address(BLE_GAP_ADDR_TYPE_RANDOM_STATIC) 0x46 is not allowed. See the figure in this post.

Reply Children
No Data