Using LFRC as the softdevice LFCLK source, enabling and running the WDT causes the softdevice to hang until the watchdog reset when calling nrf_sdh_disable_request. This is with SDK v15.3.0 on both S112 and S140.
Configuring the WDT to pause on debugging, I was able to trace the call to following:
nrf_sdh_disable_request
sdh_state_observer_notify
handler(evt, p_observer->p_context)
(which is sd_state_evt_handler
in the first iteration of my loop)nrfx_clock_enable
nrf_drv_clock_lfclk_release
lfclk_stop
7.
nrfx_clock_lfclk_stop
while(nrf_clock_lf_is_running()). <--- Hangs here (nrfx_clock.c:245)
Given the functions below, I don't see a way for the softdevice to successfully disable while using an LFRC that is also in use by the WDT, without registering an
m_clock_cb.lfclk_requests
, which the nrfx_wdt
drivers do not appear to do:Am I missing a softdevice call or step that enables it to proceed while sharing the LFCLK source with WDT?
Here are my clock settings for the softdevice:
Fullscreen123456789101112131415161718192021// <o> NRF_SDH_CLOCK_LF_SRC - SoftDevice clock source.// <0=> NRF_CLOCK_LF_SRC_RC// <1=> NRF_CLOCK_LF_SRC_XTAL// <2=> NRF_CLOCK_LF_SRC_SYNTH#ifndef NRF_SDH_CLOCK_LF_SRC#define NRF_SDH_CLOCK_LF_SRC 1#endif// <o> NRF_SDH_CLOCK_LF_RC_CTIV - SoftDevice calibration timer interval.#ifndef NRF_SDH_CLOCK_LF_RC_CTIV#define NRF_SDH_CLOCK_LF_RC_CTIV 16#endif// <o> NRF_SDH_CLOCK_LF_RC_TEMP_CTIV - SoftDevice calibration timer interval under constant temperature.// <i> How often (in number of calibration intervals) the RC oscillator shall be calibrated// <i> if the temperature has not changed.#ifndef NRF_SDH_CLOCK_LF_RC_TEMP_CTIV#define NRF_SDH_CLOCK_LF_RC_TEMP_CTIV 2
Commenting out the call to nrf_drv_clock_lfclk_release
or lfclk_stop
prevents the hang.
Also, if I switch NRF_SDH_CLOCK_LF_SRC
to LFSYNT, the softdevice disables successfully without any hanging. However, the softdevice documentation states that there are only two sources usable for the softdevice: the internal RC and XTAL.
Is LFSYNT not recommended for the softdevice? Or is this a valid alternative as an "internal RC" if the additional current consumption is acceptable?