<?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>nRF5 DFU over serial</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/60774/nrf5-dfu-over-serial</link><description>We are implementing a DFU controller to perform DFU over serial for the nRF52832. 
 Our reference is the nRF5 SDK v15.3.0 DFU Serial documentation (Nordic/SDK/nRF_SDK_15.3.0_docs/nrf5/lib_dfu_transport_serial.html). 
 The documentation has a message sequence</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 04 May 2020 13:44:13 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/60774/nrf5-dfu-over-serial" /><item><title>RE: nRF5 DFU over serial</title><link>https://devzone.nordicsemi.com/thread/247905?ContentTypeID=1</link><pubDate>Mon, 04 May 2020 13:44:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2d1cff79-7344-4d53-94ab-28e9c0515489</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;I&amp;#39;m glad that you figured out most of the stuff. Let me know if you still have any issue transferring the image.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5 DFU over serial</title><link>https://devzone.nordicsemi.com/thread/247657?ContentTypeID=1</link><pubDate>Thu, 30 Apr 2020 22:50:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ffa53f8e-76e6-4cd0-988c-b0ba6eaad81d</guid><dc:creator>Phil</dc:creator><description>&lt;p&gt;Yes, thanks.&amp;nbsp; I had found that after looking through the boot-loader.&amp;nbsp; Your code sets the data object length of the last object to the length of the remaining firmware image bytes.&amp;nbsp; It also looks like the code in the boot-loader requires the last data object length to be equal to the length of the remaining bytes. I might be wrong here.&amp;nbsp; However, the issue is that I was requesting a data object size less than 4096 bytes that was not the last data object.&amp;nbsp; The SDK15.3.0 DFU documentation is not clear on this.&lt;/p&gt;
&lt;p&gt;My problem is that the firmware size is in the init packet, which sent to the boot-loader successfully.&amp;nbsp; However, I was down-loading a test image while developing my DFU protocol code.&amp;nbsp; This is writing a generated test pattern into the nRF52 ROM and the total length was much less than the firmware image length.&lt;/p&gt;
&lt;p&gt;By the way, we are implementing the DFU controller as a state machine.&amp;nbsp; We process the response to every command sent to the boot-loader. We set the PRN to 1 at the start to get a response to every write data packet.&amp;nbsp; That way the DFU is self-timing and the offset returned in the response to write commands keeps track of the progress. Also there is no need to request a CRC just before the execute command as this is returned in the write data response.&lt;/p&gt;
&lt;p&gt;Thanks for your help.&amp;nbsp; Much appreciated.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5 DFU over serial</title><link>https://devzone.nordicsemi.com/thread/247607?ContentTypeID=1</link><pubDate>Thu, 30 Apr 2020 14:24:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4e7a3392-3d61-4b34-b316-6313af396139</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Phil,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The firmware I made was quite a long time ago so I don&amp;#39;t remember all the detail.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;But the way it works in our bootloader is that&amp;nbsp;you only set the data object size once, for all packets. And the last packet is the only exception. You don&amp;#39;t need to set the data object size for the last packet. The bootloader detect that automatically because the size of the image is sent at the beginning already.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you have a look at the&amp;nbsp;on_data_obj_create_request() function in nrf_dfu_req_handler.c you can find an error log &amp;quot;NRF_LOG_ERROR(&amp;quot;Object size must be page aligned&amp;quot;);&amp;quot; Data object size need to be page aligned, so either 4096 or 8192 and so on.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5 DFU over serial</title><link>https://devzone.nordicsemi.com/thread/247427?ContentTypeID=1</link><pubDate>Wed, 29 Apr 2020 23:34:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ba76b716-3afd-4526-a869-54e275d78740</guid><dc:creator>Phil</dc:creator><description>&lt;p&gt;I&amp;#39;ve narrowed my problem down to a specific issue.&amp;nbsp; I cannot send a Create data object command with size other than 0x1000 (4096).&amp;nbsp; This size is the max_size returned by the SELECT data object request.&lt;/p&gt;
&lt;p&gt;Create data object: size = 512:&amp;nbsp; &amp;nbsp; [01 02 &lt;strong&gt;00 02 00 00&lt;/strong&gt;].&amp;nbsp; Response [60 01 &lt;strong&gt;03&lt;/strong&gt;]: status = &lt;strong&gt;missing or invalid parameter&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Create data object: size = 4096:&amp;nbsp; [01 02 00 10 00 00].&amp;nbsp; Response [60 01 01]:&amp;nbsp; status = success&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;I notice in your example code that you send a Create data object command at the start of each data object transfer.&amp;nbsp; Each one, except the last, has size=4096. The size of the last one is the length of the remaining bytes of the firmware image.&amp;nbsp; This is exactly what we intend to do.&amp;nbsp; I also notice you are never checking the response to the Create data object command (or any commands).&amp;nbsp; Does this actually work?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Does the number of bytes transferred for each data object have to equal the size in the Create data object command?&amp;nbsp; Could we just always create a data object of max_size and just send fewer bytes where necessary before sending the EXECUTE command?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5 DFU over serial</title><link>https://devzone.nordicsemi.com/thread/247338?ContentTypeID=1</link><pubDate>Wed, 29 Apr 2020 12:34:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:922b6d54-7b40-410a-b904-76d03e8bfa66</guid><dc:creator>Phil</dc:creator><description>&lt;p&gt;Thanks Hung.&amp;nbsp; We do all the steps in your guide.&lt;/p&gt;
&lt;p&gt;I had a look at your DFUMaster_UART code.&amp;nbsp; The DFU message sequence diagram in SDK15.3.0 says to send a SELECT command [06 01] to select the Init object before the transfer of the Init packet.&amp;nbsp; &amp;nbsp;Then also send a SELECT command [06 02] to select a data object before transferring the firmware image.&lt;/p&gt;
&lt;p&gt;I can&amp;#39;t see where you send any SELECT command in your code.&amp;nbsp; Does that mean it is not strictly necessary?&lt;/p&gt;
&lt;p&gt;Also I notice you send the EXECUTE command at the end of each data object during the firmware image transfer.&amp;nbsp; That answers one of my questions.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5 DFU over serial</title><link>https://devzone.nordicsemi.com/thread/247283?ContentTypeID=1</link><pubDate>Wed, 29 Apr 2020 10:09:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2bde2a71-3bc2-4922-a4de-0738a25c9597</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Phil,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I actually made an example of DFU controller running on nRF52 that you can have a look:&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/nordic/short-range-guides/b/software-development-kit/posts/getting-started-with-nordics-secure-dfu-bootloader#h108sjziaxo3m81rkgr1has5r1d72qtu"&gt;https://devzone.nordicsemi.com/nordic/short-range-guides/b/software-development-kit/posts/getting-started-with-nordics-secure-dfu-bootloader#h108sjziaxo3m81rkgr1has5r1d72qtu&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I would suggest to test the example and review the code. If you still have any question, please let me know.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5 DFU over serial</title><link>https://devzone.nordicsemi.com/thread/247209?ContentTypeID=1</link><pubDate>Wed, 29 Apr 2020 06:37:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fc7130e0-ccf8-4198-9d65-5778458b1dbf</guid><dc:creator>Phil</dc:creator><description>&lt;p&gt;Furthermore after some trial and error, I found I couldn&amp;#39;t send a CREATE data object command with a size less than the max_size returned by the SELECT data object command.&lt;/p&gt;
&lt;p&gt;For example SELECT data object returns max_size 0x1000 (4096)&lt;/p&gt;
&lt;p&gt;If the firmware image size is 0x3200, this requires 3 data objects of 0x1000 and 1 data object of 0x200&lt;/p&gt;
&lt;p&gt;When command CREATE data object of size 0x1000,&amp;nbsp; [01 02 00 10 00 00] is sent the response is [01] success. After that the data object is sent Ok and the EXECUTE command also returns success.&lt;/p&gt;
&lt;p&gt;When sending the last 512 bytes the command CREATE data object of size 0x0200, [01 02 00 02 00 00] , returns status code [03]&amp;nbsp;NRF_DFU_RES_CODE_INVALID_PARAMETER..&amp;nbsp; Then it doesn&amp;#39;t accept any write commands.&lt;/p&gt;
&lt;p&gt;It seems the only size that is valid for the Create Data Object command is the max_size returned by the Select data object request.&lt;/p&gt;
&lt;p&gt;How do we send the last data block of 512 bytes in this example?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>