<?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>Start of application takes ages after DFU process is complete</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/110315/start-of-application-takes-ages-after-dfu-process-is-complete</link><description>Hello, 
 in my application (SDK 16.0.0, nRF52840) I perform a DFU and successfully update the application firmware. However I have noticed that from the moment when the DFU is complete (i.e. the moment when the on_dfu_complete callback, defined in nrf_dfu_req_handler</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 23 Apr 2024 11:34:52 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/110315/start-of-application-takes-ages-after-dfu-process-is-complete" /><item><title>RE: Start of application takes ages after DFU process is complete</title><link>https://devzone.nordicsemi.com/thread/480177?ContentTypeID=1</link><pubDate>Tue, 23 Apr 2024 11:34:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dbf14191-52f1-45d8-ade6-11160032dfb4</guid><dc:creator>ste2108</dc:creator><description>&lt;p&gt;no, just after a successful application update. Ok thanks, I&amp;#39;ll close the ticket.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Start of application takes ages after DFU process is complete</title><link>https://devzone.nordicsemi.com/thread/480176?ContentTypeID=1</link><pubDate>Tue, 23 Apr 2024 11:33:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:37ce2eb5-582f-4cea-a178-4bb949ae04e9</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi Stefano,&lt;/p&gt;
&lt;p&gt;It depends if you want your flag to also be set after a Softdevice or bootloader update.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Start of application takes ages after DFU process is complete</title><link>https://devzone.nordicsemi.com/thread/479989?ContentTypeID=1</link><pubDate>Mon, 22 Apr 2024 12:33:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:afb82eab-e0ef-41e6-a029-b76bf86e8403</guid><dc:creator>ste2108</dc:creator><description>&lt;p&gt;After looking at the function you suggested I thought it could be better to add the gpregret write operation after it is called in nrf_bootloader_init (nrf_bootloader.c). Do you see anything wrong with it? I tested it and it seems ok, which means that now even if I switch the board off during the bank1 validation and shift to bank0, the gpregret bit is eventually set and my application can use it once it has started.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Stefano&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/8a4b2d61_2D00_c5a1_2D00_491c_2D00_a282_2D00_af5fe4b17ce3.jpg" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Start of application takes ages after DFU process is complete</title><link>https://devzone.nordicsemi.com/thread/479926?ContentTypeID=1</link><pubDate>Mon, 22 Apr 2024 09:25:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e3e5938c-d2a5-4fc6-91f6-ec95202d752b</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Maybe after app_active() returns with NRF_SUCCESS here:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1713777906327v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Start of application takes ages after DFU process is complete</title><link>https://devzone.nordicsemi.com/thread/479886?ContentTypeID=1</link><pubDate>Mon, 22 Apr 2024 08:07:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7e87065a-50de-4083-8831-3024b97a8ed6</guid><dc:creator>ste2108</dc:creator><description>&lt;p&gt;Dear Vidar,&lt;/p&gt;
&lt;p&gt;Thank you for your answer. I need the bootloader to signal a successful firmware update to the application, and I am presently doing it by setting a bit of the gpregret register in the&amp;nbsp;&amp;nbsp;&lt;span&gt;on_dfu_complete callback. The problem is that, in case an hard reset (e.g. shutdown) happens during the period when the firmware is moved from bank 1 to bank 0, the gpregret bit will be reset (whereas the shift from bank 1 to bank 0 will be finalised anyway, once the device is repowered). A simple solution would be to move the setting of the gpregret bit to the end of the fw validation, after the 13 seconds discussed above. Could you please tell me which is the best point to do that?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thank you.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Kind regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Stefano&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Start of application takes ages after DFU process is complete</title><link>https://devzone.nordicsemi.com/thread/479585?ContentTypeID=1</link><pubDate>Fri, 19 Apr 2024 05:43:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eac631d8-1af9-4568-8878-47827571cb7f</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;That can happen to the best of us &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt; Yes, the bootloader is reset after the on_dfu_complete() callback has been invoked, and the image is copied from bank 1 to bank 0 on the subsequent startup.&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Start of application takes ages after DFU process is complete</title><link>https://devzone.nordicsemi.com/thread/479509?ContentTypeID=1</link><pubDate>Thu, 18 Apr 2024 15:17:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:15329a69-7c9f-4b6f-94f1-e21979624d18</guid><dc:creator>ste2108</dc:creator><description>&lt;p&gt;Right, I mixed bits with bytes as for the word :) the numbers are getting close to what I see experimentally then. I will perform the test you suggest and let you know, but can you please confirm that the callback on_dfu_complete in &lt;span&gt;nrf_dfu_req_handler.c&amp;nbsp;&lt;/span&gt;is called before the new image is moved from bank 1 to bank 0? Cause otherwise there is smtg wrong in the way I do things.&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Stefano&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Start of application takes ages after DFU process is complete</title><link>https://devzone.nordicsemi.com/thread/479504?ContentTypeID=1</link><pubDate>Thu, 18 Apr 2024 15:06:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f3e9074c-68f0-4a75-bf8d-a3f05c3487d6</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Dear Stefano,&lt;/p&gt;
&lt;p&gt;No problem. Regarding&amp;nbsp;the calculation, there are 1024 words in a page, so I think it should be&amp;nbsp;&lt;span&gt;85+(0,041*(4096/&lt;strong&gt;4&lt;/strong&gt;))&amp;nbsp;= 127 ms. We also need to account for the time it takes to update the progress&amp;nbsp;in&amp;nbsp; the BL settings page.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:inherit;"&gt;nrf_bootloader_fw_activation.c-&amp;gt;&lt;/span&gt;&lt;span style="font-family:inherit;"&gt;app_activate()-&amp;gt;&lt;/span&gt;&lt;span style="font-family:inherit;"&gt;image_copy&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1713452490623v1.png" alt=" " /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;You can try increasing the&amp;nbsp;NRF_BL_FW_COPY_PROGRESS_STORE_STEP value in sdk_config.h to see if that helps. This controls how frequent the settings page will be updated during the activation process.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Vidar&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Start of application takes ages after DFU process is complete</title><link>https://devzone.nordicsemi.com/thread/479498?ContentTypeID=1</link><pubDate>Thu, 18 Apr 2024 14:44:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:71c2b7ac-b4c6-458b-b022-d269dc4a371b</guid><dc:creator>ste2108</dc:creator><description>&lt;p&gt;Dear Vidar,&lt;/p&gt;
&lt;p&gt;Thank you for your quick answer. This can partially explain the large delay I observe. My application is exactly 409600, i.e. 100 pages, wide (the image we send is created in such a way to be always that size, and exactly half the available flash for dual update. I have verified in flash that after an update bank 1 starts immediately after the end of bank 0). So the time to erase and copy one page would be 85+(0,041*(4096/32)) ms=90 ms, and 9 seconds for 100 pages. Does any other potential source of delay to the start of application come to your mind?&lt;/p&gt;
&lt;p&gt;In addition to that, does this mean that when the on_dfu_complete is called the firmware has been copied into bank 1 but no validity check on it has been performed yet? What happens if there is a power cut during this validity check?&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Stefano&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Start of application takes ages after DFU process is complete</title><link>https://devzone.nordicsemi.com/thread/479487?ContentTypeID=1</link><pubDate>Thu, 18 Apr 2024 14:16:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:05fa9ac1-67d5-45aa-96e2-51f5996b04a7</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello Stefano,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The activation delay is caused by the bootloader having to copy the FW image from bank 1 into bank 0.&amp;nbsp;As can be seen from the&amp;nbsp;&lt;a title="Flash programming" href="https://infocenter.nordicsemi.com/topic/ps_nrf52840/nvmc.html?cp=5_0_0_3_2_9_0#unique_762295276"&gt;Flash programming&lt;/a&gt;&amp;nbsp;section of the PS, erasing one flash page takes ~85 ms, and the time to write one word is 41 us.&lt;/p&gt;
&lt;p&gt;If it is important to reduce this delay, you could consider configuring the bootloader so that it only perfom single bank updates (&lt;a title="Dual-bank and single-bank updates" href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/lib_bootloader_dfu_banks.html?cp=9_1_3_5_1_2"&gt;Dual-bank and single-bank updates&lt;/a&gt;) of the application, which means the application will be updated in-place.&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>