<?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 OTA nrftoolbox does not automatically reconnect when initiating dfu from application</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/6898/dfu-ota-nrftoolbox-does-not-automatically-reconnect-when-initiating-dfu-from-application</link><description>Hi, 
 I am developing some DFU OTA firmware for nRF51822, QFAAH0 (v3 silicon, 256kB ROM, 16kB flash), on a custom board, using SD110v8. Both my application and bootloader were adapted from the Keil pack examples. 
 I am experiencing a funny behaviour</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 12 Nov 2015 23:56:41 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/6898/dfu-ota-nrftoolbox-does-not-automatically-reconnect-when-initiating-dfu-from-application" /><item><title>RE: DFU OTA nrftoolbox does not automatically reconnect when initiating dfu from application</title><link>https://devzone.nordicsemi.com/thread/24326?ContentTypeID=1</link><pubDate>Thu, 12 Nov 2015 23:56:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:71b8e955-f09b-451b-bfc0-a9ec8c327d3c</guid><dc:creator>R. Kawajiri</dc:creator><description>&lt;p&gt;Hi, I am working with gcc. Could you tell me how to configure similar one with gcc?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU OTA nrftoolbox does not automatically reconnect when initiating dfu from application</title><link>https://devzone.nordicsemi.com/thread/24325?ContentTypeID=1</link><pubDate>Fri, 02 Oct 2015 22:18:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:296e8343-bf90-42f9-92a7-4cc0878f66fd</guid><dc:creator>Spirit</dc:creator><description>&lt;p&gt;@Mike I have an identical problem from your very firs post. I configured Zero Initialized Data to IRAM2 as @Hung Bui said, but the problem still persist :(
Could you plesase send me your code?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU OTA nrftoolbox does not automatically reconnect when initiating dfu from application</title><link>https://devzone.nordicsemi.com/thread/24324?ContentTypeID=1</link><pubDate>Sun, 24 May 2015 07:24:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e513bd06-3803-4762-926b-371dcf3f1b2c</guid><dc:creator>Mike</dc:creator><description>&lt;p&gt;Hi Hung, your solution worked. Thank you so much for your help! -Mike&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU OTA nrftoolbox does not automatically reconnect when initiating dfu from application</title><link>https://devzone.nordicsemi.com/thread/24323?ContentTypeID=1</link><pubDate>Thu, 21 May 2015 13:51:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:62e2e0ad-eb2a-4a56-bbf2-2f12924bdabb</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;@Mike: Looking at your code, I haven&amp;#39;t  seen the dfu_ble_svc.c file&amp;#39;s option has been configured with Zero Initialized Data to IRAM2. As shown in my answer above.&lt;/p&gt;
&lt;p&gt;After configured that, I managed to use your bootloader to update with bonding re-encrypted (hrs with dfu application).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU OTA nrftoolbox does not automatically reconnect when initiating dfu from application</title><link>https://devzone.nordicsemi.com/thread/24322?ContentTypeID=1</link><pubDate>Wed, 20 May 2015 12:08:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cef58f4f-d6ee-46bc-aa53-5b220499d02f</guid><dc:creator>Mike</dc:creator><description>&lt;p&gt;Hi Hung, I have created a case on mypage. The project is setup for my custom board, but it should load just fine on the new pca10028 dev board too.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU OTA nrftoolbox does not automatically reconnect when initiating dfu from application</title><link>https://devzone.nordicsemi.com/thread/24319?ContentTypeID=1</link><pubDate>Tue, 12 May 2015 09:31:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:25b07b2c-f3c3-4356-bc39-199db3144741</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;@Mike: sorry for that late response, I was on vacation.&lt;/p&gt;
&lt;p&gt;&amp;quot;how does the application decide where to put the peer data?&amp;quot;: The application doesn&amp;#39;t do the work to put data to the No-int area, it&amp;#39;s the SVC call dfu_ble_svc_set_peer_data() that will jump to dfu_ble_set_peer_data in the bootloader code. In side that dfu_ble_set_peer_data() it will copy the data from source (m_peer_data from application) to destination (no-init area).&lt;/p&gt;
&lt;p&gt;I&amp;#39;m not sure why the SVC call didn&amp;#39;t work or it couldn&amp;#39;t modify the No-init RAM area. If possible please send me your bootloader project file, I can try to reproduce the issue here.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU OTA nrftoolbox does not automatically reconnect when initiating dfu from application</title><link>https://devzone.nordicsemi.com/thread/24321?ContentTypeID=1</link><pubDate>Thu, 07 May 2015 15:43:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:687574b9-4a70-4aef-9feb-503ef45429b7</guid><dc:creator>Mike</dc:creator><description>&lt;p&gt;Hi Hung,
I have followed your instructions to debug. Indeed, the dfu_ble_get_peer_data() fails. I also looked at the RAW Memory data. For the default bootloader, I see the memory at address 0x3F80 onwards changes when the device restarts from the application. Whereas for my own bootloader, the data at 0x3F80 onwards stays the same (doesnt change at all). This suggests that when using my own bootloader, the peer data is not written to the RAM.&lt;/p&gt;
&lt;p&gt;However, my question is, I am using the same application for both cases, why would it only work with one particular bootloader?&lt;/p&gt;
&lt;p&gt;Another question I have is, how does the application decide where to put the peer data? As the NoInit RAM section is not set up for the application. So how does the application know that starting from 0x3F80 is the NoInit area?&lt;/p&gt;
&lt;p&gt;Thanks a lot. Mike&lt;/p&gt;
&lt;p&gt;EDIT:
I did a big of debugging on the application side. In particular, where the dfu_app_peer_data_set() is called. I noticed that the value in RAM doesnt get changed at all when this function is called. I added a bit of direct memory manipulation code with pointers, these code however changes the data in the RAM no problem. Please see the code below:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;        err_code = dfu_ble_svc_set_peer_data(&amp;amp;m_peer_data); 
                                 // the previous line didnt change anything in the RAM at 0x20003F80
        APP_ERROR_CHECK(err_code);
		
		uint8_t *ptr;
		ptr = (uint8_t*)0x20003F80;
		for (int i=0; i&amp;lt;6; i++) {
			*ptr = (uint8_t) m_peer_data.addr.addr[i];
			ptr++;				
		}
                                 // after the above line, the data in the RAM is changed accordingly
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU OTA nrftoolbox does not automatically reconnect when initiating dfu from application</title><link>https://devzone.nordicsemi.com/thread/24320?ContentTypeID=1</link><pubDate>Thu, 07 May 2015 12:09:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3c7d2a41-5577-44cc-927b-27e0dbe1c611</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;@Mike: You can follow &lt;a href="https://devzone.nordicsemi.com/question/18039/bootloader-debugging/"&gt;this instruction&lt;/a&gt; to set bootloader in debug mode.&lt;/p&gt;
&lt;p&gt;When running in debug mode, you can add a break point at dfu_transport_update_start() in bootloader.c to see what will be executed when you jump from application to bootloader. Most likely the dfu_ble_get_peer_data() has returned fail. Then you can check if the peer_data is set properly in your application by adding breakpoint at dfu_app_peer_data_set() in application and dfu_ble_set_peer_data() in bootloader&lt;/p&gt;
&lt;p&gt;You should also check if dfu_ble_svc.c  file&amp;#39;s option has been set with Memory Assignment to Zero Initialized Data (IRAM2).&lt;/p&gt;
&lt;p&gt;I would suggest you to use the no pack SDK&amp;#39;s zip version instead of basing on the pack. It&amp;#39;s easier to modify without using pack.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU OTA nrftoolbox does not automatically reconnect when initiating dfu from application</title><link>https://devzone.nordicsemi.com/thread/24318?ContentTypeID=1</link><pubDate>Wed, 06 May 2015 16:20:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f4cd4919-0bf2-43fc-a447-91f7a0352e35</guid><dc:creator>Mike</dc:creator><description>&lt;p&gt;Hi Hung,
I think I finally fully understand what you mentioned earlier, regarding the address +1 issue. I did a bit of debugging and found that the MAC address agrees exactly for each of the 5 steps you talked about, if im using the default codes.
In particular, in step 4, the advertising name is actually n/a and the MAC address is A (not A+1).&lt;/p&gt;
&lt;p&gt;So this means, in my own bootloader, somehow the reset didnt work as expected. Would you have any suggestion in where to look for potential causes for the A+1 issue in Step 4? I&amp;#39;m certain that the NoInit button is ticked for the last 0x80 bytes of RAM. And my RAM layout is as follows:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;IRAM1     0x20002000     0x1F80&lt;/li&gt;
&lt;li&gt;IRAM2     0x20003F80     0x0080  NoInit&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Also, FYI, the reason why I did my own DFU bootloader is I wanted to have both BLE and Serial, hence I have separated out many .c and .h files from the PACK, these are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;bootloader.c&lt;/li&gt;
&lt;li&gt;bootloader_settings_arm.c&lt;/li&gt;
&lt;li&gt;bootloader_util_arm.c&lt;/li&gt;
&lt;li&gt;dfu_dual_bank.c&lt;/li&gt;
&lt;li&gt;dfu_init_template.c&lt;/li&gt;
&lt;li&gt;dfu_transport_ble.c&lt;/li&gt;
&lt;li&gt;dfu_transport_serial.c&lt;/li&gt;
&lt;li&gt;hci_mem_pool.c&lt;/li&gt;
&lt;li&gt;hci_slip.c&lt;/li&gt;
&lt;li&gt;hci_transport.c&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;All other required source files are from the Keil PACKS.&lt;/p&gt;
&lt;p&gt;Thanks a lot for your time again. Mike.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU OTA nrftoolbox does not automatically reconnect when initiating dfu from application</title><link>https://devzone.nordicsemi.com/thread/24317?ContentTypeID=1</link><pubDate>Wed, 06 May 2015 15:30:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aa338ed2-37b4-4e89-bea5-aa0da9776277</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;@Mike: It&amp;#39;s based on the MAC address.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU OTA nrftoolbox does not automatically reconnect when initiating dfu from application</title><link>https://devzone.nordicsemi.com/thread/24316?ContentTypeID=1</link><pubDate>Wed, 06 May 2015 13:59:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:90793cc3-85e5-4b82-98c4-c0b74629a83b</guid><dc:creator>Mike</dc:creator><description>&lt;p&gt;Hi Hung,
Just a quick question first, how does nrftoolbox decide which device to in step 5? does it go by the MAC address? advertising name? or something else.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU OTA nrftoolbox does not automatically reconnect when initiating dfu from application</title><link>https://devzone.nordicsemi.com/thread/24315?ContentTypeID=1</link><pubDate>Wed, 06 May 2015 12:52:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:31a5983e-e167-4bd5-a963-e3e68034ee3a</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;@Mike:
If the default address (application&amp;#39;s address) is A. The correct behaviour should be:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;First run of the bootloader , the address should be A+1&lt;/li&gt;
&lt;li&gt;After DFU the dfu_test_app_hrm.zip, the address should be A , and the normal application running&lt;/li&gt;
&lt;li&gt;After the master connect and discovery service and trigger another DFU.&lt;/li&gt;
&lt;li&gt;The central disconnect and the bootloader start with address A, start directed advertising&lt;/li&gt;
&lt;li&gt;The central automatically connect to the device and do DFU.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The bootloader should start with address A+1 , only when it is started from power on or from reset not from application (button less).&lt;/p&gt;
&lt;p&gt;In your case it advertise with address A+1 at step 4 and 5, which is quite strange.
Which master device did you use ? Have you tried with our Master Control Panel on PC ?&lt;/p&gt;
&lt;p&gt;Explanation on why we change the address can be found &lt;a href="https://devzone.nordicsemi.com/question/37060/dfu-device-address-changes/"&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU OTA nrftoolbox does not automatically reconnect when initiating dfu from application</title><link>https://devzone.nordicsemi.com/thread/24314?ContentTypeID=1</link><pubDate>Wed, 06 May 2015 12:34:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cac3bcf0-ed74-4dca-9c7b-8d26be3e58eb</guid><dc:creator>Mike</dc:creator><description>&lt;p&gt;Hi Hung,&lt;/p&gt;
&lt;p&gt;Thanks for the prompt reply.&lt;/p&gt;
&lt;p&gt;Firstly, if the bootloader address is the +1 of the application, does that mean its the correct behaviour? Also, does it matter which one is even which one is odd?&lt;/p&gt;
&lt;p&gt;As you mentioned, the Bluetooth MAC address in bootloader is +1 of the application. When using both my own bootloader or the sample bootloader.&lt;/p&gt;
&lt;p&gt;At the same time, I used the sample code, &amp;quot;dfu_dual_bank_ble_...&amp;quot; from the packs on my development board pca10028. The application I used is the hrm.zip file in the bootloader example&amp;#39;s folder. The same behaviour is replicated, the bootloader address is +1 of the application.&lt;/p&gt;
&lt;p&gt;Pretty much in all the test scenarios, I have the +1 address happening. The only time when automatic reconnection doesnt work is when using my own bootloader.&lt;/p&gt;
&lt;p&gt;Cheers, Mike&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU OTA nrftoolbox does not automatically reconnect when initiating dfu from application</title><link>https://devzone.nordicsemi.com/thread/24313?ContentTypeID=1</link><pubDate>Wed, 06 May 2015 11:38:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8a2323f5-eee3-48cf-855a-2e58dd0c9406</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Mike,&lt;/p&gt;
&lt;p&gt;I suspect that you didn&amp;#39;t configured your project to have NoInit RAM section to preserve the peer data from application when switching to bootloader.
You can quickly check this by checking the Bluetooth address of your DFU bootloader after it switch from application to bootloader. If it&amp;#39;s not the same as your application&amp;#39;s but your application address +1, then it&amp;#39;s most likely the issue I suspecting.&lt;/p&gt;
&lt;p&gt;Configuration for dfu_ble_svc.c needed:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/IRAM2.PNG" alt="image description" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>