<?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 protocol details for a custom DFU controller?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/48867/dfu-protocol-details-for-a-custom-dfu-controller</link><description>Hi, 
 I&amp;#39;m trying to create a Node application (using Noble) that acts as a DFU controller so that I can automate DFU&amp;#39;ing hundreds of devices (nRF52 using SDK 15.0.0). I&amp;#39;ve been referencing this documentation. I have several questions that I can&amp;#39;t seem</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 18 Aug 2020 10:35:42 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/48867/dfu-protocol-details-for-a-custom-dfu-controller" /><item><title>RE: DFU protocol details for a custom DFU controller?</title><link>https://devzone.nordicsemi.com/thread/265057?ContentTypeID=1</link><pubDate>Tue, 18 Aug 2020 10:35:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:34c30f91-4f7b-4203-a8e5-7f2ab95f0bcd</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I suspect this is caused by doing post validation before the last chunk of data has been written to flash. There is no part of the DFU protocol that gives you information about that, so I do not see any other solution than waiting a bit so that you are sure that all data is written to flash before doing post validation.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU protocol details for a custom DFU controller?</title><link>https://devzone.nordicsemi.com/thread/264820?ContentTypeID=1</link><pubDate>Mon, 17 Aug 2020 10:22:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1fa2b543-5d1b-44c0-83a6-2f3db70b5894</guid><dc:creator>m.reynal</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I write a controller in cpp to do dfu over ble.&lt;/p&gt;
&lt;p&gt;I have the same issue (not a 100% bug)&amp;nbsp;: all crc and offset are ok until the end. But I have a &amp;laquo;&amp;nbsp;hash failure&amp;nbsp;&amp;raquo; on the last execute command.&lt;/p&gt;
&lt;p&gt;I think my controller is sending packets too fast, so last packets are not written yet in flash (queue usage not empty) when execute command is handled by the target. (see target&amp;rsquo;s logs).&lt;/p&gt;
&lt;p&gt;I set PRN to have last packet of each object waiting for response with CRC and offset (see in logs &amp;laquo;&amp;nbsp;PRN reached). CRC and Offset are ok, so controller sends execute command&amp;hellip; then hash failure&lt;/p&gt;
&lt;p&gt;Maybe I&amp;rsquo;m missing something&amp;nbsp;before the last execute command, something to &amp;lsquo;synchronize&amp;rsquo; controller and target&amp;nbsp;(now I have a awfull hack to wait 100ms before sending last execute command?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/dfu-ota-_2D00_-hash-failure-_2D00_-target-logs.txt.txt"&gt;devzone.nordicsemi.com/.../dfu-ota-_2D00_-hash-failure-_2D00_-target-logs.txt.txt&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU protocol details for a custom DFU controller?</title><link>https://devzone.nordicsemi.com/thread/194824?ContentTypeID=1</link><pubDate>Wed, 26 Jun 2019 09:31:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:540eea03-b0fc-4477-9d9e-bbaa036a1ce0</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;As you write,&amp;nbsp;&amp;nbsp;the response&amp;nbsp;&amp;lt;60, 04, 0b, 0c&amp;gt; means you have a verification failure (NRF_DFU_EXT_ERROR_VERIFICATION_FAILED). This only happens if validation fails, and since we know the bootloader itself with public key etc is OK (it works if you use another DFU master, and validation can only faile for one of two reasons: either the data is corrupt in some way or the signature is corrupt in some way.&lt;/p&gt;
[quote user="scla"] Edit: I checked the CRC&amp;#39;s for every data object sent over my controller with the smartphone DFU controller. They are exactly the same![/quote]
&lt;p&gt;Does this apply to all CRC&amp;#39;s? And none are missing on the failing case? If so, this indicates that the data is correct, since you have the same CRC values using both DFU masters, even though only one of the DFU masters is working.&lt;/p&gt;
[quote user="scla"]Just tried importing and using pc-nrf-dfu-js instead of my own custom controller and have the same issue&amp;nbsp;as in the below link. It looks like the hash in the init packet is not matching with the application file hash.[/quote]
&lt;p&gt;Can you upload the two hashes here? Could it be something as simple as the endianness being swapped?&lt;/p&gt;
&lt;p&gt;It could be interesting to see full flash dumps of the device after upgrade in both cases so that we can diff the dumps and easily see what the differences are. You can dump the flash content using for instance &amp;quot;nrfjprog --memrd 0 --n 0x80000 &amp;gt; full_flash.txt&amp;quot; (adjust the size if you have a part with other than 512 kB flash).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU protocol details for a custom DFU controller?</title><link>https://devzone.nordicsemi.com/thread/194728?ContentTypeID=1</link><pubDate>Tue, 25 Jun 2019 19:01:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c3843522-d36b-48d5-aa5c-a43902c9e74b</guid><dc:creator>scla</dc:creator><description>&lt;p&gt;Hi Einar, thanks for the reply.&lt;/p&gt;
&lt;p&gt;I think I&amp;#39;ve sorted through most of the issues I was having, which mostly came from not properly understanding data objects. Now I have everything set up like the diagram. Also, I do not set the MTU, but I think I will return to this issue at a later time. Right now I&amp;#39;m sending 230 bytes each iteration which is fast enough for development.&lt;/p&gt;
&lt;p&gt;One large issue that I&amp;#39;m running into is creating the last data object. The target gives me a max data object size of 4096 bytes. For the SD + BL init + bin files, everything seems to send correctly until after I send the last data object, CRC command, and execute. CRC checks out fine, but after sending execute I get the response &amp;lt;60, 04, 0b, 0c&amp;gt; which seems to be a validation error. With a smartphone using nRF Connect, I see this same data object being sent with a response of &amp;lt;60, 04, 01&amp;gt; in the logs. Edit: I checked the CRC&amp;#39;s for every data object sent over my controller with the smartphone DFU controller. They are exactly the same!&lt;/p&gt;
&lt;p&gt;I feel like I&amp;#39;m missing something very simple here for the last data object. Data objects and their sizes seem to be the same as what is in the smartphone logs, however. Any ideas?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Edit:&lt;/p&gt;
&lt;p&gt;Just tried importing and using pc-nrf-dfu-js instead of my own custom controller and have the same issue&amp;nbsp;as in the below link. It looks like the hash in the init packet is not matching with the application file hash.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/NordicSemiconductor/pc-nrf-dfu-js/issues/44?_pjax=%23js-repo-pjax-container"&gt;https://github.com/NordicSemiconductor/pc-nrf-dfu-js/issues/44?_pjax=%23js-repo-pjax-container&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The DFU package was made with nrfutil and works over a smartphone, so I do not think the package is at fault here. Strange that both my custom controller and pc-nrf-dfu-js fail. Any ideas?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DFU protocol details for a custom DFU controller?</title><link>https://devzone.nordicsemi.com/thread/194330?ContentTypeID=1</link><pubDate>Mon, 24 Jun 2019 11:46:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f509a623-49f7-483e-8d3f-3359a09c9453</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user=""] I am rather confused why this works, since in the sequence diagram it states that I can only send up to 20 bytes at the time.[/quote]
&lt;p&gt;It seems the diagram hs not been updated, and is the same as for older SDK versions, before the&amp;nbsp;bootloader.&lt;/p&gt;
[quote user=""]Also, for whatever reason the &amp;quot;Response PRN success&amp;quot; (btw, what does PRN mean?) never occurs.[/quote]
&lt;p&gt;&amp;nbsp;PRN is Packet Receipt Notification. You can see more description in the &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.3.0/lib_dfu_transport_serial.html?cp=5_1_3_5_2_3_1_0#lib_dfu_serial_transport_msc_init"&gt;serial transport layer documentation&lt;/a&gt; (though the concept is there regardless of transport):&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;em&gt;Before the actual DFU process can start, the DFU controller must set the Packet Receipt Notification (PRN) value and obtain the maximum transmission unit (MTU). In most cases, the PRN can be set to 0 to disable checksums being sent back to the controller during transfers. However, if the transport layer is unreliable, set the PRN to a value other than 0.&lt;/em&gt;&lt;/p&gt;
[quote user=""]Now I begin the same process as above, but when I send the create command (&amp;lt;01, 02, C8&amp;gt;, where 0xC8 = 200 bytes), I get the response &amp;lt;60, 01, 03&amp;gt;. I cannot seem to find anywhere in the documentation what 03 means. [/quote]
&lt;p&gt;3 is&amp;nbsp;NRF_DFU_RES_CODE_INVALID_PARAMETER. Have you done anything to increase the MTU before this? &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.0.0/lib_dfu_transport_ble.html?cp=5_5_1_3_5_2_2_2#lib_dfu_transport_ble_dfu_packet"&gt;From the documentation&lt;/a&gt;: &amp;quot;If no larger Att MTU size is negotiated with the DFU Service, the expected maximum size of a write is 20 Bytes. &amp;quot;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>