<?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 while in sd_app_evt_wait</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/14607/watchdog-while-in-sd_app_evt_wait</link><description>Hi 
 I&amp;#39;ve discovered last week some unexpected resets by the watchdog. I guess I&amp;#39;ve the explanation and the workaround for the behavior, but it would be great to have this assumption confirmed. Maybe some other peoples have similar behaviors. 
 The</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 25 Aug 2016 03:30:04 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/14607/watchdog-while-in-sd_app_evt_wait" /><item><title>RE: Watchdog while in sd_app_evt_wait</title><link>https://devzone.nordicsemi.com/thread/55748?ContentTypeID=1</link><pubDate>Thu, 25 Aug 2016 03:30:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6eddd84f-c6cb-4206-9a4e-7916c3e222b4</guid><dc:creator>Quoc Khanh</dc:creator><description>&lt;p&gt;Thank you for your clear explanation.
I appreciate your help!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Watchdog while in sd_app_evt_wait</title><link>https://devzone.nordicsemi.com/thread/55747?ContentTypeID=1</link><pubDate>Thu, 25 Aug 2016 03:26:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c1f44889-d7d4-4e03-9771-bc537adba583</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;Yes it will pause until woken from sleep mode. So you are being woken from sleep mode, hence it&amp;#39;s counting very, very slowly because you&amp;#39;re being woken very, very occasionally, but you are being woken.&lt;/p&gt;
&lt;p&gt;So again, for the n&amp;#39;th time, feed the watchdog. When you are in your low power mode and sleeping for a long, long time with your watchdog timer disabled, any time you are woken up from __wfe(), feed the watchdog, that will prevent any occasional events which are occurring and causing the CPU to run even just a few microseconds, from causing the watchdog reset.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;__wfe()
if( in_deep_sleep_mode )
    feed_watchog()
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Watchdog while in sd_app_evt_wait</title><link>https://devzone.nordicsemi.com/thread/55746?ContentTypeID=1</link><pubDate>Thu, 25 Aug 2016 03:21:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:db8ce635-7a23-4233-9935-e8b5578aa909</guid><dc:creator>Quoc Khanh</dc:creator><description>&lt;p&gt;Actually I&amp;#39;m using:
__WFE();
__SEV();
__WFE();
in my code. And the WD is fed every 50ms using a timer when my system is on.&lt;/p&gt;
&lt;p&gt;In sleep mode, I turn off all the modules including the timer. Because I thought the WD will be paused in sleep mode when I config:&lt;/p&gt;
&lt;p&gt;NRF_WDT-&amp;gt;CONFIG = (WDT_CONFIG_HALT_Pause &amp;lt;&amp;lt; WDT_CONFIG_HALT_Pos) | (WDT_CONFIG_SLEEP_Pause  &amp;lt;&amp;lt; WDT_CONFIG_SLEEP_Pos);&lt;/p&gt;
&lt;p&gt;Is it true that the WD will pause until the system is woken up from Sleep mode? In my application, sometimes the system needs to sleep for a very long time (some days or even some weeks).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Watchdog while in sd_app_evt_wait</title><link>https://devzone.nordicsemi.com/thread/55745?ContentTypeID=1</link><pubDate>Thu, 25 Aug 2016 03:13:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4f1713d0-06c2-4bfc-9420-cb04f98c1ab6</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;and for your case you have a very simple solution also. When you&amp;#39;re in your very, very low-power mode, don&amp;#39;t use sd_app_evt_wait(), use __wfe(). sd_app_evt_wait() is only an optimised version of __wfe() anyway which filters out system events so you are only &amp;#39;woken&amp;#39; on user events. Since the events at that point are so rare, it really doesn&amp;#39;t matter, so use __wfe() and just feed the watchdog each time. Use sd_app_evt_wait() for the other places in your code where you are advertising or in connection and there will be lots of system events.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Watchdog while in sd_app_evt_wait</title><link>https://devzone.nordicsemi.com/thread/55744?ContentTypeID=1</link><pubDate>Thu, 25 Aug 2016 03:10:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9ff6df0e-5f18-4e54-9ef9-bef1eb8866c0</guid><dc:creator>Quoc Khanh</dc:creator><description>&lt;p&gt;Ah yes, you are right. I didn&amp;#39;t disable the softdevice. I will try, hope it works.
Thank you so much for spending time!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Watchdog while in sd_app_evt_wait</title><link>https://devzone.nordicsemi.com/thread/55743?ContentTypeID=1</link><pubDate>Thu, 25 Aug 2016 03:02:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:507f0f43-94e4-4e25-99e7-e84ba4b6bac0</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;well that wasn&amp;#39;t really his problem - because he wasn&amp;#39;t stopping advertising etc, he was in connection so it was guaranteed that there would be constant interrupts in the softdevice and the CPU would be coming out of sleep mode on a regular basis, he just wanted to confirm whether those expected short wakeups would increment the watchdog, which they do, without causing sd_app_evt_wait() to return, which they don&amp;#39;t.&lt;/p&gt;
&lt;p&gt;So you have found a similar thing, expect it takes much longer, which means the chip is only waking up very, very occasionally, and not, as in his case, all the time. So whatever you still do have left on, eg the softdevice enable, is causing the chip to do something and so the WDT counts.&lt;/p&gt;
&lt;p&gt;So the solution is to either turn off enough stuff that the chip never wakes at all, or feed the watchdog.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Watchdog while in sd_app_evt_wait</title><link>https://devzone.nordicsemi.com/thread/55742?ContentTypeID=1</link><pubDate>Thu, 25 Aug 2016 02:51:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b3c828d6-f89f-4b88-9702-b27a10daf912</guid><dc:creator>Quoc Khanh</dc:creator><description>&lt;p&gt;Thank you for your quick reply.
My trouble is: I use a WD and it is fed every 50ms when my system is working (advertising, reading data from a sensor via I2C port...) using a timer. The WD is set to pause in the Sleep mode. The function sd_app_evt_wait (or WFE()) is placed in the main loop so the system will be awoken up when there is some interrupt. When I would like to put my system into sleep mode to save energy, I disable all functions (advertising, reading sensors... and so on). It means sd_app_evt_wait() will put the chip into sleep mode. However, as I described above, after an amount of time, there is a reset and my system is awoken up. This amount of time is proportional to CRV values as in my test.&lt;/p&gt;
&lt;p&gt;Therefore, I think I have a same problem with Adrian Eggenberger that even when we put the system into sleep mode, sometimes the WD counter still increases. Until it reach the CRV value, WD will reset the chip.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Watchdog while in sd_app_evt_wait</title><link>https://devzone.nordicsemi.com/thread/55741?ContentTypeID=1</link><pubDate>Thu, 25 Aug 2016 02:33:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1965d8c0-549a-4c42-951f-957731013961</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;I&amp;#39;m afraid I don&amp;#39;t understand any part of your comment whatsoever. This question was about feeding the watchdog on a regular basis and whether sd_app_evt_wait() wakes up on a regular basis, which it doesn&amp;#39;t, hence you need a timer to feed the watchdog. You seem to be talking about something entirely different..&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Watchdog while in sd_app_evt_wait</title><link>https://devzone.nordicsemi.com/thread/55740?ContentTypeID=1</link><pubDate>Thu, 25 Aug 2016 02:29:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:11c39c6c-4895-43dc-a956-aa0a39e8d286</guid><dc:creator>Quoc Khanh</dc:creator><description>&lt;p&gt;I have the same problem. I set the WD CRV at: 120s, 3s, 1s and 2/3s. My system woke up after: more than 2days, 135min, 45min and 30min, respectively. It&amp;#39;s a big problem that we only can pause the WD.&lt;/p&gt;
&lt;p&gt;In my case, I stop all functions (including advertising) and clear all interrupts. BLE handling of the softdevice could be a reason. I&amp;#39;m not sure if there is some other automatic interrupts or not.&lt;/p&gt;
&lt;p&gt;I hope there will be a clear answer and solution for this situation.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Watchdog while in sd_app_evt_wait</title><link>https://devzone.nordicsemi.com/thread/55750?ContentTypeID=1</link><pubDate>Mon, 20 Jun 2016 09:24:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f0578d5e-aa45-4a16-a7af-70272e06461c</guid><dc:creator>Adrian Eggenberger</dc:creator><description>&lt;p&gt;Thanks for confirming this. I didn&amp;#39;t think about the advertising, but it makes sense that the same effect happens there as well.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Watchdog while in sd_app_evt_wait</title><link>https://devzone.nordicsemi.com/thread/55749?ContentTypeID=1</link><pubDate>Mon, 20 Jun 2016 09:22:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d7a5fea0-59ee-4d1e-9e26-01058c871df3</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;yes that&amp;#39;s right - and 5/80 sounds like about the right kind of duty cycle too, depends a bit what you&amp;#39;re doing, just advertising it would be much longer, in connection it&amp;#39;s working harder.&lt;/p&gt;
&lt;p&gt;And the correct solution is to have your own timer to feed the watchdog.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>