<?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>Watchdog : NRFX_WDT_CONFIG_BEHAVIOUR =&amp;gt; Run in SLEEP, Pause in HALT</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/49038/watchdog-nrfx_wdt_config_behaviour-run-in-sleep-pause-in-halt</link><description>Hello, 
 I&amp;#39;m using the watchdog and i&amp;#39;m feeding it in my main loop : 
 
 
 I tried with 
 #define NRFX_WDT_CONFIG_BEHAVIOUR 1 
 and 
 #define NRFX_WDT_CONFIG_BEHAVIOUR 0 
 But i&amp;#39;m still having a watchdog that is triggered and i don&amp;#39;t knwo why. If someone</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 27 Jun 2019 13:44:53 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/49038/watchdog-nrfx_wdt_config_behaviour-run-in-sleep-pause-in-halt" /><item><title>RE: Watchdog : NRFX_WDT_CONFIG_BEHAVIOUR =&gt; Run in SLEEP, Pause in HALT</title><link>https://devzone.nordicsemi.com/thread/195178?ContentTypeID=1</link><pubDate>Thu, 27 Jun 2019 13:44:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9b895bb4-08b1-48d0-84b9-5d562dc5cf0a</guid><dc:creator>Aurele</dc:creator><description>&lt;p&gt;ok, i will think about enabling the watchdog in sleep mode, especially since you are saying it is not very power consuming.&lt;/p&gt;
&lt;p&gt;Thank you very much again for the help ;)&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Aur&amp;eacute;lien&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Watchdog : NRFX_WDT_CONFIG_BEHAVIOUR =&gt; Run in SLEEP, Pause in HALT</title><link>https://devzone.nordicsemi.com/thread/195082?ContentTypeID=1</link><pubDate>Thu, 27 Jun 2019 10:32:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a66b1d54-b28a-4af1-946c-44b57923e0cb</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user="Aurel"]I want to stop the watchdog in sleep mode because of consumption constrain i have[/quote]
&lt;p&gt;Having the WDT running all the time adds very little to the current consumption (typically&amp;nbsp;&lt;span&gt;0.3&amp;nbsp;µA), so if you really need a WDT, then I recommend you at least consider whether it is a good idea to pause it while sleeping.&lt;/span&gt;&lt;/p&gt;
[quote user="Aurel"]o you agree the only purpose is to allow the user to debug wihtout being disturbed by the watchdog ?[/quote]
&lt;p&gt;Yes. But on the other hand, you could just build your firmware with the WDT disabled if you need to debug, so it is usually not needed.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Watchdog : NRFX_WDT_CONFIG_BEHAVIOUR =&gt; Run in SLEEP, Pause in HALT</title><link>https://devzone.nordicsemi.com/thread/195074?ContentTypeID=1</link><pubDate>Thu, 27 Jun 2019 09:37:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5abdafe7-7545-4c2c-8c80-e79c84b83a69</guid><dc:creator>Aurele</dc:creator><description>&lt;p&gt;My bad, i finally found out the issue. It was coming from my confusion between&amp;nbsp;WDT_CONFIG_BEHAVIOUR and&amp;nbsp;NRFX_WDT_CONFIG_BEHAVIOUR.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I&amp;#39;m sorry for the inconvenience, all is working fine, now i&amp;#39;m just setting all configuration flag that does not start with &amp;quot;NRFX_&amp;quot;&lt;/p&gt;
&lt;p&gt;By the way, one more question, i&amp;#39;m using the following behaviour :&amp;nbsp;WDT_CONFIG_BEHAVIOUR = 0&lt;/p&gt;
&lt;p&gt;(Pause in SLEEP and HALT ) I want to stop the watchdog in sleep mode because of consumption constrain i have, but for the HALT, do you agree the only purpose is to allow the user to debug wihtout being disturbed by the watchdog ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Watchdog : NRFX_WDT_CONFIG_BEHAVIOUR =&gt; Run in SLEEP, Pause in HALT</title><link>https://devzone.nordicsemi.com/thread/195061?ContentTypeID=1</link><pubDate>Thu, 27 Jun 2019 09:15:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:910a53bf-ec80-4b80-a96d-dd662a0359ec</guid><dc:creator>Aurele</dc:creator><description>&lt;p&gt;I agree with what you said but&amp;nbsp;even when i set&amp;nbsp;&lt;span&gt;WDT_CONFIG_BEHAVIOUR to 8 (watchdog stopped in sleep), it still triggers a wdt interrupt after a while.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Watchdog : NRFX_WDT_CONFIG_BEHAVIOUR =&gt; Run in SLEEP, Pause in HALT</title><link>https://devzone.nordicsemi.com/thread/195047?ContentTypeID=1</link><pubDate>Thu, 27 Jun 2019 08:31:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7326172e-c120-4d65-bf8b-3eb9f9546ac8</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;span&gt;Aurélien,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I see. Then it all makes sense:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;WDT_CONFIG_BEHAVIOUR is 1, so the WDT runs in sleep.&lt;/li&gt;
&lt;li&gt;You don&amp;#39;t call&amp;nbsp;power_manage() in debug mode, so&amp;nbsp;watchdog_feed() is called frequently.&lt;/li&gt;
&lt;li&gt;In release mode, you call&amp;nbsp;power_manage(), which makes the CPU sleep until there is an event/interrupt. If there are no interrupts before the WDT times out there is no new call to&amp;nbsp;watchdog_feed(), and the WDT resets the device as expected.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Watchdog : NRFX_WDT_CONFIG_BEHAVIOUR =&gt; Run in SLEEP, Pause in HALT</title><link>https://devzone.nordicsemi.com/thread/195026?ContentTypeID=1</link><pubDate>Thu, 27 Jun 2019 07:47:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:06a0d197-b69f-46aa-bda0-a39ad306b55e</guid><dc:creator>Aurele</dc:creator><description>&lt;p&gt;Hi Einar,&lt;/p&gt;
&lt;p&gt;Thank you very much for the help.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Here is the code of the watchdog :&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/* Private variables ---------------------------------------------------------*/

nrf_drv_wdt_channel_id m_channel_id;

/* Private functions ---------------------------------------------------------*/

/**
 * @brief WDT events handler.
 */
static void wdt_event_handler(void)
{
    //bsp_board_leds_off();
    NRF_LOG_INFO(&amp;quot;Watchdog ISR triggered&amp;quot;);

    //NOTE: The max amount of time we can spend in WDT interrupt is two cycles of 32768[Hz] clock - after that, reset occurs
}

uint32_t watchdog_init(void)
{
    uint32_t err_code = NRF_SUCCESS;

    //Configure WDT.
    nrf_drv_wdt_config_t config = NRF_DRV_WDT_DEAFULT_CONFIG;
    err_code = nrf_drv_wdt_init(&amp;amp;config, wdt_event_handler);
    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();

    return err_code;
}

void watchdog_feed(void) {
    nrf_drv_wdt_channel_feed(m_channel_id);
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;It is mainly inspired from the example in the SDK.&lt;/p&gt;
&lt;p&gt;Here is my sdk_config file :&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/5810.sdk_5F00_config.h"&gt;devzone.nordicsemi.com/.../5810.sdk_5F00_config.h&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I totally agree with your analysis. Actually, i was assuming that the SDK and softdevice was working fine and i only wanted to protect my application code from blocking that&amp;#39;s why i put the feeding function in the main loop.&lt;/p&gt;
&lt;p&gt;Then, i wanted to stop the watchdog in&amp;nbsp;sleep mode just because of power consumption constrain i have on my device but i didn&amp;#39;t evaluate the current consumption of the watchdog yet, and maybe it&amp;nbsp;is insignificant.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Finally,&amp;nbsp;i have understood why the issue occurs only in release. It is just because in debug i don&amp;#39;t call :&amp;nbsp;power_manage(); So the CPU never goes in sleep mode.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Aur&amp;eacute;lien&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Watchdog : NRFX_WDT_CONFIG_BEHAVIOUR =&gt; Run in SLEEP, Pause in HALT</title><link>https://devzone.nordicsemi.com/thread/194955?ContentTypeID=1</link><pubDate>Wed, 26 Jun 2019 18:39:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b85253cd-1dff-494e-9d98-e93ee25d4708</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The NRFX_WDT_CONFIG_BEHAVIOUR define is replaced by whatever you have set WDT_CONFIG_BEHAVIOUR, unless you have taken the effort to remove the legacy driver and apply_old_configs.h (which there is no reason to do). Therefore, you should make sure you set&amp;nbsp;&lt;span&gt;WDT_CONFIG_BEHAVIOUR to the configuration you want. If you want the WDT to pause when the CPU is sleeping you should use 0 or 8. I don&amp;#39;t understand why you see a difference with debug mode or not, though. Can you show your complete code, at least the implementation of your watchdog_init() and whatchdog_feed() functions, as well as your sdk_config.h?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Regarding feeding the watchdog at the right place or not, that depends entirely on what you want to do and how you use the watchdog. In my opinion, making the WDT pause when CPU is sleeping and just feeding it in the main loop is a bit useless, as there can be several cases where the WDT should have fired but does not with this configuration. (For instance, there is a problem with the wake-up interrupt, so the CPU sleeps forever and the WDT does not reset it. And always feeding the watchdog in the main loop means that the only thing the WDT would save you from is if the application is stuck in some state that prevents the main loop from running. Any other error would go undetected.)&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>