<?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 Implementation Advice</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/39546/watchdog-implementation-advice</link><description>We are preparing an application to enter production and seeking to harden it to protect against unexpected system lockup. 
 The application is a datalogger peripheral based on nRF52840 and SDK 14.2 with BLE used to intermittently transfer data to a central</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 19 Oct 2018 08:58:51 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/39546/watchdog-implementation-advice" /><item><title>RE: Watchdog Implementation Advice</title><link>https://devzone.nordicsemi.com/thread/153590?ContentTypeID=1</link><pubDate>Fri, 19 Oct 2018 08:58:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2b4a09cf-b9ec-4c1b-b6cb-bbb02c8ec7a8</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Unfortunately, this bug was not fixed in SDK 15.2.0, so it need to be re-patched.&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t think it&amp;#39;s necessary to have WD coverage for all code paths. Maybe reload one register from the data logging event and another one from the main loop before entering sleep. This should ensure that the logging event is triggered periodically, and that it always returns to the main loop afterwards.&lt;/p&gt;
&lt;p&gt;You can use advertisement timeout to wake the application when advertising for extended periods of time. E.g. start advertisement with timeout set to 80 seconds, then on timeout, feed WDT and re-start advertising (remember to reload both RR registers in this event if data logging is not running in &amp;quot;adv. mode&amp;quot;).&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Watchdog Implementation Advice</title><link>https://devzone.nordicsemi.com/thread/153543?ContentTypeID=1</link><pubDate>Fri, 19 Oct 2018 01:03:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d21f6e47-d17e-41f3-85f6-d59fb2eb52e6</guid><dc:creator>jumpingfool</dc:creator><description>&lt;p&gt;Hi Vidar - thanks for your help.&lt;/p&gt;
&lt;p&gt;Noted on the recommendation to move to SDK 15.2 for the 52840. Can you confirm if the fix for the peer manager bug identified in SDK 14.2 as described in the below case has been rolled&amp;nbsp;into 15.2 or will we need to re-patch the newer SDK?&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/29926/bug-in-peer-manager-in-sdk-14-2"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/29926/bug-in-peer-manager-in-sdk-14-2&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Regarding proper implementation of the WDT,&amp;nbsp;&lt;span&gt;I understand the benefit of multiple RR registers when there is more than one predictable code path through the application, but our application spends the majority of its time sleeping to conserve power and waiting for external events to wake it up. Sleep periods may&amp;nbsp;happen for extended periods, e.g. when advertising. I&amp;nbsp;therefore don&amp;#39;t believe we can&amp;nbsp;use&amp;nbsp;RR registers directly to monitor&amp;nbsp;the system is working correctly, as&amp;nbsp;we can&amp;#39;t rely on events coming in to reset them.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;There are a great many event handlers that link the SDK to our application and&amp;nbsp;act as entry points to the codebase, none of which can be relied upon to be called regularly enough to reload an RR register.&lt;/p&gt;
&lt;p&gt;One potential approach would be to set a flag at the start and end of each event handler in our application code and then have a monitor task (running on a timer) to check&amp;nbsp;the flags and reset the RR register if all ok, but this seems like a complex solution. It also would not catch any issues occurring within the SDK code itself (like the peer manager bug discussed&amp;nbsp;above).&lt;/p&gt;
&lt;p&gt;Do you have a&amp;nbsp;recommended way to ensure coverage of all code paths in an event based system like Nordic have implemented in the SDK?&amp;nbsp;Is there a single place where such a&amp;nbsp;check can&amp;nbsp;be implemented&amp;nbsp;for all SDK/soft device generated events?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Watchdog Implementation Advice</title><link>https://devzone.nordicsemi.com/thread/153391?ContentTypeID=1</link><pubDate>Thu, 18 Oct 2018 08:12:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3cc6fb78-0740-4203-ad2c-d9edf14b9a92</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;em&gt;From this I understand we will need to make the following changes to the boot loader in order to use the watchdog with our application:&lt;/em&gt;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;em&gt;- Remove clock uninit from boot loader code&lt;/em&gt;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;em&gt;- Add a timer to the boot loader to kick the dog during DFU&lt;/em&gt;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;em&gt;Assuming this is correct I have the following additional questions:&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Yes, this is correct. It should not&amp;nbsp;be necessary to make any other changes. That said, I would strongly recommend you to port your existing code to SDK 15.2/s140 v6.1.0. The SDK14/s140v5 combination should not be used in production because of limited testing and verification for the 52840. The MBR shipped with s140 v5 does for instance not allow bootloader updates&amp;nbsp;which will&amp;nbsp;prevent&amp;nbsp;DFU of future softdevices (i.e., major updates with breaking API changes).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The WDT issues has been addressed in the SDK 15 bootloader.&amp;nbsp;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;em&gt;Are there any other corner cases we should be aware of for our application, such as the behaviour of the watchdog when the application is placed in system_off&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Only that the WDT will not run while the chip is in System OFF mode since all clock sources are powered down. WDT will start to run again once the device is woken up by a LPCOMP event.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;em&gt;What is the best way to check that the soft device tasks&amp;nbsp;are&amp;nbsp;still functioning correctly (i.e. advertising or maintaining BLE connection correctly) such that we can check for this before&amp;nbsp;feeding the dog in our&amp;nbsp;application code?&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The softdevice will notify the application if an unrecoverable error occurs (&lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s140.sds/dita/softdevices/s130/overview/error_handling.html?cp=2_3_2_0_3_1"&gt;SD error handling&lt;/a&gt;).&amp;nbsp;It should be safe to assume that the softdevice is functioning correctly as long as this doesn&amp;#39;t happen. You may&amp;nbsp;use the &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s140.sds/dita/softdevices/s130/radio_notif/radio_notification.html?cp=2_3_2_0_10"&gt;radio notification feature&lt;/a&gt;&amp;nbsp;if you want to verify that there are periodic radio events, but keep in mind that it may have a slight impact on current consumption as the application will be woken up on radio events that would otherwise have been running in the &amp;quot;background&amp;quot;.&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;em&gt;Are there any other recommendations in addition to enabling the watchdog for hardening our application for production&amp;nbsp;(e.g. relating to power management, etc).&amp;nbsp;&lt;/em&gt;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;em&gt;This is our first time taking a buttonless&amp;nbsp;embedded system into production&amp;nbsp;so if there are any resources/whitepapers (from Nordic or elsewhere) that would help guide us on things&amp;nbsp;we should&amp;nbsp;consider&amp;nbsp;they would be welcomed!&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Not that I can think of, the WDT should be very effective in preventing the FW app from becoming stuck as long as it is&amp;nbsp;properly&amp;nbsp;implemented.&amp;nbsp;You&amp;nbsp;may consider to use more than one RR register and reload them in separate parts of the code to ensure that the program flow is correct. E.g, program can potentially get stuck in a error handler,etc while WDT is still being reloaded&amp;nbsp;by a higher priority interrupt event.&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>