<?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>simplified Dual bank DFU</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/30434/simplified-dual-bank-dfu</link><description>Hi, 
 I&amp;#39;m trying to do (customized / simplified) dual bank DFU on NRF52832 as simple as possible, without any complicated checks. 
 Assume I succeeded into storing the new firmware in a free Flash bank (bank1, e.g. @ 0x50000), I need to know which functions</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 21 Feb 2018 16:08:17 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/30434/simplified-dual-bank-dfu" /><item><title>RE: simplified Dual bank DFU</title><link>https://devzone.nordicsemi.com/thread/121561?ContentTypeID=1</link><pubDate>Wed, 21 Feb 2018 16:08:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8d1344fd-9ae0-4141-8d87-28a84c30f7a6</guid><dc:creator>Rune Holmgren</dc:creator><description>[quote user=""]Is that normal? I thought the application is running in RAM and not affected if application area is erased in flash without doing a reset. Is there any way to&amp;nbsp; solve this?[/quote]
&lt;p&gt;You can run from RAM, but you typically don&amp;#39;t. Most applications are running directly from flash. (Unless you have explicitly&amp;nbsp;done something to ensure the application is running from RAM). I&amp;#39;ll come back to how to solve it after all the questions.&lt;/p&gt;
[quote user=""]is it possible to just set the application start address in UICR to the start address of bank1 (0x50000) to boot new SW?[/quote]
&lt;p&gt;No, running firmware is not allowed to update the UICR. Using a debugger is the only way to change it, which means that in production the UICR values will be final.&lt;/p&gt;
[quote user=""]If all this is not possible, is it possible to just use the code snippet in &amp;nbsp;nrf_dfu_postvalidate() in dfu_req_handling.c[/quote]
&lt;p&gt;This snippet only updates the state stored in the DFU settings page. This is good, but your use case&amp;nbsp;is so special it probably requires a new implementation.&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:150%;"&gt;&lt;strong&gt;How to solve the issue of copying new firmware to the correct location in flash&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;The first thing I would like you to do is to start considering your &amp;quot;application&amp;quot; to be more like a bootloader in the context of performing DFU. The DFU bootloader in the SDK can very easily update the application&amp;nbsp;because the application is not running when the copy routines are performed. The DFU bootloader is also able to update itself, and this is really what you are trying to do. You should probably have a look at how this is done in &amp;quot;nrf_dfu_bl_continue&amp;quot; in nrf_dfu_utils in SDK 14.2.0. The bootloader does not perform the copy operation itself because its hard for the piece of firmware to alter itself. Instead, it uses the MBR. The MBR is a small section of code which will run right after the device is powered up, it supports a small set of powerful features. Some of them, like SD_MBR_COMMAND_COPY_BL, are too specific to the way the nRF5 SDK DFU bootloader works. Luckily there is SD_MBR_COMMAND_COPY_SD which is an MBR command telling the MBR to copy a number of words from one address to another. When you want your application to copy new firmware from bank 1 to bank 0 you should use the&amp;nbsp;&lt;span&gt;SD_MBR_COMMAND_COPY_SD MBR command with the bank1&amp;#39;s address as source, bank0&amp;#39;s address as destination, and the firmware&amp;#39;s size in 32-bit words as size.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:inherit;"&gt;&lt;span&gt;Best regards,&lt;br /&gt;Rune Holmgren&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>