<?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>MCUboot timeout during DFU</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/70341/mcuboot-timeout-during-dfu</link><description>Greetings, 
 We have a PCB with nrf52 and nrf91 on it. 
 We have nrf9160 firmware with MCUBoot. The chip boots into mcuboot dfu mode when a certain pin is set to high during boot ( CONFIG_BOOT_SERIAL_DETECT_PIN=21 in mcuboot.conf ). With this, we were</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 17 Mar 2025 05:32:58 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/70341/mcuboot-timeout-during-dfu" /><item><title>RE: MCUboot timeout during DFU</title><link>https://devzone.nordicsemi.com/thread/527503?ContentTypeID=1</link><pubDate>Mon, 17 Mar 2025 05:32:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fb404e00-01fa-4b0f-b3f3-632bcd168d09</guid><dc:creator>DX_HK</dc:creator><description>&lt;p&gt;Hello, I also need a timeout escape from DFU.&lt;br /&gt;The nRF52 is a device that is not normally connected via USB, and is only connected via USB when updating the firmware.&lt;br /&gt;If DFU is not started due to several reasons, there is a need to automatically return to the application.&lt;/p&gt;
&lt;p&gt;It has been four years since this Q&amp;amp;A was posted, but is the timeout escape function implemented in the current NCS?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUboot timeout during DFU</title><link>https://devzone.nordicsemi.com/thread/298924?ContentTypeID=1</link><pubDate>Wed, 10 Mar 2021 09:03:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9f735a3f-8f77-4956-8cb3-bc4fe9a2607d</guid><dc:creator>Tjaz</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;thanks for the provided information.&lt;/p&gt;
&lt;p&gt;For anyone else wondering, we ended up writing our own patch that looks like this:&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;diff --git a/boot/boot_serial/src/boot_serial.c b/boot/boot_serial/src/boot_serial.c
index 9f9cd15..c7a45b9 100644
--- a/boot/boot_serial/src/boot_serial.c
+++ b/boot/boot_serial/src/boot_serial.c
@@ -591,7 +591,15 @@ boot_serial_start(const struct boot_uart_funcs *f)
     max_input = sizeof(in_buf);
 
     off = 0;
+    uint64_t start = k_uptime_get();
+    const uint64_t TIMEOUT = (60 * 60 * 1000); // 60 min
     while (1) {
+        // timeout
+        if(k_uptime_get() - start &amp;gt; TIMEOUT)
+        {
+            break;
+        }
+
         rc = f-&amp;gt;read(in_buf + off, sizeof(in_buf) - off, &amp;amp;full_line);
         if (rc &amp;lt;= 0 &amp;amp;&amp;amp; !full_line) {
             continue;
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;This adds a 1 hour timeout to the DFU procedure.&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Tjaž&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUboot timeout during DFU</title><link>https://devzone.nordicsemi.com/thread/291028?ContentTypeID=1</link><pubDate>Mon, 25 Jan 2021 12:50:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f1437605-e279-4e90-9b04-b6e4a8959ffb</guid><dc:creator>Heidi</dc:creator><description>&lt;p&gt;Hi!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;We don&amp;#39;t have a timeout implemented in MCUboot.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;But if you want to implement it yourself, it looks like mynewt has something in their MCUboot, so you could use this for inspiration when modifying the source code.&lt;/p&gt;
&lt;p&gt;See&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-mcuboot/blob/master/boot/mynewt/src/main.c"&gt;ncs/bootloader/mcuboot/boot/mynewt/src/main.c&lt;/a&gt;&amp;nbsp;more specifically &lt;a href="https://github.com/nrfconnect/sdk-mcuboot/blob/master/boot/mynewt/src/main.c#L113-L116"&gt;lines 113-116&lt;/a&gt; and&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-mcuboot/blob/master/boot/mynewt/src/main.c#L145-L149"&gt;lines 145-149&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/* Calculate the timeout duration in OS cputime ticks. */
static const uint32_t timeout_dur =
    MYNEWT_VAL(BOOT_SERIAL_DETECT_TIMEOUT) /
    (1000.0 / MYNEWT_VAL(OS_CPUTIME_FREQ));

/* Abort the listen on timeout. */
if (os_cputime_get32() &amp;gt;= start_tick + timeout_dur) {
    boot_uart_close();
    return false;
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Heidi&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUboot timeout during DFU</title><link>https://devzone.nordicsemi.com/thread/289722?ContentTypeID=1</link><pubDate>Mon, 18 Jan 2021 12:45:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f259445f-0e7d-4b32-b162-2d86c3b80d5d</guid><dc:creator>Tjaz</dc:creator><description>&lt;p&gt;Thanks.&lt;br /&gt;Looking forward to any information.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUboot timeout during DFU</title><link>https://devzone.nordicsemi.com/thread/288920?ContentTypeID=1</link><pubDate>Wed, 13 Jan 2021 12:55:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:45d1da9e-dbe3-48a6-a419-fd1dbbaca15a</guid><dc:creator>Heidi</dc:creator><description>&lt;p&gt;&amp;nbsp;Hi!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t have an answer for you at&amp;nbsp;the&amp;nbsp;moment. I just wanted to let you know I&amp;#39;m working on your case and I&amp;#39;ll get back to you after talking to some of the developers.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Heidi&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>