When creating a mesh network with many nodes, it can take a while to provision each node, especially using PyACI. An alternative is to use a static provisioner that provisions the nodes automatically but that requires a dedicated node that is used for this purpose.
This document outlines the use of a Python script, meshfwpatch.py, that can take as input, firmware that has been ripped (read back from node’s flash and saved as an Intel Hex file using nrfjprog) from a provisioned node, update the device address and the device key in that firmware, write the updated firmware to a new file, and, finally, update the mesh database file. This allows for the quick generation of multiple firmware copies that can be flashed onto nodes. The nodes are, therefore, pre-provisioned from the start automatically. It is only required to manually provision one node and then that node’s firmware can be ripped and new copies of firmware generated using this script for any number of other nodes.
The following is the workflow in order to create copies of mesh firmware from provisioned nodes:
In this procedure, we will provision a node using PyACI, rip its firmware, and then use the meshfwpatch.py script to generate new firmware. We will then flash this firmware to a new node and observe it as coming up provisioned. This process can be extended to any number of nodes.
In : db = MeshDB("database/example_database.json")
In : p = Provisioner(device, db)
In : p.scan_start()
In : p.scan_stop()
In : p.provision(name="Light bulb")
In : cc = ConfigurationClient(db)
In : cc.force_segmented = True
In : device.model_add(cc)
In : cc.publish_set(8, 0)
In : cc.composition_data_get()
In : cc.appkey_add(0)
In : cc.appkey_add(1)
In : cc.model_app_bind(db.nodes.unicast_address, 0, mt.ModelId(0x1000))
This should provision the node.
nrfjprog --family nrf52 --readcode dump_nRF52832_mesh_server_provisioned.hex
python meshfwpatch.py --list-info database\example_database.json
Node name: Light bulb
Device key: b432ad3a97e35032d0a5d2db871fdd17
Unicast address: 0x10
Node name: Light bulb_0011
Device key: 24b07e34e3b648ec840993d1acfe6bbf
Unicast address: 0x11
Node name: Light bulb_0012
Device key: a178f4436baf4c95a7c523e958a10011
Unicast address: 0x12
Node name: Light bulb_0013
Device key: d6132114a94d456eba0d3c51507412ec
Unicast address: 0x13
DISCLAIMER: Please use for development / research purposes only, noting the points below: