<?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>Can not save boot loader setting (bootloader_settings_t) when disable IS_SRVC_CHANGED_CHARACT_PRESENT 0 in bootloader</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/36977/can-not-save-boot-loader-setting-bootloader_settings_t-when-disable-is_srvc_changed_charact_present-0-in-bootloader</link><description>I&amp;#39;m using SDK 12.2.0, SofDevice 3.0 and my chip nRF52832. 
 In my boot-loader project i disable IS_SRVC_CHANGED_CHARACT_PRESENT by define to 0. 
 The dfu process is completed and firmware was tranferred but boot-loader can not jump to application because</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 11 Sep 2018 03:00:17 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/36977/can-not-save-boot-loader-setting-bootloader_settings_t-when-disable-is_srvc_changed_charact_present-0-in-bootloader" /><item><title>RE: Can not save boot loader setting (bootloader_settings_t) when disable IS_SRVC_CHANGED_CHARACT_PRESENT 0 in bootloader</title><link>https://devzone.nordicsemi.com/thread/148116?ContentTypeID=1</link><pubDate>Tue, 11 Sep 2018 03:00:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7add9b37-8b00-4834-b3e4-6831d75ee31b</guid><dc:creator>Jason</dc:creator><description>&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Finally i found where my code go wrong.&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/**@brief Function for the Application&amp;#39;s S110 SoftDevice event handler.
 *
 * @param[in] p_ble_evt S110 SoftDevice event.
 */
static void on_ble_evt(ble_evt_t * p_ble_evt)
{
    uint32_t                              err_code;
    ble_gatts_rw_authorize_reply_params_t auth_reply;

    switch (p_ble_evt-&amp;gt;header.evt_id)
    {
        case BLE_GAP_EVT_CONNECTED:

            m_conn_handle    = p_ble_evt-&amp;gt;evt.gap_evt.conn_handle;
            m_is_advertising = false;
            break;

        case BLE_GAP_EVT_DISCONNECTED:
            {
                uint8_t  sys_attr[128];
                uint16_t sys_attr_len = 128;

                m_direct_adv_cnt = APP_DIRECTED_ADV_TIMEOUT;

                err_code = sd_ble_gatts_sys_attr_get(m_conn_handle,
                                                     sys_attr,
                                                     &amp;amp;sys_attr_len,
                                                     BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS);
                APP_ERROR_CHECK(err_code);

            }
            if (!m_tear_down_in_progress)
            {
                // The Disconnected event is because of an external event. (Link loss or
                // disconnect triggered by the DFU Controller before the firmware update was
                // complete).
                // Restart advertising so that the DFU Controller can reconnect if possible.
                advertising_start();
            }

            m_conn_handle = BLE_CONN_HANDLE_INVALID;

            break;&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;In above function, when we get&amp;nbsp;&lt;/span&gt;BLE_GAP_EVT_DISCONNECTED,&lt;/p&gt;
&lt;p&gt;we also call&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;pre class="ui-code" data-mode="c_cpp"&gt;                err_code = sd_ble_gatts_sys_attr_get(m_conn_handle,
                                                     sys_attr,
                                                     &amp;amp;sys_attr_len,
                                                     BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS);
                APP_ERROR_CHECK(err_code);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t know why we call that function, but it will return an&amp;nbsp;NRF_ERROR_NOT_FOUND and make system reboot. I think that removing service change characteristic make my Generic Attribute Service empty and make that error. So my current solution is remove&amp;nbsp;APP_ERROR_CHECK(err_code); line and use the original&amp;nbsp;bootloader_settings_save method.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can not save boot loader setting (bootloader_settings_t) when disable IS_SRVC_CHANGED_CHARACT_PRESENT 0 in bootloader</title><link>https://devzone.nordicsemi.com/thread/146670?ContentTypeID=1</link><pubDate>Fri, 31 Aug 2018 08:34:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fa4da080-6695-420d-9ea8-5d8a316572d9</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;The GATT Service is mandatory in Bluetooth Low Energy peripheral, you cannot remove it.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-5007f660c1c644cb8cfc2662012a2c8f/pastedimage1535704421370v1.png" alt=" " /&gt;&lt;br /&gt;&lt;br /&gt;You should also note that most smartphones cache the GATT table of peers so that they do not have to perform service discovery unless a Service Change notification is sent. If you do not add the SC characteristic.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can not save boot loader setting (bootloader_settings_t) when disable IS_SRVC_CHANGED_CHARACT_PRESENT 0 in bootloader</title><link>https://devzone.nordicsemi.com/thread/146603?ContentTypeID=1</link><pubDate>Fri, 31 Aug 2018 02:45:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1c0709bf-dbc0-4344-86be-2d0abf8e09b1</guid><dc:creator>Jason</dc:creator><description>&lt;p&gt;Yes, that&amp;#39;s it.&amp;nbsp;With removing Service Changed characteristic, i can also remove Generic Attribute service.&amp;nbsp; It will help improve the discovery time and improve our application performance.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can not save boot loader setting (bootloader_settings_t) when disable IS_SRVC_CHANGED_CHARACT_PRESENT 0 in bootloader</title><link>https://devzone.nordicsemi.com/thread/146561?ContentTypeID=1</link><pubDate>Thu, 30 Aug 2018 15:26:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:229c7948-6fc6-48f3-a41b-120661a6994e</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;What kind of application performance are you referring to? Setting&amp;nbsp;IS_SRVC_CHANGED_CHARACT_PRESENT to 1 will simply include a characteristic in the GATT service, that&amp;#39;s it. If you set it to 0 then you remove this characteristic.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can not save boot loader setting (bootloader_settings_t) when disable IS_SRVC_CHANGED_CHARACT_PRESENT 0 in bootloader</title><link>https://devzone.nordicsemi.com/thread/146387?ContentTypeID=1</link><pubDate>Thu, 30 Aug 2018 02:28:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:17011379-ae50-4c59-a5ae-5144a98333da</guid><dc:creator>Jason</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/members/bjorn_2d00_spockeli"&gt;bjorn-spockeli&lt;/a&gt;&amp;nbsp;We think that disable&amp;nbsp;&lt;span&gt;IS_SRVC_CHANGED_CHARACT_PRESENT will&amp;nbsp;improve our&amp;nbsp;application performance. So we have to do the same in bootloader to support DFU process in IOS app. Everything is ok but this issue. Please reply if you have any idea about. Thanks.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can not save boot loader setting (bootloader_settings_t) when disable IS_SRVC_CHANGED_CHARACT_PRESENT 0 in bootloader</title><link>https://devzone.nordicsemi.com/thread/146219?ContentTypeID=1</link><pubDate>Wed, 29 Aug 2018 07:18:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9859c377-56d1-4499-a756-f67ad3b4bca7</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/members/hoai-nguyen"&gt;Jason&lt;/a&gt;: In the event log I saw that you replied, but i cant see the reply in the messages section, did you delete it?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can not save boot loader setting (bootloader_settings_t) when disable IS_SRVC_CHANGED_CHARACT_PRESENT 0 in bootloader</title><link>https://devzone.nordicsemi.com/thread/142847?ContentTypeID=1</link><pubDate>Fri, 03 Aug 2018 13:32:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e7c30545-573f-4e22-a7fe-e8a79e7ac6ba</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Could you elaborate on the reason for disabling IS_SRVC_CHANGED_CHARACT_PRESENT both in the application and the bootloader?&lt;/p&gt;
&lt;p&gt;Removing the&amp;nbsp;pstorage_clear() call is not a good idea since the following&amp;nbsp;pstorage_store wil then not be able to write the data pointed to by&amp;nbsp;p_settings correctly to flash as it is not cleared prior to the write operation.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can not save boot loader setting (bootloader_settings_t) when disable IS_SRVC_CHANGED_CHARACT_PRESENT 0 in bootloader</title><link>https://devzone.nordicsemi.com/thread/142718?ContentTypeID=1</link><pubDate>Fri, 03 Aug 2018 03:59:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:90b7900f-c02d-4882-b597-a2b46232e605</guid><dc:creator>Jason</dc:creator><description>&lt;p&gt;Thanks for your reply,&lt;/p&gt;
&lt;p&gt;I have reason to disable&amp;nbsp;&lt;span&gt;IS_SRVC_CHANGED_CHARACT_PRESENT both in my application and&lt;/span&gt;&amp;nbsp;boot loader.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Right now, i can do the dfu process with some changes in&amp;nbsp;&lt;span&gt;bootloader_settings_save method.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;This is&amp;nbsp;my old code. When dfu process completed, we call&amp;nbsp;bootloader_settings_save method to clear and save the boot loader setting. And we will not received&amp;nbsp;&lt;/span&gt;&lt;span class="s1"&gt;callbacks&lt;/span&gt; from &lt;span class="s1"&gt;pstorage&lt;/span&gt; module.&lt;/p&gt;
&lt;p class="p1"&gt;&lt;span class="s1"&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void bootloader_settings_save(bootloader_settings_t * p_settings)
{
    uint32_t err_code = pstorage_clear(&amp;amp;m_bootsettings_handle, sizeof(bootloader_settings_t));
    APP_ERROR_CHECK(err_code);

    err_code = pstorage_store(&amp;amp;m_bootsettings_handle,
                              (uint8_t *)p_settings,
                              sizeof(bootloader_settings_t),
                              0);
    APP_ERROR_CHECK(err_code);
}

void bootloader_dfu_update_process(dfu_update_status_t update_status)
{
    static bootloader_settings_t  settings;
    const bootloader_settings_t * p_bootloader_settings;

    bootloader_util_settings_get(&amp;amp;p_bootloader_settings);

    if (update_status.status_code == DFU_UPDATE_APP_COMPLETE)
    {
        settings.bank_0_crc  = update_status.app_crc;
        settings.bank_0_size = update_status.app_size;
        settings.bank_0      = BANK_VALID_APP;
        settings.bank_1      = BANK_INVALID_APP;

        m_update_status      = BOOTLOADER_SETTINGS_SAVING;
        bootloader_settings_save_completed(&amp;amp;settings);
    }
    
    ....&lt;/pre&gt;&lt;/span&gt;&lt;span class="s1"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="p1"&gt;&lt;span class="s1"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="p1"&gt;&lt;span class="s1"&gt;In my new code. I remove the line call pstorage_clear and the dfu process was successful and boot loader can jump in to application.&lt;/span&gt;&lt;/p&gt;
&lt;p class="p1"&gt;&lt;span class="s1"&gt;&lt;pre class="ui-code" data-mode="text"&gt;static void bootloader_settings_save_completed(bootloader_settings_t * p_settings)
{
    uint32_t err_code = pstorage_store(&amp;amp;m_bootsettings_handle,
                              (uint8_t *)p_settings,
                              sizeof(bootloader_settings_t),
                              0);
    APP_ERROR_CHECK(err_code);
}


void bootloader_dfu_update_process(dfu_update_status_t update_status)
{
    static bootloader_settings_t  settings;
    const bootloader_settings_t * p_bootloader_settings;

    bootloader_util_settings_get(&amp;amp;p_bootloader_settings);

    if (update_status.status_code == DFU_UPDATE_APP_COMPLETE)
    {
        settings.bank_0_crc  = update_status.app_crc;
        settings.bank_0_size = update_status.app_size;
        settings.bank_0      = BANK_VALID_APP;
        settings.bank_1      = BANK_INVALID_APP;

        m_update_status      = BOOTLOADER_SETTINGS_SAVING;
        bootloader_settings_save_completed(&amp;amp;settings);
    }
    
    ...&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="p1"&gt;&lt;span class="s1"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="p1"&gt;&lt;span class="s1"&gt;So i think the reason for my problem is calling&lt;/span&gt;&lt;/p&gt;
&lt;p class="p1"&gt;pstorage_clear(&amp;amp;m_bootsettings_handle, &lt;span class="s1"&gt;sizeof&lt;/span&gt;(&lt;span class="s2"&gt;bootloader_settings_t&lt;/span&gt;));&lt;/p&gt;
&lt;p class="p1"&gt;But i can not understand why calling that method is making error?&lt;/p&gt;
&lt;p class="p2"&gt;&lt;/p&gt;
&lt;p class="p1"&gt;&lt;span class="s1"&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can not save boot loader setting (bootloader_settings_t) when disable IS_SRVC_CHANGED_CHARACT_PRESENT 0 in bootloader</title><link>https://devzone.nordicsemi.com/thread/142144?ContentTypeID=1</link><pubDate>Tue, 31 Jul 2018 11:49:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d9301e64-4458-4580-885c-544a09310008</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;I am afraid that I dont understand what the issue. Why are you removing the Service Changed Characteristic in the bootloader project if that results in it not working? Unless there is a specific reason for removing the SC characteristic, then keep it in.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>