This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Clock driver does not start Low Frequency clock properly if Watchdog is enabled

Hello,

We've recently migrated from SDK version 15.2.0 to 17.0.0 and noticed an anomaly with the clock driver. If the watchdog is started, then after any soft reset (through reflashing firmware or calling NVIC_SystemReset), the low frequency clock will not be started and dependent peripherals like the RTC will not function. It will require a hard power cycle for the low frequency clock to start properly. This behaviour was not seen while on the v15.2.0 SDK.

We use the following clock driver calls to initiate and start the low frequency clock:

    ret_code_t ret;
    ret = nrf_drv_clock_init();
    APP_ERROR_CHECK(ret);
    
    nrf_drv_clock_lfclk_request(NULL);
    while (!nrf_drv_clock_lfclk_is_running()) {};

We noticed that one of the changes in the new SDK is the addition of the following check in nrf_drv_clock_init() of nrf_drv_clock.c:

    if (nrf_wdt_started())
    {
        m_clock_cb.lfclk_on = true;
    }

If that check is commented out, then the low frequency clock starts properly.

Update: From this thread: https://devzone.nordicsemi.com/f/nordic-q-a/51559/nrf52-wdt-lfclk-sourcing
The WDT will remain on after a soft reboot. This seems to cause the nrf_drv_clock_lfclk_request() to not actually start the LFCLK after the soft reboot.

Thank you for your assistance!

Related