<?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>Entering DFU via GPREGET, secure bootloader serial example not feeding WDT in SDKv15</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/35570/entering-dfu-via-gpreget-secure-bootloader-serial-example-not-feeding-wdt-in-sdkv15</link><description>Hello! 
 I have a custom nRF52832 board with an FTDI usb/serial part running my app successfully. 
 I generally program the board with a JLINK and SWD, but I am working to add DFU over usb/serial using the secure bootloader serial example. 
 I can set</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 22 Apr 2019 12:00:25 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/35570/entering-dfu-via-gpreget-secure-bootloader-serial-example-not-feeding-wdt-in-sdkv15" /><item><title>RE: Entering DFU via GPREGET, secure bootloader serial example not feeding WDT in SDKv15</title><link>https://devzone.nordicsemi.com/thread/182932?ContentTypeID=1</link><pubDate>Mon, 22 Apr 2019 12:00:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:037cf406-0d49-473f-b4e9-3662a7aa6b1e</guid><dc:creator>musk</dc:creator><description>&lt;p&gt;Does RTC timer need to be turned off?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Entering DFU via GPREGET, secure bootloader serial example not feeding WDT in SDKv15</title><link>https://devzone.nordicsemi.com/thread/182931?ContentTypeID=1</link><pubDate>Mon, 22 Apr 2019 11:57:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:db01fed2-d55f-4f53-8d21-620d7b627c0d</guid><dc:creator>musk</dc:creator><description>&lt;p&gt;Thank you very mach&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Entering DFU via GPREGET, secure bootloader serial example not feeding WDT in SDKv15</title><link>https://devzone.nordicsemi.com/thread/182930?ContentTypeID=1</link><pubDate>Mon, 22 Apr 2019 11:56:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:907b79bf-6d27-47cb-b64f-4ef65ec076b4</guid><dc:creator>Bruno Randolf</dc:creator><description>&lt;p&gt;The workaround is essentially described above. You trigger the watchdog from your main.c of the bootloader... in my case the code looks like this:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void feed_wdt(void)
{
	if (nrf_wdt_reload_request_is_enabled(NRF_WDT_RR0)) {
		nrf_wdt_reload_request_set(NRF_WDT_RR0);
	}
}

void wd_timer_handler(nrf_timer_event_t event_type, void* p_context)
{
	switch (event_type) {
		case NRF_TIMER_EVENT_COMPARE0:
			feed_wdt();
			break;
		default:
			break;
	}
}

static void timer_start()
{
	if (!nrf_wdt_started())
		return;

	NRF_LOG_INFO(&amp;quot;Workaround to feed WDT&amp;quot;);
	nrf_drv_timer_config_t timer_cfg = NRF_DRV_TIMER_DEFAULT_CONFIG;
	uint32_t err_code = nrf_drv_timer_init(&amp;amp;wd_timer, &amp;amp;timer_cfg,
					       wd_timer_handler);
	APP_ERROR_CHECK(err_code);
	nrf_drv_timer_extended_compare(&amp;amp;wd_timer, NRF_TIMER_CC_CHANNEL0,
				nrf_drv_timer_ms_to_ticks(&amp;amp;wd_timer, 2000),
				NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK, true);

	nrf_drv_timer_enable(&amp;amp;wd_timer);
}

/* This is called from nrf_bootloader_init() just before DFU starts */
ret_code_t nrf_dfu_init_user()
{
	timer_start();
	return NRF_SUCCESS;
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Entering DFU via GPREGET, secure bootloader serial example not feeding WDT in SDKv15</title><link>https://devzone.nordicsemi.com/thread/182928?ContentTypeID=1</link><pubDate>Mon, 22 Apr 2019 11:51:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c9f195ef-c584-44c9-a113-015ed51c3d4e</guid><dc:creator>musk</dc:creator><description>&lt;p&gt;&lt;span&gt;What should I do about it&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Entering DFU via GPREGET, secure bootloader serial example not feeding WDT in SDKv15</title><link>https://devzone.nordicsemi.com/thread/182927?ContentTypeID=1</link><pubDate>Mon, 22 Apr 2019 11:48:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f0380f91-34fb-4025-a4f4-214a18159343</guid><dc:creator>Bruno Randolf</dc:creator><description>&lt;p&gt;The same issue is present with SDK 15.3.0 and without -flto&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Entering DFU via GPREGET, secure bootloader serial example not feeding WDT in SDKv15</title><link>https://devzone.nordicsemi.com/thread/182803?ContentTypeID=1</link><pubDate>Fri, 19 Apr 2019 09:36:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:40b9f2aa-c8fb-4d44-9af9-e8c285a926ae</guid><dc:creator>musk</dc:creator><description>&lt;p&gt;&lt;span&gt;I have the same problem:but I can&amp;#39;t solve it,&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p class="src"&gt;Can you send file to my email?&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;email:739112417@qq.com.&lt;/li&gt;
&lt;li&gt;Thank you very much&lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Entering DFU via GPREGET, secure bootloader serial example not feeding WDT in SDKv15</title><link>https://devzone.nordicsemi.com/thread/172364?ContentTypeID=1</link><pubDate>Thu, 21 Feb 2019 16:58:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f3fa6e31-22b2-40d5-a23c-9e6910dade3a</guid><dc:creator>jeremysf</dc:creator><description>&lt;p&gt;Glad to hear you got it working!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Entering DFU via GPREGET, secure bootloader serial example not feeding WDT in SDKv15</title><link>https://devzone.nordicsemi.com/thread/172184?ContentTypeID=1</link><pubDate>Wed, 20 Feb 2019 20:05:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7219df53-6ff8-4ad3-ba96-d2977cf6a568</guid><dc:creator>Bruno Randolf</dc:creator><description>&lt;p&gt;Ok sorry my mistake... the workaround works, after setting NRFX_TIMER_DEFAULT_CONFIG_FREQUENCY right...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Entering DFU via GPREGET, secure bootloader serial example not feeding WDT in SDKv15</title><link>https://devzone.nordicsemi.com/thread/172178?ContentTypeID=1</link><pubDate>Wed, 20 Feb 2019 19:18:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fd0cdf19-750e-4e10-adc6-d7f8d7d81c86</guid><dc:creator>Bruno Randolf</dc:creator><description>&lt;p&gt;I have the same problem: Serial bootloader, and when the watchdog is enabled in my app the timers fail in the same way (it seems like all timers in the bootloader are never triggered) and the WDT is not fed. Unfortunately your workaround doesn&amp;#39;t work for me either...&lt;/p&gt;
&lt;p&gt;Did you use the SoftDevice or MBR?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Entering DFU via GPREGET, secure bootloader serial example not feeding WDT in SDKv15</title><link>https://devzone.nordicsemi.com/thread/137169?ContentTypeID=1</link><pubDate>Thu, 21 Jun 2018 17:19:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:40e27ec4-a8b4-4215-91ff-4c1779d40b24</guid><dc:creator>jeremysf</dc:creator><description>&lt;p&gt;Hmm, yeah, not sure what&amp;#39;s up. I will try out your&amp;nbsp;changed nrf_bootloader.c on my hardware, with my config, with my version of gcc, etc.&lt;br /&gt;&lt;br /&gt;For now, I&amp;#39;m happy with my solution to use&amp;nbsp;nrf_drv_timer in main.c, as&amp;nbsp;it co-exists side by side with the existing code in the&amp;nbsp;bootloader library (which fails to work for me), so if it ends up being a config issue, or compiler issue, or&amp;nbsp;bug in my custom hardware, it would be easy to remove.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Entering DFU via GPREGET, secure bootloader serial example not feeding WDT in SDKv15</title><link>https://devzone.nordicsemi.com/thread/137075?ContentTypeID=1</link><pubDate>Thu, 21 Jun 2018 11:34:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:978046b3-3006-4da5-93d9-dccb018c17c8</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Strange that app_timerv2 didn&amp;#39;t work for you.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Attached is the nrf_bootloader.c file I modified to start a WDT that timeout in 7 seconds and then change the&amp;nbsp;nrf_bootloader_dfu_inactivity_timer_restart() to blink an LED after 10 seconds, I didn&amp;#39;t see the WDT triggered any reset. ( I commented out the feeding in the main loop).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-7340f416da84470cbf14d6ecc7ee1cdf/nrf_5F00_bootloader.c"&gt;devzone.nordicsemi.com/.../nrf_5F00_bootloader.c&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Entering DFU via GPREGET, secure bootloader serial example not feeding WDT in SDKv15</title><link>https://devzone.nordicsemi.com/thread/137006?ContentTypeID=1</link><pubDate>Thu, 21 Jun 2018 07:26:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:00641a2a-1720-43f3-9690-0dd0cc1e54fb</guid><dc:creator>jeremysf</dc:creator><description>&lt;p&gt;So I have things working, but basically, as above, if I&amp;nbsp;have WDT enabled in my app, the app timers in the bootloader library component do not work at all for me (neither the timer to feed&amp;nbsp;the WDT nor the inactivity timeout).&lt;/p&gt;
&lt;p&gt;So instead, I am using the nrfx_timer library myself and handling the feeding of the WDT and resetting for inactivity&amp;nbsp;in the main.c of the secure bootloader.&lt;/p&gt;
&lt;p&gt;So&amp;nbsp;in my modified&amp;nbsp;main.c of the secure bootloader example, I have code like the following:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;...
#include &amp;quot;nrf_drv_timer.h&amp;quot;
#include &amp;quot;nrf_wdt.h&amp;quot;

const nrf_drv_timer_t ACTIVITY_TIMER = NRF_DRV_TIMER_INSTANCE(0);

#define COUNTDOWN_INIT 30

static int countdown = COUNTDOWN_INIT;

void feed_wdt() 
{
    if (nrf_wdt_started())
    {
        for (nrf_wdt_rr_register_t i = NRF_WDT_RR0; i &amp;lt; NRF_WDT_RR7; i++)
        {
            if (nrf_wdt_reload_request_is_enabled(i))
            {
                nrf_wdt_reload_request_set(i);
            }
        }
    }        
}

static void dfu_observer(nrf_dfu_evt_type_t evt_type)
{
    switch (evt_type)
    {
        case NRF_DFU_EVT_DFU_COMPLETED:
        case NRF_DFU_EVT_DFU_ABORTED:
            nrf_drv_timer_disable(&amp;amp;ACTIVITY_TIMER);
            break;
        case NRF_DFU_EVT_DFU_STARTED:
        case NRF_DFU_EVT_OBJECT_RECEIVED:
            countdown = COUNTDOWN_INIT;
            feed_wdt();
            break;
        default:
            break;
    }
}

void activity_timer_event_handler(nrf_timer_event_t event_type, void* p_context)
{
    switch (event_type)
    {
        case NRF_TIMER_EVENT_COMPARE0:
            countdown--;
            if( countdown &amp;lt; 0) {
                nrf_drv_timer_disable(&amp;amp;ACTIVITY_TIMER);
                NVIC_SystemReset();    
            } else {
                feed_wdt();
            }
            break;

        default:
            //Do nothing.
            break;
    }
}


int main(void) {
    nrf_drv_timer_config_t timer_cfg = NRF_DRV_TIMER_DEFAULT_CONFIG;
    uint32_t err_code = nrf_drv_timer_init(&amp;amp;ACTIVITY_TIMER, &amp;amp;timer_cfg, activity_timer_event_handler);
    APP_ERROR_CHECK(err_code);
    nrf_drv_timer_extended_compare(
         &amp;amp;ACTIVITY_TIMER, NRF_TIMER_CC_CHANNEL0, nrf_drv_timer_ms_to_ticks(&amp;amp;ACTIVITY_TIMER, 500), NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK, true);
    nrf_drv_timer_enable(&amp;amp;ACTIVITY_TIMER);

    // Protect MBR and bootloader code from being overwritten.
    uint32_t ret_val = nrf_bootloader_flash_protect(0, MBR_SIZE, false);
    APP_ERROR_CHECK(ret_val);
    ...
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Entering DFU via GPREGET, secure bootloader serial example not feeding WDT in SDKv15</title><link>https://devzone.nordicsemi.com/thread/136976?ContentTypeID=1</link><pubDate>Thu, 21 Jun 2018 02:12:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:65ca61ec-a63c-4bd0-b342-a2054683eb1f</guid><dc:creator>jeremysf</dc:creator><description>&lt;p&gt;A little bit more information: I&amp;nbsp;built the&amp;nbsp;debug version of the bootloader,&amp;nbsp;and configured it to log to SEGGER_RTT over SWD/JLINK.&lt;/p&gt;
&lt;p&gt;Here we can see that the nrf_bootloader_wdt detected that the WDT was enabled, and notice it says that it is starting a timer to feed the WDT and it sits idle at the log entry &amp;quot;&amp;lt;debug&amp;gt; app: Enter main loop&amp;quot;.&lt;/p&gt;
&lt;p&gt;However at 10s after entering the bootloader, it is rebooted, and we can see the log entry &amp;quot;&amp;lt;info&amp;gt; app: Inside main&amp;quot;. So the WDT is actually NOT being fed.&lt;/p&gt;
&lt;p&gt;I suspect that what is happening is that the event loop / app_scheduler is not working for some reason when the WDT is enabled, and&amp;nbsp;neither the app timer for feeding the WDT nor the app timer for&amp;nbsp;&lt;span&gt;NRF_BL_INACTIVITY_TIMEOUT_MS are working. The puzzling thing is this is only when the WDT is enabled.&amp;nbsp;Otherwise, things work.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;lt;info&amp;gt; app: Inside main
&amp;lt;debug&amp;gt; app: In nrf_bootloader_init
&amp;lt;debug&amp;gt; nrf_dfu_settings: Calling nrf_dfu_settings_init()...
&amp;lt;debug&amp;gt; nrf_dfu_flash: Initializing nrf_fstorage_nvmc backend.
&amp;lt;debug&amp;gt; app: Enter nrf_bootloader_fw_activate
&amp;lt;info&amp;gt; app: No firmware to activate.
&amp;lt;debug&amp;gt; app: Enter nrf_dfu_app_is_valid
&amp;lt;debug&amp;gt; app: Return true. App was valid
&amp;lt;debug&amp;gt; app: DFU mode requested via GPREGRET.
&amp;lt;info&amp;gt; nrf_bootloader_wdt: WDT enabled CRV:10240 ms
&amp;lt;info&amp;gt; nrf_bootloader_wdt: Starting a timer (7680 ms) for feeding watchdog.
&amp;lt;info&amp;gt; app_timer: RTC: initialized.
&amp;lt;debug&amp;gt; app: in weak nrf_dfu_init_user
&amp;lt;info&amp;gt; app: Entering DFU mode.
&amp;lt;debug&amp;gt; app: Initializing transports (found: 1)
&amp;lt;debug&amp;gt; nrf_dfu_serial_uart: serial_dfu_transport_init()
&amp;lt;debug&amp;gt; nrf_dfu_serial_uart: serial_dfu_transport_init() completed
&amp;lt;debug&amp;gt; nrf_dfu_flash: Initializing nrf_fstorage_nvmc backend.
&amp;lt;debug&amp;gt; app: Enter main loop
&amp;lt;info&amp;gt; app: Inside main
&amp;lt;debug&amp;gt; app: In nrf_bootloader_init
&amp;lt;debug&amp;gt; nrf_dfu_settings: Calling nrf_dfu_settings_init()...
&amp;lt;debug&amp;gt; nrf_dfu_flash: Initializing nrf_fstorage_nvmc backend.
&amp;lt;debug&amp;gt; app: Enter nrf_bootloader_fw_activate
&amp;lt;info&amp;gt; app: No firmware to activate.
&amp;lt;debug&amp;gt; app: Enter nrf_dfu_app_is_valid
&amp;lt;debug&amp;gt; app: Return true. App was valid
&amp;lt;warning&amp;gt; nrf_dfu_settings: No additional data erased
&amp;lt;debug&amp;gt; app: Running nrf_bootloader_app_start with address: 0x00001000
&amp;lt;debug&amp;gt; app: Disabling interrupts. NVIC-&amp;gt;ICER[0]: 0x0
&amp;lt;debug&amp;gt; app: running irq table set
&amp;lt;debug&amp;gt; app: After running irq table set
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Here is what the log looks like if I disable the WDT, and the&amp;nbsp;&lt;span&gt;NRF_BL_INACTIVITY_TIMEOUT_MS works:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;lt;info&amp;gt; app: Inside main
&amp;lt;debug&amp;gt; app: In nrf_bootloader_init
&amp;lt;debug&amp;gt; nrf_dfu_settings: Calling nrf_dfu_settings_init()...
&amp;lt;debug&amp;gt; nrf_dfu_flash: Initializing nrf_fstorage_nvmc backend.
&amp;lt;debug&amp;gt; app: Enter nrf_bootloader_fw_activate
&amp;lt;info&amp;gt; app: No firmware to activate.
&amp;lt;debug&amp;gt; app: Enter nrf_dfu_app_is_valid
&amp;lt;debug&amp;gt; app: Return true. App was valid
&amp;lt;debug&amp;gt; app: DFU mode requested via GPREGRET.
&amp;lt;info&amp;gt; nrf_bootloader_wdt: WDT is not enabled
&amp;lt;debug&amp;gt; app: scheduler init
&amp;lt;debug&amp;gt; app: in weak nrf_dfu_init_user
&amp;lt;info&amp;gt; app_timer: RTC: initialized.
&amp;lt;info&amp;gt; app: Entering DFU mode.
&amp;lt;debug&amp;gt; app: Initializing transports (found: 1)
&amp;lt;debug&amp;gt; nrf_dfu_serial_uart: serial_dfu_transport_init()
&amp;lt;debug&amp;gt; nrf_dfu_serial_uart: serial_dfu_transport_init() completed
&amp;lt;debug&amp;gt; nrf_dfu_flash: Initializing nrf_fstorage_nvmc backend.
&amp;lt;debug&amp;gt; app: Enter main loop
&amp;lt;debug&amp;gt; app: wait_for_event
&amp;lt;debug&amp;gt; app: wait_for_event
&amp;lt;info&amp;gt; app: Inactivity timeout.
&amp;lt;debug&amp;gt; app: Resetting bootloader.
&amp;lt;info&amp;gt; app: Inside main
&amp;lt;debug&amp;gt; app: In nrf_bootloader_init
&amp;lt;debug&amp;gt; nrf_dfu_settings: Calling nrf_dfu_settings_init()...
&amp;lt;debug&amp;gt; nrf_dfu_flash: Initializing nrf_fstorage_nvmc backend.
&amp;lt;debug&amp;gt; app: Enter nrf_bootloader_fw_activate
&amp;lt;info&amp;gt; app: No firmware to activate.
&amp;lt;debug&amp;gt; app: Enter nrf_dfu_app_is_valid
&amp;lt;debug&amp;gt; app: Return true. App was valid
&amp;lt;warning&amp;gt; nrf_dfu_settings: No additional data erased
&amp;lt;debug&amp;gt; app: Running nrf_bootloader_app_start with address: 0x00001000
&amp;lt;debug&amp;gt; app: Disabling interrupts. NVIC-&amp;gt;ICER[0]: 0x0
&amp;lt;debug&amp;gt; app: running irq table set
&amp;lt;debug&amp;gt; app: After running irq table set
&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Entering DFU via GPREGET, secure bootloader serial example not feeding WDT in SDKv15</title><link>https://devzone.nordicsemi.com/thread/136973?ContentTypeID=1</link><pubDate>Thu, 21 Jun 2018 01:49:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1853aca9-b170-483a-9ee8-378b66f1b108</guid><dc:creator>jeremysf</dc:creator><description>&lt;p&gt;Ok, I added the&amp;nbsp;following lines to the top of the secure bootloader main.c:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void wdt_event_handler(void) {
    NVIC_SystemReset();    
}

int main(void) {
    uint32_t err_code;
    nrf_drv_wdt_config_t config = {                                           \
        .behaviour          = (nrf_wdt_behaviour_t)1, \
        .reload_value       = 10000,                   \
        .interrupt_priority = 7,                   \
    };
    err_code = nrf_drv_wdt_init(&amp;amp;config, wdt_event_handler);
    APP_ERROR_CHECK(err_code);
    err_code = nrf_drv_wdt_channel_alloc(&amp;amp;m_channel_id);
    APP_ERROR_CHECK(err_code);
    nrf_drv_wdt_enable(); 

    // Protect MBR and bootloader code from being overwritten.
    uint32_t ret_val = nrf_bootloader_flash_protect(0, MBR_SIZE, false);
    APP_ERROR_CHECK(ret_val);
    ret_val = nrf_bootloader_flash_protect(BOOTLOADER_START_ADDR, BOOTLOADER_SIZE, false);
    APP_ERROR_CHECK(ret_val);
    ...&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I also enable the WDT in the config, added&amp;nbsp;nrfx_wdt.c to&amp;nbsp;the Makefile and had to comment out WDT_IRQHandler from nrf_bootloader_wdt.c which conflicts with the one in nrfx_wdt.c.&lt;/p&gt;
&lt;p&gt;For this test, I removed&amp;nbsp;all&amp;nbsp;WDT code&amp;nbsp;from my application.&lt;/p&gt;
&lt;p&gt;When I run&amp;nbsp;enter the bootloader, the WDT will fire after 10s and bring me back from the bootloader to my application (via a soft reset). In other words, the WDT is not being &amp;quot;fed&amp;quot; or reset. No matter what I set the&amp;nbsp;&lt;span&gt;NRF_BL_INACTIVITY_TIMEOUT_MS to, it does not fire (i.e. 5s, 2s, etc) when the WDT is enabled.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;If I remove this WDT code from the top of&amp;nbsp;the secure boot loader example&amp;#39;s main.c, then the&amp;nbsp;NRF_BL_INACTIVITY_TIMEOUT_MS works. I can set it to 5s, 2s (i.e. 5000ms or 2000ms) and it correctly brings me back from the bootloader to my application after the specified idle period.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;To be clear, I would expect with this added WDT code,&amp;nbsp;and the&amp;nbsp;NRF_BL_INACTIVITY_TIMEOUT_MS set to 5s, that after 5s of idle, it would reset back to my application. I would further expect if I set the WDT to 2s (i.e. 2000ms)&amp;nbsp;with the&amp;nbsp;NRF_BL_INACTIVITY_TIMEOUT_MS set to 10s, that nothing would happen at 2s (because the WDT should be being fed by the code in nrf_bootloader_wdt.c).&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thoughts?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Entering DFU via GPREGET, secure bootloader serial example not feeding WDT in SDKv15</title><link>https://devzone.nordicsemi.com/thread/136960?ContentTypeID=1</link><pubDate>Wed, 20 Jun 2018 17:19:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:41407a2a-4a3a-4f20-b9ad-1adb78682b83</guid><dc:creator>jeremysf</dc:creator><description>&lt;p&gt;Yes, I can confirm that I mean that I changed NRF_BL_INACTIVITY_TIMEOUT_MS to be 10s (ie 10000). &amp;nbsp;When I do enable the WDT in my app, I am able to see that inactivity timeout taking effect (and changes to it taking effect).&lt;/p&gt;
&lt;p&gt;Enabling the WDT in my app, I can feed it in my app, but I can&amp;rsquo;t get the boot loader to feed it, and it seems to cause the inactivity timer to no longer work.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I will try starting the WDT in the bootloader as a test as you suggest.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Entering DFU via GPREGET, secure bootloader serial example not feeding WDT in SDKv15</title><link>https://devzone.nordicsemi.com/thread/136912?ContentTypeID=1</link><pubDate>Wed, 20 Jun 2018 13:01:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7458168e-e805-4d4d-94b2-15fcd936fe0d</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Jeremy,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could you clarify the inactivity timeout is 10 seconds ? By default our inactivity timeout is 120 seconds:&amp;nbsp;NRF_BL_DFU_INACTIVITY_TIMEOUT_MS = 120000&lt;/p&gt;
&lt;p&gt;We do have a 10 second timeout but it&amp;#39;s the timeout after you update the softdevice and waiting for the application to be updated for example.&amp;nbsp;(NRF_BL_DFU_CONTINUATION_TIMEOUT_MS)&lt;/p&gt;
&lt;p&gt;Could you try to test by simply starting the WDT in the bootloader and see if there is any difference ?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>