<?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>Avoid first OTA DFU</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/18335/avoid-first-ota-dfu</link><description>I am adding a bootloader with BLE OTA upgrades. I am using SDK 11.0.0 and I based my bootloader in examples\dfu\bootloader . I can only fit a single bank upgrade (I upgrade FW, SD and bootloader, alltogether) so I am using the dfu_single_bank.c file.</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 16 Dec 2016 08:44:01 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/18335/avoid-first-ota-dfu" /><item><title>RE: Avoid first OTA DFU</title><link>https://devzone.nordicsemi.com/thread/70810?ContentTypeID=1</link><pubDate>Fri, 16 Dec 2016 08:44:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:79ec338d-ab97-45cc-8878-7ace1efdf264</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Yes, there has to be something else going on, but if you&amp;#39;re fine with using nrfjprog, then I&amp;#39;ll just mark you answer as correct. :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Avoid first OTA DFU</title><link>https://devzone.nordicsemi.com/thread/70811?ContentTypeID=1</link><pubDate>Fri, 16 Dec 2016 08:18:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:93e5c052-8aa8-4c87-8e2c-05497bed3f02</guid><dc:creator>genis</dc:creator><description>&lt;p&gt;For some reason I can&amp;#39;t understand the code above did not work for me and I saw the behavior I described. Maybe there is some side problem, I do not know. Anyway I need to write some other values when I flash the device (device name, initial configuration, etc.) so it is all right to me to do it with nrfjproj. Please feel free to delete the question if you think it may be misleading.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Avoid first OTA DFU</title><link>https://devzone.nordicsemi.com/thread/70809?ContentTypeID=1</link><pubDate>Wed, 14 Dec 2016 08:31:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c0098b55-6f5a-4252-8c0d-af691fb71a0b</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Hi Genis, the method you describe here is correct. The method described in your question, i.e. setting&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;uint8_t  m_boot_settings[CODE_PAGE_SIZE] __attribute__((at(BOOTLOADER_SETTINGS_ADDRESS))) __attribute__((used)) = {BANK_VALID_APP};
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;should also work. The bootloader will start the application if the BANK_APP_VALID flag is set &lt;strong&gt;or&lt;/strong&gt; enter bootloader mode i.e. start advertising as DfuTarg and wait for commands from the DFU controller.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Avoid first OTA DFU</title><link>https://devzone.nordicsemi.com/thread/70806?ContentTypeID=1</link><pubDate>Tue, 13 Dec 2016 16:42:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a26fb3da-4a3e-45f8-bb96-168b38f11c75</guid><dc:creator>genis</dc:creator><description>&lt;p&gt;Hello Bjorn. thanks for your answer. I can&amp;#39;t debug the bootloader. I found some docs explaining how to do it but I didn&amp;#39;t go through them yet. Anyway it appears I figured out a solution, please see the answer below&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Avoid first OTA DFU</title><link>https://devzone.nordicsemi.com/thread/70808?ContentTypeID=1</link><pubDate>Tue, 13 Dec 2016 16:42:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:709d6e0a-bce4-4d2f-91bc-adc541786a47</guid><dc:creator>genis</dc:creator><description>&lt;p&gt;I think I figured it out. By changing the lines above, every time the bootloader starts the startup code writes 0x1 at &lt;code&gt;m_boot_settings[CODE_PAGE_SIZE]&lt;/code&gt;. At some point the bootloader writes a value on that position and restarts and then, the old value is lost as the startup code writes a 0x1 there again.&lt;/p&gt;
&lt;p&gt;Instead of doing that, now I use &lt;code&gt;nrfjprog.exe&lt;/code&gt; to write a 0x1 there right after I flash the application. Something like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;SET APP_VALID_ADDRESS=0x0007F000
SET APP_VALID_VALUE=0x1
nrfjprog.exe --family NRF52 --memwr %APP_VALID_ADDRESS% --val %APP_VALID_VALUE%
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now the bootloader works all right (except by the fact I don&amp;#39;t have the device manager enabled, but that&amp;#39;s another story).&lt;/p&gt;
&lt;p&gt;Could anyone confirm what I said?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Avoid first OTA DFU</title><link>https://devzone.nordicsemi.com/thread/70807?ContentTypeID=1</link><pubDate>Tue, 13 Dec 2016 12:16:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:94dc3a11-e22e-432d-ba1e-f8e8a7b8eea6</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Could you debug your bootloader and check the value of the dfu_start variable when you reach the&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;if (dfu_start || (!bootloader_app_is_valid(DFU_BANK_0_REGION_START)))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;statement? It should be set to true if you enter the bootloader via your application, i.e. you write to the GPREGRET register in your application and then branch to the bootloader. In the bootloader the dfu_start variable is set as follows&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;dfu_start  = app_reset;
app_reset = (NRF_POWER-&amp;gt;GPREGRET == BOOTLOADER_DFU_START);
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>