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

nRF52 DK - Light Switch Example - Auto provision multiple clients

Hello,

In my setup, I have 5 clients  (buttons) that all report to the same server (lightbulb). 

I'm using the Mesh SDK 3.2 light switch example with static provisioning. If i'm using multiple servers with 1 client, there is no problem. 

But when i'm having multiple clients, problems occur. Only 1 client gets provisioned by the provisioner. 

#define SERVER_NODE_COUNT (30)
#if SERVER_NODE_COUNT > 30
#error Maximum 30 servers currently supported by client example.
#endif

/** Number of active clients nodes. */
#define CLIENT_NODE_COUNT            (5)

/** Number of On-Off client models on the Switch Node */
#define CLIENT_MODEL_INSTANCE_COUNT  (2)

I have tried changing the CLIENT_NODE_COUNT (Light_switch_example_common.h) to 5, but nothing changed. 

Also, in the provisioner main.c file there are following statements which I think only let 1 client provision.

if (!m_node_prov_setup_started)
    {
        /* If previously provisioned device is not configured, start node setup procedure. */
        if (m_nw_state.configured_devices < m_nw_state.provisioned_devices)
        {
            /* Execute configuration */
            __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Waiting for provisioned node to be configured ...\n");

            node_setup_start(m_nw_state.last_device_address, PROVISIONER_RETRY_COUNT,
                            m_nw_state.appkey, APPKEY_INDEX, NETKEY_INDEX, m_nw_state.p_client_uri);

            hal_led_pin_set(APP_CONFIGURATION_LED, 1);
        }
        else if (m_nw_state.provisioned_devices == 0)
        {
            /* Start provisioning - First provision the client with known URI hash */
            __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Waiting for Client node to be provisioned ...\n");

            static const char * uri_list[] = {EX_URI_LS_CLIENT, EX_URI_ENOCEAN, EX_URI_DM_CLIENT};
            prov_helper_provision_next_device(PROVISIONER_RETRY_COUNT, m_nw_state.next_device_address,
                                              uri_list, ARRAY_SIZE(uri_list));
            prov_helper_scan_start();

            hal_led_pin_set(APP_PROVISIONING_LED, 1);
        }
        else if (m_nw_state.provisioned_devices < (SERVER_NODE_COUNT + CLIENT_NODE_COUNT))
        {
            /* Start provisioning - rest of the devices, depending on the client that was provisioned. */
            __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Waiting for Server node to be provisioned ...\n");

            static const char * uri_list[1];
            uri_list[0] = server_uri_index_select(m_nw_state.p_client_uri);
            __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Server URI index: %d\n",  uri_list[0]);
            prov_helper_provision_next_device(PROVISIONER_RETRY_COUNT, m_nw_state.next_device_address,
                                               uri_list, ARRAY_SIZE(uri_list));
            prov_helper_scan_start();

            hal_led_pin_set(APP_PROVISIONING_LED, 1);
        }
        else
        {
            __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "All servers provisioned\n");
            return;
        }

I'm using: nRF5 SDK 15.3.0 / MESH SDK 3.20

Can anyone help me with this problem? 

Thanks in advance.

Kind regards,

Dmore

Parents
  • Hi,

    As you can see from the excerpt of check_network_state() that you posted in the opening post, the provisioner from the light switch example is hard coded to only provision and configure one client.

    In addition to changing the "else if" line in check_network_state() from checking "m_nw_state.provisioned_devices == 0" to "m_nw_state.provisioned_devices < CLIENT_NODE_COUNT", you probably need to go through the state machine in node_setup.c and ensure it does the correct thing for the steps used for configuring the client, now that you have more than one. (Have a look in node_setop.c at the client_config_steps[] array and the function config_step_execute().)

    Regards,
    Terje

Reply
  • Hi,

    As you can see from the excerpt of check_network_state() that you posted in the opening post, the provisioner from the light switch example is hard coded to only provision and configure one client.

    In addition to changing the "else if" line in check_network_state() from checking "m_nw_state.provisioned_devices == 0" to "m_nw_state.provisioned_devices < CLIENT_NODE_COUNT", you probably need to go through the state machine in node_setup.c and ensure it does the correct thing for the steps used for configuring the client, now that you have more than one. (Have a look in node_setop.c at the client_config_steps[] array and the function config_step_execute().)

    Regards,
    Terje

Children
Related