<?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>Using app_with_dfu jump to bootloader.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/14755/using-app_with_dfu-jump-to-bootloader</link><description>Hi all: 
 I use the softdevice 2.0.0 and compile bootloader example with &amp;quot;dual bank&amp;quot; on the nrf52 DK, 
 Running a system that can using DFU from app then jump to bootloader as example hrm did. 
 After I have a deep study it, I found out that: 
 </description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 01 Jul 2016 16:05:34 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/14755/using-app_with_dfu-jump-to-bootloader" /><item><title>RE: Using app_with_dfu jump to bootloader.</title><link>https://devzone.nordicsemi.com/thread/56348?ContentTypeID=1</link><pubDate>Fri, 01 Jul 2016 16:05:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bfea31cf-5edc-487d-a15a-673ba0fdf283</guid><dc:creator>Coldson</dc:creator><description>&lt;p&gt;Add comment:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    else
    {
        // Keys were not available, thus we have a non-encrypted connection.
        err_code = dm_peer_addr_get(&amp;amp;m_dm_handle, &amp;amp;m_peer_data.addr);
        APP_ERROR_CHECK(err_code);

        err_code = sd_softdevice_vector_table_base_set(NRF_UICR-&amp;gt;NRFFW[0]);
        APP_ERROR_CHECK(err_code);
        
        err_code = dfu_ble_svc_peer_data_set(&amp;amp;m_peer_data);
        APP_ERROR_CHECK(err_code);
    }
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;don&amp;#39;t forget to add to this line also.&lt;/p&gt;
&lt;p&gt;Fixed!!!!!!!!!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using app_with_dfu jump to bootloader.</title><link>https://devzone.nordicsemi.com/thread/56346?ContentTypeID=1</link><pubDate>Fri, 01 Jul 2016 15:19:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bcb3a576-cc93-47dc-8b3d-62e9d6079b31</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;@Coldson: yes you can do that also, the root cause is that we use UART when we already forwarded the interrupt vector table, using sd_softdevice_vector_table_base_set(). After that call, we should not use any peripheral that can trigger interrupt.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using app_with_dfu jump to bootloader.</title><link>https://devzone.nordicsemi.com/thread/56345?ContentTypeID=1</link><pubDate>Fri, 01 Jul 2016 15:18:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3cea300d-b8c6-407f-87d2-445169874ef6</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Just updated my comment above.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using app_with_dfu jump to bootloader.</title><link>https://devzone.nordicsemi.com/thread/56344?ContentTypeID=1</link><pubDate>Fri, 01 Jul 2016 15:17:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:50e1be62-5ea1-4dc0-8800-87e45cfcf419</guid><dc:creator>Coldson</dc:creator><description>&lt;p&gt;I provide my work around solution:&lt;/p&gt;
&lt;p&gt;Mark all DM_TRC() in dm_peer_addr_get()function.&lt;/p&gt;
&lt;p&gt;Then it work fine.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using app_with_dfu jump to bootloader.</title><link>https://devzone.nordicsemi.com/thread/56347?ContentTypeID=1</link><pubDate>Fri, 01 Jul 2016 15:04:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2622ba41-e828-4a6e-8d19-6d64e0532662</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Coldson,&lt;/p&gt;
&lt;p&gt;Good news, I found a bug. It was because we redirect the vector table to the bootloader too early in the bootloader_start() function. So if you cut the 2 lines :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;err_code = sd_softdevice_vector_table_base_set(NRF_UICR-&amp;gt;NRFFW[0]);
APP_ERROR_CHECK(err_code);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In that function in dfu_app_handler.c.&lt;/p&gt;
&lt;p&gt;And paste them after the call to dm_peer_addr_get in the same file, in dfu_app_peer_data_set. It should be ok. It should look like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;  err_code = dm_handle_get(conn_handle, &amp;amp;m_dm_handle);
    if (err_code == NRF_SUCCESS)
    {
        err_code = dm_distributed_keys_get(&amp;amp;m_dm_handle, &amp;amp;key_set);
        if (err_code == NRF_SUCCESS)
        {
            APP_ERROR_CHECK(err_code);

            m_peer_data.addr              = key_set.keys_central.p_id_key-&amp;gt;id_addr_info;
            m_peer_data.irk               = key_set.keys_central.p_id_key-&amp;gt;id_info;
            m_peer_data.enc_key.enc_info  = key_set.keys_periph.enc_key.p_enc_key-&amp;gt;enc_info;
            m_peer_data.enc_key.master_id = key_set.keys_periph.enc_key.p_enc_key-&amp;gt;master_id;


            app_context_data   = (DFU_APP_ATT_TABLE_CHANGED &amp;lt;&amp;lt; DFU_APP_ATT_TABLE_POS);
            app_context.len    = sizeof(app_context_data);
            app_context.p_data = (uint8_t *)&amp;amp;app_context_data;
            app_context.flags  = 0;

            err_code = dm_application_context_set(&amp;amp;m_dm_handle, &amp;amp;app_context);
            APP_ERROR_CHECK(err_code);
		err_code = sd_softdevice_vector_table_base_set(NRF_UICR-&amp;gt;NRFFW[0]);
		APP_ERROR_CHECK(err_code);
            err_code = dfu_ble_svc_peer_data_set(&amp;amp;m_peer_data);
            APP_ERROR_CHECK(err_code);
        }
        else
        {
            // Keys were not available, thus we have a non-encrypted connection.
            err_code = dm_peer_addr_get(&amp;amp;m_dm_handle, &amp;amp;m_peer_data.addr);
            APP_ERROR_CHECK(err_code);
		err_code = sd_softdevice_vector_table_base_set(NRF_UICR-&amp;gt;NRFFW[0]);
		APP_ERROR_CHECK(err_code);

            err_code = dfu_ble_svc_peer_data_set(&amp;amp;m_peer_data);
            APP_ERROR_CHECK(err_code);
        }
    }
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using app_with_dfu jump to bootloader.</title><link>https://devzone.nordicsemi.com/thread/56343?ContentTypeID=1</link><pubDate>Fri, 01 Jul 2016 13:15:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cd8bb979-8ed8-4fcc-a591-671224830833</guid><dc:creator>Coldson</dc:creator><description>&lt;p&gt;@Hung Bui, the example hrm_with_dfu s132. I want to let log print on my console, so in this example need to modify log_uart_init() line 175, change APP_UART_FLOW_CONTROL_ENABLED to APP_UART_FLOW_CONTROL_DISABLED, then I can get the log on console. But it will let APPLICATION not jump to bootloader.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using app_with_dfu jump to bootloader.</title><link>https://devzone.nordicsemi.com/thread/56342?ContentTypeID=1</link><pubDate>Fri, 01 Jul 2016 13:07:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:867eb709-d0f9-4ce9-b410-f28f259d0536</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;@Coldson: which example I should test ? And I don&amp;#39;t understand this &amp;quot;because I need to open UART and let it print on my teraterm.So I need to let APP_UART_FLOW_CONTROL_ENABLED-&amp;gt;APP_UART_FLOW_CONTROL_DISABLED, or I will get nothing on my console.&amp;quot;
We are talking about the issue to jump from application to bootloader when UART is used in the application.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using app_with_dfu jump to bootloader.</title><link>https://devzone.nordicsemi.com/thread/56341?ContentTypeID=1</link><pubDate>Fri, 01 Jul 2016 13:02:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:814c4768-164d-423f-a06f-fd746add4336</guid><dc:creator>Coldson</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/nRF5_5F00_SDK_5F00_11.0.0_5F00_89a8197.7z"&gt;nRF5_SDK_11.0.0_89a8197.7z&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;@Hung Bui, because I need to open UART and let it print on my teraterm.&lt;/p&gt;
&lt;p&gt;So I need to let APP_UART_FLOW_CONTROL_ENABLED-&amp;gt;APP_UART_FLOW_CONTROL_DISABLED, or I will get nothing on my console.&lt;/p&gt;
&lt;p&gt;Thx&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using app_with_dfu jump to bootloader.</title><link>https://devzone.nordicsemi.com/thread/56340?ContentTypeID=1</link><pubDate>Fri, 01 Jul 2016 08:53:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6a16b43d-28d6-4ce0-9cee-76b8d0e1e465</guid><dc:creator>Coldson</dc:creator><description>&lt;p&gt;And for disable peripheral. Now I work around disable RTC while starting DFU, and it work. So the last problem  is the UART.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using app_with_dfu jump to bootloader.</title><link>https://devzone.nordicsemi.com/thread/56339?ContentTypeID=1</link><pubDate>Fri, 01 Jul 2016 08:48:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:19220015-dbf9-4385-a462-794f1cce357c</guid><dc:creator>Coldson</dc:creator><description>&lt;p&gt;Hi Hung Bui, u can reproduce this simply using the 11.0.0 sdk hrs_with_dfu and add define &amp;quot;ENABLE_DEBUG_LOG_SUPPORT&amp;quot; and try to upgrade the nrf52-DK, this is the problem I found.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using app_with_dfu jump to bootloader.</title><link>https://devzone.nordicsemi.com/thread/56338?ContentTypeID=1</link><pubDate>Fri, 01 Jul 2016 07:52:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dbd867a7-db62-4292-92d0-85a0ae7d1f8d</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Coldson,&lt;/p&gt;
&lt;p&gt;It could be the issue that one of the applications (your application or the bootloader) was using the peripheral (UART or RTC) without configure it properly. When switching from application to bootloader and vise versa, we don&amp;#39;t reset all the registers to default state. So it&amp;#39;s up to the application to make sure all the register are configured before using it. Also I would suggest to disable any timer, peripheral before branching to bootloader.&lt;/p&gt;
&lt;p&gt;Again, if you can provide an demo code that can reproduce the issue it&amp;#39;s would be easier for us to track down the problem and find a solution.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using app_with_dfu jump to bootloader.</title><link>https://devzone.nordicsemi.com/thread/56337?ContentTypeID=1</link><pubDate>Thu, 30 Jun 2016 16:21:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6964fc7c-4249-4915-a78a-2ac5cd9d59ee</guid><dc:creator>Coldson</dc:creator><description>&lt;p&gt;@Hung Bui, I integrate dfu example to my application again, and it must not enable UART and not init RTC then DFU work. But why? Are there something related with DFU flow?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using app_with_dfu jump to bootloader.</title><link>https://devzone.nordicsemi.com/thread/56336?ContentTypeID=1</link><pubDate>Tue, 28 Jun 2016 15:11:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a142d4f5-509a-4e89-8b31-8c4e839e0f64</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;@Coldson: I mean you can try to integrate the DFU service in any example in the SDK (not the ready made hrm with dfu) , and test jumping to bootloader, if it doesn&amp;#39;t work you can send us that example.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using app_with_dfu jump to bootloader.</title><link>https://devzone.nordicsemi.com/thread/56335?ContentTypeID=1</link><pubDate>Tue, 28 Jun 2016 14:49:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a34e0c30-c457-4ee4-b5e5-adfce8d9256c</guid><dc:creator>Coldson</dc:creator><description>&lt;p&gt;It work on hrm with DFU example but fail on my own application, I will keep check my application. Thx.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using app_with_dfu jump to bootloader.</title><link>https://devzone.nordicsemi.com/thread/56334?ContentTypeID=1</link><pubDate>Tue, 28 Jun 2016 14:06:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:88ef59f0-f751-45d4-99e1-f7274648078a</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;@Coldson: I would suggest to test with an example (any example) in the SDK. If it doesn&amp;#39;t work, please send the code here and we can check what could be wrong.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using app_with_dfu jump to bootloader.</title><link>https://devzone.nordicsemi.com/thread/56333?ContentTypeID=1</link><pubDate>Tue, 28 Jun 2016 12:55:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e7d7f1bc-d687-4d15-9a28-446fb8557d12</guid><dc:creator>Coldson</dc:creator><description>&lt;p&gt;Hi, Hung Bui, if I set break point at line 111, it will never enter that line(111).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using app_with_dfu jump to bootloader.</title><link>https://devzone.nordicsemi.com/thread/56332?ContentTypeID=1</link><pubDate>Tue, 28 Jun 2016 07:52:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9a162127-494d-4e41-b705-0db2cb68e724</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Coldson,
I assume that you have flashed the bootloader (the \examples\dfu\bootloader project) in addition to your application.&lt;/p&gt;
&lt;p&gt;The dfu_ble_svc_peer_data_set(&amp;amp;m_peer_data); is an SVC call, and the code is in the bootloader not in the application, you won&amp;#39;t be able to step through it, please add a break point after that call.&lt;/p&gt;
&lt;p&gt;Please let me know what happen if you add breakpoint at line 111 instead of line 110.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using app_with_dfu jump to bootloader.</title><link>https://devzone.nordicsemi.com/thread/56331?ContentTypeID=1</link><pubDate>Mon, 27 Jun 2016 16:33:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:96e76faa-f50a-4752-928c-386b8cc6bfd3</guid><dc:creator>Coldson</dc:creator><description>&lt;p&gt;@Hung Bui, I add break point there because the whole flow will not end at the function :&amp;quot;bootloader_util_app_start(NRF_UICR-&amp;gt;NRFFW[0]);&amp;quot;, and jump to bootloader, so I add breakpoint to find which code are going wrong, I will keep find the solution. I will share the root cause in this topic if there&amp;#39;re any progress.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using app_with_dfu jump to bootloader.</title><link>https://devzone.nordicsemi.com/thread/56330?ContentTypeID=1</link><pubDate>Mon, 27 Jun 2016 15:36:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fe476ae4-a351-482b-9b9e-93b2a9723a4a</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;@Coldson: That what I suggested, don&amp;#39;t add breakpoint on that function and the step over it. Add the breakpoint after the function instead. Or do you get hardfault when calling that ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using app_with_dfu jump to bootloader.</title><link>https://devzone.nordicsemi.com/thread/56329?ContentTypeID=1</link><pubDate>Mon, 27 Jun 2016 15:13:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1aa3669a-ab35-47fa-a318-d57d819dd399</guid><dc:creator>Coldson</dc:creator><description>&lt;p&gt;Hi, Hung Bui, there&amp;#39;re no return after that break point. And, Yes, I use the device manager in my application, I will check what I feed to that function as m_peer_data.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using app_with_dfu jump to bootloader.</title><link>https://devzone.nordicsemi.com/thread/56328?ContentTypeID=1</link><pubDate>Mon, 27 Jun 2016 13:36:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3dac078e-dfc5-4498-a5cc-6be138439cad</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Coldson,&lt;/p&gt;
&lt;p&gt;Which error code you got at step #4 ? you may want to add the break point after the call (one line after )&lt;/p&gt;
&lt;p&gt;Did you use device manager in your application ? What did you feed to the function as m_peer_data ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>