I have a problem, like this fellow engineer here, but the solution is not applying for me.
More specifically here our function calls from application is like this:
void nrf_802154_deinit(void) {
nrf_802154_timer_sched_deinit();
nrf_802154_timer_coord_uninit();
nrf_802154_temperature_deinit();
nrf_802154_rsch_uninit();
nrf_802154_random_deinit();
nrf_802154_lp_timer_deinit();
nrf_802154_clock_deinit();
nrf_802154_core_deinit();
}
void nrf_802154_clock_deinit(void) {
nrf_drv_clock_uninit();
}
void nrf_drv_clock_uninit(void) {
ASSERT(m_clock_cb.module_initialized);
nrfx_clock_disable();
nrfx_clock_uninit();
m_clock_cb.module_initialized = false;
}
void nrfx_clock_uninit(void) {
NRFX_ASSERT(m_clock_cb.module_initialized);
nrfx_clock_lfclk_stop();
nrfx_clock_hfclk_stop();
m_clock_cb.module_initialized = false;
NRFX_LOG_INFO("Uninitialized.");
}
void nrfx_clock_lfclk_stop(void) {
NRFX_ASSERT(m_clock_cb.module_initialized);
nrf_clock_task_trigger(NRF_CLOCK_TASK_LFCLKSTOP);
while (nrf_clock_lf_is_running()) {}
}
Sure, the problem is Watchdog, Not stopping the LFCLK fix's the situation as below:
Proposed fix is:
void nrfx_clock_uninit(void) {
NRFX_ASSERT(m_clock_cb.module_initialized);
#if !NRFX_CHECK(NRFX_WDT_ENABLED)
// Watchdog is still using the LFCLK,
// and that's why the while loop will stuck if we call this function.
nrfx_clock_lfclk_stop();
#endif
nrfx_clock_hfclk_stop();
m_clock_cb.module_initialized = false;
NRFX_LOG_INFO("Uninitialized.");
}
I would be happy if Nordic engineers officially confirm my observation, and suggest a way if there is a reliable solution here or proposed fix is good without any side effects.