Dear Nordic Support,
I am using nRF SDK for Mesh version 3.2.0 with nRF52840-DK. I am making 2 devices like the below:
1. First device: the provisioner, able to do PB Remote and node configuration. I combined the code from the light switch provisioner example and PB remote client example. I only use function
2. Second device: the provisionne, light switch client/server. I combined the code from light switch client and PB remote server.
The code runs but it is not as I expected. After The provisioning steps runs successfully but the software fails to configure the configuration model. The function app_config_client_event_cb is not executed and after testing, I find that the m_client.event_cb in file config_client.c is never called.
Here is the code for prov_evt_handler function:
static void prov_evt_handler(const nrf_mesh_prov_evt_t * p_evt) { switch (p_evt->type) { case NRF_MESH_PROV_EVT_UNPROVISIONED_RECEIVED: { if (m_device_state == DEVICE_STATE_PB_ADV_MODE) { start_provisioning(p_evt->params.unprov.device_uuid, NRF_MESH_PROV_BEARER_ADV); m_device_state = DEVICE_STATE_NONE; } break; } case NRF_MESH_PROV_EVT_LINK_ESTABLISHED: { __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Local provisioning link established\n"); m_current_prov_address = m_next_unprov_address; break; } case NRF_MESH_PROV_EVT_COMPLETE: { __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Provisioned device addr: 0x%04X net_key_handle: %d\n", p_evt->params.complete.p_prov_data->address, m_netkey_handles[0]); __LOG_XB(LOG_SRC_APP, LOG_LEVEL_INFO, "Dev Key", p_evt->params.complete.p_devkey, NRF_MESH_KEY_SIZE); __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Adding device address, and device keys\n"); ERROR_CHECK(dsm_address_publish_add(m_next_unprov_address, &m_device_address_handles[m_next_unprov_index])); ERROR_CHECK(dsm_devkey_add(p_evt->params.complete.p_prov_data->address, m_netkey_handles[0], p_evt->params.complete.p_devkey, &m_devkey_handles[1 + m_next_unprov_index])); /* Bind the device key to the configuration server and set the new node as the active server. */ ERROR_CHECK(config_client_server_bind(m_devkey_handles[1 + m_next_unprov_index])); ERROR_CHECK(config_client_server_set(m_devkey_handles[1 + m_next_unprov_index], m_device_address_handles[m_next_unprov_index])); __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Provisioning complete! Added 0x%04X as handle %u\n", p_evt->params.complete.p_prov_data->address, m_device_address_handles[m_next_unprov_index]); m_next_unprov_index++; m_next_unprov_address += m_num_elements_of_last_guy; hal_led_blink_ms(LEDS_MASK, LED_BLINK_INTERVAL_MS, LED_BLINK_CNT_PROV); break; } case NRF_MESH_PROV_EVT_LINK_CLOSED: { store_app_data(); app_prov_success_cb(); __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Local provisioning link closed\n"); node_setup_start(m_current_prov_address, PROVISIONER_RETRY_COUNT, m_nw_state.appkey, APPKEY_INDEX, NETKEY_INDEX, m_nw_state.p_client_uri); break; } case NRF_MESH_PROV_EVT_CAPS_RECEIVED: { uint32_t status = nrf_mesh_prov_oob_use(p_evt->params.oob_caps_received.p_context, NRF_MESH_PROV_OOB_METHOD_STATIC, 0, NRF_MESH_KEY_SIZE); if (status != NRF_SUCCESS) { __LOG(LOG_SRC_APP, LOG_LEVEL_ERROR, "Provisioning OOB selection rejected, error code %d\n", status); } else { m_num_elements_of_last_guy = p_evt->params.oob_caps_received.oob_caps.num_elements; __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Using static authentication\n"); } break; } case NRF_MESH_PROV_EVT_STATIC_REQUEST: { /* Request for static authentication data. This data is used to authenticate the two nodes. */ uint8_t static_data[16] = STATIC_AUTH_DATA; ERROR_CHECK(nrf_mesh_prov_auth_data_provide(p_evt->params.static_request.p_context, static_data, 16)); __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Static authentication data provided\n"); break; } default: break; } }
And here is the debug log for the PB client (privisioner) and PB server (light switch - provisionee):
<t: 0>, main.c, 892, ----- BLE Mesh Provisioner + Remote Provisioning Client Demo ----- <t: 13027>, main.c, 818, Initializing and adding models <t: 13053>, main.c, 225, Unable to add flash manager for app data <t: 13059>, main.c, 871, Setup defaults: Adding keys, addresses, and bindings <t: 13186>, provisioner_helper.c, 414, netkey_handle: 0 <t: 13206>, mesh_app_utils.c, 65, Device UUID (raw): C5E4C95EB78319448F01568565066AAF <t: 13213>, mesh_app_utils.c, 70, Device UUID : 5EC9E4C5-83B7-4419-8F01-568565066AAF <t: 13224>, main.c, 936, Next unprovisioned device address: 0x0100 <t: 13230>, main.c, 937, Next unprovisioned device index: 0 <t: 13243>, main.c, 941, -------------------------------- 1) Provision first available device with PB-ADV 2) Set current client publish handle (corresponding to a known server) 2.1) <address handle> 3) Start remote scanning 4) Cancel the remote scanning 5) Start remote provisioning 5.1) Device number <t: 13687>, main.c, 171, Flash write complete <t: 13692>, main.c, 904, Starting application ... <t: 13698>, main.c, 906, Provisoned Nodes: 0, Configured Nodes: 0 Next Address: 0x0100 <t: 13706>, main.c, 907, Dev key : D2B4BB5BAC3E71C12B87FFC12B2CC8F1 <t: 13712>, main.c, 908, Net key : 3A202F2696D640FD5C38543DE8780D52 <t: 13719>, main.c, 909, App key : 3643DA45CF8A74A070617A9C9588AD3A <t: 13725>, main.c, 910, Press Button 1 to start provisioning and configuration process. 1 <t: 247870>, main.c, 608, Local provisioning link established <t: 249692>, main.c, 664, Using static authentication <t: 262559>, main.c, 674, Static authentication data provided <t: 276000>, main.c, 617, Provisioned device addr: 0x0100 net_key_handle: 0 <t: 276007>, main.c, 618, Dev Key: DB050AA7770E1779E8C8509403A23001 <t: 276013>, main.c, 620, Adding device address, and device keys <t: 276022>, main.c, 631, Provisioning complete! Added 0x0100 as handle 0 <t: 279659>, main.c, 360, Provisioning successful <t: 279665>, main.c, 644, Local provisioning link closed <t: 279671>, node_setup.c, 729, Configuring Node: 0x0100 <t: 279679>, node_setup.c, 617, Config client setup: devkey_handle:2 addr_handle:0 <t: 279687>, node_setup.c, 355, Getting composition data (If flash writing is not disable, there will be 2 of these lines) <t: 279745>, main.c, 171, Flash write complete <t: 279811>, main.c, 171, Flash write complete
<t: 0>, main.c, 568, ----- BLE Mesh Light Switch Client Demo ----- <t: 14021>, main.c, 525, Initializing and adding models <t: 20514>, mesh_app_utils.c, 65, Device UUID (raw): 9BE5201B8630204C8E73991513B2CA0B <t: 20521>, mesh_app_utils.c, 70, Device UUID : 1B20E59B-3086-4C20-8E73-991513B2CA0B <t: 1255333>, main.c, 175, Successfully provisioned <t: 1255338>, main.c, 178, Node Address: 0x1337 (There should be something like this) <t: 700915>, config_server.c, 629, dsm_appkey_add(appkey_handle:0 appkey_index:0) <t: 705220>, config_server.c, 2441, Access Info: element_index=0 model_id = 2-FFFF model_handle=1 <t: 716239>, config_server.c, 2441, Access Info: element_index=1 model_id = 1001-FFFF model_handle=2 <t: 717114>, config_server.c, 2441, Access Info: element_index=2 model_id = 1001-FFFF model_handle=3
Can you give me some advices where to start debugging this, or the reasons which causes this issue? I would really appreciate that.
Thank you and best regards,
Duy