<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>RTC stops running after soft reset with WDT enabled</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/65361/rtc-stops-running-after-soft-reset-with-wdt-enabled</link><description>I&amp;#39;m using nRF52840, PCA10056, and finding that if WDT is enabled (but not expired), after a soft reset (NVIC_SystemReset, or a debugger reset) the RTC no longer runs. 
 If the watchdog expires, or there is a hard reset, then RTC works again. Probably</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 02 Sep 2020 01:42:41 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/65361/rtc-stops-running-after-soft-reset-with-wdt-enabled" /><item><title>RE: RTC stops running after soft reset with WDT enabled</title><link>https://devzone.nordicsemi.com/thread/267514?ContentTypeID=1</link><pubDate>Wed, 02 Sep 2020 01:42:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e80d9fd2-0b56-4be5-b64e-2fb3088fe85b</guid><dc:creator>Remi.G</dc:creator><description>&lt;p&gt;Thanks for the speedy reply!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I can confirm that disabling those lines fixes the issue both in the example and in my application.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;To avoid modifying SDK code, I am actually using the following:&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;err_code&lt;/span&gt;&lt;span&gt;&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span&gt;nrf_drv_clock_init&lt;/span&gt;&lt;span&gt;();&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;APP_ERROR_CHECK&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;err_code&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;nrf_drv_clock_lfclk_request&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;NULL&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;nrfx_clock_lfclk_start();&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;which also works.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: RTC stops running after soft reset with WDT enabled</title><link>https://devzone.nordicsemi.com/thread/267188?ContentTypeID=1</link><pubDate>Mon, 31 Aug 2020 11:11:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:25a185c1-912e-4fff-88ca-8fc8b92b5676</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Thank you for providing the code needed to reproduce this behavior, it&amp;#39;s really helpful! It sounds like this issue may be the same as the one discussed here: &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/65329/bootloader-with-wdt-and-app_time"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/65329/bootloader-with-wdt-and-app_time &lt;/a&gt;which I&amp;#39;m still working on. I will continue to debug the problem and keep you posted.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Update: &lt;/strong&gt;I think this related to the behavior Håkon describes here (&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/35792/nrf_clock--lfclkstat-register-contents-are-not-properly-evaluated-after-a-system-reset-if-rtc-compare-event-1-or-2-are-used/138995#138995"&gt;link&lt;/a&gt;) in that you have to start the LF clock start task even if the clock has been started by the WDT first. Removing the if condition in nrf_drv_clock_init() as shown below should fix the problem.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;ret_code_t nrf_drv_clock_init(void)
{
    ret_code_t err_code = NRF_SUCCESS;
    if (m_clock_cb.module_initialized)
    {
        err_code = NRF_ERROR_MODULE_ALREADY_INITIALIZED;
    }
    else
    {
        m_clock_cb.p_hf_head      = NULL;
        m_clock_cb.hfclk_requests = 0;
        m_clock_cb.p_lf_head      = NULL;
        m_clock_cb.lfclk_requests = 0;
        err_code = nrfx_clock_init(clock_irq_handler);
#ifdef SOFTDEVICE_PRESENT
        if (!nrf_sdh_is_enabled())
#endif
        {
            nrfx_clock_enable();
        }

#if CALIBRATION_SUPPORT
        m_clock_cb.cal_state = CAL_STATE_IDLE;
#endif

        m_clock_cb.module_initialized = true;
    }

/* Mod: start LF clock regardless of WDT state */

//    if (nrf_wdt_started())
//    {
//        m_clock_cb.lfclk_on = true;
//    }
//
    NRF_LOG_INFO(&amp;quot;Function: %s, error code: %s.&amp;quot;,
                 (uint32_t)__func__,
                 (uint32_t)NRF_LOG_ERROR_STRING_GET(err_code));
    return err_code;
}
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>