Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Join an existing mesh Network with a mesh provisioner (nrf mesh sdk)

Hi,

Is it possible to join an existing mesh network with a provisioner made on Nrf52840 (s140)  ?

I have used the provisioner example to make a provisioner which actually create a new mesh network. But after an "erase all" of the board, the provisioning data are lost and the board can't reconnect to the network because information are lost during the erase (logic).

Is there a way to extract the provisioning data and mesh network data from the board to use them later on an other board ?

My goal is to create a mesh network with a device, then store in a file all the information related to this network to be able later with another board to join this network and add new devices.

I have setup a serial connection to send data through the usb port to my computer so I could retrieve and return the data by this method.

I know that this is possible in the mobile application with the "export network" and "import network" functions but I can't reproduce the functionality with the mesh SDK.

Is this possible? If yes how?
Regards

Used sdk :

- nRF5_SDK_16.0.0_98a08e2

- nrf5_SDK_for_Mesh_v4.2.0_src

Board used :

- nrf52840 evaluation board

- nrf52832 evaluation board

  • Hi,

    No I haven't add the address to the dsm database because after a reset I don't know this address.

    This address is the device mesh uuid or another thing ? If another, can I get it by broadcasting some commands ?

    Regards

  • Hi Neicureuil, 
    The address here is the address that the provisioner assigned to the node (the unicast address). 
    If you have a look at the provisioner code when it handles NRF_MESH_PROV_EVT_COMPLETE event in prov_evt_handler() in provisioner_helper.c you can find the call when it add the address to the dsm database. 

  • Hi,

          case NRF_MESH_PROV_EVT_COMPLETE:
          {
            NRF_LOG_INFO("Provisioning completed received\n");
            m_prov_state = PROV_STATE_COMPLETE;
    
            /* After provisioning completes, add corresponding node's address and device key to
            local database */
            NRF_LOG_INFO("Adding device address, and device keys\n");
            ERROR_CHECK(dsm_address_publish_add(p_evt->params.complete.p_prov_data->address,
                                                &addr_handle));
            ERROR_CHECK(dsm_devkey_add(p_evt->params.complete.p_prov_data->address,
                                       m_provisioner.p_dev_data->m_netkey_handle,
                                       p_evt->params.complete.p_devkey,
                                       &devkey_handle));
    
            /* Bind the device key to the configuration server and set the new node as the active server. */
            ERROR_CHECK(config_client_server_bind(devkey_handle));
            ERROR_CHECK(config_client_server_set(devkey_handle, addr_handle));
    
            NRF_LOG_INFO("Addr: 0x%04x addr_handle: %d netkey_handle: %d devkey_handle: %d\n",
                  p_evt->params.complete.p_prov_data->address,
                  addr_handle,
                  m_provisioner.p_dev_data->m_netkey_handle,
                  devkey_handle);
    
            break;
          }

    This is the NRF_MESH_PROV_EVT_COMPLETE  event from the provisioner.

    But in this example, its require the dev key of the provisioned device (p_evt->params.complete.p_devkey) but when I want to reload the mesh, I only have the device unicast address recovered by the alive event of the health model.

    So, how can i get the device dev key from the alive event to re add the node to the dsm database.

    Regards

  • Hi, 
    Device key is the secret key between the provisioner and the particular node. So a new node coming to the network shouldn't be able to get this key.


    You need to export the device keys out of the original provisioner. Then import it to the new provisioner. 

  • Hi,

    Thanks for the answer.

    I ask even if I think it is not possible, but is there no way to force a new exchange (and generation) of this secret key without knowing the old one ?

    Also, when I reload a mesh network (by reloading the 3 keys), the provisioner doesn't know the devices anymore (this is normal because I didn't reload the provisioning data) However, it still receives the events alives of the health model and when I send a model command, the devices of the network receive it and interpret it but I have no acknowledgement but after 5 mins, without changing anything, the acknowledgements come back for new commands.
    My question is why I don't receive any when the network reloads but with time, I end up receiving some? Is there any way to speed up this waiting process?

    Regards

Related