<?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>nrf9160: DFU of user application over serial</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/58851/nrf9160-dfu-of-user-application-over-serial</link><description>Hi 
 I am looking for a ways to perform DFU over serial, surprisingly i dont find any ways except this thread with no answers 
 https://devzone.nordicsemi.com/f/nordic-q-a/48154/9160---from-bootloader-updating-flashing-new-application-and-modem-firmware</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 28 Oct 2021 16:25:10 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/58851/nrf9160-dfu-of-user-application-over-serial" /><item><title>RE: nrf9160: DFU of user application over serial</title><link>https://devzone.nordicsemi.com/thread/336551?ContentTypeID=1</link><pubDate>Thu, 28 Oct 2021 16:25:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:03db2d91-d91c-45e1-9c55-6a18f086ae40</guid><dc:creator>Jackface</dc:creator><description>&lt;p&gt;&lt;span&gt;I tried to put &amp;quot;nrf9160dk_nrf9160.conf&amp;quot; in /path_to-ncs/bootloader/mcuboot/boot/zephyr/boards/ then DFU over UART works.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160: DFU of user application over serial</title><link>https://devzone.nordicsemi.com/thread/242546?ContentTypeID=1</link><pubDate>Mon, 30 Mar 2020 19:11:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4eb59116-31df-4674-99ea-1d7f6460eaa7</guid><dc:creator>Heidi</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;What I said below isn&amp;#39;t correct for serial DFU, only DFU OTA. Sorry about that.&lt;/p&gt;
&lt;p&gt;For a serial DFU, if the download gets interrupted, the application on the device just won&amp;#39;t work and you will have to start MCUBoot and reinitiate the process like you said.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Do you have your own slot 2 to use as the secondary slot - or do you mean slot 1? If yes, and you&amp;#39;re asking about a switch from the primary to the secondary slot, then what you describe is possible.&lt;/p&gt;
&lt;p&gt;I would also recommend using swap type&amp;nbsp;&lt;span&gt;BOOT_SWAP_TYPE_TEST, so you can revert back to the old image if the swap is unsuccessful.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;If you aren&amp;#39;t using dfu_target, remember to call&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;err = boot_request_upgrade(BOOT_UPGRADE_TEST);&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;in &lt;a href="https://github.com/NordicPlayground/fw-nrfconnect-zephyr/blob/master/include/dfu/mcuboot.h#L174"&gt;zephyr/include/dfu/mcuboot.h&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;pre&gt;&lt;span&gt;&amp;nbsp;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160: DFU of user application over serial</title><link>https://devzone.nordicsemi.com/thread/242144?ContentTypeID=1</link><pubDate>Fri, 27 Mar 2020 14:40:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8523ad38-f80f-4dc8-b2cf-52af3b8e7d7b</guid><dc:creator>kk2mkk</dc:creator><description>[quote userid="82276" url="~/f/nordic-q-a/58851/nrf9160-dfu-of-user-application-over-serial/242074"]&amp;nbsp;If the download is interrupted, and the application is not able to mark itself as successfully booted it will revert back to the old application.[/quote]
&lt;p&gt;No, i tried couple of times its always struck in MCUboot, need to re initiate the download, but never boots old image.&lt;/p&gt;
[quote userid="82276" url="~/f/nordic-q-a/58851/nrf9160-dfu-of-user-application-over-serial/242074"]Yes, this is possible but we don&amp;#39;t have any sample code available to show you how. You could for example write&amp;nbsp;a variable to flash that is read out by MCUBoot and makes it put itself in serial recovery.[/quote]
&lt;p&gt;No, my requirement is bit different, its like download the image to slot2 when my app is running, then pass control to MCUboot to perform the sanity/signature check and swap the image to slot0, is it doable? &lt;/p&gt;
&lt;p&gt;regards&lt;/p&gt;
&lt;p&gt;KK&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160: DFU of user application over serial</title><link>https://devzone.nordicsemi.com/thread/242074?ContentTypeID=1</link><pubDate>Fri, 27 Mar 2020 11:01:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:34acc58f-3a9d-436f-a6bf-4feacd691824</guid><dc:creator>Heidi</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user="kk2mkk"]The new image is directly downloaded to slot0 as a result, if the download is interrupted the device doesn&amp;#39;t have any valid image, so is there a way to boot old image if flashing fails?[/quote]
&lt;p&gt;&amp;nbsp;If the download is interrupted, and the application is not able to mark itself as successfully booted it will revert back to the old application.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="kk2mkk"]Is there a way to trigger DFU from application rather putting the device to recovery mode physically and then pass control to MCUboot to swap the image to primary slot?[/quote]
&lt;p&gt;&amp;nbsp;Yes, this is possible but we don&amp;#39;t have any sample code available to show you how. You could for example write&amp;nbsp;a variable to flash that is read out by MCUBoot and makes it put itself in serial recovery.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Heidi&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160: DFU of user application over serial</title><link>https://devzone.nordicsemi.com/thread/241940?ContentTypeID=1</link><pubDate>Thu, 26 Mar 2020 16:27:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1e4d2bdb-0511-48db-91a3-c6b9c9fa21c3</guid><dc:creator>kk2mkk</dc:creator><description>&lt;p&gt;Hi Heidi,&lt;/p&gt;
&lt;p&gt;Thanks for the information, able to upgrade the firmware with above mentioned steps, i have following questions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The new image is directly downloaded to slot0 as a result, if the download is interrupted the device doesn&amp;#39;t have any valid image, so is there a way to boot old image if flashing fails?&lt;/li&gt;
&lt;li&gt;Is there a way to trigger DFU from application rather putting the device to recovery mode physically and then pass control to MCUboot to swap the image to primary slot?&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Regards&lt;/p&gt;
&lt;p&gt;KK&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160: DFU of user application over serial</title><link>https://devzone.nordicsemi.com/thread/241382?ContentTypeID=1</link><pubDate>Tue, 24 Mar 2020 13:09:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9eca909e-3bc3-4fcc-b7a3-cd736c46ba99</guid><dc:creator>Heidi</dc:creator><description>&lt;p&gt;Hi again, Martin informed me you would like some more information on how to perform DFU over serial on the nRF9160 DK.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I just tried this and here&amp;#39;s what I did.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Make a file called &amp;quot;nrf9160_pca10090.conf&amp;quot; and place it in /path_to-ncs/bootloader/mcuboot/boot/zephyr/boards/, and add the following lines to the file.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;# Disable Zephyr console
CONFIG_CONSOLE=n
CONFIG_CONSOLE_HANDLER=n
CONFIG_UART_CONSOLE=n

# MCUBoot settings
CONFIG_BOOT_MAX_IMG_SECTORS=256

# MCUboot serial recovery
CONFIG_MCUBOOT_SERIAL=y
CONFIG_BOOT_SERIAL_DETECT_PORT=&amp;quot;GPIO_0&amp;quot;
CONFIG_BOOT_SERIAL_DETECT_PIN=6
CONFIG_BOOT_SERIAL_DETECT_PIN_VAL=0
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Then to load the bootloader configurations to the nRF9160 flash any application with the following config enabled to the chip.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_BOOTLOADER_MCUBOOT=y&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Now, to put the device in serial recovery mode push button 1 on the device, while turning it on.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It is the&amp;nbsp;&lt;span&gt;config &lt;a href="https://github.com/NordicPlayground/fw-nrfconnect-mcuboot/blob/master/boot/zephyr/Kconfig#L303"&gt;BOOT_SERIAL_DETECT_PIN&lt;/a&gt;&amp;nbsp;that determines which pin puts it in serial recovery mode and the default is pin 6 which corresponds to button 1 on the DK. This can be changed by changing the configurations in the&amp;nbsp;&amp;quot;nrf9160_pca10090.conf&amp;quot; file.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;For prerequisites, make sure you have the following installed on your computer:&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;ol&gt;
&lt;li&gt;Download, install and make sure&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;a href="https://golang.org/dl/"&gt;Go Language&lt;/a&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;(1.7 or later) is in your system path.&lt;/li&gt;
&lt;li&gt;Install&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;mcumgr&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;command-line tool by issuing the following&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code&gt;go get&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;command:&lt;br /&gt;&lt;em&gt;go get github.com/apache/mynewt-mcumgr-cli/mcumgr&lt;/em&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Now to flash the application to the device, just follow the steps under&amp;nbsp;&lt;em&gt;Updating FW&lt;/em&gt; in &lt;a href="https://devzone.nordicsemi.com/nordic/cellular-iot-guides/b/getting-started-cellular/posts/thingy91_2d00_fw_2d00_update_2d00_mcuboot"&gt;this tutorial&lt;/a&gt;,&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;For reference, here is what I ran:&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;/code&gt;&lt;pre class="ui-code" data-mode="text"&gt;mcumgr --conntype=serial --connstring=COM23 image upload nrf9160_asset_tracker_dfu.bin
mcumgr --conntype=serial --connstring=COM23 reset&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;One thing to note is that when you connect the nRF9160 DK, three COM ports will show up. Make sure to use the COM port that is connected to the nRF9160 DK. To find out which one that is, just open a terminal emulator and see which COM port spits out debug info for the application running on the nRF9160.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;For what images to use: you can either download precompiled binaries &lt;a href="https://www.nordicsemi.com/Software-and-tools/Development-Kits/nRF9160-DK/Download#infotabs"&gt;here&lt;/a&gt;&amp;nbsp;and use the files in images_dfu_bin. Or compile your own application (making sure CONFIG_&lt;span&gt;BOOTLOADER_MCUBOOT=y is set) and find the file to use in /build_folder/zephyr/app_update.bin.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Let me know if you have any further questions!&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Heidi&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160: DFU of user application over serial</title><link>https://devzone.nordicsemi.com/thread/238844?ContentTypeID=1</link><pubDate>Mon, 09 Mar 2020 13:46:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:923c86d3-6d31-491f-82c2-5c38cc34a26a</guid><dc:creator>Heidi</dc:creator><description>&lt;p&gt;Hi!&lt;/p&gt;
&lt;p&gt;You can perform DFU over serial by using MCUBoot, please see the documentation &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/mcuboot/wrapper.html"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/nordic/cellular-iot-guides/b/getting-started-cellular/posts/thingy91_2d00_fw_2d00_update_2d00_mcuboot"&gt;This&amp;nbsp;guide&lt;/a&gt; on DevZone&amp;nbsp;explains how you can use MCUBoot to update the application FW on your nRF9160 SiP. The guide focuses on the Thingy:91 but the same steps will work with the DK or a custom board.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Heidi&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>