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

How to configure a node for control model?

How to configure a node for control model. I have used light switch on/off template to implement a control mode but i i don't know how to make a control logic for client. Have to use only client at a time but if i run the code i'm getting error and it run both client and sever at same time. I have merge the client and server program for control model but i'm getting a error as NRF_INVALID_STATE which is in nrf_mesh_init function.Please help me and thanks in advance.

Parents Reply Children
  • Thanks for your reply. I'm using mesh sdk 2.1.1. For control model i used light switch control example by merge client and server main.c i'm getting error as NRF_INVALID_STATE. I have problem to initialize mesh stack & softdevice for both client and server same time. only for first time i can use mesh stack and softdevice if use the same for server i get this error.

    I have added the log which i get error:

    <t: 0>, mesh_softdevice_init.c, 117, Initializing SoftDevice...
    <t: 0>, mesh_softdevice_init.c, 75, Enabling BLE...
    <t: 16>, mesh_softdevice_init.c, 109, sd_ble_enable: app_ram_base should be adjusted to 0x20002DA0
    <t: 58413>, main.c, 303, Initializing and adding models
    <t: 63311>, main.c, 366, Device UUID : 0059ABCDEFABCDEFACCDEFABCDEFABCD
    <t: 63318>, main.c, 443, ----- BLE Mesh Light Switch Server Demo -----
    <t: 63325>, app_error_weak.c, 105, Mesh error 8 at 0x00000000 (:0)

  • Have you tried adjusting the app_ram_base like it says: "app_ram_base should be adjusted to 0x20002DA0"? You can do this by right-clicking your project -> Edit Options, changing to Common Configuration, going to the Linker tab & double clicking on Section Placement Macros. There, you can change the RAM_START value to 0x20002DA0.

  • I have tried but still i'm getting the same error. Can I use mesh init function 2 times as for client and server?

    <t: 0>, main.c, 333, ----- BLE Mesh Light Switch Client Demo -----
    <t: 0>, mesh_softdevice_init.c, 117, Initializing SoftDevice...
    <t: 0>, mesh_softdevice_init.c, 75, Enabling BLE...
    <t: 60153>, main.c, 303, Initializing and adding models
    <t: 65038>, main.c, 366, Device UUID : 0059ABCDEFABCDEFACCDEFABCDEFABCD
    <t: 65046>, main.c, 443, ----- BLE Mesh Light Switch Server Demo -----
    <t: 65052>, app_error_weak.c, 105, Mesh error 8 at 0x00000000 (:0)

  • I have resolved the problem while combining light switch control with server and client but now i have problem while provisioning the devices.


    <t: 158537>, main.c, 362, Waiting for Client node to be provisioned ...
    <t: 163291>, provisioner_helper.c, 282, Scanning For Unprovisioned Devices
    <t: 206105>, provisioner_helper.c, 144, UUID seen: 0059FFFF00000000975B2B98BE9A8FF2
    <t: 219947>, provisioner_helper.c, 144, UUID seen: 0059ABCDEFABCDEFACCDEFABCDEFABCD
    <t: 219950>, provisioner_helper.c, 95, UUID filter matched
    <t: 220510>, provisioner_helper.c, 259, Provisioning link established
    <t: 233829>, provisioner_helper.c, 254, Static authentication data provided
    <t: 245727>, provisioner_helper.c, 192, Provisioning completed received
    <t: 245729>, provisioner_helper.c, 197, Adding device address, and device keys
    <t: 245734>, provisioner_helper.c, 214, Addr: 0x0100 addr_handle: 0 netkey_handle: 0 devkey_handle: 2
    <t: 248926>, provisioner_helper.c, 155, Local provisioning link closed: prov_state: 2 remaining retries: 2
    <t: 248930>, main.c, 283, Provisioning successful
    <t: 248932>, provisioner_helper.c, 181, Provisioning complete. Node addr: 0x0100 elements: 5
    <t: 248936>, node_setup.c, 673, Configuring Node: 0x0100
    <t: 248939>, node_setup.c, 587, Config client setup: devkey_handle:2 addr_handle:0
    <t: 248942>, node_setup.c, 361, Getting composition data
    <t: 248984>, main.c, 118, Flash write complete
    <t: 251601>, main.c, 333, Config client event
    <t: 251603>, node_setup.c, 371, Adding appkey
    <t: 254563>, main.c, 333, Config client event
    <t: 254565>, node_setup.c, 272, opcode status field: 0
    <t: 254567>, node_setup.c, 382, App key bind: Health server
    <t: 255377>, main.c, 333, Config client event
    <t: 255379>, node_setup.c, 272, opcode status field: 0
    <t: 255381>, node_setup.c, 450, Setting publication address for the health server to 0x0001
    <t: 258290>, main.c, 333, Config client event
    <t: 258292>, node_setup.c, 272, opcode status field: 0
    <t: 258295>, node_setup.c, 416, App key bind: Simple On/Off client on element 0x0101
    <t: 259935>, main.c, 333, Config client event
    <t: 259937>, node_setup.c, 272, opcode status field: 2
    <t: 259940>, main.c, 276, Configuration of device 0 failed. Press Button 1 to retry.

  • It seems to me as if the provisioner is able to successfully provision the client node, but has trouble configuring the client node. The health server seems to be added correctly, but the problem is most likely in the newly added control model. Did you update the simple on off client model & simple on off server models to be control models instead of only client/server models? 

    You mentioned that you merged the main.c files of the server & the client example in the light switch example. What is the reasoning behind this choice? Didn't you want to just update the simple on off server & client models to be control models instead? Or do you want to add a new control model with different functionality?

    Could you show me the code for the new control model you created?

Related