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

how to reconnect to a mesh network when using nRF52840 serial interface example

Hi,

I'm using 2 nRF52840 DK to run the Serial Interface example, please refer to the link 

  • Serial ( named it as DK-1)
  • Light switch server (name it as DK-2)

And It works fine for me, able to completed provision and stores the DB setting into example_database.json and then powers off/on the Light switch server.

Let's say if I restart the DK-1, then how to connect back the Light switch server? I tried to load the DB setting from example_database.json again and below is the results 

  1. db = MeshDB("database/example_database.json")
  2. db.provisioners
    1. Out[2]: [{'name': 'BT Mesh Provisioner', 'UUID': bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'), 'allocated_unicast_range': [{'low_address': 0010, 'high_address': 7fff}], 'allocated_group_range': [{'low_address': c000, 'high_address': feff}]}]
  3. p = Provisioner(device, db)
    1. In [4]: 2019-05-01 20:15:10,906 - INFO - COM10: Success
      2019-05-01 20:15:10,913 - INFO - COM10: Success
      2019-05-01 20:15:10,918 - INFO - COM10: SubnetAdd: {'subnet_handle': 0}
      2019-05-01 20:15:10,924 - INFO - COM10: AppkeyAdd: {'appkey_handle': 0}
      2019-05-01 20:15:10,928 - INFO - COM10: AppkeyAdd: {'appkey_handle': 1}
  4. p.scan_start()
    1. In [5]: 2019-05-01 20:15:18,779 - INFO - COM10: Success
  5. p.scan_stop()
    1. In [6]: 2019-05-01 20:15:27,803 - INFO - COM10: Success
  6. p.provision(name="Light bulb")
    1. ---------------------------------------------------------------------------
      IndexError Traceback (most recent call last)
      c:\Program Files (x86)\Nordic Semiconductor\nrf5SDKforMeshv310src\scripts\interactive_pyaci\interactive_pyaci.py in <module>
      ----> 1 p.provision(name="Light bulb")

      c:\Program Files (x86)\Nordic Semiconductor\nrf5SDKforMeshv310src\scripts\interactive_pyaci\mesh\provisioning.py in provision(self, uuid, key_index, name, context_id, attention_duration_s)
      264 """
      265 if not uuid:
      --> 266 uuid = self.unprov_list.pop(0)
      267 elif isinstance(uuid, str):
      268 uuid = bytearray.fromhex(uuid)

      IndexError: pop from empty list

I know once the DK-2 go through the provision, the device will become a node of mesh network and it will not appear when we tried to scan it, which you can see in step 4 (i.e. p.scan_start()) --> none of device appear in the list. so that Step 6 found the error.

My Question is how DK-1 connect back to the mesh network where it forms the mesh network earlier? 

I don't see the NetKey store in the example_database.json, is this the reason why DK-1 failed to resume the connection?

 

Parents Reply Children
No Data
Related