<?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>nRF5340 - DFU over serial mission impossible</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/66242/nrf5340---dfu-over-serial-mission-impossible</link><description>Hi, 
 My system is 
 - nRF5340 custom board - Zephyr OS build v2.3.0-rc1-ncs1 - nRF-Connect-SDK v1.2.0 
 
 To perform DFU over UART I was told to merge MCUBoot + mcumgr + smp_srv along with my application (MyApp). Moving some config switches allowed me</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 30 Dec 2020 09:08:18 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/66242/nrf5340---dfu-over-serial-mission-impossible" /><item><title>RE: nRF5340 - DFU over serial mission impossible</title><link>https://devzone.nordicsemi.com/thread/286946?ContentTypeID=1</link><pubDate>Wed, 30 Dec 2020 09:08:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c2b60858-2489-4e0b-9ae8-68eeee51d43c</guid><dc:creator>Gabriele</dc:creator><description>&lt;p&gt;Hello Smile&lt;/p&gt;
&lt;p&gt;I didn&amp;#39;t use the API you are mentioning.&lt;br /&gt;You have to rebuild the MyApp with mcuboot and smp-srv child applications.&lt;br /&gt;Take a look of image, a shrinked version of MyApp, just to make you figuring out.&lt;br /&gt;In the first part of MyApp you retrieve the flag stored in the LittleFS.&lt;br /&gt;Thereafter you check the flag to switch either to the application loop or to DFU related MCUMgr APIs.&lt;br /&gt;If you run through a DFU (dfumode=1), you will erase the Flash (slot-1), write the new image (slot-1) and swap (slot-0 &amp;lt;- slot-1).&lt;br /&gt;But the LittleFS&amp;#39;s content is not touched by that, because it is safely stored on a different partition of the Flash (see memory map)&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/1856.memory_5F00_map.png" /&gt;&lt;/p&gt;
&lt;p&gt;Hope this helps.&lt;/p&gt;
&lt;p&gt;Gabriele&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/main_5F002800_extract_2900_.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340 - DFU over serial mission impossible</title><link>https://devzone.nordicsemi.com/thread/286906?ContentTypeID=1</link><pubDate>Wed, 30 Dec 2020 03:27:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:afe82e07-c3bb-4996-8215-5f3895e4a679</guid><dc:creator>Smile Jiang</dc:creator><description>&lt;p&gt;Hi,Gabriele,&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; My understanding is&amp;nbsp;that your application normally running in &amp;quot;MyApp&amp;quot; , and the&amp;nbsp;step &amp;quot;&lt;em&gt;On next reboot the flag state is read (to set the current mode of operation) and then immediately cleared in flash (for next reboot).&lt;/em&gt;&amp;quot; also done on &amp;quot;MyApp&amp;quot;, So after erased the flash, how do you step into dfu mode???&amp;nbsp;I also checked your another &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/58477/nrf5340---uart-programming-option/237663"&gt;ticket&lt;/a&gt;, you mentioned these two APIs:&lt;/p&gt;
&lt;p&gt;&lt;span&gt;int boot_set_pending(int permanent);&lt;/span&gt;&lt;br /&gt;&lt;span&gt;int boot_set_confirmed(void);&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; Did you finally use the APIs to step into DFU mode??&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; Or&amp;nbsp;your application always step into &amp;quot;MyApp&amp;quot;, but by checking a flag&amp;nbsp;on &amp;quot;MyApp&amp;quot; to decide the different operations??&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;I also met some issues about DFU on nrf5340, Looking forward to your reply.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;BR&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Smile&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340 - DFU over serial mission impossible</title><link>https://devzone.nordicsemi.com/thread/271835?ContentTypeID=1</link><pubDate>Mon, 28 Sep 2020 14:11:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0a1df370-7f3e-479b-a979-a22e10b701c8</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;I&amp;#39;m happy to help and that you found a working solution&amp;nbsp;&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340 - DFU over serial mission impossible</title><link>https://devzone.nordicsemi.com/thread/271570?ContentTypeID=1</link><pubDate>Fri, 25 Sep 2020 14:49:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:edb40d60-d228-40ca-95f3-4c2d0b27062a</guid><dc:creator>Gabriele</dc:creator><description>&lt;p&gt;&lt;span style="background-color:#ffffff;"&gt;Hi,&lt;br /&gt;I think I&amp;#39;ve fixed all major issues.&lt;br /&gt;When the application is running the init_uart is executed. The user can instruct the application to set a DFUMODE flag into flash (storage partition, NVS mode).&lt;br /&gt;On next reboot the flag state is read (to set the current mode of operation) and then immediately cleared in flash (for next reboot). When in dfu mode, the init_uart is skipped and the smp_srv management calls get executed, allowing mcumgr messages to be parsed and permitting the user to upload-test-confirm new images at will.&lt;br /&gt;Thank you for support.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340 - DFU over serial mission impossible</title><link>https://devzone.nordicsemi.com/thread/271395?ContentTypeID=1</link><pubDate>Thu, 24 Sep 2020 17:02:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:98b79c02-a58e-4dd5-b4cc-ac493d21f901</guid><dc:creator>Gabriele</dc:creator><description>&lt;p&gt;Dear Simon&lt;br /&gt;I&amp;#39;ve followed your hint and now I&amp;#39;m glad to announce you that it works!&lt;br /&gt;Now I have a different issue.&lt;br /&gt;It seems I cannot use UART-0 simultaneously for smp_srv and for user data exchange.&lt;br /&gt;This is a simplified version of my code.&lt;br /&gt;The init_uart() stuff does prevent smp_srv from working.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;int main(void)
{
    int err;
    static boot foo = true;

    /* Enabling SMP Server functionalities */
	err = STATS_INIT_AND_REG(smp_svr_stats, STATS_SIZE_32, &amp;quot;smp_svr_stats&amp;quot;);
	if (err &amp;lt; 0) {
		printk(&amp;quot;Error initializing stats system [%d]\n&amp;quot;, err);
		return -1;
	}

	os_mgmt_register_group();
	img_mgmt_register_group();
	stat_mgmt_register_group();

    /* Enabling UART-0 for user data exchange */
	err = init_uart();
	if (err) {
        printk(&amp;quot;UART init failed [%d]\n&amp;quot;, err);
		return -1;
	}

    while (1) {
        STATS_INC(smp_svr_stats, ticks); //&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt; smp_srv

        /* wait for data from rx fifo */
        struct uart_data_t *buf = k_fifo_get(&amp;amp;fifo_uart_rx_data, K_FOREVER);  //&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt; user data exchange

        /* parse user data */
        if (buf-&amp;gt;data[0] = 3) {
                foo = !foo;
        }

        k_free(buf);
    }
}
&lt;/pre&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340 - DFU over serial mission impossible</title><link>https://devzone.nordicsemi.com/thread/271195?ContentTypeID=1</link><pubDate>Wed, 23 Sep 2020 20:39:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:50d8e7f7-90ae-4a50-bf53-a151ace73c6b</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;Can&amp;#39;t you solve this by merging the smp_svr sample with your application? By that, I don&amp;#39;t mean&amp;nbsp;to merge the hex files, but do it on the code level. Put all the relevant functions from the smp_svr into your application. When you update the chip with a new application, make sure that contains the smp_svr related functions as well.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340 - DFU over serial mission impossible</title><link>https://devzone.nordicsemi.com/thread/271137?ContentTypeID=1</link><pubDate>Wed, 23 Sep 2020 14:19:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ca4ee758-a5b8-40a8-ad3e-df86ca90529f</guid><dc:creator>Gabriele</dc:creator><description>&lt;p&gt;&lt;span style="background-color:#ffffff;"&gt;Since the first image (different hash) is successfully uploaded, tested and confirmed in slot-0, I cannot run mcumgr commands remotely anymore.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color:#ffffff;"&gt;The application takes control over the UART. Nobody can repeat DFU a second time via UART.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340 - DFU over serial mission impossible</title><link>https://devzone.nordicsemi.com/thread/271125?ContentTypeID=1</link><pubDate>Wed, 23 Sep 2020 13:42:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8c4628a0-8aba-4f4a-92a9-f2f1710db473</guid><dc:creator>Simon</dc:creator><description>[quote user=""]To finish the job I have to re-initiate DFU from within MyApp, passing control to smp_srv again, otherwise all this stuff makes no sense, really.[/quote]
&lt;p&gt;&amp;nbsp;Why do you need to do this? Can&amp;#39;t you just follow the procedure from &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/samples/subsys/mgmt/mcumgr/smp_svr/README.html#device-firmware-upgrade-dfu"&gt;here&lt;/a&gt;?&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/samples/subsys/mgmt/mcumgr/smp_svr/README.html#test-the-image"&gt;Test the image&lt;/a&gt;&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;On next reset the uploaded image will remain in slot 0&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Reset the device
&lt;ul&gt;
&lt;li&gt;This can be done by clicking the reset button, or &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/samples/subsys/mgmt/mcumgr/smp_svr/README.html#reset-remotely"&gt;remotely&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/samples/subsys/mgmt/mcumgr/smp_svr/README.html#confirm-new-image"&gt;Confirm the image&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;This is to avoid the uploaded image to get swapped back into slot 1&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You should be aware of the following:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&amp;quot;Note that if you try to send the very same image that is already flashed in slot-0 then the procedure will not complete successfully since the hash values for both slots will be identical.&amp;quot;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;So don&amp;#39;t upload the same image as is already present on the device&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>