<?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>Writing the simplest possible implementation of buttonless dfu</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/78141/writing-the-simplest-possible-implementation-of-buttonless-dfu</link><description>Hi, 
 
 I&amp;#39;m trying to integrate buttonless dfu to our project. We don&amp;#39;t have any security concerns and given the existing project constraints, it&amp;#39;s not desirable to use peer_manager and power_management (which uses app_timer....) libraries. We don&amp;#39;t use</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 04 Aug 2021 11:40:23 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/78141/writing-the-simplest-possible-implementation-of-buttonless-dfu" /><item><title>RE: Writing the simplest possible implementation of buttonless dfu</title><link>https://devzone.nordicsemi.com/thread/323288?ContentTypeID=1</link><pubDate>Wed, 04 Aug 2021 11:40:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:95f48c9e-1037-4eb4-b5a1-e3a73195a6fa</guid><dc:creator>hugo_98</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I ended up with the same solution this morning. I can confirm it works on my board too.&lt;/p&gt;
&lt;p&gt;Thank&amp;#39;s a lot for your help !&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Hugo&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Writing the simplest possible implementation of buttonless dfu</title><link>https://devzone.nordicsemi.com/thread/323265?ContentTypeID=1</link><pubDate>Wed, 04 Aug 2021 10:13:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:608054c4-25af-4c79-8f7c-aeaef5239375</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I suspect you are seeing a general problem when removing the peer manager, which is that you need to add handling of a few events in your code that is otherwise handled by the peer manager. Specifically, you should add this in your handling of BLE events:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;        case BLE_GAP_EVT_SEC_PARAMS_REQUEST:
            // Pairing not supported
            err_code = sd_ble_gap_sec_params_reply(m_conn_handle, BLE_GAP_SEC_STATUS_PAIRING_NOT_SUPP, NULL, NULL);
            APP_ERROR_CHECK(err_code);
            break;

        case BLE_GATTS_EVT_SYS_ATTR_MISSING:
            // No system attributes have been stored.
            err_code = sd_ble_gatts_sys_attr_set(m_conn_handle, NULL, 0, 0);
            APP_ERROR_CHECK(err_code);
            break;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I tested by modifying the SDK 17.0.2&amp;nbsp;ble_app_buttonless_dfu example by setting&amp;nbsp;PEER_MANAGER_ENABLED to 0 in sdk_config.h and adding the code snippet from above and removing everything related to peer manager and pairing/bonding:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/73434.main.c"&gt;devzone.nordicsemi.com/.../73434.main.c&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This seems to work.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Writing the simplest possible implementation of buttonless dfu</title><link>https://devzone.nordicsemi.com/thread/323132?ContentTypeID=1</link><pubDate>Tue, 03 Aug 2021 13:31:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6d0d07a4-2130-4a42-a365-6dc8584d6c00</guid><dc:creator>hugo_98</dc:creator><description>&lt;p&gt;I just tried removing calls to peer_manager_init() in the buttonless dfu template application, configured with NRF_DFU_BLE_BUTTONLESS_SUPPORTS_BONDS set to 0 as you suggested. &lt;/p&gt;
&lt;p&gt;It leads to the same result as with my simplified buttonless dfu service -&amp;gt; I can&amp;#39;t do anything on the buttonless service characteristics. As a result the DFU can&amp;#39;t be triggered.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I&amp;#39;m really stuck on this...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Writing the simplest possible implementation of buttonless dfu</title><link>https://devzone.nordicsemi.com/thread/323116?ContentTypeID=1</link><pubDate>Tue, 03 Aug 2021 13:01:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c6c29982-671e-435e-9248-1c642ec8d36f</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi Hugo,&lt;/p&gt;
&lt;p&gt;If you want to use the buttonless DFU BLE service, then I suggest using it as it is demonstrated by the &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/ble_sdk_app_buttonless_dfu.html"&gt;Buttonless DFU Template Application&lt;/a&gt;. As long as&amp;nbsp;NRF_DFU_BLE_BUTTONLESS_SUPPORTS_BONDS is set to 0 this does not use any&amp;nbsp;bond sharing with the bootloader. The example application itself relies on the peer manager, but that can be removed here, as it has no use with buttonless DFU.&lt;/p&gt;
&lt;p&gt;The advantage of using the approach of the example and buttonless DFU service implementation is that you get the support for setting advertising name, which is important in order to get a good user experience with iOS. This is used by the nRF Connect apps etc to filter on the correct device while scanning to connect again to the device after it enters DFU mode. (you can search for&amp;nbsp;DFU_OP_SET_ADV_NAME in ble_dfu_unbonded.c to see how this is used). In this case SVCI is used not do share bonding information, but to set the device name.&lt;/p&gt;
&lt;p&gt;Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Writing the simplest possible implementation of buttonless dfu</title><link>https://devzone.nordicsemi.com/thread/323109?ContentTypeID=1</link><pubDate>Tue, 03 Aug 2021 12:51:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9b6fc31a-04ce-4c36-b105-bc72aed21548</guid><dc:creator>hugo_98</dc:creator><description>&lt;p&gt;Thanks you for confirming my guesses :) I have an almost working simplified version of buttonless dfu now.&lt;/p&gt;
&lt;p&gt;So the only issue I&amp;#39;m experiencing now is a BLE relative one :&lt;/p&gt;
&lt;p&gt;Once I trigger DFU through nrfconnect desktop app, I can&amp;#39;t do anything on the buttonless service characteristics. As a result the DFU can&amp;#39;t be triggered.&lt;/p&gt;
&lt;p&gt;This happens when I remove peer manager initialization (from the buttonless template app) :&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void peer_manager_init()
{
    ble_gap_sec_params_t sec_param;
    ret_code_t           err_code;

    err_code = pm_init();
    APP_ERROR_CHECK(err_code);

    memset(&amp;amp;sec_param, 0, sizeof(ble_gap_sec_params_t));

    // Security parameters to be used for all security procedures.
    sec_param.bond           = SEC_PARAM_BOND;
    sec_param.mitm           = SEC_PARAM_MITM;
    sec_param.lesc           = SEC_PARAM_LESC;
    sec_param.keypress       = SEC_PARAM_KEYPRESS;
    sec_param.io_caps        = SEC_PARAM_IO_CAPABILITIES;
    sec_param.oob            = SEC_PARAM_OOB;
    sec_param.min_key_size   = SEC_PARAM_MIN_KEY_SIZE;
    sec_param.max_key_size   = SEC_PARAM_MAX_KEY_SIZE;
    sec_param.kdist_own.enc  = 1;
    sec_param.kdist_own.id   = 1;
    sec_param.kdist_peer.enc = 1;
    sec_param.kdist_peer.id  = 1;

    err_code                 = pm_sec_params_set(&amp;amp;sec_param);
    APP_ERROR_CHECK(err_code);

    err_code = pm_register(pm_evt_handler);
    APP_ERROR_CHECK(err_code);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I believe it&amp;#39;s a security matter regarding the characteristic configuration... However I didn&amp;#39;t touch the original code from ble_dfu_unbonded.c :&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;uint32_t ble_dfu_buttonless_char_add(ble_dfu_buttonless_t *p_dfu)
{
    ble_add_char_params_t add_char_params;

    memset(&amp;amp;add_char_params, 0, sizeof(add_char_params));
    add_char_params.uuid                = BLE_DFU_BUTTONLESS_CHAR_UUID;
    add_char_params.uuid_type           = p_dfu-&amp;gt;uuid_type;
    add_char_params.char_props.indicate = 1;
    add_char_params.char_props.write    = 1;
    add_char_params.is_defered_write    = true;
    add_char_params.is_var_len          = true;
    add_char_params.max_len             = BLE_GATT_ATT_MTU_DEFAULT;

    add_char_params.cccd_write_access   = SEC_OPEN;
    add_char_params.write_access        = SEC_OPEN;
    add_char_params.read_access         = SEC_OPEN;

    return characteristic_add(p_dfu-&amp;gt;service_handle, &amp;amp;add_char_params, &amp;amp;p_dfu-&amp;gt;control_point_char);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;What&amp;#39;s the relationship between the peer manager configuration and the buttonless dfu&amp;#39;s characteristic behaviour ?&lt;/p&gt;
&lt;p&gt;Should I adjust some settings in ble_dfu_buttonless_char_add() ?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;
&lt;p&gt;Hugo&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Writing the simplest possible implementation of buttonless dfu</title><link>https://devzone.nordicsemi.com/thread/323089?ContentTypeID=1</link><pubDate>Tue, 03 Aug 2021 12:14:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:40fe85dd-bf02-473e-9bc9-767d9608b8ca</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The absolute simplest way is to ensure that the bootloader is built with&amp;nbsp;NRF_BL_DFU_ENTER_METHOD_GPREGRET set to 1 in it&amp;#39;s&amp;nbsp; sdk_config.h and then write to GPREGRET and reset as explained in &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/72902/force-enter-the-dfu-with-command/300645#300645"&gt;this post&lt;/a&gt;&amp;nbsp;from the application to enter DFU mode.&lt;/p&gt;
&lt;p&gt;Note that this is only possible when not using bonding, and it will not be possible to set a different advertising name which is useful for iOS as the (API does not expose the BLE address). With this approach there is no dependency on peer manager at all, or anything else for that matter.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>