<?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 and sd_app_evt_wait()</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/33134/watchdog-and-sd_app_evt_wait</link><description>Hi, I have an issue with the watchdog and sd_app_evt_wait() when running the softdevice. It seems impossible to not let the watchdog go off while having an idle ble connection! When the timeout is set to 1s and the connection interval at 7.5ms (min),</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 02 May 2018 13:03:13 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/33134/watchdog-and-sd_app_evt_wait" /><item><title>RE: Watchdog and sd_app_evt_wait()</title><link>https://devzone.nordicsemi.com/thread/130563?ContentTypeID=1</link><pubDate>Wed, 02 May 2018 13:03:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1e4ea879-9db8-49d8-aaa3-34b254cc2ea3</guid><dc:creator>run_ar</dc:creator><description>&lt;p&gt;Unfortunately, there is no formula to calculate this. I guess you could also enable radio notifications to wakeup the application whenever there is a radio event if you do not want to use a timer.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Watchdog and sd_app_evt_wait()</title><link>https://devzone.nordicsemi.com/thread/130131?ContentTypeID=1</link><pubDate>Fri, 27 Apr 2018 13:46:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4bcdbfa0-c926-4be7-af8b-df3b3ac827e3</guid><dc:creator>Marten</dc:creator><description>&lt;p&gt;Thanks,&lt;br /&gt;&lt;br /&gt;This is indeed what I figured out myself, but was not very sure because it is not documented.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;Is there somewhere a formula what I can use to know what this timeout must be ?&lt;br /&gt;Eg 1s watchdog, connection interval 7.5ms, watchdog goes off after 45s when idle (which is in fact not a very long time).&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Marten&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Watchdog and sd_app_evt_wait()</title><link>https://devzone.nordicsemi.com/thread/130128?ContentTypeID=1</link><pubDate>Fri, 27 Apr 2018 13:34:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7597c566-c568-442c-9431-32dbe49a1060</guid><dc:creator>run_ar</dc:creator><description>&lt;p&gt;So the SD will run in the background without notifying the application while advertising or in a connection with only empty packets. This means the wdt timer will run even if the application does not wake up. So, Yes, if your application does nothing for a very long time while the sd is running, you need to have a timer to wake it up in order to feed the wdt.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Watchdog and sd_app_evt_wait()</title><link>https://devzone.nordicsemi.com/thread/127365?ContentTypeID=1</link><pubDate>Mon, 09 Apr 2018 09:00:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aea3b827-1c66-4126-9913-5c917f0c9287</guid><dc:creator>Marten</dc:creator><description>&lt;p&gt;Sorry, but nRF52 has a feature to pause the watchdog while in sleep and/or when halted by the debugger! So not only in system off the watdog doesn&amp;#39;t run.&lt;/p&gt;
&lt;p&gt;I do know how to handle interrupts and design an embedded product, this is out of the scope of this issue.&lt;/p&gt;
&lt;p&gt;I am 100% sure I am returning from ProcessEvents in time, it is sd_app_evt_wait() which is not returning because there is no need for. As said, I just added the watchdog in the blinky app which is doing nothing&lt;/p&gt;
&lt;p&gt;Could someone please explain how to add the watchdog in eg the ble_app_blinky peripheral example and using sd_app_evt_wait()? I think it is impossible to do this without having a timer that feeds the watchdog in time (every 40s).&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Marten&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Watchdog and sd_app_evt_wait()</title><link>https://devzone.nordicsemi.com/thread/127259?ContentTypeID=1</link><pubDate>Fri, 06 Apr 2018 15:49:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ee23e8f4-61c5-4bd5-9932-13e99b285699</guid><dc:creator>AmbystomaLabs</dc:creator><description>&lt;p&gt;It will return from sd_app_evt_wait for any reason at all.&amp;nbsp; So, even the radio strobing the receiver on an off will wake it up. I doubt the reason for the WDT timeout is due to it not waking up.&amp;nbsp; More likely it&amp;#39;s not returning from ProcessEvents. You should do wdt refresh somewhere or multiple places inside ProcessEvents since you feel that is your core process.&lt;/p&gt;
&lt;p&gt;Also, I wouldn&amp;#39;t recommend handling the comms like this.&amp;nbsp; Normally one would have an ISR or a system event drive something as important as communications and not handle it in main.&amp;nbsp; Generally people do low level housekeeping activities or even nothing at all in main.&lt;/p&gt;
&lt;p&gt;Your comment about pausing the WDT while asleep is also a really bad idea.&amp;nbsp; Again the point of the WDT is to catch the device not waking up.&amp;nbsp; When a BLE device is idle it is still sending out advertisements or listening.&amp;nbsp; Either of these wakes it up periodically and thus will cause the WDT to refresh. &lt;/p&gt;
&lt;p&gt;The only time the WDT won&amp;#39;t run (and this is automatic) is during system off. A return from system off is always a reset by definition. The only thing fun you can do with system off is to keep ram alive and try to pick up where you left off.&amp;nbsp; Though simpler just to let it do a reset.&amp;nbsp; Uses less power too if ram is off.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Watchdog and sd_app_evt_wait()</title><link>https://devzone.nordicsemi.com/thread/127256?ContentTypeID=1</link><pubDate>Fri, 06 Apr 2018 15:15:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b7b489fe-af23-46e5-9c04-5b80726ab84c</guid><dc:creator>Marten</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Thanks for the answer.&lt;/p&gt;
&lt;p&gt;See below the simple while(1). The goal of the watchdog is to make sure that all the code called from ProcessEvents() does not take longer than the watchdog timeout (eg 1s)&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;while(1)
{
    ProcessEvents();
    nrf_drv_wdt_feed();
    sd_app_evt_wait();
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The issue that I have is that when a user connects with my peripheral device and then just does nothing and waits for 45 seconds, the watchdog resets the system, which is of course not desired. It should be possible to have an idle connection without sending real data over. Thee watchdog should reset the system when my ProcessEvents() function takes too long.&lt;/p&gt;
&lt;p&gt;This just because I cannot feed the watchdog, because softdevice does not return from sd_app_evt_wait().&lt;/p&gt;
&lt;p&gt;I pause the watchdog while in sleep and halt mode, but apparantly not when softdevice is just sending empty packets.&lt;/p&gt;
&lt;p&gt;I hope this clarifies the issue.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Marten&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Watchdog and sd_app_evt_wait()</title><link>https://devzone.nordicsemi.com/thread/127244?ContentTypeID=1</link><pubDate>Fri, 06 Apr 2018 14:22:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6c97f6e1-8ac0-4cb3-a933-00dda1e73a2b</guid><dc:creator>AmbystomaLabs</dc:creator><description>&lt;p&gt;I&amp;#39;m really not sure what you are asking.&lt;/p&gt;
&lt;p&gt;It seems you want to stop the watchdog once in a while since you are not refreshing it timely.&amp;nbsp; This would not be consistent with the point of a watchdog which is to go off no matter how screwed up the code was.&lt;/p&gt;
&lt;p&gt;If it is going off during normal operations then you just haven&amp;#39;t chosen your refresh strategy properly.&amp;nbsp; You need to find a place in the code that it should always be hitting unless something terrible is wrong.&amp;nbsp; You can even refresh in multiple places in the code if your device has different operating modes. The wdt doesn&amp;#39;t care how often it is refreshed nor where it is refreshed from as long as it happens before time runs out.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>