Hi,
I'm using the provisioning example from the mesh sdk and I have an "ASSERTION FAILED at :0" error when I'm trying to re provision a node that I have provision before and reset.
To reproduce :
- Provision a node using the example.
- Reset the node using the "config_client_node_reset" function from config client. (The node is successfully unprovisioned and I receive the unprovision beacon)
- Try to provision again the same noed => Assertion Failed
Edit :
- After few tests, the problem also appends when I'm trying to provision an other node ather calling "config_client_node_reset"
After putting logs, its seem to be the "list_compare_add" function (in list.c) that cause this error. I got the first log but not the second.
#include "nrf_log.h"
uint32_t list_compare_add(list_node_t ** pp_head, list_node_t * p_new, list_cmp_cb_t cmp_cb)
{
NRF_LOG_INFO("------- T1");
NRF_MESH_ASSERT(pp_head != NULL && p_new != NULL && cmp_cb != NULL);
NRF_MESH_ASSERT(*pp_head != p_new);
NRF_LOG_INFO("------- T2");
if (*pp_head == NULL)
{
*pp_head = p_new;
(*pp_head)->p_next = NULL; /* sanitize */
return NRF_SUCCESS;
}
else
{
list_node_t * p_node = (*pp_head);
list_node_t * p_prev = NULL;
while (p_node != NULL &&
!cmp_cb(p_node, p_new))
{
p_prev = p_node;
p_node = p_node->p_next;
NRF_MESH_ASSERT(p_node != p_new);
}
/* This is the last element in the list. */
if (p_node == NULL)
{
list_insert(p_prev, p_new);
return NRF_SUCCESS;
}
else
{
return NRF_ERROR_FORBIDDEN;
}
}
}
<info> app: Config client event <info> app: Acknoledge for device reset <info> app: Provisioning ask <info> app: Stop Scanning For Unprovisioned Devices <info> app: ------- T1 <error> app: ASSERTION FAILED at :0
This method is called from "nrf_mesh_prov_bearer_add" in nrf_mesh_prov.c which is called from "prov_helper_provisioner_init" in provisioner_helper.c
uint32_t nrf_mesh_prov_bearer_add(nrf_mesh_prov_ctx_t * p_ctx, prov_bearer_t * p_prov_bearer)
{
if (p_ctx == NULL || p_prov_bearer == NULL)
{
return NRF_ERROR_NULL;
}
uint32_t status = list_compare_add(&p_ctx->p_bearers, &p_prov_bearer->node, bearer_compare_callback);
if (status == NRF_SUCCESS)
{
p_prov_bearer->p_parent = p_ctx;
p_ctx->supported_bearers |= p_prov_bearer->bearer_type;
}
return status;
}
static uint8_t prov_helper_provisioner_init(void)
{
if (!m_provisioner_init_done)
{
nrf_mesh_prov_oob_caps_t capabilities = NRF_MESH_PROV_OOB_CAPS_DEFAULT(ACCESS_ELEMENT_COUNT);
if (nrf_mesh_prov_init(&m_prov_ctx, m_public_key, m_private_key, &capabilities, prov_evt_handler) != NRF_SUCCESS)
{
return SERIAL_ERROR;
}
else if(nrf_mesh_prov_bearer_add(&m_prov_ctx, nrf_mesh_prov_bearer_adv_interface_get(&m_prov_bearer_adv)) != NRF_SUCCESS)
{
return SERIAL_ERROR;
}
return SERIAL_CMD_SUCCESS;
}
m_provisioner_init_done = true;
}
Used sdk :
- nRF5_SDK_16.0.0_98a08e2
- nrf5_SDK_for_Mesh_v4.2.0_src
Board used :
- nrf52840 evaluation board
Regards