<?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 with bonds issue</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/42879/dfu-with-bonds-issue</link><description>Hello! 
 I&amp;#39;m trying to add bonding to my DFU. The DFU without bonds works perfectly but when I set #define NRF_DFU_BLE_REQUIRES_BONDS and NRF_SDH_BLE_SERVICE_CHANGED to 1 the code crashes. 
 
 
 Any idea how to fix this? 
 Thanks for the help! 
 SDK5</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 31 Jan 2019 15:43:55 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/42879/dfu-with-bonds-issue" /><item><title>RE: DFU with bonds issue</title><link>https://devzone.nordicsemi.com/thread/168922?ContentTypeID=1</link><pubDate>Thu, 31 Jan 2019 15:43:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e46e6e88-4d6f-464f-920d-fc150f8c61df</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Hi Gerardo,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I sincerly appologize for the late reply. I did a quick test with the secure bootloader and buttonless DFU example from SDK v15.2.0 and I did not see any issues when doing this in this order:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Set&amp;nbsp;&lt;span&gt;NRF_DFU_BLE_BUTTONLESS_SUPPORTS_BONDS to 1 in the sdk_config.h file of the ble_app_buttonless_dfu project.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Set NRF_DFU_BLE_REQUIRES_BONDS to 1 and&amp;nbsp;NRF_SDH_BLE_SERVICE_CHANGED to 1 in&amp;nbsp;the sdk_config.h file of the&amp;nbsp;secure_bootloader project.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;Replace the&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Compile both projects&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Download nrfutil v4.0.0 or newer from&amp;nbsp;&lt;a href="https://github.com/NordicSemiconductor/pc-nrfutil/releases"&gt;https://github.com/NordicSemiconductor/pc-nrfutil/releases&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Generate the settings page using the following nrfutil command&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;nrfutil.exe settings generate --family NRF52 --application ble_app_buttonless_dfu_pca10040_s132.hex --application-version 1 --bl-settings-version 1 --bootloader-version 1 settings.hex
&lt;/pre&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;Use mergehex to merge the SD, BL and APP using the following command:&lt;br /&gt;mergehex -m ble_app_buttonless_dfu_pca10040_s132.hex s132_nrf52_6.1.0_softdevice.hex secure_bootloader_ble_s132_pca10040_debug.hex -o sd_ble_app.hex&lt;/li&gt;
&lt;li&gt;Use mergehex to merge the&amp;nbsp;&lt;span&gt;sd_ble_app.hex with the settings.hex:&lt;br /&gt;&lt;/span&gt;mergehex -m sd_ble_app.hex settings.hex -o sd_ble_app_settings.hex&lt;/li&gt;
&lt;li&gt;Flash the combined &lt;span&gt;SD, BL and APP + Settings hex file to the nRF5X device:&lt;br /&gt;&lt;/span&gt;nrfjprog --program sd_ble_app_settings.hex --chiperase --reset&lt;/li&gt;
&lt;li&gt;nRF5x device should start advertising as &amp;quot;Nordic_Buttonless&amp;quot;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Best regards&lt;br /&gt;Bjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU with bonds issue</title><link>https://devzone.nordicsemi.com/thread/168332?ContentTypeID=1</link><pubDate>Mon, 28 Jan 2019 21:04:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:534a6322-42da-4435-817d-ba0ae9fa3a1c</guid><dc:creator>gercer</dc:creator><description>&lt;p&gt;Still no success, any idea of what I am doing wrong?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU with bonds issue</title><link>https://devzone.nordicsemi.com/thread/167473?ContentTypeID=1</link><pubDate>Wed, 23 Jan 2019 20:07:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1ad2b7b7-8c96-47db-87a0-3f9faba1da24</guid><dc:creator>gercer</dc:creator><description>&lt;p&gt;Thanks for the fast answer.&lt;br /&gt;&lt;br /&gt;Yeah, that is what is causing an error.&lt;/p&gt;
&lt;p&gt;I tried to do what you suggested but it&amp;#39;s not working. Since it&amp;#39;s the first time I am using nrfutil for the bootloader settings page i will explain step by step what i did.&lt;/p&gt;
&lt;p&gt;1.&amp;nbsp;&amp;nbsp;&lt;span&gt;NRF_DFU_BLE_BUTTONLESS_SUPPORTS_BONDS&amp;nbsp;to 1 in&amp;nbsp;&lt;strong&gt;&lt;em&gt;ble_app_buttonless_dfu_pca10040_s132.hex&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;2. &lt;strong&gt;&lt;em&gt;nrfutil settings generate --family NRF52 --application ble_app_buttonless_dfu_pca10040_s132.hex --application-version 1 --bootloader-version 1 --bl-settings-version 1 settings.hex&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;3. then merged the SD, bootloader and the settings.hex i just created using&amp;nbsp;&amp;nbsp;&lt;strong&gt;&lt;em&gt;mergehex -m settings.hex secure_bootloader_ble_s132_pca10040_debug.hex s132_nrf52_6.1.0_softdevice.hex -o output_file.hex&lt;/em&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;4.&amp;nbsp;&lt;strong&gt;&lt;em&gt;nrfjprog -f NRF52 --program output_file.hex --chiperase&lt;/em&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Could you explain me what I am doingwrong?&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;strong&gt;&lt;/strong&gt;As a possible solution, I was wondering if there was possible to do something like this&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;#if (NRF_DFU_BLE_REQUIRES_BONDS)
    /* Copy out the peer data if bonds are required */
    if (nrf_dfu_settings_peer_data_is_valid())
    {
        NRF_LOG_DEBUG(&amp;quot;Copying peer data&amp;quot;);

        err_code = nrf_dfu_settings_peer_data_copy(&amp;amp;m_peer_data);
        UNUSED_RETURN_VALUE(err_code);
    }
    else
    {
        restart_application_hex();
    }
#else&lt;/pre&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU with bonds issue</title><link>https://devzone.nordicsemi.com/thread/167438?ContentTypeID=1</link><pubDate>Wed, 23 Jan 2019 16:05:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7041b45c-46fe-4ca7-a432-39aba71d6340</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Hi Gerardo,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The 0x03 error code is&amp;nbsp;NRF_ERROR_INTERNAL.&lt;/p&gt;
&lt;p&gt;Can you set a breakpoint in&amp;nbsp;app_error_handler_bare() in main.c and then look at the call stack when this breakpoint is hit? Which function is generating the error code?&lt;/p&gt;
&lt;p&gt;I believe its the following snippet that is called after&amp;nbsp;&amp;nbsp;ble_stack_init() in&amp;nbsp;ble_dfu_transport_init() in nrf_dfu_ble.c that is causing the error, i.e. that&amp;nbsp;nrf_dfu_settings_peer_data_is_valid() returns false,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#if (NRF_DFU_BLE_REQUIRES_BONDS)
    /* Copy out the peer data if bonds are required */
    if (nrf_dfu_settings_peer_data_is_valid())
    {
        NRF_LOG_DEBUG(&amp;quot;Copying peer data&amp;quot;);

        err_code = nrf_dfu_settings_peer_data_copy(&amp;amp;m_peer_data);
        UNUSED_RETURN_VALUE(err_code);
    }
    else
    {
        APP_ERROR_HANDLER(NRF_ERROR_INTERNAL);
    }
#else&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;It this is the case, then could you try to flash nRF52832 with&amp;nbsp; the Buttonless DFU example with&amp;nbsp;NRF_DFU_BLE_BUTTONLESS_SUPPORTS_BONDS set to 1 in addition to the bootloader and SD. And then also generate a bootloader settings page using nrfutil with the compiled application hex as input and flash that as well.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This should ensure that the device jumps to the application first, which sets the peer data. You can then try to perform DFU, which should now work.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;
&lt;p&gt;Bjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>