<?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>Buttonless OTA Hanging</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/63330/buttonless-ota-hanging</link><description>I am using nRF52840 with SDK16 building with armgcc and trying to intergrate buttonless OTA into my project. 
 App details: 
 
 Based on the ble_app_hrs_freertos example project
 
 Peer manager disabled as it was causing issues with USB DFU 
 
 
 CDC</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 15 Jul 2020 09:54:17 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/63330/buttonless-ota-hanging" /><item><title>RE: Buttonless OTA Hanging</title><link>https://devzone.nordicsemi.com/thread/260090?ContentTypeID=1</link><pubDate>Wed, 15 Jul 2020 09:54:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ce142674-fcf8-45e2-974a-33acdc3468ab</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Kyle,&amp;nbsp;&lt;br /&gt;If it&amp;#39;s called in&amp;nbsp;&lt;span&gt;ble_stack_init() then you should not call it again in usb_dfu_transport_init(). &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Or you can just ignore the error if you receive&amp;nbsp;NRF_ERROR_MODULE_ALREADY_INITIALIZED.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Buttonless OTA Hanging</title><link>https://devzone.nordicsemi.com/thread/259984?ContentTypeID=1</link><pubDate>Tue, 14 Jul 2020 18:32:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:380b2926-c27a-46ba-90a1-c85ae5f7ffb8</guid><dc:creator>kfinch</dc:creator><description>&lt;p&gt;Is the handling/detecting of USB power events to help with USB enumerating as a DFU device?&lt;/p&gt;
&lt;p&gt;I tried your suggestion of calling nrf_drv_power_init() before the softdevice is initialized in ble_stack_init() and reverted the changes I made to nrf_drv_power_init(). I could not get USB to enumerate as a DFU device with those changes. With a breakpoint in nrf_drv_power_init() I saw that it got called twice, once by ble_stack_init() and again by&amp;nbsp;usb_dfu_transport_init().&lt;/p&gt;
&lt;p&gt;Falling back to my original changes, I did see it enumerate. Is there something else that I might be missing to go along with your suggestions to get USB to enumerate in DFU?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Buttonless OTA Hanging</title><link>https://devzone.nordicsemi.com/thread/259906?ContentTypeID=1</link><pubDate>Tue, 14 Jul 2020 12:24:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c01997cc-92ad-471b-b290-6709de517d42</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Kyle,&amp;nbsp;&lt;br /&gt;nrf_drv_power_init() should be called before the softdevice initialized. You may want to change the location that the function is called to before softdevice initialized (inside ble_stack_init() in nrf_dfu_ble.c )&amp;nbsp;&lt;br /&gt;The main purpose for the nrf_drv_power is to handle/detect USB power event.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Buttonless OTA Hanging</title><link>https://devzone.nordicsemi.com/thread/259752?ContentTypeID=1</link><pubDate>Mon, 13 Jul 2020 16:53:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fb4a2c35-dc51-4cd1-9efe-2cb48fb7ccc6</guid><dc:creator>kfinch</dc:creator><description>&lt;p&gt;Hello,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I was able to debug the bootloader and found where it was failing. After calling the transport init for BLE, I was able to step through&amp;nbsp;usb_dfu_transport_init() -&amp;gt;&amp;nbsp;&amp;nbsp;nrf_drv_power_init() and was returning NRF_ERROR_INVALID_STATE below at line 10:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;ret_code_t nrf_drv_power_init(nrf_drv_power_config_t const* p_config)
{
    if (m_initialized)
    {
        return NRF_ERROR_MODULE_ALREADY_INITIALIZED;
    }

    if (nrf_sdh_is_enabled())
    {
        return NRF_ERROR_INVALID_STATE;
    }
    
    if (p_config == NULL)
    {
        p_config = &amp;amp;m_drv_power_config_default;
    }

    ret_code_t err_code = nrfx_power_init(p_config);
    if (err_code == NRFX_SUCCESS)
    {
        m_initialized = true;
    }
    return err_code;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I tried to figure out if this was an issue with any of the sdk_config flags but had no luck. After reading&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/25890/ble-and-usb-can-t-work-at-the-same-time-on-nrf52840"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/25890/ble-and-usb-can-t-work-at-the-same-time-on-nrf52840&lt;/a&gt;, I ended up returning SUCCESS here instead and have been able to successfully perform OTA and USB DFU.&lt;/p&gt;
&lt;p&gt;Does this make sense to you? I worry about whether or not this is the correct fix. I checked SDK v17 to see if this had been changed and it had not.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Buttonless OTA Hanging</title><link>https://devzone.nordicsemi.com/thread/259740?ContentTypeID=1</link><pubDate>Mon, 13 Jul 2020 15:14:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f4e88c0b-23f3-4d4c-ac4b-63866ee42182</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Kyle,&amp;nbsp;&lt;br /&gt;Sorry for late reply I was on vacation last week.&amp;nbsp;&lt;br /&gt;I don&amp;#39;t think there is much modification between the SDK v15.2 and SDK v16.&amp;nbsp;&lt;br /&gt;I would suggest to have a look at my example and try to port the same in SDK v16.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If the issue persist we would need to debug the bootloader and check what caused the issue.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Buttonless OTA Hanging</title><link>https://devzone.nordicsemi.com/thread/258869?ContentTypeID=1</link><pubDate>Tue, 07 Jul 2020 17:03:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:84cdd8a5-62b3-4fb1-8090-7d9310ba5a93</guid><dc:creator>kfinch</dc:creator><description>&lt;p&gt;After more digging on the Devzone, I think this ticket describes the issue that I am seeing:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/35431/dfu-over-ble-and-usb"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/35431/dfu-over-ble-and-usb&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I saw that you were able to get something to work for nRF52832 SDK15. Any ideas what needs to be done for nRF52840 SDK16?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Buttonless OTA Hanging</title><link>https://devzone.nordicsemi.com/thread/258697?ContentTypeID=1</link><pubDate>Tue, 07 Jul 2020 00:40:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ce2f24e1-8372-4861-92c5-98d0d40aedd6</guid><dc:creator>kfinch</dc:creator><description>&lt;p&gt;Hello,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thank you for your response. I confirmed that svci is configured for both the application and the bootloader.&lt;/p&gt;
&lt;p&gt;With more investigation today, I found that the device was successfully getting into DFU, but after some time, the nRF Toolbox App would report &amp;quot;Upload Failed: DFU_DEVICE_DISCONNECTED&amp;quot;. I was able to get the device into DFU mode and see if it was advertising and saw that it was as &amp;quot;DfuTarg&amp;quot; as expected from the sdk_config. But I am confused why the advertising name was able to change from the product name since I still have &lt;strong&gt;ble_dfu_buttonless_async_svci_init()&lt;/strong&gt; commented out.&lt;/p&gt;
&lt;p&gt;Since I also have USB DFU implemented, I attempted to disable the USB DFU functionality so that my bootloader was only configured for OTA DFU. With that version of the bootloader, I was able to perform an OTA using the &amp;quot;nRF Connect&amp;quot; app (saw in another post that it might work better).&lt;/p&gt;
&lt;p&gt;So now the question has evolved to why does having USB DFU functionality enabled prevent OTA from staying connected and completing? Using the &amp;quot;--print-memory-usage&amp;quot;&amp;quot; GCC flag, I see that the bootloader is using 45% of&amp;nbsp; the reserved 56 kB of FLASH, so it doesn&amp;#39;t seem like a memory issue.&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Buttonless OTA Hanging</title><link>https://devzone.nordicsemi.com/thread/258323?ContentTypeID=1</link><pubDate>Fri, 03 Jul 2020 12:54:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2f8ab8e5-516b-49fe-9db2-98e0a192ef51</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Kyle,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you remove&amp;nbsp;&lt;strong&gt;ble_dfu_buttonless_async_svci_init() &lt;/strong&gt;the application won&amp;#39;t be able to call the svc function provided by the softdevice, namely&amp;nbsp;nrf_dfu_set_adv_name() function. This function allow the bootloader to change the advertising name to the name desired by the application. This may not be the functionality that you need.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;But you need to skip the call for&amp;nbsp;&lt;span&gt;nrf_dfu_set_adv_name() and nrf_dfu_set_adv_name_on_sys_evt in the code.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;You may need to check your bootloader to see if it&amp;#39;s configured the svci functions correctly.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;But anyway, in the end of the day the only thing the application need to do to switch from application to the bootloader is to write to the GPREGRET register value BOOTLOADER_DFU_START and trigger a soft reset (please have a look at&amp;nbsp;ble_dfu_buttonless_bootloader_start_finalize() function). The bootloader will read the GPREGRET register and decide to enter the DFU booting or not.&amp;nbsp;&lt;br /&gt;You may need to trigger a disconnection to the application before that, but that&amp;#39;s not obligated (just to avoid the&amp;nbsp;delay to wait for the connection timeout)&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>