Dear Nordic experts,
This short code snippet is supposed to reset (unprovision) a Bluetooth Mesh node and reboot it (nRF5 SDK for Mesh 5.0.0):
void node_reset(void) { __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, " >>>>> Resetting node <<<<< \n"); if (mesh_stack_is_device_provisioned()) { mesh_stack_config_clear(); mesh_stack_device_reset(); } schedule_reboot(); // just waits for 2 seconds before calling sd_nvic_SystemReset(); to reboot the node. }
node_reset() is called at the main() loop once an input pin is set. At the time it is called, the (custom/vendor) model is still operating. The problem is, that mesh_stack_config_clear() ends up in app_error_fault_handler().
The following is printed at the debug terminal in SES:
<t: 2006463>, main.c, 252, >>>>> Resetting node <<<<< <t: 2006553>, main.c, 213, Mesh event: NRF_MESH_EVT_CONFIG_STABLE <t: 2006556>, main.c, 217, Mesh event: NRF_MESH_EVT_FLASH_STABLE <t: 2006559>, main.c, 217, Mesh event: NRF_MESH_EVT_FLASH_STABLE <t: 2006650>, main.c, 213, Mesh event: NRF_MESH_EVT_CONFIG_STABLE <t: 2006653>, main.c, 217, Mesh event: NRF_MESH_EVT_FLASH_STABLE <t: 2006656>, main.c, 217, Mesh event: NRF_MESH_EVT_FLASH_STABLE <t: 2006747>, main.c, 213, Mesh event: NRF_MESH_EVT_CONFIG_STABLE <t: 2006750>, main.c, 217, Mesh event: NRF_MESH_EVT_FLASH_STABLE <t: 2006753>, main.c, 217, Mesh event: NRF_MESH_EVT_FLASH_STABLE <t: 2006844>, main.c, 213, Mesh event: NRF_MESH_EVT_CONFIG_STABLE <t: 2006847>, main.c, 217, Mesh event: NRF_MESH_EVT_FLASH_STABLE <t: 2006850>, main.c, 217, Mesh event: NRF_MESH_EVT_FLASH_STABLE <t: 2006869>, app_error_weak.c, 105, Mesh assert at 0x0002E65E (:0)
And the stacktrace looks like this:
app_error_fault_handler() mesh_assertion_handler() backend_evt_handler() write_complete_cb() process_action_queue() send_end_events() bearer_event_handler() bearer_event_flag_set() mesh_config_backend_record_write() dirty_entries_process() mesh_config_entry_set() seqnum_block_allocate() mesh_stack_config_clear() node_reset() main()
The questions now are:
What's causing this issue? Or: How do you reset/unprovision and reboot a mesh node in nRF5 SDK for Mesh 5.0.0?
Your help is very much appreciated,
Thank you,
Michael.