<?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>How to use nrfutil dfu ble with the DFU buttonless example?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/82351/how-to-use-nrfutil-dfu-ble-with-the-dfu-buttonless-example</link><description>I have some questions on using the nrfutil dfu ble with the buttonless example. 
 Should both devices (central and peripheral) be already bonded before starting the DFU process via nrfutil dfu ble?. Looks like they should not be bonded because the peripheral</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 15 Dec 2021 10:45:36 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/82351/how-to-use-nrfutil-dfu-ble-with-the-dfu-buttonless-example" /><item><title>RE: How to use nrfutil dfu ble with the DFU buttonless example?</title><link>https://devzone.nordicsemi.com/thread/343601?ContentTypeID=1</link><pubDate>Wed, 15 Dec 2021 10:45:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fd4ff529-696c-4601-905f-e49075883d1f</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;No, nrfutil has no way of fetching bonding data. Both nrfutil and nRF Connect are built on top of something called pc-ble-driver, which supports bonding, but you have to implement the part where you store the bonding data on the computer yourself. This is done in nRF Connect, but not in nrfutil. Since the data is stored on the computer (in the application) and not on the nRF, then the bonding data will not carry on from nRF Connect for Desktop to nrfutil.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I remember writing the previous answer in this ticket, asking myself whether to include a section/warning on bonding in bootloaders, so I&amp;#39;ll throw it in now.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;If you require bonding in the bootloader, and something happens during the DFU process, so that the end users decides to delete the bonding information while the nRF has deleted the previous application, the device is bricked, because the bootloader requires bonding, but there are no devices that has bonding data for the nRF stored. Of course, normally, a DFU error can be restored, but if you have 10 000 devices, and say 100 fails on the first attempt of the DFU either due to a battery brown out, or an out of range issue, then it is not unlikely that one out of those 100 decides to delete bonding info to get a &amp;quot;clean start&amp;quot;. Just keep that in mind.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Another approach is to require bonding to write to the buttonless DFU characteristic. In that case, only bonded devices can put the nRF in DFU mode, and the bootloader is secure, so it is impossible to upload malicious FW. The worst case is that someone else connects when the device advertises as a DFU target, and tries to upload something, but in that case the bootloader will reject the wrong image because it is not signed correctly. So worst case you can keep trying until you get connected to the correct device.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Now, that doesn&amp;#39;t solve your bonding issue. If you require bonding on the nRF, you can&amp;#39;t use nrfutil as-is. You need to write your own application that handles the bonding data.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use nrfutil dfu ble with the DFU buttonless example?</title><link>https://devzone.nordicsemi.com/thread/343485?ContentTypeID=1</link><pubDate>Tue, 14 Dec 2021 16:41:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:79555fa5-f0cb-4dcd-844f-3b3d75684aaf</guid><dc:creator>KV</dc:creator><description>&lt;p&gt;Hi Edvin,&lt;/p&gt;
&lt;p&gt;I have the buttonless example working without bonding. I also have the same example working with bonding, but via the nRF connect desktop application.&lt;/p&gt;
&lt;p&gt;You had mentioned in your earlier response&amp;nbsp;&lt;/p&gt;
[quote userid="26071" url="~/f/nordic-q-a/82351/how-to-use-nrfutil-dfu-ble-with-the-dfu-buttonless-example/341793#341793"]Apart from that, the nrfutil command that you used look good, but you can&amp;#39;t use bonding if you use nrfutil directly (because nrfutil doesn&amp;#39;t support bonding).[/quote]
&lt;p&gt;Does this mean that nRF Connect Desktop is the only way to perform DFU with bonding enabled?&lt;/p&gt;
&lt;p&gt;I know that nrfutil does not provide a way to pair/bond, but can you clarify whether it is possible to bond via nRFConnect desktop and then use the nrfutil to perform the DFU?&lt;/p&gt;
&lt;p&gt;I tried bonding with nRFConnect and then issued the nrfutil command, but I received an error below:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;nrfutil dfu ble -ic NRF52 -p COM14 -cd 0 -mtu 131 -n &amp;quot;Nordic_Buttonless&amp;quot; -pkg C:\Users\irtxxx\Desktop\buttonless_dfu_image_bonds.zip&lt;/code&gt;&lt;br /&gt;&lt;code&gt; [------------------------------------] 0%2021-12-14 10:39:43,448 Exception: on_gap_evt_auth_status() got an unexpected keyword argument &amp;#39;error_src&amp;#39;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;2021-12-14 10:39:43,450 &amp;lt;FrameSummary file c:\python\lib\site-packages\pc_ble_driver_py\ble_driver.py, line 2787 in ble_event_handler_sync&amp;gt;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;2021-12-14 10:39:43,450&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;Traceback (most recent call last):&lt;/code&gt;&lt;br /&gt;&lt;code&gt; File &amp;quot;C:\Python\Scripts\nrfutil-script.py&amp;quot;, line 11, in &amp;lt;module&amp;gt;&lt;/code&gt;&lt;br /&gt;&lt;code&gt; load_entry_point(&amp;#39;nrfutil===6.1.X&amp;#39;, &amp;#39;console_scripts&amp;#39;, &amp;#39;nrfutil&amp;#39;)()&lt;/code&gt;&lt;br /&gt;&lt;code&gt; File &amp;quot;c:\python\lib\site-packages\click\core.py&amp;quot;, line 1137, in __call__&lt;/code&gt;&lt;br /&gt;&lt;code&gt; return self.main(*args, **kwargs)&lt;/code&gt;&lt;br /&gt;&lt;code&gt; File &amp;quot;c:\python\lib\site-packages\click\core.py&amp;quot;, line 1062, in main&lt;/code&gt;&lt;br /&gt;&lt;code&gt; rv = self.invoke(ctx)&lt;/code&gt;&lt;br /&gt;&lt;code&gt; File &amp;quot;c:\python\lib\site-packages\click\core.py&amp;quot;, line 1668, in invoke&lt;/code&gt;&lt;br /&gt;&lt;code&gt; return _process_result(sub_ctx.command.invoke(sub_ctx))&lt;/code&gt;&lt;br /&gt;&lt;code&gt; File &amp;quot;c:\python\lib\site-packages\click\core.py&amp;quot;, line 1668, in invoke&lt;/code&gt;&lt;br /&gt;&lt;code&gt; return _process_result(sub_ctx.command.invoke(sub_ctx))&lt;/code&gt;&lt;br /&gt;&lt;code&gt; File &amp;quot;c:\python\lib\site-packages\click\core.py&amp;quot;, line 1404, in invoke&lt;/code&gt;&lt;br /&gt;&lt;code&gt; return ctx.invoke(self.callback, **ctx.params)&lt;/code&gt;&lt;br /&gt;&lt;code&gt; File &amp;quot;c:\python\lib\site-packages\click\core.py&amp;quot;, line 763, in invoke&lt;/code&gt;&lt;br /&gt;&lt;code&gt; return __callback(*args, **kwargs)&lt;/code&gt;&lt;br /&gt;&lt;code&gt; File &amp;quot;c:\python\lib\site-packages\nrfutil-6.1.x-py3.8.egg\nordicsemi\__main__.py&amp;quot;, line 1205, in ble&lt;/code&gt;&lt;br /&gt;&lt;code&gt; dfu.dfu_send_images()&lt;/code&gt;&lt;br /&gt;&lt;code&gt; File &amp;quot;c:\python\lib\site-packages\nrfutil-6.1.x-py3.8.egg\nordicsemi\dfu\dfu.py&amp;quot;, line 127, in dfu_send_images&lt;/code&gt;&lt;br /&gt;&lt;code&gt; self._dfu_send_image(self.manifest.application)&lt;/code&gt;&lt;br /&gt;&lt;code&gt; File &amp;quot;c:\python\lib\site-packages\nrfutil-6.1.x-py3.8.egg\nordicsemi\dfu\dfu.py&amp;quot;, line 88, in _dfu_send_image&lt;/code&gt;&lt;br /&gt;&lt;code&gt; self.dfu_transport.open()&lt;/code&gt;&lt;br /&gt;&lt;code&gt; File &amp;quot;c:\python\lib\site-packages\nrfutil-6.1.x-py3.8.egg\nordicsemi\dfu\dfu_transport_ble.py&amp;quot;, line 475, in open&lt;/code&gt;&lt;br /&gt;&lt;code&gt; self.target_device_name, self.target_device_addr = self.dfu_adapter.connect(&lt;/code&gt;&lt;br /&gt;&lt;code&gt; File &amp;quot;c:\python\lib\site-packages\nrfutil-6.1.x-py3.8.egg\nordicsemi\dfu\dfu_transport_ble.py&amp;quot;, line 164, in connect&lt;/code&gt;&lt;br /&gt;&lt;code&gt; self.jump_from_buttonless_mode_to_bootloader(DFUAdapter.BLE_DFU_BUTTONLESS_BONDED_CHAR_UUID)&lt;/code&gt;&lt;br /&gt;&lt;code&gt; File &amp;quot;c:\python\lib\site-packages\nrfutil-6.1.x-py3.8.egg\nordicsemi\dfu\dfu_transport_ble.py&amp;quot;, line 199, in jump_from_buttonless_mode_to_bootloader&lt;/code&gt;&lt;br /&gt;&lt;code&gt; self.bond()&lt;/code&gt;&lt;br /&gt;&lt;code&gt; File &amp;quot;c:\python\lib\site-packages\nrfutil-6.1.x-py3.8.egg\nordicsemi\dfu\dfu_transport_ble.py&amp;quot;, line 327, in bond&lt;/code&gt;&lt;br /&gt;&lt;code&gt; self.adapter.driver.ble_gap_sec_params_reply(self.conn_handle,&lt;/code&gt;&lt;br /&gt;&lt;code&gt; File &amp;quot;c:\python\lib\site-packages\pc_ble_driver_py\ble_driver.py&amp;quot;, line 106, in wrapper&lt;/code&gt;&lt;br /&gt;&lt;code&gt; raise NordicSemiException(&lt;/code&gt;&lt;br /&gt;&lt;code&gt;pc_ble_driver_py.exceptions.NordicSemiException: Failed to ble_gap_sec_params_reply. Error code: NRF_ERROR_INVALID_STATE&lt;/code&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to use nrfutil dfu ble with the DFU buttonless example?</title><link>https://devzone.nordicsemi.com/thread/341793?ContentTypeID=1</link><pubDate>Fri, 03 Dec 2021 08:21:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e3888168-54dc-477f-ac2a-bf1355b74d87</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;If you have not already, I suggest that you go through &lt;a href="https://devzone.nordicsemi.com/guides/short-range-guides/b/software-development-kit/posts/getting-started-with-nordics-secure-dfu-bootloader"&gt;this guide&lt;/a&gt;. It is old, but still very useful.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I believe that the issues are related to bonding. If you follow the guide, you will see how to get started without bonding, and you can add bonding later, if you like.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I suggest that you do not use the precompiled .hex files, but compile and flash the examples, like it is described in the guide from the link.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Apart from that, the nrfutil command that you used look good, but you can&amp;#39;t use bonding if you use nrfutil directly (because nrfutil doesn&amp;#39;t support bonding). However, you can do it from nRF Connect for Desktop -&amp;gt; Bluetooth Low Energy if you want to test that later when you have everything up and running without bonding.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>