<?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>Jumping to Bootloader from the Application</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/12606/jumping-to-bootloader-from-the-application</link><description>How can I jump to the bootloader from the application without anything BLE related. Possibly through a botton? 
 I&amp;#39;m on the newest SDK v11.</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 07 Apr 2016 09:29:12 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/12606/jumping-to-bootloader-from-the-application" /><item><title>RE: Jumping to Bootloader from the Application</title><link>https://devzone.nordicsemi.com/thread/47860?ContentTypeID=1</link><pubDate>Thu, 07 Apr 2016 09:29:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:96c75369-0cdf-41fc-a709-4f666b10fcf3</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;No, the GPREGRET register will not be retained during a Power-on-Reset. Pleas refer &lt;strong&gt;section 12.1.19 Reset behavior&lt;/strong&gt; in the nRF51 Reference Manual, found &lt;a href="https://www.nordicsemi.com/eng/nordic/download_resource/20337/12/79895475"&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Jumping to Bootloader from the Application</title><link>https://devzone.nordicsemi.com/thread/47858?ContentTypeID=1</link><pubDate>Wed, 06 Apr 2016 14:40:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c697b3b6-21a3-47d4-8eab-2ef065c78e8f</guid><dc:creator>rabiaasl</dc:creator><description>&lt;p&gt;What would happen if I set the GPREGRET and turn off the device? Will the GPREGRET still retain the data when the device starts up again?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Jumping to Bootloader from the Application</title><link>https://devzone.nordicsemi.com/thread/47859?ContentTypeID=1</link><pubDate>Wed, 06 Apr 2016 07:01:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:692091a1-5d28-4a12-a6f4-b5a9e7ccbba2</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;No, you can write to the GPREGRET (General purpose retention register) at any time and set it to any value. No, writing to the GPREGRET register does not have to be followed by a reset. Since the register is retained during a reset, you can set it to a certain value indicating the reason for the reset and then check it after the device has reset. We do not have any documentation on how to use GPREGRET register.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Jumping to Bootloader from the Application</title><link>https://devzone.nordicsemi.com/thread/47857?ContentTypeID=1</link><pubDate>Tue, 05 Apr 2016 23:58:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4214dc1d-460c-4d4c-9ef1-2549e9fb3c89</guid><dc:creator>rabiaasl</dc:creator><description>&lt;p&gt;Is there documentation on how to use the GPREGRET register?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Jumping to Bootloader from the Application</title><link>https://devzone.nordicsemi.com/thread/47856?ContentTypeID=1</link><pubDate>Tue, 05 Apr 2016 23:39:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0f47144c-8aa3-4671-b53b-7b8db8f4fd67</guid><dc:creator>rabiaasl</dc:creator><description>&lt;p&gt;Are there any restrictions on how many times you can read/write to this register? Or what you set it as? After setting it does it always have to be followed by a reset? What if you want to communicate different reasons why a reset occurred using this register? Can you set it to values of your choice?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Jumping to Bootloader from the Application</title><link>https://devzone.nordicsemi.com/thread/47855?ContentTypeID=1</link><pubDate>Wed, 30 Mar 2016 07:31:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9ff6b04e-e629-4ebe-a18d-76cf81536769</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;In order to jump to the bootloader , you have to add this define in your application project&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#define BOOTLOADER_DFU_START 0xB1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and call the following functions when the button is pressed:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;if (button_is_pressed)

{
    //  Write to the the GPREGRET REGISTER and reset the chip

   //You can use the sd_-functions 

    err_code = sd_power_gpregret_set(BOOTLOADER_DFU_START);

    APP_ERROR_CHECK(err_code);

    sd_nvic_SystemReset();   


   //OR set the register directly and then call NVIC_SystemReset(); 

    NRF_POWER-&amp;gt;GPREGRET = BOOTLOADER_DFU_START;

    NVIC_SystemReset();
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In the bootloader you have to remove the init_softdevice check in ble_stack_init(), i.e.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;//if (init_softdevice)

//{
    err_code = sd_mbr_command(&amp;amp;com);

    APP_ERROR_CHECK(err_code);
//}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;-Bjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Jumping to Bootloader from the Application</title><link>https://devzone.nordicsemi.com/thread/47861?ContentTypeID=1</link><pubDate>Thu, 17 Mar 2016 00:39:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5e22419b-d29e-468c-9d10-9db3878626f2</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;Many ways. You could just make the button reset the system and then have that button be the same one which triggers the bootloader to enter DFU mode, press the button and hold it for long enough the bootloader sees it, that doesn&amp;#39;t even require any code change in the loader.&lt;/p&gt;
&lt;p&gt;I added a few lines of code to the start of the bootloader to force it into DFU mode if a given value is written to GPREGRET. That works too, I have a standard control service which uses BLE to receive an enter DFU command, writes GPREGRET and resets, then it goes into DFU mode. I found this preferable to the method in the manual which bounces between the two, it&amp;#39;s clever, but more than I needed. This way I can quite easily force myself into bootloader mode with either a button or a command over my BLE command channel.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>