<?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>NRF51 SDK 9.0.0 S110 Buttonless DFU Issue (Segger Embedded Studio)</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/82980/nrf51-sdk-9-0-0-s110-buttonless-dfu-issue-segger-embedded-studio</link><description>Hi there, I am working with an application that uses the NRF51 chip (through the Taiyo Yuden EYSGCNZWY BLE module) and am trying to implement buttonless DFU. I am having issues starting DFU when enabling through the Legacy DFU Service from the application</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 10 Jan 2022 10:31:18 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/82980/nrf51-sdk-9-0-0-s110-buttonless-dfu-issue-segger-embedded-studio" /><item><title>RE: NRF51 SDK 9.0.0 S110 Buttonless DFU Issue (Segger Embedded Studio)</title><link>https://devzone.nordicsemi.com/thread/346886?ContentTypeID=1</link><pubDate>Mon, 10 Jan 2022 10:31:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0379dea0-a8d7-42a1-8714-495cbd3aa90c</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;If you are using a watchdog timer in your application, you must add that in the bootloader as well, if it isn&amp;#39;t there already (the later SDKs does this automatically). So what is the reason that the DFU is not starting? Is it because GPREGRET != 0xB1? Have you tried setting it to 0xB1 from your application, then?&lt;/p&gt;
&lt;p&gt;I am sorry, but I struggle to see the difference between your bootloader and the one that you refer to as &amp;quot;&lt;span&gt;ble_app_hrs_s110_with_dfu_pca10028 bootloader&amp;quot;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Edvin&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF51 SDK 9.0.0 S110 Buttonless DFU Issue (Segger Embedded Studio)</title><link>https://devzone.nordicsemi.com/thread/346586?ContentTypeID=1</link><pubDate>Fri, 07 Jan 2022 03:07:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3466f0ae-ea41-4785-9d1e-5bbf9864ff9a</guid><dc:creator>EmbedCortex</dc:creator><description>&lt;p&gt;Hi Edvin,&lt;br /&gt;&lt;br /&gt;Thanks for the suggestion - I had been debugging the bootloader but through continued debugging with the desktop_keyboard bootloader I was able to see the DFU upload wasn&amp;#39;t getting past the wait_for_events() function and more specifically the sd_app_evt_wait() function in bootloader.c. Doing further research into this issue I found an article that discussed the cause of this issue in SDK9 (&lt;a href="https://www.programmerall.com/article/8197885958/"&gt;&lt;/a&gt;&lt;a href="https://www.programmerall.com/article/8197885958/"&gt;https://www.programmerall.com/article/8197885958/&lt;/a&gt;).&lt;br /&gt;&lt;br /&gt;To summarize, I had the watchdog initialized in my application. By adding the watchdog feeding the DFU was not halted which was the cause of the continuous reset while in the bootloader. Now my custom application based on the desktop_keyboard project performs DFU the same was as the desktop_keyboard reference project. The challenge is still that the desktop_keyboard reference project does not perform DFU in the way I would like. As I explained previously, the desktop_keyboard reference initiates the DFU process from the application, then the device disconnects and advertises as DfuTarg. Then I can connect to DfuTarg and re-initiate the DFU process which completes successfully.&lt;br /&gt;&lt;br /&gt;The&amp;nbsp;&lt;span&gt;ble_app_hrs_s110_with_dfu_pca10028 example has a more desirable DFU process that doesn&amp;#39;t require reconnecting, however, making the watchdog changes to this example bootloader didn&amp;#39;t solve it for the custom application. Using the same custom application with the single_bank_ble_s110 bootloader and the watchdog feeding the DFU works the same as the desktop_keyboard example - not like the ble_app_hrs_s110_with_dfu_pca10028 example. When debugging the custom application it makes it to the&amp;nbsp;bootloader_start() function, but halts&amp;nbsp;before getting to bootloader_util_app_start(). When using the bootloader from the ble_app_hrs_s110_with_dfu_pca10028 bootloader (aka single_bank_ble_s110) I did implement a few changes in the application:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span&gt;Added a reset_prepare() function (see below)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Added&amp;nbsp;dfu_app_peer_data_set() call in bootloader_start() function&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;static void reset_prepare(void)
{
    uint32_t err_code;

    if (s_conn_handle != BLE_CONN_HANDLE_INVALID)
    {
        // Disconnect from peer.
        err_code = sd_ble_gap_disconnect(s_conn_handle, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
        APP_ERROR_CHECK(err_code);
    }
    else
    {
        // If not connected, the device will be advertising. Hence stop the advertising.
        advertising_stop();
    }

    err_code = ble_conn_params_stop();
    APP_ERROR_CHECK(err_code);

    nrf_delay_ms(500);
}&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;static void bootloader_start(uint16_t conn_handle)
{
    uint32_t err_code;
    uint16_t sys_serv_attr_len = sizeof(m_peer_data.sys_serv_attr);

    err_code = sd_ble_gatts_sys_attr_get(conn_handle,
                                         m_peer_data.sys_serv_attr,
                                         &amp;amp;sys_serv_attr_len,
                                         BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS);
      
    if (err_code != NRF_SUCCESS)
    {
        // Any error at this stage means the system service attributes could not be fetched.
        // This means the service changed indication cannot be sent in DFU mode, but connection
        // is still possible to establish.
    }

    m_reset_prepare();
    
    err_code = sd_power_gpregret_set(BOOTLOADER_DFU_START);
    APP_ERROR_CHECK(err_code);

    err_code = sd_softdevice_disable();
    APP_ERROR_CHECK(err_code);

    err_code = sd_softdevice_vector_table_base_set(NRF_UICR-&amp;gt;BOOTLOADERADDR);
    APP_ERROR_CHECK(err_code);

    dfu_app_peer_data_set(conn_handle);
    NVIC_ClearPendingIRQ(SWI2_IRQn);
    interrupts_disable();
    
    bootloader_util_app_start(NRF_UICR-&amp;gt;BOOTLOADERADDR);
}&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The watchdog appears to timeout and the bootloader does start, but since it wasn&amp;#39;t entered via the application (and setting GPREGRET = 0xB1), the DFU process doesn&amp;#39;t start and a reconnection loop starts.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF51 SDK 9.0.0 S110 Buttonless DFU Issue (Segger Embedded Studio)</title><link>https://devzone.nordicsemi.com/thread/346368?ContentTypeID=1</link><pubDate>Thu, 06 Jan 2022 08:31:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2bbc6af2-3252-41b0-9cd9-bef175abcfb7</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Have you tried to debug the bootloader to find out why it starts the application, and doesn&amp;#39;t start in DFU mode? From your bootloader_start() function, there is a function that is called: sd_power_gpregret_set(BOOTLOADER_DFU_START);&lt;/p&gt;
&lt;p&gt;Is this register read in your bootloader? Is it searching for the same value that you set in your application (BOOTLOADER_DFU_START), and does this parameter (definition) have the same hexadecimal value in the bootloader and in your application?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I am not in detail familiar with these old bootloaders (the generation before the secure_bootloader from SDK ~12).&amp;nbsp;If you can&amp;#39;t find where your bootloader reads the gpregret register, perhaps you can zip the bootloader and upload it here on DevZone?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF51 SDK 9.0.0 S110 Buttonless DFU Issue (Segger Embedded Studio)</title><link>https://devzone.nordicsemi.com/thread/346332?ContentTypeID=1</link><pubDate>Thu, 06 Jan 2022 03:30:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5daaef25-191b-4ba8-834a-abb56ba611a4</guid><dc:creator>EmbedCortex</dc:creator><description>&lt;p&gt;Hi Edvin,&lt;br /&gt;&lt;br /&gt;Thanks for addressing my question. I have done quite a bit more digging and have some more details.&lt;/p&gt;
&lt;p&gt;The project that our application is based on is the nrfreadydesktop2v310 project &amp;#39;desktop_keyboard&amp;#39; which is a reference design developed by Nordic. In our application the pairing was changed to not require a passkey entry by using&amp;nbsp;BLE_GAP_IO_CAPS_NONE. Beyond that, the DFU handling in our application is very similar to (if not exactly copied from) the desktop_keyboard project.&lt;/p&gt;
&lt;p&gt;Using the bootloader provided in the desktop_keyboard example project I observed the following:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Upload softdevice and bootloader (with modified clock frequency for the&amp;nbsp;&lt;span&gt;Taiyo Yuden EYSGCNZWY BLE module, and single bank rather than dual bank)&lt;/span&gt;.&lt;/li&gt;
&lt;li&gt;Device starts advertising as DfuTarg and I can upload the application using nRF Connect successfully.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Application starts normally and I can pair with it using nRF Connect.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Initiate DFU using nRF Connect, but bootloader does not start the DFU process and instead jumps right to the application. This process repeats indefinitely.&amp;nbsp;&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;This is the bootloader_start function in the application (directly copied from desktop_keyboard project):&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static void bootloader_start(uint16_t conn_handle)
{
    uint32_t err_code;
    uint16_t sys_serv_attr_len = sizeof(m_peer_data.sys_serv_attr);

    err_code = sd_ble_gatts_sys_attr_get(conn_handle,
                                         m_peer_data.sys_serv_attr,
                                         &amp;amp;sys_serv_attr_len,
                                         BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS);
      
    if (err_code != NRF_SUCCESS)
    {
        // This means the service changed indication cannot be sent in DFU mode, but connection
        // is still possible to establish.
    }

    m_reset_prepare();
    
    err_code = sd_power_gpregret_set(BOOTLOADER_DFU_START);
    APP_ERROR_CHECK(err_code);

    err_code = sd_softdevice_disable();
    APP_ERROR_CHECK(err_code);

    err_code = sd_softdevice_vector_table_base_set(NRF_UICR-&amp;gt;BOOTLOADERADDR);
    APP_ERROR_CHECK(err_code);

    NVIC_ClearPendingIRQ(SWI2_IRQn);
    interrupts_disable();
    bootloader_util_app_start(NRF_UICR-&amp;gt;BOOTLOADERADDR);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Another test I did was using the bootloader and ble_app_hrs_s110_with_dfu_pca10028 example from SDK9. To check if the segger import was the issue, I moved the&amp;nbsp;&lt;span&gt;ble_app_hrs_s110_with_dfu_pca10028 application to Segger. I uploaded the bootloader and application via DFU, and am also able to perform DFU initiated by the application.&amp;nbsp;&lt;strong&gt;This is the desired result.&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The last test I ran was using the desktop_keyboard reference project with as limited changes as possible since this is likely the closest relation to the custom application. The main changes involved disabling the keyboard matrix and key scanning as well as using BLE_GAP_IO_CAPS_NONE. I can pair with the device and initiate the DFU process. The device then disconnects and starts advertising as DfuTarg. At that point I am able to connect to the DfuTarg device and re-initiate the DFU process which then completes. This isn&amp;#39;t the exact behaviour I am looking for, however, it is different than what I am observing with the custom application.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Once again, any help would be greatly appreciated!&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF51 SDK 9.0.0 S110 Buttonless DFU Issue (Segger Embedded Studio)</title><link>https://devzone.nordicsemi.com/thread/344639?ContentTypeID=1</link><pubDate>Tue, 21 Dec 2021 14:46:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3c6d4ddc-a50f-4322-97a3-1e693d19a04d</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Since the peer manager (or perhaps it was called device manager in the old SDKs) stores the bonding data in flash, make sure that the bootloader has set aside some pages for &amp;quot;application persistent storage&amp;quot;. Look in your bootloaders sdk_config.h for any parameters/definitions that could resemble this.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Also make sure that your application is aware of the bootloader, so that it sets the flash pages used by the device manager beneath the bootloader.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Due to holiday season in Norway we are a bit short staffed from now until the beginning of January. Please expect some delay in answers during this period.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>