<?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>DFU Bootloader&amp;#39;s settings can become corrupt after a power-cycle</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/24729/dfu-bootloader-s-settings-can-become-corrupt-after-a-power-cycle</link><description>Hello, 
 My team and I are experiencing a problem with our custom DFU Bootloader, which is based on the Experimental Bootloader Secure Serial example (SDK 13), running in a custom NRF52832 board. Our main app uses a single bank, and we&amp;#39;re also using</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 01 Sep 2017 13:11:16 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/24729/dfu-bootloader-s-settings-can-become-corrupt-after-a-power-cycle" /><item><title>RE: DFU Bootloader's settings can become corrupt after a power-cycle</title><link>https://devzone.nordicsemi.com/thread/97355?ContentTypeID=1</link><pubDate>Fri, 01 Sep 2017 13:11:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:029f36a4-76f7-4f01-94d5-c5ed6de1c559</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;No, it&amp;#39;s not implemented and I don&amp;#39;t know about the plan or if we going to implement that. As I mentioned, it&amp;#39;s important to make sure there will be no unexpected reset when doing DFU. Also, if the DFU bootloader setting is corrupted, worst case will be the update process need to start again.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU Bootloader's settings can become corrupt after a power-cycle</title><link>https://devzone.nordicsemi.com/thread/97353?ContentTypeID=1</link><pubDate>Thu, 31 Aug 2017 16:08:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a17e188f-cb92-4d1b-849a-a0ed24e572f9</guid><dc:creator>Tiago Costa</dc:creator><description>&lt;p&gt;&amp;quot;I assume the delay added so it take longer than the time the nRF52 can run when the power is cut down ? &amp;quot; That&amp;#39;s right! We&amp;#39;ve measured the delay that it takes to get the voltage to drop low enough so that the nRF52 is completely off when the power is cut. Is that bootloader setting flag already implemented in the SDK or is that an upcoming feature?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU Bootloader's settings can become corrupt after a power-cycle</title><link>https://devzone.nordicsemi.com/thread/97352?ContentTypeID=1</link><pubDate>Thu, 31 Aug 2017 15:33:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:77e58c3e-36d2-4fa9-bc2c-330f0407646c</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Good to know Tiago. I didn&amp;#39;t know you store your application image on an SD Card.
I assume the delay added so it take longer than the time the nRF52 can run when the power is cut down ?
I think the bootloader setting flag should help. But we haven&amp;#39;t heard any report about that problem yet.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU Bootloader's settings can become corrupt after a power-cycle</title><link>https://devzone.nordicsemi.com/thread/97354?ContentTypeID=1</link><pubDate>Thu, 31 Aug 2017 11:29:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ce1f8509-b3be-434e-83dc-8c1ad321e2b8</guid><dc:creator>Tiago Costa</dc:creator><description>&lt;p&gt;That bootloader setting update flag would be handy actually. Could this help prevent the settings from being reset if they become corrupt?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU Bootloader's settings can become corrupt after a power-cycle</title><link>https://devzone.nordicsemi.com/thread/97351?ContentTypeID=1</link><pubDate>Thu, 31 Aug 2017 11:16:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:118a4ddc-573a-4848-985d-823cda4f1c1e</guid><dc:creator>Tiago Costa</dc:creator><description>&lt;p&gt;Hi Hung, your reasoning makes total sense. I would expect the settings to become corrupt if a power-loss occurs during an update. However, frequently, the settings were also lost when our bootloader was calculating a CRC of our firmware files stored in a SD Card, when we forced a reset.&lt;/p&gt;
&lt;p&gt;Finally, I believe we have sorted it out:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;when we cut power to the board while the bootloader is calculating the CRC, we&amp;#39;ve noticed that the NRF52 continued to run after the SD Card stopped working (due to low voltage). This caused the read operation to fail, aborting the calculation and triggering a write to the settings (indicating that the image on the SD Card is not valid). After adding a delay before the write operation, we prevented the read errors which can be an indication of a sudden power loss, and the issue could not be reproduced again.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Thanks again for all the assistance on this.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU Bootloader's settings can become corrupt after a power-cycle</title><link>https://devzone.nordicsemi.com/thread/97349?ContentTypeID=1</link><pubDate>Wed, 30 Aug 2017 19:08:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ae207005-3283-4c6f-91c6-5a26848620db</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;I suspect the bootloader has been reset when it&amp;#39;s performing a bootloader setting update, meaning it&amp;#39;s trying to erase the old bootloader setting and write a new one. Before the new bootloader setting can be written it got reset and the next boot up the bootloader setting appears corrupted.&lt;/p&gt;
&lt;p&gt;Do you have the issue if you simply reset the bootloader without doing any DFU update ? From my understanding, the bootloader setting only get updated if there is a DFU update.&lt;/p&gt;
&lt;p&gt;Avoiding a system reset when doing DFU is pretty important. That&amp;#39;s why most vendors require battery &amp;gt;50% or power supply plugged before doing DFU update.&lt;/p&gt;
&lt;p&gt;If needed, we can implement a flag telling if the bootloader setting update is in progress and can continue/retry that on the next booting if there is a reset occurs.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU Bootloader's settings can become corrupt after a power-cycle</title><link>https://devzone.nordicsemi.com/thread/97348?ContentTypeID=1</link><pubDate>Wed, 30 Aug 2017 08:43:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:75a1be4e-2f85-4648-9559-c0b7d552ccc7</guid><dc:creator>Tiago Costa</dc:creator><description>&lt;p&gt;Hi Hung, thanks for your reply. The bootloader fails to enter the application because the bootloader settings are erased by calling nrf_dfu_settings_init() when the bootloader starts, causing nrf_dfu_app_is_valid() to return false. This only occurs if the bootloader is power-cycled multiple times in a row, otherwise works just fine and loads the main app as expected. I have checked the SDK function nrf_dfu_settings_init(), and it seems to only erase the settings whenever they are corrupt. I just don&amp;#39;t understand why would they become corrupt when neither the bootloader or the main app are writing to the settings or any other flash region.&lt;/p&gt;
&lt;p&gt;The flow of our bootloader on boot is as follows:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;calls  nrf_dfu_settings_init() to load the bootloader&amp;#39;s settings&lt;/li&gt;
&lt;li&gt;calls nrf_dfu_continue() in the event there is a pending flash operation - can this cause problems even if there is no pending flash operation?&lt;/li&gt;
&lt;li&gt;proceeds to load the main app if nrf_dfu_app_is_valid() returns true and if enter_buttonless_dfu is not set&lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU Bootloader's settings can become corrupt after a power-cycle</title><link>https://devzone.nordicsemi.com/thread/97350?ContentTypeID=1</link><pubDate>Tue, 29 Aug 2017 15:59:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2343d6eb-83c1-47c2-8b60-cb65218f6905</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Tiago,&lt;/p&gt;
&lt;p&gt;Could you try to modify the bootloader to print out some log to check what cause the bootloader not to enter application ? My suspicion is that the application is modified (because of some flash operation? ) and the CRC is mismatched.
If you can reproduce the issue, you can also simply run the bootloader in debug mode and step into the code where it check for application valid.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>