<?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>Bootloader address flash write</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/112924/bootloader-address-flash-write</link><description>1. Hi i am utilizing nrf52840 sdk with ver 17.1.10 s140 and i have the central UART as main app from there we are calling bootloader 
 2. Before calling bootloader ble dfu we are writing the data in the Flash address 0x3e000 4 bytes 
 3. After entering</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 08 Aug 2024 05:37:07 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/112924/bootloader-address-flash-write" /><item><title>RE: Bootloader address flash write</title><link>https://devzone.nordicsemi.com/thread/497406?ContentTypeID=1</link><pubDate>Thu, 08 Aug 2024 05:37:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0f5e2e1f-c772-4733-b51e-59ccda8a2d08</guid><dc:creator>AP1</dc:creator><description>&lt;p&gt;Hi thanks for the reply we are using GPREGRET registers to store the values it is working fine during soft reset&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader address flash write</title><link>https://devzone.nordicsemi.com/thread/493822?ContentTypeID=1</link><pubDate>Mon, 15 Jul 2024 07:46:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:caf4234e-d66e-4d16-a24e-70ea6a1fcda5</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;The flash is erased in units of flash pages, which are 4kB each on the nRF52 series.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader address flash write</title><link>https://devzone.nordicsemi.com/thread/493745?ContentTypeID=1</link><pubDate>Sat, 13 Jul 2024 08:32:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dcb886c4-974c-48af-beff-6d04d6c70734</guid><dc:creator>AP1</dc:creator><description>&lt;p&gt;1. Hi I need to write in flash address but my issue is before writing anything I should erase atleast 4kB data in flash address then only I can write&amp;nbsp;&lt;/p&gt;
&lt;p&gt;2. Is there any thing like we can erase only required bytes in flash&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader address flash write</title><link>https://devzone.nordicsemi.com/thread/493744?ContentTypeID=1</link><pubDate>Sat, 13 Jul 2024 08:28:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1803a69d-964e-49a6-ba11-7a37563bd4ed</guid><dc:creator>AP1</dc:creator><description>&lt;p&gt;Hi I am using s140 soft device ver 7.2.0 will flash address remains same as you have posted above or there is any changes will be there&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader address flash write</title><link>https://devzone.nordicsemi.com/thread/493611?ContentTypeID=1</link><pubDate>Fri, 12 Jul 2024 10:58:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:79511cf8-529c-4c78-be3d-568fdb130261</guid><dc:creator>AP1</dc:creator><description>&lt;p&gt;Hi vidar Berg thanks for your reply&lt;/p&gt;
&lt;p&gt;1.I have tried with&amp;nbsp;&lt;span&gt;nrf_power_gpregret api by writing and reading in the register it is working fine in bootloader_ble_debug app&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;2.but when we tried to read only using&amp;nbsp;nrf_power_gpregret2_get() after power reset the data is 0 is that the register value becoming 0 after power reset or any where it is clearing in the code after reset in booloader_ble_debug sdk&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;3. Can i verify through any particular flash address or the register address so that the data is written&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;4. Is there any other registers which will retain its value even after power reset&lt;/p&gt;
&lt;p&gt;&lt;br /&gt; // nrf_power_gpregret2_set(0x56);&lt;br /&gt; // APP_ERROR_CHECK(err_code);&lt;/p&gt;
&lt;p&gt;// Set GPREGRET register to trigger DFU&lt;br /&gt; uint8_t ret = nrf_power_gpregret2_get();&lt;br /&gt; APP_ERROR_CHECK(err_code);&lt;/p&gt;
&lt;p&gt;&lt;span&gt;logs:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;ret = 0x0&lt;br /&gt;&amp;lt;info&amp;gt; app: Inside main&lt;br /&gt;&amp;lt;debug&amp;gt; app: In nrf_bootloader_init&lt;br /&gt;&amp;lt;debug&amp;gt; nrf_dfu_settings: Calling nrf_dfu_settings_init()...&lt;br /&gt;&amp;lt;debug&amp;gt; nrf_dfu_flash: Initializing nrf_fstorage_nvmc backend.&lt;br /&gt;&amp;lt;debug&amp;gt; nrf_dfu_settings: Using settings page.&lt;br /&gt;&amp;lt;debug&amp;gt; nrf_dfu_settings: Copying forbidden parts from backup page.&lt;br /&gt;&amp;lt;debug&amp;gt; nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.&lt;br /&gt;&amp;lt;info&amp;gt; nrf_dfu_settings: Backing up settings page to address 0xFE000.&lt;br /&gt;&amp;lt;debug&amp;gt; nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.&lt;br /&gt;&amp;lt;debug&amp;gt; app: Enter nrf_bootloader_fw_activate&lt;br /&gt;&amp;lt;info&amp;gt; app: No firmware to activate.&lt;br /&gt;&amp;lt;info&amp;gt; app: Boot validation failed. No valid app to boot.&lt;br /&gt;&amp;lt;debug&amp;gt; app: DFU mode because app is not valid.&lt;br /&gt;&amp;lt;info&amp;gt; nrf_bootloader_wdt: WDT is not enabled&lt;br /&gt;&amp;lt;debug&amp;gt; app: in weak nrf_dfu_init_user&lt;br /&gt;&amp;lt;debug&amp;gt; app: timer_stop (0x2000599C)&lt;br /&gt;&amp;lt;debug&amp;gt; app: timer_activate (0x2000599C)&lt;br /&gt;&amp;lt;info&amp;gt; app: Entering DFU mode.&lt;br /&gt;&amp;lt;debug&amp;gt; app: Initializing transports (found: 1)&lt;br /&gt;&amp;lt;debug&amp;gt; nrf_dfu_ble: Initializing BLE DFU transport&lt;br /&gt;&amp;lt;debug&amp;gt; nrf_dfu_ble: Setting up vector table: 0x000F1000&lt;br /&gt;&amp;lt;debug&amp;gt; nrf_dfu_ble: Enabling SoftDevice.&lt;br /&gt;&amp;lt;debug&amp;gt; nrf_dfu_ble: Configuring BLE stack.&lt;br /&gt;&amp;lt;debug&amp;gt; nrf_dfu_ble: Enabling the BLE stack.&lt;br /&gt;&amp;lt;debug&amp;gt; nrf_dfu_ble: No advertising name found&lt;br /&gt;&amp;lt;debug&amp;gt; nrf_dfu_ble: Using default advertising name&lt;br /&gt;&amp;lt;debug&amp;gt; nrf_dfu_ble: Advertising...&lt;br /&gt;&amp;lt;debug&amp;gt; nrf_dfu_ble: BLE DFU transport initialized.&lt;br /&gt;&amp;lt;debug&amp;gt; nrf_dfu_flash: Initializing nrf_fstorage_sd backend.&lt;br /&gt;&amp;lt;debug&amp;gt; app: Enter main loop&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader address flash write</title><link>https://devzone.nordicsemi.com/thread/493557?ContentTypeID=1</link><pubDate>Fri, 12 Jul 2024 06:33:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:90d1cd60-7671-4d92-b77b-407cf248f6d1</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;The GPREGRET registers are included in the POWER peripheral, which the Softdevice reserves access to. Therefore, you need to use the&amp;nbsp;sd_power_gpregret_* APIs to access these registers in the application while the Softdevice is enabled. However, these functions cannot be when the Softdevice is disabled, hence the&amp;nbsp;NRF_ERROR_SVC_HANDLER_MISSING (&amp;#39;1&amp;#39;)&amp;nbsp; error.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You can see how the&amp;nbsp;nrf_power_gpregret* functions are used in the bootloader.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader address flash write</title><link>https://devzone.nordicsemi.com/thread/493466?ContentTypeID=1</link><pubDate>Thu, 11 Jul 2024 14:19:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8814ac0a-515f-41f5-a652-f964e776f58e</guid><dc:creator>AP1</dc:creator><description>&lt;p&gt;1. Hi&amp;nbsp; after setting the&amp;nbsp;&lt;span&gt;GPREGRET2 register value&amp;nbsp; in which address should i verify that the value is written properly&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;i have the following code snippet in central uart app before calling ble bootloader is this a correct method ?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt; // Clear GPREGRET register&lt;br /&gt; err_code = sd_power_gpregret_clr(0, 0xFF);&lt;br /&gt; APP_ERROR_CHECK(err_code);&lt;/p&gt;
&lt;p&gt;// Set GPREGRET register to trigger DFU&lt;br /&gt; err_code = sd_power_gpregret_set(0, BOOTLOADER_DFU_START);&lt;br /&gt; APP_ERROR_CHECK(err_code);&lt;/p&gt;
&lt;p&gt;// Clear GPREGRET2 register&lt;br /&gt; err_code = sd_power_gpregret_clr(1, 0xFF);&lt;br /&gt; APP_ERROR_CHECK(err_code);&lt;br /&gt; &lt;br /&gt; // Set GPREGRET2 register&lt;br /&gt; err_code = sd_power_gpregret_set(1, 0x56);&lt;br /&gt; APP_ERROR_CHECK(err_code);&lt;/p&gt;
&lt;p&gt;// Reset the system&lt;br /&gt; NVIC_SystemReset();&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;2. I Tried to write the register in the Bootloader_ble_debug app to verify whether we can able to write and read the data&amp;nbsp; but error code 01 is returned form the func what are the required things to be done before writing into it&amp;nbsp;&lt;/p&gt;
&lt;p&gt;code snippet&amp;nbsp;&lt;/p&gt;
&lt;p&gt;uint32_t err_code;&lt;/p&gt;
&lt;p&gt;err_code = sd_power_gpregret_clr(1, 0xFF);&lt;br /&gt; NRF_LOG_DEBUG(&amp;quot;ret 1 = %d\n&amp;quot;, err_code);&lt;br /&gt; APP_ERROR_CHECK(err_code);&lt;br /&gt; &lt;br /&gt; // Set GPREGRET2 register&lt;br /&gt; err_code = sd_power_gpregret_set(1, 0x56);&lt;br /&gt; NRF_LOG_DEBUG(&amp;quot;ret 2 = %d\n&amp;quot;, err_code);&lt;br /&gt; APP_ERROR_CHECK(err_code);&lt;/p&gt;
&lt;p&gt;uint32_t custom_data = NRF_POWER-&amp;gt;GPREGRET2;&lt;/p&gt;
&lt;p&gt;NRF_LOG_DEBUG(&amp;quot;custom data 0x%04X&amp;quot;, custom_data);&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;logs:&lt;/p&gt;
&lt;p&gt;&amp;lt;info&amp;gt; app: Inside main&lt;br /&gt;&amp;lt;debug&amp;gt; app: ret 1 = 1&lt;/p&gt;
&lt;p&gt;&amp;lt;error&amp;gt; app: Received an error: 0x00000001!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Note : i have tried to achieve that&amp;nbsp;read and write in both the app for verification of this&amp;nbsp;&lt;span&gt;GPREGRET2 register&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader address flash write</title><link>https://devzone.nordicsemi.com/thread/493406?ContentTypeID=1</link><pubDate>Thu, 11 Jul 2024 12:12:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:98c1fbc5-d547-4a44-a2da-169e0b640a30</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;I&amp;#39;m trying to understand your goal is. If just want the app to be able to pass a flag/value to the bootloader, you could just use the one of the General purpose retention registers (GPREGRET). These are retained through a Soft reset.&lt;/p&gt;
&lt;p&gt;Note that&amp;nbsp;there are two of these registers available, and one is used by the bootloader when&amp;nbsp;NRF_BL_APP_CRC_CHECK_SKIPPED_ON_GPREGRET2 is enabled, and the other when&amp;nbsp;NRF_BL_DFU_ENTER_METHOD_GPREGRET is enabled.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader address flash write</title><link>https://devzone.nordicsemi.com/thread/493334?ContentTypeID=1</link><pubDate>Thu, 11 Jul 2024 08:54:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c7d1a8c0-b888-4eef-956e-a2404d018606</guid><dc:creator>AP1</dc:creator><description>&lt;p&gt;1. So i need&amp;nbsp; to retain the data at least 4 byte even if it enters into bootloader_ble dfu after triggering form the main central UART&lt;/p&gt;
&lt;p&gt;2.&amp;nbsp; I have explained requirements in the above post so need to know that for writing at least 4 bytes is possible using &lt;span&gt;fstorage&amp;nbsp;because we need to erase before writing&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;3. Is it required to erase 4096 bytes before writing the data ?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;3. Is there any other method like registers, so that i can write 4 bytes data in the flash and that should be accessible even if it enters in the bootloader_ble dfu mode also&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Note : I need only 1 byte if it is not happening 4 bytes is also ok but i need a simple way to write small data in flash or registers so that i can access in bootloader_ble dfu also&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader address flash write</title><link>https://devzone.nordicsemi.com/thread/493306?ContentTypeID=1</link><pubDate>Thu, 11 Jul 2024 07:40:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:be462235-fcbe-4a75-9990-5d59bb0960da</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Can you please elaborate on what you are trying to achieve? The minimum write size for&amp;nbsp;flash is 4 bytes.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader address flash write</title><link>https://devzone.nordicsemi.com/thread/493303?ContentTypeID=1</link><pubDate>Thu, 11 Jul 2024 07:35:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:09cf4d19-d2e9-4583-9fbc-d97e419f5e57</guid><dc:creator>AP1</dc:creator><description>&lt;p&gt;Hi thanks for your reply i need to write only 1 byte data and currently i am using fstorage libraries can we achieve using this or is there any other method for writing small data into flash or any registers that can be used ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader address flash write</title><link>https://devzone.nordicsemi.com/thread/493232?ContentTypeID=1</link><pubDate>Wed, 10 Jul 2024 17:13:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b7659c9b-942e-452a-9be7-b222ecf9a98b</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;You should use the area below the bootloader shown as &amp;quot;Application data&amp;quot; here:&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1720631502929v2.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://docs.nordicsemi.com/bundle/sdk_nrf5_v17.1.0/page/lib_bootloader.html"&gt;https://docs.nordicsemi.com/bundle/sdk_nrf5_v17.1.0/page/lib_bootloader.html&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The size and location of this area is dependent on the start address of the bootloader and the NRF_DFU_APP_DATA_AREA_SIZE value configured in the bootloader project.&lt;/p&gt;
&lt;p&gt;Bes regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>