I'm trying out the new Bluetooth Mesh Version 184.108.40.206 and getting Error 0x181(wrong_state) during Appkey Deployment. It worked with the version Bluetooth Mesh Version 1.1.
I have taken the main.c file from "Mesh - problems provisioning using sdk 1.2.0" thread and extended it with the function "gecko_cmd_mesh_prov_appkey_add (prov_evt -> address, netkey_id, appkey_id)".
The error 0x8C has never appeared.
I use the hardware:
MGM12P BRD4304A as well as my own hardware with the Radio Module MGM12P32GAV2 (EFR32MG12P432F1024GM48)
Thanks in advance, Michael
Attached main.c file
Initializing as provisioner Successfully initialized gecko_cmd_mesh_prov_init_id networks: 0 address: 2001 ivi: 0 Creating a new netkey Success, netkey id = 0 Creating a new appkey Success, appkey_id = 0 Appkey: a2 fe 20 6e 1f 26 84 0f b0 ec a3 15 b6 37 e4 b7 Starting to scan for unprovisioned device beacons Success - initializing unprovisioned beacon scan gecko_evt_mesh_prov_unprov_beacon_id 53696c6162734465762df022ce570b00 confirm? Sending prov request Successful call of gecko_cmd_mesh_prov_provision_device Node successfully provisioned. New node address: 1. provisioning done - uuid 0x53696C6162734465762DF022CE570B00 Appkey deploy - Mesh Addr 0x1; NwkID 0x0; AppID 0x0 Appkey deployment failed. error: 181
I tried your code and it fails in appkey deployment, but with different error code:
Successful call of gecko_cmd_mesh_prov_provision_device Node successfully provisioned. New node address: 0. provisioning done - uuid 0x53696C6162734465762DB01818570B00 Appkey deploy - Mesh Addr 0x0; NwkID 0x0; AppID 0x0 Appkey deployment failed. error: c02 gecko_evt_mesh_prov_unprov_beacon_id 53696c6162734465762d6df1b5570b00 confirm?
From API reference: 0x0c02 = "does_not_exist " - Returned when trying to manipulate a key or some other
resource with an ID which does not exist
EDIT: I noticed a mismatch between your debug output and mine: in my test, the address of the provisioned node is 0 which seems wrong. I'll try to figure out what is causing the mismatch here (I did not change anything in your code)
Thanks for your quick reply.
I get your behavior if I set the constant MESH_CFG_MAX_PROVISIONED_DEVICES to 0.
Did you adjust the memory configuration?
Good point, I forgot to change the memory config. After fixing that I see the same problem that you reported originally, the appkey deployment fails with code 0x181 "wrong state".
I will let you know when I have more info how to fix this.
Do you have configuration client model included in the DCD? It is not included in the lighting example and needs to be added manually. After adding this model to the DCD I got forward in my tests.
I'm working on cleaning up the code and adding rest of the configuration so that this can be used as a generic provisioner+configurator example. I'll post the finished version later.
No, It was not included.
After activating this client I get the error 0x182 (out_of_memory).
I will wait for the example.
Thanks in advance, Michael
My configuration looks this.
#define MESH_CFG_MAX_ELEMENTS 1 #define MESH_CFG_MAX_MODELS 4 #define MESH_CFG_MAX_APP_BINDS 4 #define MESH_CFG_MAX_SUBSCRIPTIONS 4 #define MESH_CFG_MAX_NETKEYS 4 #define MESH_CFG_MAX_APPKEYS 4 #define MESH_CFG_MAX_DEVKEYS 1 #define MESH_CFG_NET_CACHE_SIZE 16 #define MESH_CFG_RPL_SIZE 32 #define MESH_CFG_MAX_SEND_SEGS 4 #define MESH_CFG_MAX_RECV_SEGS 4 #define MESH_CFG_MAX_VAS 4 #define MESH_CFG_MAX_PROV_SESSIONS 2 #define MESH_CFG_MAX_PROV_BEARERS 2 #define MESH_CFG_MAX_GATT_CONNECTIONS 3 #define MESH_CFG_GATT_TXQ_SIZE 4 #define MESH_CFG_MAX_PROVISIONED_DEVICES 32 #define MESH_CFG_MAX_PROVISIONED_DEVICE_NETKEYS 2 #define MESH_CFG_MAX_FOUNDATION_CLIENT_CMDS 0
Can you tell me what you have changed?
I have attached a working provisioner example that can be bolted on top of the soc-btmesh-light example. It scans for unprovisioned beacons and asks user to confirm or reject UUIDs by pressing pushbutton PB1 or PB0, respectively.
After provisioning, the app reads DCD content from the node and checks what SIG models are iniside it. Based on this information, it decides how to configure the node, i.e.
With this example, it is possible to provision and configure the dimmable light switch and light examples from the BT mesh 1.2.0 SDK.
This version has not been extensively tested and I am planning to add more features in the near future, including configuration of vendor models and management of the network (at least possibility to remove nodes). The next version will most probably be released as a knowledgebase article with more documentation included, stay tuned for updates...
The zip package includes an example log file from the provisioner, showing how it looks like when you provision one dimmable light and one switch. By looking at the log file it is quite easy to see what are the steps required to configure a light or a switch.
EDIT: see an updated code package (v2) later in this thread
I'm trying the provisioner example
I have find where to change this parameters: Max Provisioned Devices, Max Provisioned Device Netkeys Max Foundation Client Cmds
but I don't know how to add Configuration Client model to the DCD.
Could anyone explain what is Configuration Client model and where I have to add it?
The configuration client model can be added to DCD by pressing the plus icon, see above screenshot. And the memory configuration parameters can be found in the second tab that is highlighted in the picture with red pen.
After performing these changes, you need to save the *.isc file, press Generate and rebuild the project.
Thank you! Now I get it working fine.
I can't wait for the knowledgebase article you are planning, It would be great to have some light on bluetooth mesh develop.
Attaching new version of the provisioner code, still in draft mode. This version supports configuration of vendor models. Additionally some refactoring done (mainly function config_check() that decides what is the suitable configuration based on the device composition data).
I used your prov_example_draft_v2 code and made some modifications to satisfy our application, which uses our own vendor models. For the most part it works really well. However, it gets into a condition where it fails with a 0x180 error code when calling gecko_cmd_mesh_prov_provision_device, which means there's an invalid parameter in the command. Since the length for uuid is fixed at 16, it seems there are only 2 parameters passed into it that could be invalid; netkey_id and uuid_copy. When provisioning is successful, the same values are passed in as are passed in for the failure condition (see the debug output below for success and failure cases).
It seems to get into this state when it fails during the binding, publish set, or subscription set process. Doing a hard reset does not fix it.
In order to get out of the failure state and get it to successfully call gecko_cmd_mesh_prov_provision_device, I have to do a factory restore. The problem with this is it erases all off the keys. Since the Appkey is different after doing so, I have to reprovision every device in the network in order for them to communicate. This is a really inconvenient thing to have to do.
Initializing as provisioner Device name: 'Provisioner 8e:9' Successfully initialized gecko_cmd_mesh_prov_init_id networks: 1 address: 2001 ivi: 0 network keys already exist Starting to scan for unprovisioned device beacons Success - initializing unprovisioned beacon scan gecko_evt_mesh_prov_unprov_beacon_id 53696c6162734465762dfc317e570b00 Provision node as a Puck (PB1) or Hub (PB0)? Node will be provisioned as a Puck. Disable Relay (PB1) or Enable Relay (PB0)? Node will NOT be provisioned as a Relay. Sending prov request netkey_id: 0 uuid_copy: 53696c6162734465762dfc317e570b00 Failed call to provision node. 180 gecko_evt_mesh_prov_unprov_beacon_id 53696c6162734465762dfc317e570b00 Provision node as a Puck (PB1) or Hub (PB0)?
Initializing as provisioner Device name: 'Provisioner 8e:9' Successfully initialized gecko_cmd_mesh_prov_init_id networks: 1 address: 2001 ivi: 0 network keys already exist Starting to scan for unprovisioned device beacons Success - initializing unprovisioned beacon scan gecko_evt_mesh_prov_unprov_beacon_id 53696c6162734465762dfc317e570b00 Provision node as a Puck (PB1) or Hub (PB0)? Node will be provisioned as a Puck. Disable Relay (PB1) or Enable Relay (PB0)? Node will NOT be provisioned as a Relay. Sending prov request netkey_id: 0 uuid_copy: 53696c6162734465762dfc317e570b00 Successful call of gecko_cmd_mesh_prov_provision_device Node successfully provisioned. Address: 0001 provisioning done - uuid 0x53696C6162734465762DFC317E570B00
Any thoughts on what is causing this to happen?