<?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>Unable to get app to run when flashing BL, SD and App via nrfjprog</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/61056/unable-to-get-app-to-run-when-flashing-bl-sd-and-app-via-nrfjprog</link><description>I am trying to flash a secure DFU bootloader (compiled using my own key), a soft device, and my application using nrfjprog with the intention being to have the application boot when the board is reset. However, it always goes back to the bootloader after</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 07 May 2020 14:47:22 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/61056/unable-to-get-app-to-run-when-flashing-bl-sd-and-app-via-nrfjprog" /><item><title>RE: Unable to get app to run when flashing BL, SD and App via nrfjprog</title><link>https://devzone.nordicsemi.com/thread/248775?ContentTypeID=1</link><pubDate>Thu, 07 May 2020 14:47:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:33e75705-45ca-4374-8bc8-8a6c5f7fcc5b</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Hi Dave,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Happy to hear that things are now working fine.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;
&lt;p&gt;Bjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to get app to run when flashing BL, SD and App via nrfjprog</title><link>https://devzone.nordicsemi.com/thread/248742?ContentTypeID=1</link><pubDate>Thu, 07 May 2020 13:40:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3faaf57e-00a7-462e-8668-65d65f833d54</guid><dc:creator>SleepingDog</dc:creator><description>&lt;p&gt;I have made a number of changes and it appears to be working now:&lt;/p&gt;
&lt;p&gt;1) Changed&amp;nbsp;NRF_BL_DFU_ENTER_METHOD_BUTTON from 1 to 0 in sdk_config.h&lt;/p&gt;
&lt;p&gt;2) Changed&amp;nbsp;NRF_BL_DFU_ENTER_METHOD_BUTTONLESS from 0 to 1 in sdk_config.h&lt;/p&gt;
&lt;p&gt;3) Changed the way I was requesting DFU in my app from&lt;/p&gt;
&lt;pre&gt;    sd_power_gpregret_clr(0, 0xFF);
    sd_power_gpregret_set(0, 1);
    sd_nvic_SystemReset();
&lt;/pre&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; to:&lt;/p&gt;
&lt;pre&gt;    uint32_t value;
    sd_power_gpregret_get(0, &amp;amp;value);
    value |= BOOTLOADER_DFU_START;
    sd_power_gpregret_set(0, value);
    sd_nvic_SystemReset();
&lt;/pre&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; using the macro definition for BOOTLOADER_DFU_START taken from a bootloader header file.&lt;/p&gt;
&lt;p&gt;The combination of the above seems to have fixed the problem.&lt;/p&gt;
&lt;p&gt;I will close this ticket after I have performed more extensive testing.&lt;/p&gt;
&lt;p&gt;Regards to all.&lt;/p&gt;
&lt;p&gt;Dave&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to get app to run when flashing BL, SD and App via nrfjprog</title><link>https://devzone.nordicsemi.com/thread/248710?ContentTypeID=1</link><pubDate>Thu, 07 May 2020 12:39:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c4c918a2-af3f-40f2-9c41-d7c9377f4396</guid><dc:creator>SleepingDog</dc:creator><description>&lt;p&gt;Further info.&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve added some code to turn LEDs on when various events happen. I&amp;#39;m finding that it is getting into this piece of code:&lt;/p&gt;
&lt;pre&gt;  static bool dfu_enter_check(void)&lt;br /&gt;  {&lt;br /&gt;    .&lt;br /&gt;    .&lt;br /&gt;    .&lt;br /&gt;    if (NRF_BL_DFU_ENTER_METHOD_GPREGRET &amp;amp;&amp;amp;
       (nrf_power_gpregret_get() &amp;amp; BOOTLOADER_DFU_START))
    {
        NRF_LOG_DEBUG(&amp;quot;DFU mode requested via GPREGRET.&amp;quot;);  &amp;lt;&amp;lt;&amp;lt; Gets here
&lt;/pre&gt;
&lt;p&gt;So it looks like GPREGRET is still set. I set it in my app when I want to go into DFU mode. How is that flag supposed to get cleared?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to get app to run when flashing BL, SD and App via nrfjprog</title><link>https://devzone.nordicsemi.com/thread/248522?ContentTypeID=1</link><pubDate>Wed, 06 May 2020 14:40:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:213af524-3d3b-4b40-a3b2-2c4118722bd9</guid><dc:creator>SleepingDog</dc:creator><description>&lt;p&gt;Thanks Bj&amp;oslash;rn&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve changed the order of events in my flashing script to what you suggested, and added the sectorerase option when flashing the bootloader setting, but it still works the same way.&lt;/p&gt;
&lt;p&gt;I can&amp;#39;t seem to set a breakpoint in that function, though (using SES). I get the ? in the breakpoint dot. I can set a breakpoint where it is called in nrf_bootloader_init() where it is called, though, but when I single step it does not seem to go into dfu_enter_check(). Very strange.&lt;/p&gt;
&lt;p&gt;Dave&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to get app to run when flashing BL, SD and App via nrfjprog</title><link>https://devzone.nordicsemi.com/thread/248504?ContentTypeID=1</link><pubDate>Wed, 06 May 2020 13:59:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:acea5483-28fe-438b-a1e8-730148be9417</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Hi David,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;the correct flashing order is&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;nrfjprog --eraseall&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;nrfutil settings generate --family NRF52840 --application&amp;nbsp;emf_firmware_pca10056_s140.hex&amp;nbsp;&amp;nbsp;--application-version 1 --bootloader-version 0 --bl-settings-version 2 bootloader_setting.hex&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;nrfjprog --program&amp;nbsp;s140_nrf52_6.1.1_softdevice.hex -f NRF52&lt;br /&gt;&lt;/span&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span&gt;nrfjprog --program&amp;nbsp;secure_bootloader_ble_s140_pca10056.hex -f NRF52&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;nrfjprog --program bootloader_setting.hex --sectorerase&amp;nbsp; -f NRF52&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;nrfjprog --program&amp;nbsp;emf_firmware_pca10056_s140.hex -f NRF52&lt;br /&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;nrfjprog --reset&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The bootloader settings should set the bank 0 bank code to&amp;nbsp;NRF_DFU_BANK_VALID_APP(0x01) and the bootloader should see this on boot and jump to the application.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Can you set a breakpoint in the&amp;nbsp;app_is_valid if statement in dfu_enter_check() in nrf_bootloader.c to see if&amp;nbsp;dfu_enter_check returns false?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static bool dfu_enter_check(void)
{
    if (!app_is_valid(crc_on_valid_app_required()))
    {
        NRF_LOG_DEBUG(&amp;quot;DFU mode because app is not valid.&amp;quot;);
        return true;
    }
    
    .
    .
    .
}&lt;/pre&gt;&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;Bjørn&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to get app to run when flashing BL, SD and App via nrfjprog</title><link>https://devzone.nordicsemi.com/thread/248482?ContentTypeID=1</link><pubDate>Wed, 06 May 2020 13:25:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1c105e03-c947-406f-8edb-6ca0c6c9579e</guid><dc:creator>SleepingDog</dc:creator><description>&lt;p&gt;I have some updated information.&lt;/p&gt;
&lt;p&gt;Within my firmware app I have code that allows the user to switch to DFU mode so that they can upload a new firmware app via BLE DFU. If I go into DFU mode using that method and then run my script to erase all and flash everything it will not launch the app unless I power cycle the board after running my script. Once the board has been powered down and back up I can reflash everything over and over again and it always works.&lt;/p&gt;
&lt;p&gt;So to be clear, here is the sequence:&lt;/p&gt;
&lt;p&gt;1) f/w app running, go into DFU mode (see code below), flash SD/BL/APP (using nrfjprog) =&amp;gt; bootloader still running and advertising for DFU&lt;/p&gt;
&lt;p&gt;2) power cycle board =&amp;gt; firmware app launches ok&lt;/p&gt;
&lt;p&gt;3) flash SD/BL/APP (using nrfjprog) =&amp;gt; firmware app is running&lt;/p&gt;
&lt;p&gt;Can repeat step 3 and always works&lt;/p&gt;
&lt;p&gt;This is what I&amp;#39;m doing within my firmware app to go into DFU mode:&lt;/p&gt;
&lt;pre&gt;    sd_power_gpregret_clr(0, 0xFF);
    sd_power_gpregret_set(0, 1);
    sd_nvic_SystemReset();
&lt;/pre&gt;
&lt;p&gt;Perhaps there is a better (proper?) way of getting into DFU mode?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to get app to run when flashing BL, SD and App via nrfjprog</title><link>https://devzone.nordicsemi.com/thread/248314?ContentTypeID=1</link><pubDate>Tue, 05 May 2020 22:39:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:28802d00-1737-4179-8815-4dacc3f6cfdf</guid><dc:creator>SleepingDog</dc:creator><description>&lt;p&gt;Thanks for the idea. I tried that, but no change in behaviour I&amp;#39;m afraid.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to get app to run when flashing BL, SD and App via nrfjprog</title><link>https://devzone.nordicsemi.com/thread/248307?ContentTypeID=1</link><pubDate>Tue, 05 May 2020 19:45:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8cb73ed1-18b8-4b6c-8911-4be8379456cd</guid><dc:creator>Turbo J</dc:creator><description>&lt;p&gt;Try flashing the bootloader settings &lt;em&gt;after&lt;/em&gt; flashing the bootloader and firmware. Otherwise these will get overwritten.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>