<?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>How to enable watchdog</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/27411/how-to-enable-watchdog</link><description>Hi,
I&amp;#39;m a beginner in programming Nordic uC and I would like to know how to enable the watchdog in my application. Are there particular functions to call?
Thanks!</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 23 Nov 2017 12:15:37 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/27411/how-to-enable-watchdog" /><item><title>RE: How to enable watchdog</title><link>https://devzone.nordicsemi.com/thread/108260?ContentTypeID=1</link><pubDate>Thu, 23 Nov 2017 12:15:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:efe30e16-041b-4f5f-8aa0-35114e802000</guid><dc:creator>max</dc:creator><description>&lt;p&gt;feed can be placed in the main loop
WDT_CONFIG_RELOAD_VALUE is a time in milliseconds before the WD is accrues. every feed you reload the timer aggain&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to enable watchdog</title><link>https://devzone.nordicsemi.com/thread/108259?ContentTypeID=1</link><pubDate>Thu, 23 Nov 2017 11:32:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d2e8021d-09da-43d2-bba1-057acc901663</guid><dc:creator>Francesca</dc:creator><description>&lt;p&gt;Hi, thanks for your answer! I&amp;#39;m not sure what nrf_drv_wdt_channel_feed(m_channel_id); is useful for and where to place it (maybe in the for(;;)?). Moreover what&amp;#39;s the meaning of WDT_CONFIG_RELOAD_VALUE? Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to enable watchdog</title><link>https://devzone.nordicsemi.com/thread/108257?ContentTypeID=1</link><pubDate>Mon, 20 Nov 2017 13:12:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3ad86997-8a6b-4b81-9afc-1892ba2716e8</guid><dc:creator>AmbystomaLabs</dc:creator><description>&lt;p&gt;Also since it is not a protected service you can write directly to the registers if you want:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;void wdt_init(void)
{
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);
NRF_WDT-&amp;gt;CRV = 150*32768; // 150 sec. timout
NRF_WDT-&amp;gt;RREN |= WDT_RREN_RR0_Msk; //Enable reload register 0
NRF_WDT-&amp;gt;TASKS_START = 1;
}

//And this bit refreshes the WDT.  Just put it where ever you think is appropriate. 
NRF_WDT-&amp;gt;RR[0] = WDT_RR_RR_Reload; //Reload watchdog register 0
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to enable watchdog</title><link>https://devzone.nordicsemi.com/thread/108258?ContentTypeID=1</link><pubDate>Mon, 20 Nov 2017 12:40:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6e207cc1-a9a4-40ac-8677-84a3e03828ef</guid><dc:creator>max</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;This is how i do it&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Init&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;static void System_task_initWatchdog(void)
{
  nrf_drv_wdt_config_t config = NRF_DRV_WDT_DEAFULT_CONFIG;
  uint32_t err_code = nrf_drv_wdt_init(&amp;amp;config,WatchdogHadler);
  APP_ERROR_CHECK(err_code);
  err_code = nrf_drv_wdt_channel_alloc(&amp;amp;m_channel_id);
  APP_ERROR_CHECK(err_code);
  nrf_drv_wdt_enable();
  
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Feed&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;nrf_drv_wdt_channel_feed(m_channel_id);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;sdk_config.h&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#ifndef WDT_ENABLED
#if WDOG
#define WDT_ENABLED 1
#else
#define WDT_ENABLED 0
#endif
#endif
#if  WDT_ENABLED
// &amp;lt;o&amp;gt; WDT_CONFIG_BEHAVIOUR  - WDT behavior in CPU SLEEP or HALT mode

// &amp;lt;1=&amp;gt; Run in SLEEP, Pause in HALT 
// &amp;lt;8=&amp;gt; Pause in SLEEP, Run in HALT 
// &amp;lt;9=&amp;gt; Run in SLEEP and HALT 
// &amp;lt;0=&amp;gt; Pause in SLEEP and HALT 

#ifndef WDT_CONFIG_BEHAVIOUR
#define WDT_CONFIG_BEHAVIOUR 0
#endif

// &amp;lt;o&amp;gt; WDT_CONFIG_RELOAD_VALUE - Reload value  &amp;lt;15-4294967295&amp;gt; 


#ifndef WDT_CONFIG_RELOAD_VALUE
#define WDT_CONFIG_RELOAD_VALUE 20000
#endif

// &amp;lt;o&amp;gt; WDT_CONFIG_IRQ_PRIORITY  - Interrupt priority


// &amp;lt;i&amp;gt; Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice
// &amp;lt;0=&amp;gt; 0 (highest) 
// &amp;lt;1=&amp;gt; 1 
// &amp;lt;2=&amp;gt; 2 
// &amp;lt;3=&amp;gt; 3 
// &amp;lt;4=&amp;gt; 4 
// &amp;lt;5=&amp;gt; 5 
// &amp;lt;6=&amp;gt; 6 
// &amp;lt;7=&amp;gt; 7 

#ifndef WDT_CONFIG_IRQ_PRIORITY
#define WDT_CONFIG_IRQ_PRIORITY 7
#endif
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>