<?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>Update code via UART instead of FOTA nRF9160</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/77869/update-code-via-uart-instead-of-fota-nrf9160</link><description>Hello, 
 I am using your NRF9160 chip and need Nordic team help. I have refer to your FOTA sample, I am looking for a safer solution for updating code. On my board, I use ESP32, Is there any way to download the app_update.bin file with ESP32 chip and</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 28 Jul 2021 03:17:21 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/77869/update-code-via-uart-instead-of-fota-nrf9160" /><item><title>RE: Update code via UART instead of FOTA nRF9160</title><link>https://devzone.nordicsemi.com/thread/322120?ContentTypeID=1</link><pubDate>Wed, 28 Jul 2021 03:17:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d41fe407-3ad6-4532-85b8-f9d2ccc868f4</guid><dc:creator>haohv6</dc:creator><description>&lt;p&gt;Thank you, I will try it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Update code via UART instead of FOTA nRF9160</title><link>https://devzone.nordicsemi.com/thread/322082?ContentTypeID=1</link><pubDate>Tue, 27 Jul 2021 14:37:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d4a83f6c-3948-435f-8f41-fe71a387e73b</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;Is there no way of downloading the&amp;nbsp;DFU update directly to the nRF9160? That would really simplify this.&lt;/p&gt;
&lt;p&gt;If I have understood it correctly, you want to first download it to the ESP32 and then transfer it&amp;nbsp;to the nRF9160?&lt;/p&gt;
&lt;p&gt;The .bin file is just a big block of bytes, so you need to set up a uart on the ESP32 and a uart on the nRF9160 and send all the bytes over, a few bytes at the time.&lt;/p&gt;
&lt;p&gt;Regarding the ESP32, you have to first download the .bin file and either transfer it directly (as you receive it from the cloud) to the nR9160 or save it in flash temporarily and then send it over. However, I can&amp;#39;t really help you with the ESP32,&amp;nbsp;since this is not our product, you have to ask here:&amp;nbsp;&lt;a href="https://www.espressif.com/"&gt;https://www.espressif.com/&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;When you&amp;#39;ve gotten that to work, you need to set up UART on the nRF9160 to receive the .bin file. For that you can use the LPUART sample. Then you can connect &lt;em&gt;RX91&amp;lt;-&amp;gt;TX ESP32&lt;/em&gt; and &lt;em&gt;TX91&amp;lt;-&amp;gt;RX ESP32 &lt;/em&gt;and&lt;em&gt; GND&amp;lt;-&amp;gt;GND&lt;/em&gt;&amp;nbsp;(and optionally the flow control lines).&lt;/p&gt;
&lt;p&gt;After this,&amp;nbsp;you have to execute the steps 1-3, which I mentioned in the initial post. But we can get back to this later, when you have been able to set up UART communication between the two boards.&lt;/p&gt;
&lt;p&gt;Here is the lpuart sample:&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-nrf/tree/v1.6.0/samples/peripheral/lpuart"&gt;https://github.com/nrfconnect/sdk-nrf/tree/v1.6.0/samples/peripheral/lpuart&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Here is the lpuart sample with flow control disabled:&amp;nbsp;&lt;a href="https://github.com/simon-iversen/sdk-nrf/tree/b548980db67ad4f05cfe2ac64e321d143c1111c7/samples/peripheral/lpuart"&gt;https://github.com/simon-iversen/sdk-nrf/tree/b548980db67ad4f05cfe2ac64e321d143c1111c7/samples/peripheral/lpuart&lt;/a&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Update code via UART instead of FOTA nRF9160</title><link>https://devzone.nordicsemi.com/thread/321916?ContentTypeID=1</link><pubDate>Tue, 27 Jul 2021 02:05:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:55ce00ed-0385-4578-b06a-832b4451b649</guid><dc:creator>haohv6</dc:creator><description>&lt;p&gt;Thanks for your information.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Can you give me a sample how to send .bin file via uart, I really don&amp;#39;t have any ideal about it.&lt;/p&gt;
&lt;p&gt;Thank.&lt;/p&gt;
&lt;div style="left:-100px;position:absolute;top:-20px;" id="gtx-trans"&gt;
&lt;div class="gtx-trans-icon"&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Update code via UART instead of FOTA nRF9160</title><link>https://devzone.nordicsemi.com/thread/321892?ContentTypeID=1</link><pubDate>Mon, 26 Jul 2021 18:26:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1c485460-4686-4384-9630-b1c3dc27351e</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;Yes, this is possible. All you need to do is the following:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Place app_update.bin in the secondary slot of the nrf9160&lt;/li&gt;
&lt;li&gt;Reset the&amp;nbsp;nrf9160
&lt;ol&gt;
&lt;li&gt;The mcuboot will then check the secondary slot and if it finds a valid image, it will swap it with the image in the primary slot and boot the new image&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;Mark the image as &amp;quot;okay&amp;quot; to prevent rollback on next reset
&lt;ol&gt;
&lt;li&gt;This can be done from the image itself using&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/a9423cbce69a5df78140a2cf3ba11aa56d395cfc/include/dfu/mcuboot.h#L181"&gt;&lt;span&gt;boot_write_img_confirmed()&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;span&gt;You can set up everything yourself, by sending app_update.bin one block at the time over UART from the&amp;nbsp;ESP32 to the nRF9160&amp;nbsp; and putting it in the secondary slot. Then executing step 2 and 3 from the nRF9160.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;You can also use the mcumgr protocol, which supports commands that makes it possible to send the image, confirm the image and reset the&amp;nbsp;client (nrf9160)&amp;nbsp;from the host (ESP32) side. We do have solutions for this in NCS/Zephyr, however&amp;nbsp;if the ESP32 doesn&amp;#39;t support NCS/Zephyr I think you&amp;#39;ll have some work to do, but it should be manageable.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Please let me know what approach sounds the best and if you have any more question.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Simon&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>