<?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>Serial bootloader watchdog and RTT print issue</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/49018/serial-bootloader-watchdog-and-rtt-print-issue</link><description>Hello, 
 i am currently developing on nRF52840 using SDK 15.2.0. I have an application and a bootloader. I use the GPREGRET register to boot to bootloader. 
 I have an issue where the WDT does not get reloaded if i do not have a debug printout in the</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 14 Aug 2019 11:20:03 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/49018/serial-bootloader-watchdog-and-rtt-print-issue" /><item><title>RE: Serial bootloader watchdog and RTT print issue</title><link>https://devzone.nordicsemi.com/thread/204043?ContentTypeID=1</link><pubDate>Wed, 14 Aug 2019 11:20:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:acfea3d8-a893-445c-9153-6356b6036f29</guid><dc:creator>tommik</dc:creator><description>&lt;p&gt;Hi Hung,&lt;/p&gt;
&lt;p&gt;unfortunately I do not have any time to debug this at the moment, i will return to you when i find the time.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Serial bootloader watchdog and RTT print issue</title><link>https://devzone.nordicsemi.com/thread/203291?ContentTypeID=1</link><pubDate>Fri, 09 Aug 2019 11:52:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:92cc0e39-862e-4f82-8264-ddb975ef59dc</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Tommik,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I have tried to reproduce the issue but couldn&amp;#39;t. Attached you can find the bootloader and the buttonless application. It works with just the WDT timer to feed the dog ( I commented out the&amp;nbsp;nrf_bootloader_wdt_feed() inside the loop_forever)&lt;/p&gt;
&lt;p&gt;If you comment out&amp;nbsp;&amp;nbsp;wdt_feed(); inside&amp;nbsp;wdt_feed_timer_handler() you can see that WDT will be triggered after 5 seconds (or 20 seconds if you use your setting). This shows that the timer is working normally. So maybe it needs something else to trigger the issue.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-5f789ec6263d4730ab9d705aff2c31aa/ble_5F00_app_5F00_buttonless_5F00_dfu-_2D00_-WDT.zip"&gt;devzone.nordicsemi.com/.../ble_5F00_app_5F00_buttonless_5F00_dfu-_2D00_-WDT.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-5f789ec6263d4730ab9d705aff2c31aa/pca10040_5F00_ble_5F00_debug-_2D00_-WDT_5F00_bootloader.zip"&gt;devzone.nordicsemi.com/.../pca10040_5F00_ble_5F00_debug-_2D00_-WDT_5F00_bootloader.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;If you can modify the projects I sent here to show the issue it would be greatly appreciated.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I removed the CRC check, you don&amp;#39;t need to generate bootloader setting to run the buttonless app. These&amp;nbsp;are based on SDK v15.2&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Serial bootloader watchdog and RTT print issue</title><link>https://devzone.nordicsemi.com/thread/203131?ContentTypeID=1</link><pubDate>Thu, 08 Aug 2019 14:43:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:05af92c2-8611-4dd7-86c2-0528c94ad7ec</guid><dc:creator>tommik</dc:creator><description>&lt;p&gt;The bootloader i am using is the unchanged UART bootloader SW from SDK 15.2.0, which I compile from source. sdk_config and main are from the&amp;nbsp;secure_bootloader\pca10056_uart_debug example.&lt;/p&gt;
&lt;p&gt;From what i understand, the issue is present with other people also, as in this ticket I linked earlier:&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/35570/entering-dfu-via-gpreget-secure-bootloader-serial-example-not-feeding-wdt-in-sdkv15/"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/35570/entering-dfu-via-gpreget-secure-bootloader-serial-example-not-feeding-wdt-in-sdkv15/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;From that ticket:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&amp;quot;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;NRF_BL_INACTIVITY_TIMEOUT_MS are working.&amp;nbsp;&amp;quot;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;This is the same exact issue I am witnessing. Others seem to circumvent the problem by implementing an own timer to replace the non-functioning timer.&lt;/p&gt;
&lt;p&gt;Steps to recreate:&lt;/p&gt;
&lt;p&gt;Use&amp;nbsp;nRF5_SDK_15.2.0_9412b96&amp;nbsp;example in examples\dfu\secure_bootloader\pca10056_uart_debug with the following values changed in the sdk_config:&lt;/p&gt;
&lt;p&gt;#define NRF_BL_DFU_ENTER_METHOD_BUTTON 0&lt;/p&gt;
&lt;p&gt;#define NRF_BL_DFU_ENTER_METHOD_BUTTONLESS 1&lt;/p&gt;
&lt;p&gt;#define NRF_BL_DFU_INACTIVITY_TIMEOUT_MS 180000&lt;/p&gt;
&lt;p&gt;#define NRFX_UARTE_DEFAULT_CONFIG_HWFC 1&lt;/p&gt;
&lt;p&gt;#define NRFX_UART_DEFAULT_CONFIG_HWFC 1&lt;/p&gt;
&lt;p&gt;#define NRF_LOG_BUFSIZE 1024&lt;/p&gt;
&lt;p&gt;Other values in sdk_config are as provided in the example.&lt;/p&gt;
&lt;p&gt;Use an application software with the following WDT setting:&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;nrf_drv_wdt_config_t config = {&lt;br /&gt; .behaviour = 1,&lt;br /&gt; .reload_value = 20000,&lt;br /&gt; .interrupt_priority = 6,&lt;br /&gt; };&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;/p&gt;
&lt;p&gt;Then start the application. Some time after the application has started, do the following functions:&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;err_code = sd_power_gpregret_clr(0, 0xffffffff);&lt;br /&gt; APP_ERROR_CHECK(err_code);&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;err_code = sd_power_gpregret_set(0, BOOTLOADER_DFU_START);&lt;br /&gt; APP_ERROR_CHECK(err_code);&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;NVIC_SystemReset();&lt;/p&gt;
&lt;p&gt;The bootloader boots into DFU mode. On my application the bootloader starts into DFU mode, and tries to start the dfu timers but they do not start, and a wdt reset happens shortly after. When commenting out the clock check, thus starting the LFCLK, all works fine.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Serial bootloader watchdog and RTT print issue</title><link>https://devzone.nordicsemi.com/thread/203124?ContentTypeID=1</link><pubDate>Thu, 08 Aug 2019 14:19:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fa5bdd7a-fa28-482c-9d15-a9dc7513932f</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Tommik,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This is very strange, especially the issue with&amp;nbsp;&lt;span&gt;nrf_clock_lf_is_running().&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Just for clarification, do you see the same issue on the stock bootloader example ? Could you let us know how to reproduce the issue here ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Serial bootloader watchdog and RTT print issue</title><link>https://devzone.nordicsemi.com/thread/203066?ContentTypeID=1</link><pubDate>Thu, 08 Aug 2019 12:34:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:09c6b73b-6ed4-40fa-bdca-edd52810ab13</guid><dc:creator>tommik</dc:creator><description>&lt;p&gt;I tried setting NRFX_WDT_CONFIG_BEHAVIOUR to Pause in SLEEP and HALT in the main app. I use it when configuring the WDT as the value for the behaviour member of the nrf_drv_wdt_config_t struct. Changing it provided no difference in the operation.&lt;/p&gt;
&lt;p&gt;The DFU timer did not work, because&amp;nbsp;nrf_clock_lf_is_running() called in nrf_bootloader_dfu_timers.h returns true even though the clock is not running. Removing the check, and thus calling nrf_clock_task_trigger(NRF_CLOCK_TASK_LFCLKSTART) on timer init made the&amp;nbsp;timers work for both the inactivity timer as well as for the&amp;nbsp;wdt feed timer, and now the bootloader finally works, as the periodic interrupts wake the processor periodically.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Serial bootloader watchdog and RTT print issue</title><link>https://devzone.nordicsemi.com/thread/203058?ContentTypeID=1</link><pubDate>Thu, 08 Aug 2019 12:17:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8e3b3b0e-1a3e-497f-99f5-00f782a579e2</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Tommik,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks for&amp;nbsp;updating.&lt;/p&gt;
&lt;p&gt;It depends on how you configure the WDT, there is an option that the WDT shouldn&amp;#39;t run when the CPU is in sleep mode. In that case you don&amp;#39;t need to periodically wake the CPU up to feed the dog. In other case, a timer is needed.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Serial bootloader watchdog and RTT print issue</title><link>https://devzone.nordicsemi.com/thread/202987?ContentTypeID=1</link><pubDate>Thu, 08 Aug 2019 08:54:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:66f0c025-da8b-493b-ad9e-1ce1a6101d8d</guid><dc:creator>tommik</dc:creator><description>&lt;p&gt;Ok, i think i got this. The WDT is fed in the &amp;quot;loop_forever&amp;quot;-function in the nrf_bootloader.c file. When there are no debug printouts, the wait_for_event() call puts the device to sleep, and there are no events -&amp;gt; the wdt is never fed. When there are debugs, the log is processed constantly, so wait_for_event() is never called and the processor does not sleep, meaning that the watchdog is fed periodically. The WDT feed timer does not work, as is the case with others. I had no success implementing my own timer function, i will try to make some event that wakes the processor periodically so that the WDT is fed.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Serial bootloader watchdog and RTT print issue</title><link>https://devzone.nordicsemi.com/thread/202771?ContentTypeID=1</link><pubDate>Wed, 07 Aug 2019 09:06:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2349568d-88c5-49be-bdcc-94adcd1ceb99</guid><dc:creator>tommik</dc:creator><description>&lt;p&gt;The bootloader is not modified save for the printout. I think i am experiencing the same issue as this:&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/35570/entering-dfu-via-gpreget-secure-bootloader-serial-example-not-feeding-wdt-in-sdkv15/"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/35570/entering-dfu-via-gpreget-secure-bootloader-serial-example-not-feeding-wdt-in-sdkv15/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;For some reason a trace print in the WDT feed also prevents the WDT reset.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I will test if making an own timer to feed the WDT fixes my issue, as it seems to have worked for others.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Serial bootloader watchdog and RTT print issue</title><link>https://devzone.nordicsemi.com/thread/195125?ContentTypeID=1</link><pubDate>Thu, 27 Jun 2019 11:55:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c55d8a23-44f1-4db8-bcd7-47d6ec7e3650</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Velho,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This is pretty strange.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could you try to test using our buttonless dfu example and the stock DFU bootloader and enable WDT to test ?&amp;nbsp;&lt;br /&gt;In our example we don&amp;#39;t print RTT log inside&amp;nbsp;wdt_feed().&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Do you modify have any modification to the bootloader ?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>