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

Mesh Provisioning Setup, nRF SDK for Mesh 2.0.1

Hi there,

I was wondering if someone at Nordic could verify something for me. I had a go at modifying the lightswitch example (node_setup.c) in the mesh sdk, to instead be setup in this configuration:  One "Client" to many "Servers". I currently have it set up so that I can send a "trigger" packet from my client node to either of my four server nodes (which sample sensor data). This will then start an app timer on the device in question which then pushes its sensor data to the client at every time interval. This setup is similar to the Thingy52 mesh demo which is based on the older mesh sdk (v1.0.0).

What I would like to know is:

1. For my client and four server nodes, is this the correct way to set up the provisioning:

// Config steps

/* Sequence of steps for the client nodes */
static const config_steps_t client_config_steps[] =
{
    NODE_SETUP_CONFIG_COMPOSITION_GET,
    NODE_SETUP_CONFIG_APPKEY_ADD,
    NODE_SETUP_CONFIG_APPKEY_BIND_HEALTH,
    NODE_SETUP_CONFIG_PUBLICATION_HEALTH,
    NODE_SETUP_CONFIG_APPKEY_BIND_ONOFF_CLIENT,
    NODE_SETUP_CONFIG_APPKEY_BIND_ONOFF_CLIENT,
    NODE_SETUP_CONFIG_APPKEY_BIND_ONOFF_CLIENT,
    NODE_SETUP_CONFIG_APPKEY_BIND_ONOFF_CLIENT,
    NODE_SETUP_CONFIG_PUBLICATION_ONOFF_CLIENT1,
    NODE_SETUP_CONFIG_PUBLICATION_ONOFF_CLIENT2,
    NODE_SETUP_CONFIG_PUBLICATION_ONOFF_CLIENT3,
    NODE_SETUP_CONFIG_PUBLICATION_ONOFF_CLIENT4,
    NODE_SETUP_DONE
};

/* Sequence of steps for the server nodes */
static const config_steps_t server_config_steps[] =
{
    NODE_SETUP_CONFIG_COMPOSITION_GET,
    NODE_SETUP_CONFIG_APPKEY_ADD,
    NODE_SETUP_CONFIG_APPKEY_BIND_HEALTH,
    NODE_SETUP_CONFIG_APPKEY_BIND_ONOFF_SERVER,
    NODE_SETUP_CONFIG_PUBLICATION_HEALTH,
    NODE_SETUP_CONFIG_PUBLICATION_ONOFF_SERVER, /* Newly added */
    //NODE_SETUP_CONFIG_SUBSCRIPTION_ONOFF_SERVER,
    NODE_SETUP_DONE
};

static void setup_select_steps(uint16_t addr)
{
    if (addr == UNPROV_START_ADDRESS)
    {
        mp_config_step = client_config_steps;
    }
//    else if (addr <= (UNPROV_START_ADDRESS + CLIENT_NODE_ONOFF_CLIENT_MODEL_INSTANCES + 2))
//    {
//        mp_config_step = server1_server2_config_steps;
//    }
    else
    {
        mp_config_step = server_config_steps;
    }
}

/** Step execution function for the configuration state machine. */
static void config_step_execute(void)
{
    uint32_t status;
    static uint16_t model_element_addr = 0;

    /* This example configures the provisioned nodes in the following way
     * Node 0: Client node (Switch)
     * Node 1,2,3 ...: Server nodes (Lights)
     *
     * Group Even: All nodes with even address
     * Group Odd: All nodes with odd address
     */

    /* Customize configuration steps for client vs. server nodes.
     * For client nodes: Skip, usual publication and subscription
     */

    switch (*mp_config_step)
    {
        /* Read the composition data from the node: */
        case NODE_SETUP_CONFIG_COMPOSITION_GET:
        {
            __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Getting composition data\n");
            retry_on_fail(config_client_composition_data_get(0x00));

            expected_status_set(CONFIG_OPCODE_COMPOSITION_DATA_STATUS, 0, NULL);
            break;
        }

        /* Add the application key to the node: */
        case NODE_SETUP_CONFIG_APPKEY_ADD:
        {
            __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Adding appkey\n");
            retry_on_fail(config_client_appkey_add(NETKEY_INDEX, m_appkey_idx, mp_appkey));

            static const uint8_t exp_status[] = {ACCESS_STATUS_SUCCESS, ACCESS_STATUS_KEY_INDEX_ALREADY_STORED};
            expected_status_set(CONFIG_OPCODE_APPKEY_STATUS, sizeof(exp_status), exp_status);
            break;
        }

        /* Bind the health server to the application key: */
        case NODE_SETUP_CONFIG_APPKEY_BIND_HEALTH:
        {
            __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "App key bind: Health server\n");
            access_model_id_t model_id;
            model_id.company_id = ACCESS_COMPANY_ID_NONE;
            model_id.model_id = HEALTH_SERVER_MODEL_ID;
            uint16_t element_address = m_current_node_addr;
            retry_on_fail(config_client_model_app_bind(element_address, m_appkey_idx, model_id));

            static const uint8_t exp_status[] = {ACCESS_STATUS_SUCCESS};
            expected_status_set(CONFIG_OPCODE_MODEL_APP_STATUS, sizeof(exp_status), exp_status);
            break;
        }

        /* Bind the On/Off server to the application key: */
        case NODE_SETUP_CONFIG_APPKEY_BIND_ONOFF_SERVER:
        {
            __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "App key bind: Simple On/Off server\n");
            access_model_id_t model_id;
            model_id.company_id = ACCESS_COMPANY_ID_NORDIC;
            model_id.model_id = SIMPLE_ON_OFF_SERVER_MODEL_ID;
            uint16_t element_address = m_current_node_addr;
            retry_on_fail(config_client_model_app_bind(element_address, m_appkey_idx, model_id));

            static const uint8_t exp_status[] = {ACCESS_STATUS_SUCCESS};
            expected_status_set(CONFIG_OPCODE_MODEL_APP_STATUS, sizeof(exp_status), exp_status);
            break;
        }

        /* Bind the On/Off client to the application key: */
        case NODE_SETUP_CONFIG_APPKEY_BIND_ONOFF_CLIENT:
        {
            if (model_element_addr == 0)
            {
                model_element_addr = m_current_node_addr + 1;
            }
            __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "App key bind: Simple On/Off client on element 0x%04x\n", model_element_addr);
            access_model_id_t model_id;
            model_id.company_id = ACCESS_COMPANY_ID_NORDIC;
            model_id.model_id = SIMPLE_ON_OFF_CLIENT_MODEL_ID;
            uint16_t element_address = model_element_addr;
            status = config_client_model_app_bind(element_address, m_appkey_idx, model_id);
            retry_on_fail(status);

            static const uint8_t exp_status[] = {ACCESS_STATUS_SUCCESS};
            expected_status_set(CONFIG_OPCODE_MODEL_APP_STATUS, sizeof(exp_status), exp_status);

            if (status == NRF_SUCCESS)
            {
                model_element_addr++;
            }
            break;
        }

        /* Configure the publication parameters for the Health server: */
        case NODE_SETUP_CONFIG_PUBLICATION_HEALTH:
        {
            config_publication_state_t pubstate = {0};
            pubstate.element_address = m_current_node_addr;
            pubstate.publish_address.type = NRF_MESH_ADDRESS_TYPE_UNICAST;
            pubstate.publish_address.value = PROVISIONER_ADDRESS;
            pubstate.appkey_index = 0;
            pubstate.frendship_credential_flag = false;
            pubstate.publish_ttl = (SERVER_NODE_COUNT > NRF_MESH_TTL_MAX ? NRF_MESH_TTL_MAX : SERVER_NODE_COUNT);
            pubstate.publish_period.step_num = 1;
            pubstate.publish_period.step_res = ACCESS_PUBLISH_RESOLUTION_10S;
            pubstate.retransmit_count = 1;
            pubstate.retransmit_interval = 0;
            pubstate.model_id.company_id = ACCESS_COMPANY_ID_NONE;
            pubstate.model_id.model_id = HEALTH_SERVER_MODEL_ID;
            __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Setting publication address for the health server to 0x%04x\n", pubstate.publish_address.value);
            retry_on_fail(config_client_model_publication_set(&pubstate));

            static const uint8_t exp_status[] = {ACCESS_STATUS_SUCCESS};
            expected_status_set(CONFIG_OPCODE_MODEL_PUBLICATION_STATUS, sizeof(exp_status), exp_status);
            break;
        }

        /* Newly added */
        case NODE_SETUP_CONFIG_PUBLICATION_ONOFF_SERVER:
        {
            config_publication_state_t pubstate = {0};
            pubstate.element_address = m_current_node_addr;
            pubstate.publish_address.type = NRF_MESH_ADDRESS_TYPE_UNICAST;
            pubstate.publish_address.value = m_current_node_addr - CLIENT_NODE_ONOFF_CLIENT_MODEL_INSTANCES;
            pubstate.appkey_index = m_appkey_idx;
            pubstate.frendship_credential_flag = false;
            pubstate.publish_ttl = (SERVER_NODE_COUNT > NRF_MESH_TTL_MAX ? NRF_MESH_TTL_MAX : SERVER_NODE_COUNT);
            pubstate.publish_period.step_num = 0;
            pubstate.publish_period.step_res = ACCESS_PUBLISH_RESOLUTION_100MS;
            pubstate.retransmit_count = 1;
            pubstate.retransmit_interval = 0;
            pubstate.model_id.company_id = ACCESS_COMPANY_ID_NORDIC;
            pubstate.model_id.model_id = SIMPLE_ON_OFF_SERVER_MODEL_ID;
            __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Set: on/off server pub addr: 0x%04x\n", pubstate.publish_address.value);
            retry_on_fail(config_client_model_publication_set(&pubstate));

            static const uint8_t exp_status[] = {ACCESS_STATUS_SUCCESS};
            expected_status_set(CONFIG_OPCODE_MODEL_PUBLICATION_STATUS, sizeof(exp_status), exp_status);
            break;
        }

        /* Configure the publication parameters for the 1st two On/Off servers to publish to
        corresponding On/Off clients. This demonstrates the state change publication due to local
        event on the server. */
        case NODE_SETUP_CONFIG_PUBLICATION_ONOFF_SERVER1_2:
        {
            config_publication_state_t pubstate = {0};
            pubstate.element_address = m_current_node_addr;
            pubstate.publish_address.type = NRF_MESH_ADDRESS_TYPE_UNICAST;
            pubstate.publish_address.value = m_current_node_addr - CLIENT_NODE_ONOFF_CLIENT_MODEL_INSTANCES;
            pubstate.appkey_index = m_appkey_idx;
            pubstate.frendship_credential_flag = false;
            pubstate.publish_ttl = (SERVER_NODE_COUNT > NRF_MESH_TTL_MAX ? NRF_MESH_TTL_MAX : SERVER_NODE_COUNT);
            pubstate.publish_period.step_num = 0;
            pubstate.publish_period.step_res = ACCESS_PUBLISH_RESOLUTION_100MS;
            pubstate.retransmit_count = 1;
            pubstate.retransmit_interval = 0;
            pubstate.model_id.company_id = ACCESS_COMPANY_ID_NORDIC;
            pubstate.model_id.model_id = SIMPLE_ON_OFF_SERVER_MODEL_ID;
            __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Set: on/off server pub addr: 0x%04x\n", pubstate.publish_address.value);
            retry_on_fail(config_client_model_publication_set(&pubstate));

            static const uint8_t exp_status[] = {ACCESS_STATUS_SUCCESS};
            expected_status_set(CONFIG_OPCODE_MODEL_PUBLICATION_STATUS, sizeof(exp_status), exp_status);
            break;
        }

        /* Configure subscription address for the On/Off server */
        case NODE_SETUP_CONFIG_SUBSCRIPTION_ONOFF_SERVER:
        {
            __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Adding subscription\n");
            uint16_t element_address = m_current_node_addr;
            nrf_mesh_address_t address = {NRF_MESH_ADDRESS_TYPE_INVALID, 0, NULL};
            address.type = NRF_MESH_ADDRESS_TYPE_GROUP;
//            if (m_current_node_addr % 0x02)
//            {
//                address.value  = GROUP_ADDRESS_ODD;
//            }
//            else
//            {
//                address.value  = GROUP_ADDRESS_EVEN;
//            }
            address.value = 0xFACE;
            access_model_id_t model_id;
            model_id.company_id = ACCESS_COMPANY_ID_NORDIC;
            model_id.model_id = SIMPLE_ON_OFF_SERVER_MODEL_ID;
            retry_on_fail(config_client_model_subscription_add(element_address, address, model_id));

            static const uint8_t exp_status[] = {ACCESS_STATUS_SUCCESS};
            expected_status_set(CONFIG_OPCODE_MODEL_SUBSCRIPTION_STATUS, sizeof(exp_status), exp_status);
            break;
        }

        /* Configure the 1st client model to 1st server */
        case NODE_SETUP_CONFIG_PUBLICATION_ONOFF_CLIENT1:
        {
            config_publication_state_t pubstate = {0};
            client_pub_state_set(&pubstate, m_current_node_addr + ELEMENT_IDX_ONOFF_CLIENT1,
                                 UNPROV_START_ADDRESS + CLIENT_NODE_ONOFF_CLIENT_MODEL_INSTANCES + ELEMENT_IDX_ONOFF_CLIENT1);
            retry_on_fail(config_client_model_publication_set(&pubstate));

            static const uint8_t exp_status[] = {ACCESS_STATUS_SUCCESS};
            expected_status_set(CONFIG_OPCODE_MODEL_PUBLICATION_STATUS, sizeof(exp_status), exp_status);
            break;
        }

        case NODE_SETUP_CONFIG_PUBLICATION_ONOFF_CLIENT2:
        {
            config_publication_state_t pubstate = {0};
            client_pub_state_set(&pubstate, m_current_node_addr + ELEMENT_IDX_ONOFF_CLIENT2,
                                 UNPROV_START_ADDRESS + CLIENT_NODE_ONOFF_CLIENT_MODEL_INSTANCES + ELEMENT_IDX_ONOFF_CLIENT2);
            retry_on_fail(config_client_model_publication_set(&pubstate));

            static const uint8_t exp_status[] = {ACCESS_STATUS_SUCCESS};
            expected_status_set(CONFIG_OPCODE_MODEL_PUBLICATION_STATUS, sizeof(exp_status), exp_status);
            break;
        }

        case NODE_SETUP_CONFIG_PUBLICATION_ONOFF_CLIENT3:
        {
            config_publication_state_t pubstate = {0};
            client_pub_state_set(&pubstate, m_current_node_addr + ELEMENT_IDX_ONOFF_CLIENT3,
                                 UNPROV_START_ADDRESS + CLIENT_NODE_ONOFF_CLIENT_MODEL_INSTANCES + ELEMENT_IDX_ONOFF_CLIENT3);
            retry_on_fail(config_client_model_publication_set(&pubstate));

            static const uint8_t exp_status[] = {ACCESS_STATUS_SUCCESS};
            expected_status_set(CONFIG_OPCODE_MODEL_PUBLICATION_STATUS, sizeof(exp_status), exp_status);
            break;
        }

        case NODE_SETUP_CONFIG_PUBLICATION_ONOFF_CLIENT4:
        {
            config_publication_state_t pubstate = {0};
            client_pub_state_set(&pubstate, m_current_node_addr + ELEMENT_IDX_ONOFF_CLIENT4,
                                 UNPROV_START_ADDRESS + CLIENT_NODE_ONOFF_CLIENT_MODEL_INSTANCES + ELEMENT_IDX_ONOFF_CLIENT4);
            retry_on_fail(config_client_model_publication_set(&pubstate));

            static const uint8_t exp_status[] = {ACCESS_STATUS_SUCCESS};
            expected_status_set(CONFIG_OPCODE_MODEL_PUBLICATION_STATUS, sizeof(exp_status), exp_status);
            break;
        }

        default:
            ERROR_CHECK(NRF_ERROR_NOT_FOUND);
            break;
    }
}

and the corresponding provisioning log:

<t:          0>, MeshProvisioner.c,  542, Initializing Mesh Provisioner Node.
<t:          0>, mesh_softdevice_init.c,  112, Initializing SoftDevice...
<t:          0>, mesh_softdevice_init.c,   77, Enabling BLE...
<t:          0>, mesh_softdevice_init.c,   88, Ram base: 0x200032C8
<t:        616>, MeshProvisioner.c,  481, Initializing and adding models
<t:        630>, MeshProvisioner.c,  524, Setup defaults: Adding keys, addresses, and bindings 
<t:        807>, provisioner_helper.c,  329, netkey_handle: 0
<t:        819>, MeshProvisioner.c,  564, <start> 
<t:      27295>, MeshProvisioner.c,  110, Flash write complete
<t:      27297>, MeshProvisioner.c,  551, Starting application ...
<t:      27300>, MeshProvisioner.c,  553, Provisoned Nodes: 0, Configured Nodes: 0 Next Address: 0x0100
<t:      27304>, MeshProvisioner.c,  554, Dev key : 29B04D47ED066B8D301D5DCFD4B1B655
<t:      27308>, MeshProvisioner.c,  555, Net key : A53EC6FCE6D850A9469BBD7CA32EDFF6
<t:      27311>, MeshProvisioner.c,  556, App key : 0E034F04AC90146C1AA24295092BD24C
<t:      27314>, MeshProvisioner.c,  557, Press Button 1 to start provisioning and configuration process. 
0<t:     207257>, MeshProvisioner.c,  441, Button 1 pressed
<t:     207259>, MeshProvisioner.c,  354, Waiting for Client node to be provisioned ...
<t:     212024>, provisioner_helper.c,  282, Scanning For Unprovisioned Devices
<t:     212028>, provisioner_helper.c,  144, UUID seen: 0059FFFF00000000A39BDAD70B6AA30C
<t:     228294>, provisioner_helper.c,  144, UUID seen: 0059FFFF000000008CCBA48354D8DCB3
<t:     241917>, provisioner_helper.c,  144, UUID seen: 0059FFFF00000000DC9A0FF5D5A77431
<t:     260518>, provisioner_helper.c,  144, UUID seen: 0059ABCDEFABCDEFACCDEFABCDEFABCD
<t:     260521>, provisioner_helper.c,   95, UUID filter matched
<t:     261411>, provisioner_helper.c,  259, Provisioning link established
<t:     274351>, provisioner_helper.c,  254, Static authentication data provided
<t:     286674>, provisioner_helper.c,  192, Provisioning completed received
<t:     286677>, provisioner_helper.c,  197, Adding device address, and device keys
<t:     286683>, provisioner_helper.c,  214, Addr: 0x0100 addr_handle: 0 netkey_handle: 0 devkey_handle: 2
<t:     290353>, provisioner_helper.c,  155, Local provisioning link closed: prov_state: 2  remaining retries: 2
<t:     290358>, MeshProvisioner.c,  275, Provisioning successful
<t:     290360>, provisioner_helper.c,  181, Provisioning complete. Node addr: 0x0100 elements: 5
<t:     290364>, node_setup.c,  695, Configuring Node: 0x0100
<t:     290367>, node_setup.c,  609, Config client setup: devkey_handle:2 addr_handle:0
<t:     290370>, node_setup.c,  361, Getting composition data
<t:     290411>, MeshProvisioner.c,  110, Flash write complete
<t:     362206>, MeshProvisioner.c,  325, Config client event
<t:     362209>, node_setup.c,  371, Adding appkey
<t:     365938>, MeshProvisioner.c,  325, Config client event
<t:     365941>, node_setup.c,  272, opcode status field: 0 
<t:     365943>, node_setup.c,  382, App key bind: Health server
<t:     366822>, MeshProvisioner.c,  325, Config client event
<t:     366824>, node_setup.c,  272, opcode status field: 0 
<t:     366827>, node_setup.c,  450, Setting publication address for the health server to 0x0001
<t:     369670>, MeshProvisioner.c,  325, Config client event
<t:     369673>, node_setup.c,  272, opcode status field: 0 
<t:     369675>, node_setup.c,  416, App key bind: Simple On/Off client on element 0x0101
<t:     370621>, MeshProvisioner.c,  325, Config client event
<t:     370624>, node_setup.c,  272, opcode status field: 0 
<t:     370626>, node_setup.c,  416, App key bind: Simple On/Off client on element 0x0102
<t:     397479>, MeshProvisioner.c,  325, Config client event
<t:     397481>, node_setup.c,  272, opcode status field: 0 
<t:     397484>, node_setup.c,  416, App key bind: Simple On/Off client on element 0x0103
<t:     398363>, MeshProvisioner.c,  325, Config client event
<t:     398365>, node_setup.c,  272, opcode status field: 0 
<t:     398368>, node_setup.c,  416, App key bind: Simple On/Off client on element 0x0104
<t:     399167>, MeshProvisioner.c,  325, Config client event
<t:     399170>, node_setup.c,  272, opcode status field: 0 
<t:     399173>, node_setup.c,  301, Set: on/off client: 0x0101  pub addr: 0x0105
<t:     402506>, MeshProvisioner.c,  325, Config client event
<t:     402508>, node_setup.c,  272, opcode status field: 0 
<t:     402511>, node_setup.c,  301, Set: on/off client: 0x0102  pub addr: 0x0106
<t:     406289>, MeshProvisioner.c,  325, Config client event
<t:     406291>, node_setup.c,  272, opcode status field: 0 
<t:     406294>, node_setup.c,  301, Set: on/off client: 0x0103  pub addr: 0x0107
<t:     410794>, MeshProvisioner.c,  325, Config client event
<t:     410797>, node_setup.c,  272, opcode status field: 0 
<t:     410799>, node_setup.c,  301, Set: on/off client: 0x0104  pub addr: 0x0108
<t:     415347>, MeshProvisioner.c,  325, Config client event
<t:     415350>, node_setup.c,  272, opcode status field: 0 
<t:     415352>, MeshProvisioner.c,  241, Configuration of device 0 successful
<t:     415356>, provisioner_helper.c,  282, Scanning For Unprovisioned Devices
<t:     415390>, MeshProvisioner.c,  110, Flash write complete
<t:     425318>, provisioner_helper.c,  144, UUID seen: 0059FFFF000000008CCBA48354D8DCB3
<t:     425321>, provisioner_helper.c,   95, UUID filter matched
<t:     426016>, provisioner_helper.c,  259, Provisioning link established
<t:     505442>, provisioner_helper.c,  254, Static authentication data provided
<t:     650125>, provisioner_helper.c,  192, Provisioning completed received
<t:     650128>, provisioner_helper.c,  197, Adding device address, and device keys
<t:     650134>, provisioner_helper.c,  214, Addr: 0x0105 addr_handle: 1 netkey_handle: 0 devkey_handle: 3
<t:     653763>, provisioner_helper.c,  155, Local provisioning link closed: prov_state: 2  remaining retries: 2
<t:     653767>, MeshProvisioner.c,  275, Provisioning successful
<t:     653770>, provisioner_helper.c,  181, Provisioning complete. Node addr: 0x0105 elements: 1
<t:     653773>, node_setup.c,  695, Configuring Node: 0x0105
<t:     653777>, node_setup.c,  609, Config client setup: devkey_handle:3 addr_handle:1
<t:     653780>, node_setup.c,  361, Getting composition data
<t:     653822>, MeshProvisioner.c,  110, Flash write complete
<t:     695979>, MeshProvisioner.c,  304, Node 0x0100 alive with 0 active fault(s), RSSI: -40
<t:     709019>, MeshProvisioner.c,  325, Config client event
<t:     709022>, node_setup.c,  371, Adding appkey
<t:     712048>, MeshProvisioner.c,  325, Config client event
<t:     712051>, node_setup.c,  272, opcode status field: 0 
<t:     712053>, node_setup.c,  382, App key bind: Health server
<t:     712987>, MeshProvisioner.c,  325, Config client event
<t:     712990>, node_setup.c,  272, opcode status field: 0 
<t:     712992>, node_setup.c,  397, App key bind: Simple On/Off server
<t:     714358>, MeshProvisioner.c,  325, Config client event
<t:     714360>, node_setup.c,  272, opcode status field: 0 
<t:     714363>, node_setup.c,  450, Setting publication address for the health server to 0x0001
<t:     717565>, MeshProvisioner.c,  325, Config client event
<t:     717568>, node_setup.c,  272, opcode status field: 0 
<t:     717570>, node_setup.c,  474, Set: on/off server pub addr: 0x0101
<t:     743834>, MeshProvisioner.c,  325, Config client event
<t:     743836>, node_setup.c,  272, opcode status field: 0 
<t:     743839>, MeshProvisioner.c,  241, Configuration of device 1 successful
<t:     743842>, provisioner_helper.c,  282, Scanning For Unprovisioned Devices
<t:     743876>, MeshProvisioner.c,  110, Flash write complete
<t:     767725>, provisioner_helper.c,  144, UUID seen: 0059FFFF00000000DC9A0FF5D5A77431
<t:     767728>, provisioner_helper.c,   95, UUID filter matched
<t:     768385>, provisioner_helper.c,  259, Provisioning link established
<t:     781317>, provisioner_helper.c,  254, Static authentication data provided
<t:     858730>, provisioner_helper.c,  192, Provisioning completed received
<t:     858733>, provisioner_helper.c,  197, Adding device address, and device keys
<t:     858739>, provisioner_helper.c,  214, Addr: 0x0106 addr_handle: 2 netkey_handle: 0 devkey_handle: 4
<t:     862115>, provisioner_helper.c,  155, Local provisioning link closed: prov_state: 2  remaining retries: 2
<t:     862120>, MeshProvisioner.c,  275, Provisioning successful
<t:     862122>, provisioner_helper.c,  181, Provisioning complete. Node addr: 0x0106 elements: 1
<t:     862126>, node_setup.c,  695, Configuring Node: 0x0106
<t:     862129>, node_setup.c,  609, Config client setup: devkey_handle:4 addr_handle:2
<t:     862132>, node_setup.c,  361, Getting composition data
<t:     862173>, MeshProvisioner.c,  110, Flash write complete
<t:     917413>, MeshProvisioner.c,  325, Config client event
<t:     917415>, node_setup.c,  371, Adding appkey
<t:     947029>, MeshProvisioner.c,  325, Config client event
<t:     947032>, node_setup.c,  272, opcode status field: 0 
<t:     947034>, node_setup.c,  382, App key bind: Health server
<t:     947893>, MeshProvisioner.c,  325, Config client event
<t:     947895>, node_setup.c,  272, opcode status field: 0 
<t:     947898>, node_setup.c,  397, App key bind: Simple On/Off server
<t:     948753>, MeshProvisioner.c,  325, Config client event
<t:     948756>, node_setup.c,  272, opcode status field: 0 
<t:     948758>, node_setup.c,  450, Setting publication address for the health server to 0x0001
<t:     952433>, MeshProvisioner.c,  325, Config client event
<t:     952435>, node_setup.c,  272, opcode status field: 0 
<t:     952438>, node_setup.c,  474, Set: on/off server pub addr: 0x0102
<t:     956241>, MeshProvisioner.c,  325, Config client event
<t:     956243>, node_setup.c,  272, opcode status field: 0 
<t:     956246>, MeshProvisioner.c,  241, Configuration of device 2 successful
<t:     956251>, provisioner_helper.c,  282, Scanning For Unprovisioned Devices
<t:     956286>, MeshProvisioner.c,  110, Flash write complete
<t:     993716>, provisioner_helper.c,  144, UUID seen: 0059FFFF000000006373FAF563A7EBAF
<t:     993719>, provisioner_helper.c,   95, UUID filter matched
<t:     994679>, provisioner_helper.c,  259, Provisioning link established
<t:    1023466>, MeshProvisioner.c,  304, Node 0x0100 alive with 0 active fault(s), RSSI: -39
<t:    1043905>, MeshProvisioner.c,  304, Node 0x0105 alive with 0 active fault(s), RSSI: -64
<t:    1140483>, provisioner_helper.c,  254, Static authentication data provided
<t:    1214603>, provisioner_helper.c,  192, Provisioning completed received
<t:    1214606>, provisioner_helper.c,  197, Adding device address, and device keys
<t:    1214611>, provisioner_helper.c,  214, Addr: 0x0107 addr_handle: 3 netkey_handle: 0 devkey_handle: 5
<t:    1218376>, provisioner_helper.c,  155, Local provisioning link closed: prov_state: 2  remaining retries: 2
<t:    1218381>, MeshProvisioner.c,  275, Provisioning successful
<t:    1218384>, provisioner_helper.c,  181, Provisioning complete. Node addr: 0x0107 elements: 1
<t:    1218387>, node_setup.c,  695, Configuring Node: 0x0107
<t:    1218390>, node_setup.c,  609, Config client setup: devkey_handle:5 addr_handle:3
<t:    1218394>, node_setup.c,  361, Getting composition data
<t:    1218434>, MeshProvisioner.c,  110, Flash write complete
<t:    1273886>, MeshProvisioner.c,  325, Config client event
<t:    1273889>, node_setup.c,  371, Adding appkey
<t:    1276923>, MeshProvisioner.c,  325, Config client event
<t:    1276925>, node_setup.c,  272, opcode status field: 0 
<t:    1276928>, node_setup.c,  382, App key bind: Health server
<t:    1277836>, MeshProvisioner.c,  325, Config client event
<t:    1277838>, node_setup.c,  272, opcode status field: 0 
<t:    1277841>, node_setup.c,  397, App key bind: Simple On/Off server
<t:    1278337>, MeshProvisioner.c,  304, Node 0x0106 alive with 0 active fault(s), RSSI: -69
<t:    1278812>, MeshProvisioner.c,  325, Config client event
<t:    1278815>, node_setup.c,  272, opcode status field: 0 
<t:    1278818>, node_setup.c,  450, Setting publication address for the health server to 0x0001
<t:    1282243>, MeshProvisioner.c,  325, Config client event
<t:    1282245>, node_setup.c,  272, opcode status field: 0 
<t:    1282248>, node_setup.c,  474, Set: on/off server pub addr: 0x0103
<t:    1308557>, MeshProvisioner.c,  325, Config client event
<t:    1308560>, node_setup.c,  272, opcode status field: 0 
<t:    1308563>, MeshProvisioner.c,  241, Configuration of device 3 successful
<t:    1308567>, provisioner_helper.c,  282, Scanning For Unprovisioned Devices
<t:    1308601>, MeshProvisioner.c,  110, Flash write complete
<t:    1324849>, provisioner_helper.c,  144, UUID seen: 0059FFFF00000000A39BDAD70B6AA30C
<t:    1324852>, provisioner_helper.c,   95, UUID filter matched
<t:    1325579>, provisioner_helper.c,  259, Provisioning link established
<t:    1339152>, provisioner_helper.c,  254, Static authentication data provided
<t:    1351472>, MeshProvisioner.c,  304, Node 0x0100 alive with 0 active fault(s), RSSI: -40
<t:    1371512>, MeshProvisioner.c,  304, Node 0x0105 alive with 0 active fault(s), RSSI: -63
<t:    1482629>, provisioner_helper.c,  192, Provisioning completed received
<t:    1482632>, provisioner_helper.c,  197, Adding device address, and device keys
<t:    1482637>, provisioner_helper.c,  214, Addr: 0x0108 addr_handle: 4 netkey_handle: 0 devkey_handle: 6
<t:    1486095>, provisioner_helper.c,  155, Local provisioning link closed: prov_state: 2  remaining retries: 2
<t:    1486100>, MeshProvisioner.c,  275, Provisioning successful
<t:    1486102>, provisioner_helper.c,  181, Provisioning complete. Node addr: 0x0108 elements: 1
<t:    1486106>, node_setup.c,  695, Configuring Node: 0x0108
<t:    1486109>, node_setup.c,  609, Config client setup: devkey_handle:6 addr_handle:4
<t:    1486113>, node_setup.c,  361, Getting composition data
<t:    1486153>, MeshProvisioner.c,  110, Flash write complete
<t:    1541102>, MeshProvisioner.c,  325, Config client event
<t:    1541105>, node_setup.c,  371, Adding appkey
<t:    1544833>, MeshProvisioner.c,  325, Config client event
<t:    1544835>, node_setup.c,  272, opcode status field: 0 
<t:    1544838>, node_setup.c,  382, App key bind: Health server
<t:    1546266>, MeshProvisioner.c,  325, Config client event
<t:    1546268>, node_setup.c,  272, opcode status field: 0 
<t:    1546271>, node_setup.c,  397, App key bind: Simple On/Off server
<t:    1547027>, MeshProvisioner.c,  325, Config client event
<t:    1547030>, node_setup.c,  272, opcode status field: 0 
<t:    1547032>, node_setup.c,  450, Setting publication address for the health server to 0x0001
<t:    1572190>, MeshProvisioner.c,  325, Config client event
<t:    1572193>, node_setup.c,  272, opcode status field: 0 
<t:    1572196>, node_setup.c,  474, Set: on/off server pub addr: 0x0104
<t:    1576594>, MeshProvisioner.c,  325, Config client event
<t:    1576596>, node_setup.c,  272, opcode status field: 0 
<t:    1576599>, MeshProvisioner.c,  241, Configuration of device 4 successful
<t:    1576603>, provisioner_helper.c,  282, Scanning For Unprovisioned Devices
<t:    1576637>, MeshProvisioner.c,  110, Flash write complete
<t:    1605653>, MeshProvisioner.c,  304, Node 0x0106 alive with 0 active fault(s), RSSI: -72
<t:    1608831>, MeshProvisioner.c,  304, Node 0x0107 alive with 0 active fault(s), RSSI: -54
<t:    1679515>, MeshProvisioner.c,  304, Node 0x0100 alive with 0 active fault(s), RSSI: -40
<t:    1698629>, MeshProvisioner.c,  304, Node 0x0105 alive with 0 active fault(s), RSSI: -64
<t:    1876331>, MeshProvisioner.c,  304, Node 0x0108 alive with 0 active fault(s), RSSI: -62
<t:    1933351>, MeshProvisioner.c,  304, Node 0x0106 alive with 0 active fault(s), RSSI: -73
<t:    1936198>, MeshProvisioner.c,  304, Node 0x0107 alive with 0 active fault(s), RSSI: -56
<t:    2006678>, MeshProvisioner.c,  304, Node 0x0100 alive with 0 active fault(s), RSSI: -41
<t:    2026738>, MeshProvisioner.c,  304, Node 0x0105 alive with 0 active fault(s), RSSI: -61

2. I wish provision more than four server nodes, and have them behave in the same way. How do I modify my existing code in order to add more nodes? Do I do this:

/* Sequence of steps for the client nodes */
static const config_steps_t client_config_steps[] =
{
    NODE_SETUP_CONFIG_COMPOSITION_GET,
    NODE_SETUP_CONFIG_APPKEY_ADD,
    NODE_SETUP_CONFIG_APPKEY_BIND_HEALTH,
    NODE_SETUP_CONFIG_PUBLICATION_HEALTH,
    NODE_SETUP_CONFIG_APPKEY_BIND_ONOFF_CLIENT,
    NODE_SETUP_CONFIG_APPKEY_BIND_ONOFF_CLIENT,
    NODE_SETUP_CONFIG_APPKEY_BIND_ONOFF_CLIENT,
    NODE_SETUP_CONFIG_APPKEY_BIND_ONOFF_CLIENT,
    NODE_SETUP_CONFIG_APPKEY_BIND_ONOFF_CLIENT, //added
    NODE_SETUP_CONFIG_PUBLICATION_ONOFF_CLIENT1,
    NODE_SETUP_CONFIG_PUBLICATION_ONOFF_CLIENT2,
    NODE_SETUP_CONFIG_PUBLICATION_ONOFF_CLIENT3,
    NODE_SETUP_CONFIG_PUBLICATION_ONOFF_CLIENT4,
    NODE_SETUP_CONFIG_PUBLICATION_ONOFF_CLIENT5, //added etc
    NODE_SETUP_DONE
};

And add the corresponding case statements in config_step_execute()? Is there anything else I need to adjust in other files?

3. Rather than setting up multiple client model instances in that fashion, could I maybe just have one, and have all nodes in the mesh subscribe/post their data to that model? Is my understanding correct?

4. I want to know how to correctly set up grouping so that I can have one sever group in which I can send one "trigger" packet which all nodes on the mesh will then receive and subsequently start pushing their data.

5. With my current working setup of one client and four server nodes, every now and then one or two nodes will stop pushing data. (the sensor data update rate is the same on each node ~3 secs). I suspect something is causing these nodes to reset (mcu could be hitting fault). Is this because I am trying to send too much data at once around the mesh? My packet size is 20bytes. In the function simple_on_off_server_status_publish() there is a field called msg.force_segmented = false, could I use this to get around this issue? As I understand the maximum reliable packet size is 15 bytes (read something along those lines on the forums).

I made a previous thread on some of these problems (which I have sorted, as I have four server nodes "working" to some extent), but did not get an official reply -> devzone.nordicsemi.com/.../light-switch-example-modification-using-nrf-sdk-for-mesh-2-0-1

If you could please help me out that would be greatly appreciated. Slight smile

  • Hi,

    I am very sorry for slow response on this one.

    Although I do not have clear answers to all of your questions, here are my thoughts on the matter:

    1. & 2. It looks like that is a natural expansion of the light switch example, yes. However, it will become very tedious over time to add identical configurations over and over again.

    3. Yes, I think that would be a better solution. AFAIK you can configure all the servers to publish status messages to the same client.

    4. You can set all the servers on a common group address, and use a model for controlling the publish behavior of all the servers in one operation. For instance use some sort of on/off model for turning the sensor on and off, and let it publish status periodically when in the "on" state.

    5. Maximum payload size is 11 bytes, i.e. the number 15 includes some header data. In order to figure out if you hit a fault it is best to monitor the log output of the device, and/or do a debug session where you put breakpoints in the fault handlers.

    Regards,
    Terje

  • Hi Terje, Thanks for the reply.

    I have some questions regarding your reply:

    1. & 2. It looks like that is a natural expansion of the light switch example, yes. However, it will become very tedious over time to add identical configurations over and over again.

    Yes I agree, it will get very tedious the more nodes I decide to add, that's why I have decided to eventually use the android app that got released a few weeks ago to do the provisioning (with some modifications).

    3. Yes, I think that would be a better solution. AFAIK you can configure all the servers to publish status messages to the same client.

    Okay, so it should work, I have tried this with limited success. Any snippets of code outlining how to do this properly for more than four nodes at the provisioning stage? I have already set up my own custom models etc.

    4. You can set all the servers on a common group address, and use a model for controlling the publish behavior of all the servers in one operation. For instance use some sort of on/off model for turning the sensor on and off, and let it publish status periodically when in the "on" state.

    I have tried modifying the light switch example with limited success, can't seem to expand the number of nodes in one group (and get messages from them).

    5. Maximum payload size is 11 bytes, i.e. the number 15 includes some header data. In order to figure out if you hit a fault it is best to monitor the log output of the device, and/or do a debug session where you put breakpoints in the fault handlers.

    I know how to use the debugger Grinning. I would have thought that segmentation of messages gets handled automatically (in the background).

    Let me know your thoughts

    Regards,

Related