<?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>Buttonless Secure DFU - Preparing for Production</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/39873/buttonless-secure-dfu---preparing-for-production</link><description>I am porting an application with buttonless DFU from SDK 14.2 to SDK 15.2 to target nRF52840 and in the process working to prepare the code for production. 
 After some effort to get the environment set up correctly (I initially missed the compile time</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 05 Nov 2018 04:17:03 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/39873/buttonless-secure-dfu---preparing-for-production" /><item><title>RE: Buttonless Secure DFU - Preparing for Production</title><link>https://devzone.nordicsemi.com/thread/155848?ContentTypeID=1</link><pubDate>Mon, 05 Nov 2018 04:17:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f4f1d7f3-e92d-45ea-a86b-7889ef36564b</guid><dc:creator>jumpingfool</dc:creator><description>&lt;p&gt;Thanks - that works!&lt;/p&gt;
&lt;p&gt;To save confusion for others it might be wise&amp;nbsp;to update Appendix 1 of the DFU tutorial to note that the MBR needs to be cleared when flashing new firmware with the bootloader present when using&amp;nbsp;SDK 15:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/b/blog/posts/getting-started-with-nordics-secure-dfu-bootloader"&gt;devzone.nordicsemi.com/.../getting-started-with-nordics-secure-dfu-bootloader&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Buttonless Secure DFU - Preparing for Production</title><link>https://devzone.nordicsemi.com/thread/155743?ContentTypeID=1</link><pubDate>Fri, 02 Nov 2018 12:18:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:87ae62e4-beb8-4fd5-ac95-1cc70a8de0af</guid><dc:creator>Marjeris Romero</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;My mistake, there was a change from SDK 14.2 to SDK15.2. In SDK 15.2 we use MBR parameter storage as a backup of the bootloader settings page. You will need to erase the backup stored in the MBR (and reflash app + settings). Try this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;nrfjprog --erasepage 0x000FE000
nrfjprog --program application.hex --sectorerase
nrfutil settings generate --family NRF52840 --application application.hex --application-version 1 --bootloader-version 2 --bl-settings-version 1 settings.hex
nrfjprog --program settings.hex --sectorerase
nrfjprog --reset&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Where 0x000FE000 is the start adress of the MBR parameter storage in nRF52840.&lt;/p&gt;
&lt;p&gt;See the comment on the update under &amp;quot;New features&amp;quot; &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v15.2.0%2Findex.html&amp;amp;cp=4_0_0_0"&gt;here&lt;/a&gt;:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;- The bootloader settings page is now backed up before being updated. This increases protection from corruption caused by chance events
    (for example, power failure) and malicious apps.&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Marjeris&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Buttonless Secure DFU - Preparing for Production</title><link>https://devzone.nordicsemi.com/thread/155450?ContentTypeID=1</link><pubDate>Wed, 31 Oct 2018 22:52:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:df62b4e0-bd0d-4aba-a07b-aab05a193f84</guid><dc:creator>jumpingfool</dc:creator><description>&lt;p&gt;These are the commands I&amp;#39;m using that work and bring the application up correctly (application is built prior in SES):&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;nrfjprog -e
nrfjprog --program s140_nrf52_6.1.0_softdevice.hex
nrfjprog --program bootloader.hex 
nrfjprog --program application.hex --sectorerase
nrfutil settings generate --family NRF52840 --application application.hex --application-version 1 --bootloader-version 2 --bl-settings-version 1 settings.hex
nrfjprog --program settings.hex --sectorerase
nrfjprog --reset&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;If I don&amp;#39;t do the erase and just flash the application/bootloader settings the&amp;nbsp;device comes up in DFU mode. I didn&amp;#39;t have this issue with SDK 14.2.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Buttonless Secure DFU - Preparing for Production</title><link>https://devzone.nordicsemi.com/thread/155392?ContentTypeID=1</link><pubDate>Wed, 31 Oct 2018 15:17:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8357bd00-a53b-4f49-a527-946bf51c7126</guid><dc:creator>Marjeris Romero</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;You should be able to re-flash the application + bootloader settings using --sectorerase. There are no changes in SDK15.2 that modify this. Could you post the commands you are using to update the application?&lt;/p&gt;
&lt;p&gt;Just as a recap, you&amp;#39;ll need to&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Build the application hex file&lt;/li&gt;
&lt;li&gt;Generate a new bootloader settings based on new application hex file&lt;/li&gt;
&lt;li&gt;Flash the new application and new bootloader settings&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Best Regards,&lt;/p&gt;
&lt;p&gt;Marjeris&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Buttonless Secure DFU - Preparing for Production</title><link>https://devzone.nordicsemi.com/thread/155279?ContentTypeID=1</link><pubDate>Wed, 31 Oct 2018 09:48:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3f3d6bf4-ef17-4fb8-b645-24ca90a1b5aa</guid><dc:creator>jumpingfool</dc:creator><description>&lt;p&gt;Thanks msromero -&amp;nbsp;we will follow your advice!&lt;/p&gt;
&lt;p&gt;A seperate but related question - I have found that on SDK 15.2 I can no longer re-flash just the application (+ settings page) when the bootloader is present. If I try the device will go to DFU mode on reset, presumably because the bootloader is rejecting the updated application.&lt;/p&gt;
&lt;p&gt;Instead I have to fully erase the chip and write SD + bootloader + application + settings page all at the one time, then it works. If I send a new application over DFU it also works. It is only when attempting to flash a new&amp;nbsp;application directly there is a problem.&lt;/p&gt;
&lt;p&gt;Has something changed in the SDK 15.2 bootloader that means the application cannot be re-flashed after initial programming? Any work around for this? It is a pain for development having to fully erase the device each time the application is updated as bonding information, etc is lost in the process.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Buttonless Secure DFU - Preparing for Production</title><link>https://devzone.nordicsemi.com/thread/155189?ContentTypeID=1</link><pubDate>Tue, 30 Oct 2018 15:09:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:318e4f01-b823-4a03-bc44-3696b1381380</guid><dc:creator>Marjeris Romero</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]What is the purpose of the&amp;nbsp;buttonless_dfu_sdh_state_observer function? What&amp;nbsp;drives the need&amp;nbsp;to enter&amp;nbsp;system off here?[/quote]
&lt;p&gt;All our BLE peripherals examples advertise for a certain amount of time and then they go to sleep. The skip CRC thing is because there is a bootloader, so it will make bootup a little faster. So what happens here is that the advertising times out -&amp;gt; the Softdevice is disable -&amp;gt; the buttonless_dfu_sdh_state_observer handler puts the system to sleep.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]In app_shutdown_handler -&amp;gt;&amp;nbsp;NRF_PWR_MGMT_EVT_PREPARE_DFU there is code (but commented out) that would disable the softdevice and stop the application timers. Is this required and if so why given the system is about to be reset to enter DFU?[/quote]
&lt;p&gt;&amp;nbsp;This part of the code can be used if you have an application that needs to finish a task before it resets into DFU mode. &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]It it usual to change&amp;nbsp;the name advertised by the bootloader to be application specific or leave it as the generic DfuTarg in production?[/quote]
&lt;p&gt;&amp;nbsp;You can change the name if you want or leave it as it is. Just make sure your mobile app know which target the application is going to connect to perform DFU.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]What is the correct way to handle the situation where a device gets stuck in DFU mode (e.g. due to link loss part way through an update)? How does our central (smartphone application) identify&amp;nbsp;the device and recover it to a working state?[/quote]
&lt;p&gt;This will depend if you are using &lt;a href="http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v15.2.0%2Flib_bootloader_dfu_banks.html"&gt;dual-bank or single-bank updates&lt;/a&gt;. In the buttonless_dfu example this is taken care of. The preferred update mode if there is enough space for the application (something that usually is the case using nRF52840) is dual-bank. There is a time-out in the DFU bootloader, and it will either recover to the old application and start advertising again, or it will start advertising in bootloader mode if using single-bank. If there is a disconnect and connect while the DFU update is going on the bootloader will remember where in the update it is and continue from it.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]Our application is bonded but at present we are doing open DFU. Is this a common approach and if so are there any security risks when doing secure DFU&amp;nbsp;without bonding?[/quote]
&lt;p&gt;I have asked around here and it seems that DFU without bonding is a common approach. Some may see more disadventages than adventages when using bonds. The bootloader will verify the signature of the init packet regardless of it using bonds or not to perform updates.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]Is it recommended to use the same private&amp;nbsp;key for signing firmware to all devices or should&amp;nbsp;each device be coded with an individual key? If so how can the key in the bootloader be set without needing to recompile each time?[/quote]
&lt;p&gt;&amp;nbsp;Yes, you should use the same private key, as long as it is kept private&amp;nbsp;&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;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]Any other security/logistics&amp;nbsp;considerations&amp;nbsp;around the DFU process we should be aware of before entering production?[/quote]
&lt;p&gt;One I can think of is that is you are using bonds you will need to use dual-bank updates. If the application you are updating the nRF52840 with is not valid and you loose your bonded device while performing the update, you will be stucked if using single-bank. When using dual-bank you can go back to the last verified application. &lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best Regards,&lt;/p&gt;
&lt;p&gt;Marjeris&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>