With the release of SDK For Mesh v5.0.0 the mesh_stack_power_down() was introduced.
When calling mesh_stack_power_down() an assert was hit in nrf_mesh_timer_tail_handle().
void nrf_mesh_timer_tail_handle(void)
{
NRF_RTC1->EVTENCLR = RTC_EVTEN_COMPARE1_Msk;
NRF_RTC1->INTENCLR = RTC_EVTEN_COMPARE1_Msk;
NRF_MESH_ASSERT(mp_cb != NULL);
mp_cb(timer_now());
}
This is because mesh_stack_power_down() was called when a RTC1 IRQ was pending with EVENTS_COMPARE[1] set.
The timer_stop() function need to clear this event to prevent calls to nrf_mesh_timer_tail_handle().
diff --git a/mesh/core/src/timer.c b/mesh/core/src/timer.c
index 949fef5..2137036 100644
--- a/mesh/core/src/timer.c
+++ b/mesh/core/src/timer.c
@@ -180,6 +180,7 @@ void timer_stop(void)
{
NRF_RTC1->EVTENCLR = RTC_EVTEN_COMPARE1_Msk;
NRF_RTC1->INTENCLR = RTC_EVTEN_COMPARE1_Msk;
+ NRF_RTC1->EVENTS_COMPARE[1] = 0;
m_ovfw_timer_counter = 0;
m_tail_timer_counter = 0;
Thanks.