<?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>How to use the watchdog when DFU</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/16208/how-to-use-the-watchdog-when-dfu</link><description>Hi 
 I opened the Watchdog in the user application,and do nothing in the bootloader.Then when I use DFU,the CPU reset appears.How can I to deal with it? 
 And when I upgrade willful termination APP(nRF Toolbox),the CPU(nRF52832)is down,and can&amp;#39;t work</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 24 Jun 2020 12:15:13 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/16208/how-to-use-the-watchdog-when-dfu" /><item><title>RE: How to use the watchdog when DFU</title><link>https://devzone.nordicsemi.com/thread/256690?ContentTypeID=1</link><pubDate>Wed, 24 Jun 2020 12:15:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:155690f2-2c00-4edc-b80d-30888191e281</guid><dc:creator>Somesh Burkule</dc:creator><description>&lt;p&gt;yes I&amp;#39;ll check.&lt;/p&gt;
&lt;p&gt;today I have checked with different WDT reload values. It&amp;#39;s working fine with 15000 but not below than that.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use the watchdog when DFU</title><link>https://devzone.nordicsemi.com/thread/256653?ContentTypeID=1</link><pubDate>Wed, 24 Jun 2020 10:50:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:16b1df97-37fe-4b67-9b9e-d66bdf856f76</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;The bootloader should feed the WDT in an infinite loop, see&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/**@brief Continually sleep and process tasks whenever woken.
 */
static void loop_forever(void)
{
    while (true)
    {
        //feed the watchdog if enabled.
        nrf_bootloader_wdt_feed();

        app_sched_execute();

        if (!NRF_LOG_PROCESS())
        {
            wait_for_event();
        }
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;as well as start a timer that feeds the WDT periodically&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void nrf_bootloader_wdt_init(void)
{
    static bool initialized = false;

    if (initialized)
    {
        return;
    }

    if (nrf_wdt_started())
    {
        uint32_t wdt_ticks = nrf_wdt_reload_value_get();

        NRF_LOG_INFO(&amp;quot;WDT enabled CRV:%d ticks&amp;quot;, wdt_ticks);

        //wdt_ticks must be reduced to feed the watchdog before the timeout.
        uint32_t reduced_timeout_ticks = MAX((int32_t)wdt_ticks - MAX_FLASH_OP_TIME_TICKS,
                                             NRF_BOOTLOADER_MIN_TIMEOUT_TICKS);

        /* initial watchdog feed */
        wdt_feed();

        NRF_LOG_INFO(&amp;quot;Starting a timer (%d ticks) for feeding watchdog.&amp;quot;, reduced_timeout_ticks);
        nrf_bootloader_wdt_feed_timer_start(reduced_timeout_ticks, wdt_feed_timer_handler);

        NVIC_EnableIRQ(WDT_IRQn);
    }
    else
    {
        NRF_LOG_INFO(&amp;quot;WDT is not enabled&amp;quot;);
    }

    initialized = true;
}

static void wdt_feed_timer_handler(void)
{
    NRF_LOG_INFO(&amp;quot;Internal feed&amp;quot;);
    wdt_feed();
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Can you debug the bootloader when the WDT interval is set to 3seconds and check that you enter the&amp;nbsp;wdt_feed_timer_handler()?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use the watchdog when DFU</title><link>https://devzone.nordicsemi.com/thread/256607?ContentTypeID=1</link><pubDate>Wed, 24 Jun 2020 08:40:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:61376a61-ebbe-46cc-b939-6655e2cac3d0</guid><dc:creator>Somesh Burkule</dc:creator><description>&lt;p&gt;Ok. thanks.&lt;/p&gt;
&lt;p&gt;Actually I was getting an issue while dfu. when nrf set to boot mode it resets due to WDT and app started working normally as I have set WDT reload value to 3000.&lt;/p&gt;
&lt;p&gt;after I have changed it to 60000( 60 sec ), all works fine yeserday. I have set nrf to boot mode then completed dfu process and app updated.&lt;/p&gt;
&lt;p&gt;Can you please explain the reason?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use the watchdog when DFU</title><link>https://devzone.nordicsemi.com/thread/256582?ContentTypeID=1</link><pubDate>Wed, 24 Jun 2020 07:30:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:437688d1-e891-43d3-b93e-483cc41306d5</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;The Secure Bootloader in SDK v15.2.0 handles this automatically. It will check if the WDT is enabled, if yes, then the bootloader will feed the WDT periodically so that it does not time out.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;So you dont have to add any code that feeds the WDT in the bootloader as this is already included.&amp;nbsp;&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><item><title>RE: How to use the watchdog when DFU</title><link>https://devzone.nordicsemi.com/thread/256429?ContentTypeID=1</link><pubDate>Tue, 23 Jun 2020 12:01:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3737ecba-941b-4925-b3f4-28bc51c6b1b5</guid><dc:creator>Somesh Burkule</dc:creator><description>&lt;p&gt;Ok.&lt;/p&gt;
&lt;p&gt;I am confused where to feed watchdog? as you provided link there is some difference in file.&lt;/p&gt;
&lt;p&gt;can you please clear me?&lt;/p&gt;
&lt;p&gt;I&amp;#39;m using sdk15.2, softdevice 6.1.0, nrf52832 and secure bootloader.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use the watchdog when DFU</title><link>https://devzone.nordicsemi.com/thread/256317?ContentTypeID=1</link><pubDate>Tue, 23 Jun 2020 07:43:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bc030023-5a4f-4e6e-8289-6d6de0a68f04</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/members/somesh-burkule"&gt;Somesh Burkule&lt;/a&gt; The WDT cannot be disabled after it has been started. The WDT will run until it times out( which resets the nRF) or the nRF device is reset.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use the watchdog when DFU</title><link>https://devzone.nordicsemi.com/thread/256316?ContentTypeID=1</link><pubDate>Tue, 23 Jun 2020 07:40:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:da848e5b-4e1f-478c-8325-588a51c98144</guid><dc:creator>Somesh Burkule</dc:creator><description>&lt;p&gt;Hi &lt;a href="https://devzone.nordicsemi.com/members/bjorn_2d00_spockeli"&gt;bjorn-spockeli&lt;/a&gt;,&lt;/p&gt;
&lt;p&gt;I think one of the simplest solution is to disable WDT before entering to boot mode. then complete the dfu process and start WDT at the start of app code.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;is it?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use the watchdog when DFU</title><link>https://devzone.nordicsemi.com/thread/139985?ContentTypeID=1</link><pubDate>Fri, 13 Jul 2018 02:52:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5f2c0ca4-6f00-4f9e-9d36-a41be213a177</guid><dc:creator>lamdo</dc:creator><description>&lt;p&gt;Hi &lt;a href="https://devzone.nordicsemi.com/members/svenkbach"&gt;Sven&lt;/a&gt;, can I ask you implement 10second and 30 second watchdog at the same time or separately? if the same time, can you help how to implement that? Thank you&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use the watchdog when DFU</title><link>https://devzone.nordicsemi.com/thread/61895?ContentTypeID=1</link><pubDate>Fri, 08 Sep 2017 10:57:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4e548119-a0f7-49d0-a3b0-588c990e1480</guid><dc:creator>Jarmo</dc:creator><description>&lt;p&gt;Thanks for the hint! This is not an active thing for me just now, but maybe some day again I need to test this :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use the watchdog when DFU</title><link>https://devzone.nordicsemi.com/thread/61894?ContentTypeID=1</link><pubDate>Fri, 08 Sep 2017 08:40:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ca39eaf8-23b9-494a-bb6d-4f13c060701a</guid><dc:creator>Sven</dc:creator><description>&lt;p&gt;One thing you may consider what I have applied is the WDT settings in the nrf_drv_config.h
I use&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#define WDT_CONFIG_BEHAVIOUR     NRF_WDT_BEHAVIOUR_PAUSE_SLEEP_HALT
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Since bootloader with bluetooth most of the time waits for events, no timeout is occuring for the duration of the update process. Thus far I have implemented 10 second and 30 second timeouts for watchdog and both successfully have enabled to finish the dfu process. I am using nRF51 and legacy dfu.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use the watchdog when DFU</title><link>https://devzone.nordicsemi.com/thread/61893?ContentTypeID=1</link><pubDate>Fri, 13 Jan 2017 14:53:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:64ee29a2-bbc6-4c71-aea4-e5c56059b941</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Yes, I expect that calling &lt;code&gt;nrf_drv_wdt_channel_feed()&lt;/code&gt; without &lt;code&gt;calling nrf_drv_wdt_init()&lt;/code&gt; in the bootloader leads to undefined behaviour.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use the watchdog when DFU</title><link>https://devzone.nordicsemi.com/thread/61892?ContentTypeID=1</link><pubDate>Fri, 13 Jan 2017 13:50:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:01285bea-b048-42ac-9b64-704ee02b0dea</guid><dc:creator>Jarmo</dc:creator><description>&lt;p&gt;Ok, thanks for info! Earlier, I had an experience that the system crashed when I tried to feed watchdog without its initialization. At that time I used the software API and not directly hardware registers, so it might be that the function nrf_drv_wdt_channel_feed() caused the crash.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use the watchdog when DFU</title><link>https://devzone.nordicsemi.com/thread/61891?ContentTypeID=1</link><pubDate>Fri, 13 Jan 2017 13:29:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1049944d-d4de-4830-92e9-6a2f53252e23</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;The legacy bootloader from SDK 8 does not perform a reset when jumping from the application to the bootloader. Thus, if the WDT has been started in the application, then its not possible to stop or configure the WDT as the watchdog’s configuration registers, which comprises registers CRV, RREN, and CONFIG, will be blocked until the device has reset. It is possible to check whether the WDT is running or not by reading the RUNSTATUS register, but as I stated previously, you&amp;#39;re not able to pause it if the application started it before branching to the bootloader. You could just feed the WDT regardless of the WDT state(i.e. running or not running). If its not running then you will just write to the WDS reload register which will have no effect.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use the watchdog when DFU</title><link>https://devzone.nordicsemi.com/thread/61890?ContentTypeID=1</link><pubDate>Fri, 13 Jan 2017 08:54:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e9a7bb61-f57a-43af-82d7-90ae56947f28</guid><dc:creator>Jarmo</dc:creator><description>&lt;p&gt;I think the best way to solve the problem in hand would be to stop the watchdog in the bootloader, or set the timeout into infinite (what does mean &amp;quot;the registers are available for configuration again&amp;quot;?), if that is possible. But if not, then I need a solution that I asked above.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use the watchdog when DFU</title><link>https://devzone.nordicsemi.com/thread/61889?ContentTypeID=1</link><pubDate>Fri, 13 Jan 2017 08:48:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:04b4c4a3-018f-46e4-9c27-834b94a501d8</guid><dc:creator>Jarmo</dc:creator><description>&lt;p&gt;In this case it is nRF51 and SDK8, so no secure bootloader. So, what would be the best way with it? Since all our applications do not use watchdog, but all are using the same bootloader, I would need a safe way to bypass watchdog in the bootloader if it is not running. In other words, if an application has not started watchdog, bootloader should not use it, neither. How to achieve that? We definitely do not want to have two different versions of DFU-OTA bootloader.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use the watchdog when DFU</title><link>https://devzone.nordicsemi.com/thread/61888?ContentTypeID=1</link><pubDate>Fri, 13 Jan 2017 08:41:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:44f21cc4-4bb5-412d-bf57-38565eaadd42</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;@nikula (Jarmo): Are you using the nRF51 or nRF52? Are you using the legacy or the secure bootloader? How long is the WDT interval? If its the latter, then I would put it in the &lt;code&gt;nrf_dfu_req_handler_on_req()&lt;/code&gt; function in &lt;code&gt;dfu_req_handling.c&lt;/code&gt;, see &lt;a href="https://devzone.nordicsemi.com/question/103394/s130-dfu-ble-bootloader-no-timeout/"&gt;this&lt;/a&gt; answer.&lt;/p&gt;
&lt;p&gt;You should be able to configure the WDT after a reset according to the documentation, see &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/wdt.html?resultof=%22%77%61%74%63%68%64%6f%67%22%20"&gt;this&lt;/a&gt; link.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;When the device starts running again, after a reset, or waking up from OFF mode, the watchdog configuration registers will be available for configuration again.&lt;/em&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use the watchdog when DFU</title><link>https://devzone.nordicsemi.com/thread/61887?ContentTypeID=1</link><pubDate>Thu, 12 Jan 2017 15:04:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:28e00ce4-b828-4e87-8bac-f135b2b642cf</guid><dc:creator>Jarmo</dc:creator><description>&lt;p&gt;How to actually do that? Where is the loop I can put that watchdog feeding call in your bootloader_secure? If I remember right, there is an event loop, yes. But might it be that BT events are coming so rarely that the watchdog bites before the it is feeded next time?&lt;/p&gt;
&lt;p&gt;Furthermore, can I check in the bootloader somehow, if the watchdog is running or not?&lt;/p&gt;
&lt;p&gt;And in the first place, I don&amp;#39;t really understand why watchdog is not stopped when the system resets. There&amp;#39;s no any clever reason for that kind of design.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use the watchdog when DFU</title><link>https://devzone.nordicsemi.com/thread/61886?ContentTypeID=1</link><pubDate>Tue, 06 Sep 2016 07:39:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f8bb810a-ff59-4aca-a430-2b8003f9c80c</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;You&amp;#39;ll have to &amp;quot;feed&amp;quot; the watchdog in the bootloader, i.e. call&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;NRF_WDT-&amp;gt;RR[0] = 0x6E524635UL;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;in order to prevent the watchdog timer from timing out and resetting the chip.&lt;/p&gt;
&lt;p&gt;-Bjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>