This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Can not save boot loader setting (bootloader_settings_t) when disable IS_SRVC_CHANGED_CHARACT_PRESENT 0 in bootloader

I'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 the 

bootloader_settings_t cannot saved in method bootloader_settings_save of bootloader.c file

I have another test with enable IS_SRVC_CHANGED_CHARACT_PRESENT the dfu process was successful. 

  • What kind of application performance are you referring to? Setting IS_SRVC_CHANGED_CHARACT_PRESENT to 1 will simply include a characteristic in the GATT service, that's it. If you set it to 0 then you remove this characteristic. 

  • Yes, that's it. With removing Service Changed characteristic, i can also remove Generic Attribute service.  It will help improve the discovery time and improve our application performance.

  • The GATT Service is mandatory in Bluetooth Low Energy peripheral, you cannot remove it. 



    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.

  • Thanks,

    Finally i found where my code go wrong.

    /**@brief Function for the Application'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->header.evt_id)
        {
            case BLE_GAP_EVT_CONNECTED:
    
                m_conn_handle    = p_ble_evt->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,
                                                         &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;

    In above function, when we get BLE_GAP_EVT_DISCONNECTED,

    we also call

     

                    err_code = sd_ble_gatts_sys_attr_get(m_conn_handle,
                                                         sys_attr,
                                                         &sys_attr_len,
                                                         BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS);
                    APP_ERROR_CHECK(err_code);

    I don't know why we call that function, but it will return an 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 APP_ERROR_CHECK(err_code); line and use the original bootloader_settings_save method.

     

Related