<?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 via own protocol</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/59387/dfu-via-own-protocol</link><description>Hi, 
 we are developing a device with 2 &amp;#181;C one being the nRF52832 for BLE connectivity. We want to do DFU via BLE with our own protocol. From what I&amp;#39;ve read, in this case some sort of Background DFU is the way to go. So far I&amp;#39;ve saved the new firmware</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 26 Mar 2020 13:58:45 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/59387/dfu-via-own-protocol" /><item><title>RE: DFU via own protocol</title><link>https://devzone.nordicsemi.com/thread/241873?ContentTypeID=1</link><pubDate>Thu, 26 Mar 2020 13:58:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:97540a6d-b5b5-458a-bbeb-4388b7a4f8ab</guid><dc:creator>JoEi</dc:creator><description>&lt;p&gt;Hi Edvin,&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve tested it the way I wrote in my last post and it works great.&lt;/p&gt;
&lt;p&gt;One problem I had was that when I flashed the firmware on the controller the start address of the bootloader got deleted. But&amp;nbsp;this is now fixed.&lt;/p&gt;
&lt;p&gt;Right now we consider to drop the init packet and instead add some TLVs at the end of the binary.&lt;br /&gt;&lt;br /&gt;Thanks again for your responses because they pushed me in the right direction. =)&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Johannes&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU via own protocol</title><link>https://devzone.nordicsemi.com/thread/241327?ContentTypeID=1</link><pubDate>Tue, 24 Mar 2020 10:40:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:74232e6a-6ce6-4f25-bfec-efbb5345810a</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Have you tested?&lt;/p&gt;
&lt;p&gt;I am not sure whether you need to validate and/or write the bootloader settings after the transfer is complete. This is what happens usually:&lt;/p&gt;
&lt;p&gt;on_data_obj_execute_request() is called when a transfer is usually done. This calls:&lt;/p&gt;
&lt;p&gt;m_observer(NRF_DFU_EVT_OBJECT_RECEIVED); -&amp;gt;&amp;nbsp;dfu_observer() -&amp;gt; case&amp;nbsp;NRF_DFU_EVT_OBJECT_RECEIVED -&amp;gt;&amp;nbsp;inactivity_timeout-&amp;gt;&amp;nbsp;bootloader_reset() -&amp;gt;&amp;nbsp;nrf_dfu_settings_backup(do_reset) -&amp;gt;&amp;nbsp;settings_backup() -&amp;gt; settings_write().&amp;nbsp;&lt;/p&gt;
&lt;p&gt;So maybe you need to do this if you have tranferred an image.&lt;/p&gt;
&lt;p&gt;Try it first, and see how it behaves. If it doesn&amp;#39;t work, try to call bootloader_reset() after entering the bootloader, and then see what happens.&lt;/p&gt;
&lt;p&gt;We don&amp;#39;t have the support for this out of the box, but you need to study the bootloader example to see what it usually does, and skip the transfer part.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;BR,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU via own protocol</title><link>https://devzone.nordicsemi.com/thread/241213?ContentTypeID=1</link><pubDate>Mon, 23 Mar 2020 16:43:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:316a4209-eca3-4daf-ae5a-7c7119c51d16</guid><dc:creator>JoEi</dc:creator><description>&lt;p&gt;Yeah I&amp;#39;m using a dual bank for that.&lt;br /&gt;So you mean after I&amp;#39;ve done the validation, filled bank_1 with the corresponding size, crc and bank code and set bank_current to bank 1 in the dfu/bootloader settings, i don&amp;#39;t need to execute&amp;nbsp;&lt;strong&gt;sd_power_gpregret_set(0, BOOTLOADER_DFU_START);&lt;/strong&gt; but instead just call&amp;nbsp;&lt;strong&gt;nrf_pwr_mgmt_shutdown(NRF_PWR_MGMT_SHUTDOWN_RESET);&lt;/strong&gt;. &lt;br /&gt;Then the bootloader should swap bank 0 with bank 1 and start the new firmware.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU via own protocol</title><link>https://devzone.nordicsemi.com/thread/241204?ContentTypeID=1</link><pubDate>Mon, 23 Mar 2020 15:32:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aa67c218-b76d-4992-a338-e444148fd8ff</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;I was thinking about the message sequence chart. I&amp;#39;m sorry. I forgot the link in the previous reply. Do you intend to use the serial bootloader as a starting point? In that case, I would check out this one:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v14.2.0/lib_dfu_transport_serial.html?cp=7_5_3_3_5_2_3_1#lib_dfu_transport_serial_msc"&gt;https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v14.2.0/lib_dfu_transport_serial.html?cp=7_5_3_3_5_2_3_1#lib_dfu_transport_serial_msc&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;What the bootloader normally does after you set the gpregret register as you described here, is that it starts in DFU mode and initializes the DFU transports (serial). Then it just waits for the transfer to begin.&lt;/p&gt;
&lt;p&gt;If you look at the transfer init packet sequence chart, you pretty much have already transferred this image, so find out what happens in the bootloader when you typically send the execute command. What does the bootloader do then?&lt;/p&gt;
&lt;p&gt;It stores the new settings, and then gets ready to receive the rest of the image. Since this is already transferred, you need to check what the bootloader does when you send the execute command after the image is transferred.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Have you thought about what will happen if there is something wrong with the packet that you have transferred over BLE in the application? Do you intend to run a dual bank, so that you have a fallback if the CRC doesn&amp;#39;t match for the application image?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU via own protocol</title><link>https://devzone.nordicsemi.com/thread/241180?ContentTypeID=1</link><pubDate>Mon, 23 Mar 2020 14:44:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:18492f4c-16b1-4b46-ac5c-b0a125cb24da</guid><dc:creator>JoEi</dc:creator><description>&lt;p&gt;Hi Edvin,&lt;/p&gt;
&lt;p&gt;thanks for your quick response.&lt;br /&gt;Yes you are right it&amp;#39;s the transport I&amp;#39;m referring to. And yes I&amp;#39;m using the nrfutil to generate the .bin and .dat files.&lt;br /&gt;Do&amp;nbsp;you mean this &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v14.2.0%2Flib_bootloader_dfu_process.html&amp;amp;cp=7_5_3_3_5_1_0"&gt;chart&lt;/a&gt;?&lt;br /&gt;So I&amp;#39;d need to do the prevalidation of the init-file and the postvalidation of the new firmware. Then the settings for bank 1 are written to 0x7F000, if I&amp;#39;m not mistaken.&amp;nbsp;&amp;nbsp;&lt;br /&gt;And after that&amp;nbsp;I need to activate the bootloader via&lt;strong&gt; sd_power_gpregret_set(0, BOOTLOADER_DFU_START);&lt;br /&gt;&lt;/strong&gt;Is there anything else I need to do?&lt;br /&gt;Yeah it would&amp;nbsp; have been nice if I could&amp;nbsp;simply transfer these two files via BLE and save them in flash and the bootloader would do the rest.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Johannes&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU via own protocol</title><link>https://devzone.nordicsemi.com/thread/241132?ContentTypeID=1</link><pubDate>Mon, 23 Mar 2020 12:53:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a7171f97-ac52-477b-921d-e17dc2573358</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;When you say &amp;quot;own protocol&amp;quot;, is that just the transport layer? Are you still using nrfutil to generate the packets? I assume you are, since you are asking about the init packet.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Did you study the message sequence charts that the original bootloader use?&lt;/p&gt;
&lt;p&gt;Use this, and study the bootloader examples to see what is done when the init packet is received. The bootloader will have to check the CRC and the signature of the packet to see that it is indeed a valid packet. Then study what happens when the entire image has been transferred.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;You still need to do these jobs that the bootloader normally do. The only thing you want to separate out is the actual transfer of the image, right?&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>