<?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>How to make it run application when there is a bootloader in the nRF52</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/18067/how-to-make-it-run-application-when-there-is-a-bootloader-in-the-nrf52</link><description>Hi, 
 I&amp;#39;m using the bootloader in nRF5_SDK V12.0 with nRF52832. I have some problems want to know: 
 
 
 How to make it run application first after I program softdevice,bootloader and application? I found that it runs the bootloader and broadcast</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 08 Dec 2016 07:27:52 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/18067/how-to-make-it-run-application-when-there-is-a-bootloader-in-the-nrf52" /><item><title>RE: How to make it run application when there is a bootloader in the nRF52</title><link>https://devzone.nordicsemi.com/thread/69690?ContentTypeID=1</link><pubDate>Thu, 08 Dec 2016 07:27:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a4d825ac-6464-46c7-9ceb-48b6d62895f9</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Happy to help!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to make it run application when there is a bootloader in the nRF52</title><link>https://devzone.nordicsemi.com/thread/69689?ContentTypeID=1</link><pubDate>Thu, 08 Dec 2016 02:24:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:78565827-f0d3-4881-8831-6884f80cd7db</guid><dc:creator>Alice</dc:creator><description>&lt;p&gt;Hi Bjørn Spockeli, I know my issue. I just use setting, bootloader, softdevice the three files to combine. It should include application. Thanks a lot.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to make it run application when there is a bootloader in the nRF52</title><link>https://devzone.nordicsemi.com/thread/69688?ContentTypeID=1</link><pubDate>Tue, 06 Dec 2016 13:23:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ac7653ae-5bba-48ce-9641-00bfe5c0e5f7</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Hi Alice, as far as I know there are no issues with the compute crc function. I have never seen that the CRC is calculated incorrectly. Would it be possible for you to attach the application hex file you&amp;#39;re using to create the setting page and the firmware image to the question so that I can check if I see the same issue?&lt;/p&gt;
&lt;p&gt;You should only use the application.hex and not the merged application+settings page hex to create the firmware image.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to make it run application when there is a bootloader in the nRF52</title><link>https://devzone.nordicsemi.com/thread/69687?ContentTypeID=1</link><pubDate>Mon, 05 Dec 2016 02:09:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:93f3f082-1b8c-4ba9-a3ed-8db7acbccfb3</guid><dc:creator>Alice</dc:creator><description>&lt;p&gt;The settings page as follow:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;0x0007F000: FAD8B19F 00000001 00000001 00000001   |................|
0x0007F010: 00000000 00000000 00005EA8 5221C273   |.........^..s.!R|
0x0007F020: 00000001 00000000 00000000 00000000   |................|
0x0007F030: 00000000 00000000 00000000 00000000   |................|
0x0007F040: 00000000 00000000 00000000 00000000   |................|
0x0007F050: 00000000 00000000 00000000 FFFFFFFF   |................|
0x0007F060: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF   |................|
0x0007F070: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF   |................|
0x0007F080: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF   |................|
0x0007F090: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF   |................|
0x0007F0A0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF   |................|
0x0007F0B0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF   |................|
0x0007F0C0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF   |................|
0x0007F0D0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF   |................|
0x0007F0E0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF   |................|
0x0007F0F0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF   |................|
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;We can see that the CRC stored on the bootloader settings page is 0x5221C273, then I debug it and set a breakpoint at the&lt;code&gt;if (crc != s_dfu_settings.bank_0.image_crc)&lt;/code&gt;, the crc is 0xDD2F1460. So it wouldn&amp;#39;t run the application. Is there any problem for the crc32_compute function? The SDK I use is nRF5_SDK_12.0.0_12f24da.&lt;/p&gt;
&lt;p&gt;Besides, I found another problem.For example, my application is app.hex and use app.hex to generate the setting page app_setting.hex. Softdevice and bootloader have been flashed to the chip. Then I use app_setting.hex to generate the ZIP and use nRF Toolbox to update the fireware, it failes.  The APP reported as completed(just 1% and then 100%,veyy soon), in fact the device is not updated. However, if I use app.hex to generate the ZIP (the same way)and use nRF Toolbox to update the fireware, it&amp;#39;s OK. The version of APP is 4.2.0.  I use bootloader_secure from the
nRF5_SDK_12.1.0_0d23e2a, the problem still exist.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to make it run application when there is a bootloader in the nRF52</title><link>https://devzone.nordicsemi.com/thread/69685?ContentTypeID=1</link><pubDate>Fri, 02 Dec 2016 13:07:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4a3d0750-9acc-4985-83b3-59b8a2bbac93</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;The bootloader will calculate the CRC of the application and compare it to the CRC that is stored on the bootloader settings page(@0x7F000) that you created with nrfutil and merged with your bootloader, Softdevice and application hex. The settings page that you attached above shows that nrfutil calculated the CRC to 0x5BA4336D. If you have flashed the same application to your nRF52, then &lt;code&gt;crc32_compute&lt;/code&gt; in &lt;code&gt;nrf_dfu_app_is_valid&lt;/code&gt; should return the same crc, if it doesn&amp;#39;t then its not the same application. Can you set a breakpoint at the  &lt;code&gt;if (crc != s_dfu_settings.bank_0.image_crc)&lt;/code&gt; statement and see what &lt;code&gt;crc32_compute&lt;/code&gt; returns?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to make it run application when there is a bootloader in the nRF52</title><link>https://devzone.nordicsemi.com/thread/69686?ContentTypeID=1</link><pubDate>Fri, 02 Dec 2016 07:35:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e08aa8f3-85ca-4d14-8a42-cb1f61d530e5</guid><dc:creator>Alice</dc:creator><description>&lt;p&gt;Thanks.  I have use  sd_power_gpregret_set API to do it.&lt;/p&gt;
&lt;p&gt;I have debuged it and found it didn&amp;#39;t run to
&lt;code&gt;if (nrf_dfu_app_is_valid())&lt;/code&gt;
Also the value of enter_bootloader_mode is 0. However,in the
&lt;code&gt;if(enter_bootloader_mode != 0 || !nrf_dfu_app_is_valid())&lt;/code&gt;
nrf_dfu_app_is_valid returns false, that is the CRC != 0, so it didn&amp;#39;t run the application. But I donn&amp;#39;t know why the CRC is not 0.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to make it run application when there is a bootloader in the nRF52</title><link>https://devzone.nordicsemi.com/thread/69684?ContentTypeID=1</link><pubDate>Thu, 01 Dec 2016 13:50:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ebaad4aa-fa1f-42ff-8178-d502cb5bb0ce</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;The GPREGRET registers are a part of the POWER peripheral that is restricted when the SoftDevice is enabled, see &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.sds/dita/softdevices/s130/sd_resource_reqs/hw_block_interrupt_vector.html"&gt;this&lt;/a&gt; page in the S132 v3.0.0 Product Specification. It is therefore important that you use the SoftDevice API,  &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.api.v3.0.0/group___n_r_f___s_o_c___f_u_n_c_t_i_o_n_s.html#ga62737e6515d380aa3eeba6582d061592"&gt;sd_power_gpregret_set&lt;/a&gt;, when you want to write to the GPREGRET register and the SoftDevice is enabled. Looking at the bootloader settings I can see that the bank 0 code(@0x7F020) is set to 0x00000001(NRF_DFU_BANK_VALID_APP) and you should reach the&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;if (nrf_dfu_app_is_valid())
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;statment in nrf_dfu_init() in nrf_dfu.c. Have you checked this?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to make it run application when there is a bootloader in the nRF52</title><link>https://devzone.nordicsemi.com/thread/69683?ContentTypeID=1</link><pubDate>Thu, 01 Dec 2016 10:24:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cc788c14-de49-4131-86ae-512a4ea0b5f7</guid><dc:creator>Alice</dc:creator><description>&lt;p&gt;I couldn&amp;#39;t find how to add a attachment, the settings page as follow:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;0x0007F000: 5BA4336D 00000001 00000001 00000001   |m3.[............|
0x0007F010: 00000000 00000000 00005F14 F3CC7A53   |........._..Sz..|
0x0007F020: 00000001 00000000 00000000 00000000   |................|
0x0007F030: 00000000 00000000 00000000 00000000   |................|
0x0007F040: 00000000 00000000 00000000 00000000   |................|
0x0007F050: 00000000 00000000 00000000 FFFFFFFF   |................|
0x0007F060: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF   |................|
0x0007F070: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF   |................|
0x0007F080: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF   |................|
0x0007F090: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF   |................|
0x0007F0A0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF   |................|
0x0007F0B0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF   |................|
0x0007F0C0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF   |................|
0x0007F0D0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF   |................|
0x0007F0E0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF   |................|
0x0007F0F0: FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF   |................|`
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I set the all version to 1&lt;/p&gt;
&lt;p&gt;Would you see the same problem with GPREGRET register as me?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to make it run application when there is a bootloader in the nRF52</title><link>https://devzone.nordicsemi.com/thread/69682?ContentTypeID=1</link><pubDate>Wed, 30 Nov 2016 14:35:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a862cc12-2616-482b-a5ce-1921b6b23a37</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Can you readout the bootloader settings page using the following nrjprog command&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;nrfjprog -f nrf52 --memrd 0x7F000 --n 256 &amp;gt;&amp;gt; bootloader_setings_hexdump.txt
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and attach it to the question. Could you also try to debug the bootloader and see if it enters the&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; if(enter_bootloader_mode != 0 || !nrf_dfu_app_is_valid())
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;or the&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;if (nrf_dfu_app_is_valid()) 
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;statment in nrf_dfu_init() in nrf_dfu.c?&lt;/p&gt;
&lt;p&gt;It could be that writing to the GPREGRET registers when the SoftDevice is enabled will trigger a Hardfault, i.e. a Reset. I will look into this.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to make it run application when there is a bootloader in the nRF52</title><link>https://devzone.nordicsemi.com/thread/69681?ContentTypeID=1</link><pubDate>Wed, 30 Nov 2016 14:27:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:76c676a4-7cca-4d16-95d5-36eca298cc14</guid><dc:creator>Alice</dc:creator><description>&lt;p&gt;I combine them into one file and then flash it to my board,but  it just run the bootloader. What problem do you think?
Both GPREGRET and GPREGRET2, I have tried it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to make it run application when there is a bootloader in the nRF52</title><link>https://devzone.nordicsemi.com/thread/69680?ContentTypeID=1</link><pubDate>Wed, 30 Nov 2016 13:45:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:557254a2-7ffb-4b66-83b0-9b078b1881f9</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;ol&gt;
&lt;li&gt;Yes, you can and should combine them into one file and then flash it to you board.&lt;/li&gt;
&lt;li&gt;Yes, you should be able to set the application version in the bootloader settings freely. Just keep in mind that the next time you create an application image then the application version number must be greater than the one in bootloader settings, please see &amp;quot;Acceptance rules for versions&amp;quot; on &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v12.0.0/ble_sdk_app_dfu_bootloader.html?cp=4_0_0_4_3_1_3#lib_bootloader_dfu_init_validation"&gt;this&lt;/a&gt; Infocenter page&lt;/li&gt;
&lt;li&gt;Yes, you a right, the GPREGRET register is more suited for this. Are you writing to the GPREGRET or GPREGRET2?&lt;/li&gt;
&lt;/ol&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to make it run application when there is a bootloader in the nRF52</title><link>https://devzone.nordicsemi.com/thread/69679?ContentTypeID=1</link><pubDate>Wed, 30 Nov 2016 12:46:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:efb65615-7ca4-4b64-a043-596b75db9d72</guid><dc:creator>Alice</dc:creator><description>&lt;p&gt;@Bjørn Thanks.&lt;/p&gt;
&lt;p&gt;Do you mean that I just need to use the application.hex to generate the bootloader settings page?
I do it as follow. Could the version number defined freely by me?
nrfutil settings generate --family NRF52 --application nrf52832_1130.hex --application-version 3 --bootloader-version 2 --bl-settings-version 1 setting_1130.hex&lt;/p&gt;
&lt;p&gt;Could I merge setting.hex,softdevice and bootloader to one file and then flash it to my device? I have tried it but it just run the bootloader.&lt;/p&gt;
&lt;p&gt;I found another way to switch bootloader just now. That is use the GPREGRET register because it can retain it&amp;#39;s value after a soft-reset. But I also meet a problem, when I receive the AT command and then I just wirte one byte value to the GPREGRET register, the chip will reset. I donn&amp;#39;t know why. Does this way be better than write a value to flash?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to make it run application when there is a bootloader in the nRF52</title><link>https://devzone.nordicsemi.com/thread/69678?ContentTypeID=1</link><pubDate>Wed, 30 Nov 2016 12:07:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7fc15987-2005-4ced-a238-55944f8b7a39</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Hi Alice,&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;You have to generate the bootloader settings page that sets the application crc and the bank 0 status flag to &lt;code&gt;NRF_DFU_BANK_VALID_APP&lt;/code&gt;, see &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.tools/dita/tools/nrfutil/nrfutil_settings_generate_display.html"&gt;this&lt;/a&gt; page in the nrfutil documentation.&lt;/li&gt;
&lt;li&gt;The bootloader will check the CRC of the application against the application CRC stored in the bootloader settings page. If you flash a new application to your device, then the CRCs will not match. Thus, you have to update the bootloader settings page that corresponds to your new application.&lt;/li&gt;
&lt;li&gt;If you&amp;#39;re only writing one value to flash then I suggest that you use the SoftDevice Flash API, see &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.api.v3.0.0/group___n_r_f___s_o_c___f_u_n_c_t_i_o_n_s.html#ga8b49f2e72e97291aecc18ce396956eed"&gt;sd_flash_write&lt;/a&gt; documentation in the S132 SoftDevice API documentation.&lt;/li&gt;
&lt;/ol&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></channel></rss>