<?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>NRF52 Watchdog not resetting</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/43986/nrf52-watchdog-not-resetting</link><description>Hi, 
 Currently I am trying to implement Watchdog functionality into my Project. 
 I have the followowing problem: 
 I use the Nordic WatchdogTimer.h and instance the class with 1s in the constructor. 
 now, if I just do a &amp;#39;while(1);&amp;#39; the code succesfuly</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 14 Mar 2019 14:22:07 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/43986/nrf52-watchdog-not-resetting" /><item><title>RE: NRF52 Watchdog not resetting</title><link>https://devzone.nordicsemi.com/thread/176229?ContentTypeID=1</link><pubDate>Thu, 14 Mar 2019 14:22:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:69ecdc21-7644-43e7-a402-ab394b98f115</guid><dc:creator>jonas.woerner</dc:creator><description>&lt;p&gt;yep, its very odd. Also If I set the CONFIG to 0x00000009 I am not able to prevent the reset, even though I set the reload value to the RR0 register.&lt;/p&gt;
&lt;p&gt;I will try a different chip soon, maybe its defective.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52 Watchdog not resetting</title><link>https://devzone.nordicsemi.com/thread/176228?ContentTypeID=1</link><pubDate>Thu, 14 Mar 2019 14:17:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:49eeb1be-efea-4c66-b8f6-c660113169f3</guid><dc:creator>Einar Thorsrud</dc:creator><description>[quote user="jonas.woerner"]the chip does not sleep, nor am i debugging it(or does connecting over Segger RTT count as debugging?), but it simply wont reset if I set the config register to 0x00. I do start the chip after configuring it.[/quote]
&lt;p&gt;&amp;nbsp;That&amp;#39;s odd. So you let CONFGIG be 0x00 (which is equivalent with not writing to it), and starts the watchdog, but do not feed it, and then it does not reset? Did you also remember to set the CRV register to something sensible (the default value is all 1&amp;#39;s, so it will take a long time to timeout)?&lt;/p&gt;
[quote user="jonas.woerner"]regarding the power cycle, does that mean I can reconfigure the WDT every program start or every power cycle?[/quote]
&lt;p&gt;&amp;nbsp;A power on reset will reset the watchdog, but soft reset would not. You can see mor details under &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/power.html?cp=2_1_0_17_7#unique_832471788"&gt;Reset behavior&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52 Watchdog not resetting</title><link>https://devzone.nordicsemi.com/thread/176166?ContentTypeID=1</link><pubDate>Thu, 14 Mar 2019 12:15:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a62ebbeb-f55d-4ad0-9855-d2617e17d5cb</guid><dc:creator>jonas.woerner</dc:creator><description>&lt;p&gt;the chip does not sleep, nor am i debugging it(or does connecting over Segger RTT count as debugging?), but it simply wont reset if I set the config register to 0x00. I do start the chip after configuring it.&lt;/p&gt;
&lt;p&gt;regarding the power cycle, does that mean I can reconfigure the WDT every program start or every power cycle?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52 Watchdog not resetting</title><link>https://devzone.nordicsemi.com/thread/176083?ContentTypeID=1</link><pubDate>Thu, 14 Mar 2019 07:20:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3c25e66a-d57a-41cf-b482-3d18843f2088</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;What do you mean by saying that it won&amp;#39;t work when CONFIG is set to 0? In that case the WDT will pause when in sleep or haltet by a debugger, so if your current test code does that, then you should not expect to see a reset.&lt;/p&gt;
&lt;p&gt;Regarding changes to the CONFIG register, that must always be done before the WDT is started by writing to&amp;nbsp;TASKS_START. Once it is started it cannot be reconfigured, and the only way to stop it (so that it can be reconfigured again) is with a reset. This is intentional behavior, as it prevents a malfunction system to accidentally reconfigure the SoftDevice, potentially preventing a WDT reset.&lt;/p&gt;
&lt;p&gt;The WDT chapter in the PS specifies it like this:&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;em&gt;The watchdog must be configured before it is started. After it is started, the watchdog’s configuration registers, which comprise registers CRV, RREN, and CONFIG, will be blocked for further configuration.&lt;/em&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52 Watchdog not resetting</title><link>https://devzone.nordicsemi.com/thread/175469?ContentTypeID=1</link><pubDate>Mon, 11 Mar 2019 17:46:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:68c5b662-9a2f-40d2-b0c9-a013183cf022</guid><dc:creator>jonas.woerner</dc:creator><description>&lt;p&gt;well.. I discovered something strange... when I set CONFIG to 0x00000009 it will work. If I try to set it to 0x00 it wont work?! also, I noticed that for the CONFIG=... it will take a power cycle for the change to get applied, is that intentionally?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52 Watchdog not resetting</title><link>https://devzone.nordicsemi.com/thread/173050?ContentTypeID=1</link><pubDate>Tue, 26 Feb 2019 13:46:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:395fb7a0-76a5-4a29-9f99-bc1465cd3845</guid><dc:creator>jonas.woerner</dc:creator><description>&lt;p&gt;yehaa, its working!&lt;/p&gt;
&lt;p&gt;I still dont know why the WatchdogTimer.h does not work, but I will just do it this way now.&lt;/p&gt;
&lt;p&gt;my first try to do it without the included file would have worked, if I wouldnt have been so stupid and accidentally use 0x00001001 instead of 0b00001001.&lt;/p&gt;
&lt;p&gt;So thanks for helping me out! &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Jonas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52 Watchdog not resetting</title><link>https://devzone.nordicsemi.com/thread/173048?ContentTypeID=1</link><pubDate>Tue, 26 Feb 2019 13:35:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:635e6a53-ac5a-44ad-88d7-1c9c99c72c5d</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;There are a few issues with your code, but none that should prevent it from working. I have fixed the writes to the WDT registers and modified the code to match the normal nRF5 SDK like this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;int main(void)
{
    APP_ERROR_CHECK(NRF_LOG_INIT(NULL));
    NRF_LOG_DEFAULT_BACKENDS_INIT();
    NRF_LOG_INFO(&amp;quot;Temperature example started.&amp;quot;);

    static const uint16_t NRF_CLK_RATE = 32768; //32KHz
    NRF_WDT-&amp;gt;CONFIG = 0x00000009;
    NRF_WDT-&amp;gt;CRV = 2 * NRF_CLK_RATE;
    NRF_WDT-&amp;gt;RREN = 0x11111111;
    NRF_WDT-&amp;gt;TASKS_START = 1;

    while (1)
    {
        NRF_LOG_INFO(&amp;quot;looping&amp;quot;);
        nrf_delay_ms(1000);
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;This gives the expected log output:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;lt;info&amp;gt; app: Temperature example started.
&amp;lt;info&amp;gt; app: looping
&amp;lt;info&amp;gt; app: Temperature example started.
&amp;lt;info&amp;gt; app: looping
&amp;lt;info&amp;gt; app: looping
&amp;lt;info&amp;gt; app: Temperature example started.
&amp;lt;info&amp;gt; app: looping
&amp;lt;info&amp;gt; app: looping
&amp;lt;info&amp;gt; app: Temperature example started.
&amp;lt;info&amp;gt; app: looping
&amp;lt;info&amp;gt; app: looping
&amp;lt;info&amp;gt; app: Temperature example started.
&amp;lt;info&amp;gt; app: looping
&amp;lt;info&amp;gt; app: looping
&amp;lt;info&amp;gt; app: Temperature example started.
&amp;lt;info&amp;gt; app: looping
&amp;lt;info&amp;gt; app: looping
&amp;lt;info&amp;gt; app: Temperature example started.
&amp;lt;info&amp;gt; app: looping
&amp;lt;info&amp;gt; app: looping
&amp;lt;info&amp;gt; app: Temperature example started.
&amp;lt;info&amp;gt; app: looping
&amp;lt;info&amp;gt; app: looping
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Please also note that the SDK includes a &lt;a href="https://www.nordicsemi.com/DocLib/Content/SDK_Doc/nRF5_SDK/v15-2-0/nrf_dev_wdt_example"&gt;WDT example&lt;/a&gt; which uses the &lt;a href="https://www.nordicsemi.com/DocLib/Content/SDK_Doc/nRF5_SDK/v15-2-0/hardware_driver_wdt"&gt;WDT driver&lt;/a&gt;, providing a high-level API that is tested and verified by us (Nordic).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52 Watchdog not resetting</title><link>https://devzone.nordicsemi.com/thread/173029?ContentTypeID=1</link><pubDate>Tue, 26 Feb 2019 12:54:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8183fefd-f153-4672-8ce0-d003b2f141a1</guid><dc:creator>twihtronics</dc:creator><description>&lt;p&gt;That&amp;#39;s what I was thinking as well. WDT::Kick() didn&amp;#39;t seem like a normal functional plus :: told us it was c++.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52 Watchdog not resetting</title><link>https://devzone.nordicsemi.com/thread/172993?ContentTypeID=1</link><pubDate>Tue, 26 Feb 2019 11:40:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:20052845-574c-486e-9512-c1b0d54ab1bd</guid><dc:creator>jonas.woerner</dc:creator><description>&lt;p&gt;I just tested:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;int main()
{
  static const uint16_t NRF_CLK_RATE = 32768; //32KHz
  NRF_WDT-&amp;gt;CONFIG = 0x00001001;
  NRF_WDT-&amp;gt;CRV = 2 * NRF_CLK_RATE;
  NRF_WDT-&amp;gt;RREN = 0x111111111;
  NRF_WDT-&amp;gt;TASKS_START = 1;
  SEGGER_RTT_Init();
  SEGGER_RTT_WriteString(0, &amp;quot;startup\n&amp;quot;);

  while (1)
  {
    SEGGER_RTT_WriteString(0, &amp;quot;looping\n&amp;quot;);
    Thread::wait(1000);
  }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;It does not work.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52 Watchdog not resetting</title><link>https://devzone.nordicsemi.com/thread/172991?ContentTypeID=1</link><pubDate>Tue, 26 Feb 2019 11:35:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5628db10-6099-471c-8457-acacbe924b05</guid><dc:creator>jonas.woerner</dc:creator><description>&lt;p&gt;yeah, I just realized that, my bad. I think I got it somewhere from git, im not 100% sure where tho.&lt;/p&gt;
&lt;p&gt;however, I read the documentation ( &lt;a href="http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.nrf52832.ps.v1.1%2Fwdt.html"&gt;http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.nrf52832.ps.v1.1%2Fwdt.html&lt;/a&gt; ) and from what I can tell this code should work... all registers are set correctly. so whats the mistake?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52 Watchdog not resetting</title><link>https://devzone.nordicsemi.com/thread/172989?ContentTypeID=1</link><pubDate>Tue, 26 Feb 2019 11:24:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5a61ad1c-6652-45fb-976f-ee2d9516afac</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;This is not SDK code from Nordic (here is no WatchdogTimer.h file in the SDK).&amp;nbsp;Where does this come from?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52 Watchdog not resetting</title><link>https://devzone.nordicsemi.com/thread/172988?ContentTypeID=1</link><pubDate>Tue, 26 Feb 2019 11:21:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:61ef3aab-276a-4c2a-bfe9-1484c8c443bf</guid><dc:creator>jonas.woerner</dc:creator><description>&lt;p&gt;I just realized that my WatchdogTimer.h is for NRF51xx boards... here is the code:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;WatchdogTimer::WatchdogTimer(float seconds)
{
    //Configure watchdog timer
    //HALT_Pause: Pause watchdog when debugger stops chip
    //Sleep_Run: Continue running watchdog when chip sleeps
    NRF_WDT-&amp;gt;CONFIG = (WDT_CONFIG_HALT_Pause &amp;lt;&amp;lt; WDT_CONFIG_HALT_Pos) | ( WDT_CONFIG_SLEEP_Run &amp;lt;&amp;lt; WDT_CONFIG_SLEEP_Pos);
    
    //Set watchdog timeout (seconds * clock cycle)
    NRF_WDT-&amp;gt;CRV = seconds * (float)NRF_CLK_RATE;
    
    //Enable reload register 0
    NRF_WDT-&amp;gt;RREN = WDT_RREN_RR0_Enabled &amp;lt;&amp;lt; WDT_RREN_RR0_Pos;
    
    //Start the watchdog timer
    NRF_WDT-&amp;gt;TASKS_START = 1;
}

void WatchdogTimer::kick()
{
    //Reload register 0
    NRF_WDT-&amp;gt;RR[0] = WDT_RR_RR_Reload;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;now im wondering what I have to change so it would work with my NRF52.. but I will do some research&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52 Watchdog not resetting</title><link>https://devzone.nordicsemi.com/thread/172984?ContentTypeID=1</link><pubDate>Tue, 26 Feb 2019 10:46:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7136cbe3-3090-4f3e-a660-a4765e0f2729</guid><dc:creator>jonas.woerner</dc:creator><description>&lt;p&gt;yep, here I have the ultra minimal code, which still shows this strange behaviour.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#include &amp;quot;RTT/SEGGER_RTT.h&amp;quot;
#include &amp;quot;WatchdogTimer.h&amp;quot;
int main() {
SEGGER_RTT_Init();
SEGGER_RTT_WriteString(0,&amp;quot;startup\n&amp;quot;);
WatchdogTimer WDT(3);

  while(1) {
    SEGGER_RTT_WriteString(0,&amp;quot;looping\n&amp;quot;);
    Thread::wait(1000);
    while(1);
  }

}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;when used exactly like this the code resets after some time (I noticed its not the WDT timeout, but rather random when it resets...)&lt;/p&gt;
&lt;p&gt;if you remove the while(1); the code will print &amp;quot;looping&amp;quot; all the time without restarting.&lt;/p&gt;
&lt;p&gt;my guess is still that it has something to do with the bitfields file, because thats the only thing I modified. But I dont find this file anywhere... only versions that are different from mine.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52 Watchdog not resetting</title><link>https://devzone.nordicsemi.com/thread/172436?ContentTypeID=1</link><pubDate>Fri, 22 Feb 2019 08:15:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9fdb007f-2a78-499e-9c3b-bb3259c3c998</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The only way to prevent the watchdog from resetting is feeding it (or going to sleep if the WDT is configured to pause in that case - which is usually not a good idea). Can you upload the minimal code you are using to test this?&amp;nbsp;That way we can see if we spot something odd.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52 Watchdog not resetting</title><link>https://devzone.nordicsemi.com/thread/172346?ContentTypeID=1</link><pubDate>Thu, 21 Feb 2019 15:29:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a14ea68a-6826-4eb5-bca3-84f0ac28ca44</guid><dc:creator>twihtronics</dc:creator><description>&lt;p&gt;it probably does the same functionality. have you double checked your registers in debug mode to verify the setup is correct? I would assume it is since while(1); triggers a reset. Are you sure there is nothing else feeding the dog?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52 Watchdog not resetting</title><link>https://devzone.nordicsemi.com/thread/172331?ContentTypeID=1</link><pubDate>Thu, 21 Feb 2019 14:28:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:06f97849-e435-4cc9-9d1d-cec463746ec1</guid><dc:creator>jonas.woerner</dc:creator><description>&lt;p&gt;I didnt find an unmodified version of the bitfield.h, the only one I found had completly different defines in it..&lt;/p&gt;
&lt;p&gt;I am using SDK14 I think, so I guess thats not an option.. however, what does it do differently from the old WDT library?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52 Watchdog not resetting</title><link>https://devzone.nordicsemi.com/thread/172311?ContentTypeID=1</link><pubDate>Thu, 21 Feb 2019 13:37:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:77d16da9-73eb-45a7-a59e-1716962c0891</guid><dc:creator>twihtronics</dc:creator><description>&lt;p&gt;have you attempted to run a diff between your modified bitfield.h and the standard one? Not sure if this has anything to do with you issue but it is a start. Or may try using the watch dog driver assuming you are using sdk15.2 or above.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>