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

Mesh with customize MAC address ??

Referenece devzone example, :devzone.nordicsemi.com/.../mesh-mac-address

We should set the new MAC value via sd_ble_gap_addr_set before mesh_init( adv_start)

But flash manager was initialized in function mesh_init. It means that we can not use flash data( mesh configuration) before mesh_init, also means we can not read the MAC value stored in flash ?

So how to store the MAC address assigned in factory in correty way ,and how to read it and set to softdevice?

Urgent case because this issue has been block our factory manufaction, Please rise the priroty of this case as possible!

  • Hi Guorong,

    Could you give more information about what you want to achieve ? Do you want to change the new MAC address for mesh packet or you want to change the MAC address for PB-GATT or PROXY packet ? 
    Note that calling sd_ble_gap_addr_set () only change the MAC address for BLE PB-GATT or PROXY packet, not the mesh advertising packet. 
    I did a quick test here with calling sd_ble_gap_addr_set(), before start() and it worked fine for me: 

    int main(void)
    {
        initialize();
        ble_gap_addr_t       m_my_addr;                                                              /**< Local GAP address. */
    
      m_my_addr.addr[5]   = 0xC0;
      m_my_addr.addr[4]   = 0xEE;
      m_my_addr.addr[3]   = 0xDD;
      m_my_addr.addr[2]   = 0xCC;
      m_my_addr.addr[1]   = 0xBB;
      m_my_addr.addr[0]   = 0xCA;
      m_my_addr.addr_type=BLE_GAP_ADDR_TYPE_RANDOM_STATIC;
      uint8_t  err_code = sd_ble_gap_addr_set(&m_my_addr);
      APP_ERROR_CHECK(err_code);
        start();
      
    
        for (;;)
        {
            (void)sd_app_evt_wait();
        }
    }



Related