<?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>Questions about serial DFU</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/33042/questions-about-serial-dfu</link><description>Dear Support Team, 
 I’m using nrf52840 with PCA10056 and SDK 14.1. I want to make a DFU feature using SPI as its transport layer. Could you please help me about the following questions? 
 1. I could find some Nordic bootloader examples which could be</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sat, 19 Jun 2021 08:35:03 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/33042/questions-about-serial-dfu" /><item><title>RE: Questions about serial DFU</title><link>https://devzone.nordicsemi.com/thread/316124?ContentTypeID=1</link><pubDate>Sat, 19 Jun 2021 08:35:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a3d0da93-f777-489d-b91e-be8ad1748e3f</guid><dc:creator>gfmoore</dc:creator><description>&lt;p&gt;This has to be one of the best answers and explanations of what is going on that I have seen on this site.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It should be expanded, updated&amp;nbsp; and put as one of the first documents that beginners should read, not stuck here in an answer. In my opinion there is to much that is assumed in knowledge as to how these things work, especially for newcomers. Well done tesc for your efforts here to an excellent set of questions by Tengfei, even of 3 years ago.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Questions about serial DFU</title><link>https://devzone.nordicsemi.com/thread/139324?ContentTypeID=1</link><pubDate>Sat, 07 Jul 2018 03:22:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e590bc5e-4791-410d-be0d-7f5f183980f4</guid><dc:creator>Aijiapeng</dc:creator><description>&lt;p&gt;Hello, Liu Tengfei.&lt;span&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class="tran"&gt;May I&lt;/span&gt;&lt;span&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class="tran"&gt;ask you&lt;/span&gt;&lt;span&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class="tran"&gt;a&lt;/span&gt;&lt;span&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class="tran"&gt;question&lt;/span&gt; ?Have you successfully completed the work of serial dfu? &lt;span&gt;I&amp;rsquo;m using nrf52832&amp;nbsp; and SDK 14.2.0. In my project ,there are two dsp,one is nrf52832 and the other is ntk658, they connect via uart with each other. ntk658 supports the sd-card function.What i want to do is using ntk658 read the ble update fw and then transfer to nrf52832 via uart. So i know i need use serial DFU bootloader.Actually,i have done it in my another project. But i used SDK 11.0.0.And the packet format is very clear &lt;span class="skip"&gt;as&lt;span class="Apple-converted-space"&gt;&lt;span style="color:#999999;font-size:medium;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;following&lt;span class="Apple-converted-space"&gt;&lt;span style="color:#999999;font-size:medium;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;picture&lt;span class="Apple-converted-space"&gt;&lt;span style="color:#999999;font-size:medium;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;shows&lt;/span&gt;,&amp;nbsp;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1530933431963v1.png" alt=" " /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;But my question is what the packet format should i send to nrf52832 in SDK 14.2.0? How can i transfer the ble upgrade fw to nrf52832?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Questions about serial DFU</title><link>https://devzone.nordicsemi.com/thread/128048?ContentTypeID=1</link><pubDate>Thu, 12 Apr 2018 12:13:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dc7ad327-6ff6-405e-9471-e83ad8eec736</guid><dc:creator>Liu Tengfei</dc:creator><description>&lt;p&gt;Thank you very much! I&amp;#39;ve fully understood it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Questions about serial DFU</title><link>https://devzone.nordicsemi.com/thread/128020?ContentTypeID=1</link><pubDate>Thu, 12 Apr 2018 10:48:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:810e3d3c-10ea-4e43-8035-93969453b3e0</guid><dc:creator>tesc</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;1. The bootloader start address is stored in the UICR registers in flash (in UICR.NRFFW[0]), also known as NRF_UICR_BOOTLOADER_START_ADDR or .uicr_bootloader_start_address. This is what is used for deciding where application data is stored. In SDK 14.2, the BOOTLOADER_START_ADDR define is used throughout the code, and it is fetched from the flash settings for the project. Please note however that you cannot do DFU from a bootloader of one size to a bootloader of larger size, as then application data location and bank size calculations might fail.&lt;/p&gt;
&lt;p&gt;2. For bootloader update, the new bootloader is first downloaded to a separate location. Then the MBR is invoked for performing the copy operation into the final location. This copy operation is safe. The MBR starts by writing to the MBR parameter storage page in flash what copy operation is to be performed. If it gets aborted (for instance by power failure) it will retry on the next boot.&lt;/p&gt;
&lt;p&gt;If the bootloader is successfully updated, but the new bootloader has bugs that prevents it from doing DFU, then you have no choice other than programming the nRF directly. Therefore you should only update to a well tested bootloader such as the ones we provide with the SDK. If you modify it you should be extra careful with testing that it works as intended. This is also a good reason to use Secure DFU, which uses signing to prevent others from making a fake update that bricks the device.&lt;/p&gt;
&lt;p&gt;3. That should work, yes.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Terje&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Questions about serial DFU</title><link>https://devzone.nordicsemi.com/thread/127688?ContentTypeID=1</link><pubDate>Tue, 10 Apr 2018 18:07:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fb018af7-4aec-49d9-9250-1570b5d0b22f</guid><dc:creator>Liu Tengfei</dc:creator><description>&lt;p&gt;Thank you very much for the useful information! I have three more problems here:&lt;/p&gt;
&lt;p&gt;1. Because of some limitations, I used a kind of our internal communication protocol between the host and application, and I have to add the protocol to my bootloader to perform DFU as well, but it will make bootloader much larger than 4 kb, I&amp;#39;m not familiar with linker scripts, so I want to confirm that will it be ok if I just update the memory section in&amp;nbsp;secure_bootloader_gcc_nrf52.ld, such as FLASH LENGTH, ORIGIN of&amp;nbsp; bootloader? According to the memory layout of nrf52840 flash, it seems like the application data will also be changed due to bootloader size.&lt;/p&gt;
&lt;p&gt;2. The bootloader itself could also be updated over bootloader/DFU, if the new bootloader image has been succefully transferred to bootloader over DFU, but power off occurred during copying the new image to the right place on the flash, how could it be recovered? If the new bootloader has been updated successfully over DFU, but the logic of the new bootloader has bugs and cannot perform DFU, will it be possible to update bootloader again without using JTAG to directly write flash?&lt;/p&gt;
&lt;p&gt;3. Since the serial bootloader won&amp;#39;t depend on softdevice in SDK15.0, if I implement my bootloader with SDK15.0, but use it to update app &amp;amp; softdevice based on SDK14.1 and softdevice 140 or 132 over DFU,&amp;nbsp;will it be ok?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Questions about serial DFU</title><link>https://devzone.nordicsemi.com/thread/127676?ContentTypeID=1</link><pubDate>Tue, 10 Apr 2018 16:17:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7a7cc0a2-ffac-4fd4-a6df-0e2e7eb325b2</guid><dc:creator>tesc</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;1. The mbr.hex is precompiled, just as the SoftDevice. Actually if you investigate the hex files you will see that the MBR is identical to the first flash pages of the corresponding SoftDevice. So you have to take that hex file for programming the MBR.&lt;/p&gt;
&lt;p&gt;2. When you have a bootloader, the bootloader is started by the MBR, yes. Then from the bootloader you jump into the application. (In some instances the bootloader enters DFU mode, such as when there is not a valid application, or when DFU mode is triggered by button press or through buttonless DFU.)&lt;/p&gt;
&lt;p&gt;If the bootloader has logging enabled, with log level of INFO or more verbose, then I do expect some log lines from the bootloader before the application is started. And you have not replaced the bootloader over DFU as well? You will always jump MBR -&amp;gt; bootloader -&amp;gt; application, if there is a bootloader present.&lt;/p&gt;
&lt;p&gt;3. blinky_mbr.hex does not include the MBR.&lt;/p&gt;
&lt;p&gt;If you use a SoftDevice then the application is placed directly after the SoftDevice in flash. If you do not use a SoftDevice, and do not use an MBR, then the application is placed at the beginning of flash. If you use MBR (but no SoftDevice), then the application is placed directly after the MBR. That is the reason why building an application for use on its own (blank), for use with MBR, and for use with SoftDevice are different. blinky_mbr.hex is the blinky application built for use with the MBR, but the hex file does not include the MBR.&lt;/p&gt;
&lt;p&gt;So yes, you must program both blinky_mbr.hex and mbr.hex to run the blinky example with MBR (but without SoftDevice.)&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Terje&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Questions about serial DFU</title><link>https://devzone.nordicsemi.com/thread/127650?ContentTypeID=1</link><pubDate>Tue, 10 Apr 2018 14:06:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:80f5c524-f45f-48ef-aceb-36c75796764c</guid><dc:creator>Liu Tengfei</dc:creator><description>&lt;p&gt;Thanks a lot for your kindly reply!&lt;/p&gt;
&lt;p&gt;I noticed Nordic has provided SDK 15.0 which has extensive update on bootloader/DFU.&lt;/p&gt;
&lt;p&gt;In SDK15.0, only the BLE bootloader is now dependent on the SoftDevice. The others depend only on the MBR (which is now part of the SDK). It&amp;#39;s really helpful for my case! So I decided to use SDK15.0 for my application. However, I also have some problems about bootloader/DFU in SDK 15.0:&lt;/p&gt;
&lt;p&gt;1. Serial&amp;nbsp;bootloader with DFU in SDK 15.0 does not need softdevice, but it need MBR, SDK 15.0 provided test DFU images&amp;nbsp; in&amp;nbsp;examples\dfu\secure_dfu_test_images\uart\nrf52840, MBR should be programmed to PDK before programming bootloader, but where is mbr.hex from? How to compile the mbr.hex myself without the one provided in the&amp;nbsp;&lt;span&gt;secure_dfu_test_images folder?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;2. During system startup, the Master Boot Record (MBR) is responsible for starting the bootloader, if a bootloader is installed. So every time when system startup,&amp;nbsp;even if there was no trigger DFU happened, MBR always will jump to bootloader first, and then after bootloader validates the app, app will be started, right?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;But after successfully DFU the hrs_app &amp;amp; softdevice, when the PDK reset, I only see&amp;nbsp;NRF_LOG_INFO&amp;nbsp;trace in hrs_app&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;and I cannot see any NRF_LOG_INFO trace in bootloader(debug version), does this mean that PDK directly goes into the app without jump to bootloader first?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;3. In SDK 15.0, for examples\dfu\secure_dfu_test_images\uart\nrf52840\blinky_mbr.hex, did the&amp;nbsp;blinky_mbr.hex merge from blinky.hex and mbr.hex? If it did, why it was 5kb which was smaller than the mbr.hex which is 8kb ?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;If I programmed the blinky_mbr.hex to PDK, do I need to program MBR again before program the bootloader?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Questions about serial DFU</title><link>https://devzone.nordicsemi.com/thread/127179?ContentTypeID=1</link><pubDate>Fri, 06 Apr 2018 09:25:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ca64a51d-d55a-4faa-886c-883cd0e43a47</guid><dc:creator>tesc</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;1. Unfortunately we do not have any C++ implementations of DFU.&lt;/p&gt;
&lt;p&gt;2. The bootloader needs the SoftDevice mainly for two reasons: First, it needs the Master Boot Record (MBR), which is delivered as part of the SoftDevice. Second, the DFU bootloader was initially written for using BLE, and the serial bootloader is based on that initial BLE bootloader. This means the SoftDevice was originally an integral part of the bootloader and many of those dependencies are still in. While the current version can access flash directly (no longer needing the SoftDevice for flash access) there are still logic and address calculations assuming that there is a SoftDevice in place. Removing the SoftDevice dependency completely (leaving only the MBR requirement) is not an easy task, with the many potential pitfalls and corner cases involved.&lt;/p&gt;
&lt;p&gt;3. The application gets built to reside at one particular area in flash, so that jumps in the resulting program (function calls, loops, if statements, etc.) goes to the right place and so that variables are read from the correct memory locations. All peripheral examples comes in a &amp;quot;blank&amp;quot; version, which means they are set to not use a SoftDevice and thus they start at address 0x0. When you use a SoftDevice, the application must start after the SoftDevice, which gives an address depending on the size of the SoftDevice, and in your particular case that is 0x230000.&lt;/p&gt;
&lt;p&gt;Some few peripheral examples comes in both a &amp;quot;blank&amp;quot; and a SoftDevice version such as &amp;quot;s132&amp;quot;, for instance examples/peripheral/blinky/pca10040 (for the nRF52832). All ble_peripheral examples are set up to use a SoftDevice, and there you can find the correct flash (ROM) settings. RAM settings depend on SoftDevice configuration.&lt;/p&gt;
&lt;p&gt;4. We do not have a &amp;quot;buttonless DFU&amp;quot; using serial, but you can use the &amp;quot;enter DFU mode&amp;quot; functionality from the ble_app_buttonless_dfu example (as you mention in (2)) in order to trigger DFU mode. Then you must implement the &amp;quot;button&amp;quot; part of it yourself and use that instead of the buttonless DFU BLE service from that example.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Terje&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>