<?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>DFU and Watchdog timer (WDT) reset</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/28106/dfu-and-watchdog-timer-wdt-reset</link><description>As many others have found, and answered questions here and here and in other posts, DFU will prematurely exit IF you have enabled WDT in your application, as the current Nordic SDK Buttonless DFU doesn&amp;#39;t consider the WDT. I hope that Nordic recognizes</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 02 Dec 2021 06:56:22 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/28106/dfu-and-watchdog-timer-wdt-reset" /><item><title>RE: DFU and Watchdog timer (WDT) reset</title><link>https://devzone.nordicsemi.com/thread/341617?ContentTypeID=1</link><pubDate>Thu, 02 Dec 2021 06:56:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:07909f47-b57f-4f14-8175-76b637d28970</guid><dc:creator>456789</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;a class="internal-link view-user-profile" href="https://devzone.nordicsemi.com/members/bjorn_2d00_spockeli"&gt;bjorn-spockeli&lt;/a&gt;,&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span&gt;Sdk17.0.1 also has this problem, do you have a solution?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU and Watchdog timer (WDT) reset</title><link>https://devzone.nordicsemi.com/thread/110852?ContentTypeID=1</link><pubDate>Wed, 13 Dec 2017 19:56:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6697f855-e2c9-40ab-ac0e-5024757752fd</guid><dc:creator>rct42</dc:creator><description>&lt;p&gt;@Neo, this is another way to do it. We initially thought about this but decided against it as it removes the ability for the WDT to get it out of an error state while in the DFU mode. However, when it comes to the BL+SD update, we don&amp;#39;t have a choice - if something goes wrong here it will brick the device. The solution I described minimizes the risks for us and has been working well in production (100 or so high value units).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU and Watchdog timer (WDT) reset</title><link>https://devzone.nordicsemi.com/thread/110853?ContentTypeID=1</link><pubDate>Wed, 13 Dec 2017 16:46:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3a5dfa57-99a0-41e5-bba3-96c3a511e374</guid><dc:creator>Neo</dc:creator><description>&lt;p&gt;If your APP has such a little timeout why don&amp;#39;t you just stop feeding WDT in APP until it resets the board  instead of doing soft reset?
After WDT timeout happens it disables WDT and you can reconfigure it in bootloader with longer timeout if needed. Or just keep it disabled.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU and Watchdog timer (WDT) reset</title><link>https://devzone.nordicsemi.com/thread/110851?ContentTypeID=1</link><pubDate>Thu, 26 Oct 2017 22:01:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:49c59a7e-7f2c-4af9-8859-9a8a86608884</guid><dc:creator>rct42</dc:creator><description>&lt;p&gt;I have also had troubles with the WDT and the DFU process. I’m currently migrating from SDK13 to SDK14, which involves updating the BL+SD then the APP (all via UART without HWFC at 9600 baud).&lt;/p&gt;
&lt;p&gt;Although I had already applied WDT reset modification to the wait_for_event() in the SDK13 bootloader programmed on the production units, I found that the WDT would still interfere with the bootloader during the BL+SD DFU. After the BL+SD image was transferred, the bootloader performs a soft reset and then runs nrf_dfu_mbr_copy_sd() (which ultimately runs sd_mbr_command()). This function appears to take between 600ms – 800ms (and possibly longer sometimes…). During this time, no app timer callbacks will be invoked as the app timer is actually polled / not interrupt driven. Thus the WDT reset will not be called in the wait_for_event().&lt;/p&gt;
&lt;p&gt;The solution to my problem involved increasing the WDT period to 4 seconds. I also do a further step of updating to a temporary SDK13 app which has the WDT disabled before doing the SDK14 update (BL+SD and then SDK14 app). Let me repeat:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Upload a temporary app which does not enable the WDT&lt;/li&gt;
&lt;li&gt;Increase WDT in production app to 4 seconds.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Note 1: I highly recommend that you do something similar when upgrading. If the WDT resets the bootloader during the nrf_dfu_mbr_copy_sd() function this will brick your device. The bootloader becomes corrupt and the only way to recover from this is to reflash the bootloader via a programmer. I’ve had to throw away some production units as they were sealed and could only be updated via the DFU.&lt;/p&gt;
&lt;p&gt;Note 2: I also initially added an app timer which calls a function to reset the WDT in the bootloader. However, it should stop resetting the WDT after 10 minutes or so (or 2x how long you expecting to stay in the bootloader). Otherwise, you’ll get into the situation where your WDT is not able to bring your bootloader out of an actual program corruption. When I found out that the app timer callbacks were actually being polled, I then changed the WDT callback to be invoked via an interrupt generated by TIMER1 with an interrupt priority of APP_IRQ_PRIORITY_HIGH. This still did not fix the problem and the WDT was still bricking the units during the BL+SD DFU! I suspect that sd_mbr_command() is an “atomic function” where global interrupts are disabled while it is in there for 600ms – 800ms. Although I’ve left this in my bootloader, I have not had any further issues after implementing my aforementioned solution.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU and Watchdog timer (WDT) reset</title><link>https://devzone.nordicsemi.com/thread/110854?ContentTypeID=1</link><pubDate>Wed, 25 Oct 2017 11:49:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b743cda6-e7e0-4014-928d-a8259712f147</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Hi Farhang,&lt;/p&gt;
&lt;p&gt;the use of the WDT is application specific and it is difficult to create a generic solution that fits all, e.g. the number of RR registers enabled and the WDT configuration ( Sleep or Halt). Hence, we have left it to the application developer to feed WDT in the bootloader.&lt;/p&gt;
&lt;p&gt;That said, I agree that we should at a minimum state in the bootloader documentation that if the WDT is enabled by the application, then it must be feed by the bootloader during the DFU process to avoid the device to reset prematurely. I think also we should point out where in the bootloader code it must be feed, e.g. add the following comment in &lt;code&gt;wait_for_event()&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;/* 
   WDT: If the Watchdog Timer has been enabled by the application, 
        then the it must be feed here 
*/ 
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Your solution looks good and I think that we can suggest it to other users that experience this issue.&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;
&lt;p&gt;Bjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>