<?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>HardFault and watchdog?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/6159/hardfault-and-watchdog</link><description>We&amp;#39;ve got an application (not using SD or SDK functions) that locks up the nRF51822 and does not reset even though the watchdog is configured and confirmed to work in all situations we can create. I thought I&amp;#39;d found a clue here but in practice when I</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 24 Mar 2015 18:13:27 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/6159/hardfault-and-watchdog" /><item><title>RE: HardFault and watchdog?</title><link>https://devzone.nordicsemi.com/thread/21576?ContentTypeID=1</link><pubDate>Tue, 24 Mar 2015 18:13:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a798eebb-4e47-4be4-b5e6-91cb8e34c156</guid><dc:creator>pabigot</dc:creator><description>&lt;p&gt;Good; a watchdog that couldn&amp;#39;t recover from a hard fault seemed pretty useless.&lt;/p&gt;
&lt;p&gt;I generate a hard fault with:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;   *(uint32_t *)~0 = 4;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The ultimate cause of the failure I was diagnosing (not directly related to this question) appears to have been a race condition where TASKS_HFCLKSTOP was issued before TASKS_CAL completed, resulting in a situation where LFCLK went out of spec killing both the watchdog and the timer that normally woke the application.  This is theory only, consistent with the behavior described for PAN #14 (which doesn&amp;#39;t apply to the chips I was using), but the anomalous lock-ups went away when I refactored the request mediation.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HardFault and watchdog?</title><link>https://devzone.nordicsemi.com/thread/21575?ContentTypeID=1</link><pubDate>Tue, 24 Mar 2015 15:39:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f3e398a7-c2e6-4f83-b69d-17397586378c</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Thank you for you observation. I have tested this on my nRF51-DK board (third revision nRF51) as well and the watchdog works fine after a hardfault. It is also logical because the watchdog reset is a HW reset, so it is supposed to work at all time.&lt;/p&gt;
&lt;p&gt;The only thing I could think of is that you write to the NRF_WDT-&amp;gt;CONFIG register to set/clear the HALT bit but accidentally clear the SLEEP bit at the same time. If you clear it, the watchdog will halt while the CPU is asleep. But the question is are you asleep after entering hardfault handler? I can go to sleep after hardfault by implementing a hardfault handler in the application with&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;void HardFault_Handler(void)  { }
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and by going to sleep in the main loop&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;power_manage();
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;could that be the case in your application?&lt;/p&gt;
&lt;p&gt;How is the hardfault generated in your case?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>