<?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 over BLE fails with GATT ERROR on nRF52840</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/120712/dfu-over-ble-fails-with-gatt-error-on-nrf52840</link><description>I am using a custom board with an nRF52840. For OTA updates, I’m using SDK 17.1.0 based on the sample codes: 
 
 
 Bootloader : secure_bootloader 
 
 
 Application : A custom application based on ble_app_blinky . 
 
 
 After flashing my custom application</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 16 Apr 2025 07:46:42 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/120712/dfu-over-ble-fails-with-gatt-error-on-nrf52840" /><item><title>RE: DFU over BLE fails with GATT ERROR on nRF52840</title><link>https://devzone.nordicsemi.com/thread/531964?ContentTypeID=1</link><pubDate>Wed, 16 Apr 2025 07:46:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d99fb061-5577-4cfe-a7f3-ae47b1f25f7f</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;br /&gt;I did a quick look but don&amp;#39;t see anything obviously missing in your code.&amp;nbsp;&lt;br /&gt;You may want to run in debug mode and break after&amp;nbsp;BLE_DFU_EVT_BOOTLOADER_ENTER event to see where the program counter is.&amp;nbsp;&lt;br /&gt;Please check if it&amp;#39;s still in the application or it&amp;#39;s jumped to the bootloader but bootloader&amp;nbsp;crash or something.&amp;nbsp;&amp;nbsp;&lt;br /&gt;You can try to test by forcing the device to enter bootloader mode (hold &amp;quot;enter bootloader mode&amp;quot; button when booting, or not flashing the application)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU over BLE fails with GATT ERROR on nRF52840</title><link>https://devzone.nordicsemi.com/thread/531915?ContentTypeID=1</link><pubDate>Tue, 15 Apr 2025 23:33:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:48b4da70-2674-4af5-aa90-f4988b305cd9</guid><dc:creator>nxtyam</dc:creator><description>&lt;p class="" data-start="89" data-end="114"&gt;Thank you for your reply.&lt;/p&gt;
&lt;p class="" data-start="116" data-end="271"&gt;The phone is &lt;strong data-start="129" data-end="136"&gt;not&lt;/strong&gt; paired with the device.&lt;br data-start="160" data-end="163" /&gt; With the combination of &lt;code data-start="187" data-end="206"&gt;secure_bootloader&lt;/code&gt; and &lt;code data-start="211" data-end="227"&gt;ble_app_blinky&lt;/code&gt;, I was able to perform DFU without bonding.&lt;/p&gt;
&lt;p class="" data-start="116" data-end="271"&gt;＞Do you see the device switch to bootloader mode and advertise in bootloader mode (DFU_Targ)?&lt;br data-start="367" data-end="370" /&gt; No, it does &lt;strong data-start="382" data-end="389"&gt;not&lt;/strong&gt; switch to bootloader mode (it does not advertise as &lt;code data-start="442" data-end="451"&gt;DfuTarg&lt;/code&gt;).&lt;/p&gt;
&lt;p class="" data-start="457" data-end="692"&gt;Do I need to implement anything additional in &lt;code data-start="503" data-end="535"&gt;ble_dfu_buttonless_evt_handler&lt;/code&gt; in order to enter bootloader mode?&lt;br data-start="570" data-end="573" /&gt; It seems like the execution does &lt;strong data-start="606" data-end="613"&gt;not&lt;/strong&gt; reach &lt;code data-start="620" data-end="655"&gt;buttonless_dfu_sdh_state_observer&lt;/code&gt; at runtime. Could this be the issue?&lt;/p&gt;
&lt;p class="" data-start="694" data-end="841"&gt;Below is a snippet of the DFU-related code implemented in my custom application.&lt;br data-start="774" data-end="777" /&gt; If you notice anything missing or incorrect, please let me know.&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;NRF_PWR_MGMT_HANDLER_REGISTER(app_shutdown_handler, 0);
static bool app_shutdown_handler(nrf_pwr_mgmt_evt_t event)
{
    switch (event)
    {
        case NRF_PWR_MGMT_EVT_PREPARE_DFU:
            NRF_LOG_INFO(&amp;quot;Power management wants to reset to DFU mode.&amp;quot;);
            break;
        default:
            return true;
    }

    NRF_LOG_INFO(&amp;quot;Power management allowed to reset to DFU mode.&amp;quot;);
    return true;
}

static void buttonless_dfu_sdh_state_observer(nrf_sdh_state_evt_t state, void * p_context)
{
    if (state == NRF_SDH_EVT_STATE_DISABLED)
    {
        // Softdevice was disabled before going into reset. Inform bootloader to skip CRC on next boot.
        nrf_power_gpregret2_set(BOOTLOADER_DFU_SKIP_CRC);

        //Go to system off.
        nrf_pwr_mgmt_shutdown(NRF_PWR_MGMT_SHUTDOWN_GOTO_SYSOFF);
    }
}

NRF_SDH_STATE_OBSERVER(m_buttonless_dfu_state_obs, 0) =
{
    .handler = buttonless_dfu_sdh_state_observer,
};

static void ble_stack_init(void)
{
    ret_code_t err_code;

    err_code = nrf_sdh_enable_request();
    APP_ERROR_CHECK(err_code);

    // Configure the BLE stack using the default settings.
    // Fetch the start address of the application RAM.
    uint32_t ram_start = 0;
    err_code = nrf_sdh_ble_default_cfg_set(APP_BLE_CONN_CFG_TAG, &amp;amp;ram_start);
    APP_ERROR_CHECK(err_code);

    // Enable BLE stack.    
    err_code = nrf_sdh_ble_enable(&amp;amp;ram_start);
    APP_ERROR_CHECK(err_code);
    
    NRF_SDH_BLE_OBSERVER(m_ble_observer, APP_BLE_OBSERVER_PRIO, on_ble_evt, NULL);
}

static void services_init(void)
{
    // Initialize the DFU service
    ble_dfu_buttonless_init_t dfus_init =
    {
        .evt_handler = ble_dfu_buttonless_evt_handler
    };
    err_code = ble_dfu_buttonless_init(&amp;amp;dfus_init);
    APP_ERROR_CHECK(err_code);
}

int main(void)
{
　　ret_code_t err_code;
　　// Initialize the async SVCI interface to bootloader before any interrupts are enabled.
    err_code = ble_dfu_buttonless_async_svci_init();
    APP_ERROR_CHECK(err_code);
　　...
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p class="" data-start="694" data-end="841"&gt;Thanks in advance for your help!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU over BLE fails with GATT ERROR on nRF52840</title><link>https://devzone.nordicsemi.com/thread/531851?ContentTypeID=1</link><pubDate>Tue, 15 Apr 2025 13:13:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4a38fdd8-2958-46fc-956a-29269c9b0e46</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Have you bonded your device with the phone ?&amp;nbsp;&lt;br /&gt;Please make sure you have service changed characteristic in the custom application ?&amp;nbsp;&lt;br /&gt;Please try to test with the default&amp;nbsp;ble_app_buttonless_dfu example.&amp;nbsp;&lt;br /&gt;Do you see the device switch to bootloader mode and advertise in bootloader more (DFU_Targ) ?&amp;nbsp;&lt;br /&gt;Please try to test using nRF&amp;nbsp;Connect mobile app as well.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>