<?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>cant access flash when bootloader is present</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/41506/cant-access-flash-when-bootloader-is-present</link><description>i am trying to use flash to store and read data. I am able to do that when there is only softdevice and application. but when there is bootloader code get stuck. softdevice using is s130 2.0.1. i used keil to generate hex . softdevice and bootloader(buttonless</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 17 Jun 2019 12:07:42 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/41506/cant-access-flash-when-bootloader-is-present" /><item><title>RE: cant access flash when bootloader is present</title><link>https://devzone.nordicsemi.com/thread/193164?ContentTypeID=1</link><pubDate>Mon, 17 Jun 2019 12:07:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c317bc0c-35a8-4aa6-93b1-257394baf5d9</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;It&amp;#39;s ok&amp;nbsp;to use the sd flash API directly. Although I prefer using fstorage/fds modules on top of the SD flash API when I have flash data needs to be updated frequently.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: cant access flash when bootloader is present</title><link>https://devzone.nordicsemi.com/thread/192701?ContentTypeID=1</link><pubDate>Thu, 13 Jun 2019 12:53:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:19e703e7-3ba1-47ad-b4e7-08f107b2a6ed</guid><dc:creator>p_t</dc:creator><description>&lt;p&gt;it works with bootloader also&amp;nbsp; ...&lt;/p&gt;
&lt;p&gt;i am now doing sd_flash_write while i am connected via NUS service...its&amp;nbsp; woking now...but do you suggest to do this way?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: cant access flash when bootloader is present</title><link>https://devzone.nordicsemi.com/thread/192629?ContentTypeID=1</link><pubDate>Thu, 13 Jun 2019 10:30:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9de7f57f-0a8e-4d99-a4ad-5c5b8521eb9d</guid><dc:creator>p_t</dc:creator><description>&lt;p&gt;ok ...so in the sd_flash write it was memory address instead of page number.&lt;/p&gt;
&lt;p&gt;err_code = sd_flash_write((uint32_t *)((NRF_FICR-&amp;gt;CODESIZE - 20)*NRF_FICR-&amp;gt;CODEPAGESIZE),data_32_1,2);&lt;/p&gt;
&lt;p&gt;with this i get , err_code = NRF_SUCCESS and&amp;nbsp;&amp;nbsp;&lt;span&gt;NRF_EVT_FLASH_OPERATION_SUCCESS in&amp;nbsp;sys_evt_dispatch&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;with pointers ..able to read data direclty from address...&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: cant access flash when bootloader is present</title><link>https://devzone.nordicsemi.com/thread/192584?ContentTypeID=1</link><pubDate>Thu, 13 Jun 2019 08:35:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f1d5f2f6-2675-4a5f-8698-5f9ff36f7b58</guid><dc:creator>p_t</dc:creator><description>&lt;p&gt;added this in ble_stack_init&lt;/p&gt;
&lt;p&gt;err_code = softdevice_sys_evt_handler_set(sys_evt_dispatch);&lt;br /&gt; APP_ERROR_CHECK(err_code);&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;then,&lt;/p&gt;
&lt;p&gt;static void sys_evt_dispatch(uint32_t sys_evt)&lt;br /&gt;{&lt;br /&gt; if(sys_evt == NRF_EVT_FLASH_OPERATION_SUCCESS)&lt;br /&gt; {&lt;br /&gt; printf(&amp;quot;\r\nerased\r\n&amp;quot;);&lt;br /&gt; }&lt;br /&gt; else if(sys_evt == NRF_EVT_FLASH_OPERATION_ERROR)&lt;br /&gt; {&lt;br /&gt; printf(&amp;quot;\r\nerror\r\n&amp;quot;);&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;when erase execute,&lt;/p&gt;
&lt;p&gt;err_code_ = sd_flash_page_erase(NRF_FICR-&amp;gt;CODESIZE - 20);&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;i get,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;err_code = NRF_SUCCESS&amp;nbsp; and&amp;nbsp; event of&amp;nbsp;&lt;span&gt;NRF_EVT_FLASH_OPERATION_SUCCESS&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;but at&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;err_code = sd_flash_write((uint32_t *)(NRF_FICR-&amp;gt;CODESIZE) - 20,data_32_1,2);&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;i get,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;err_code = NRF_ERROR_FORBIDDEN and no event in&amp;nbsp;sys_evt_dispatch&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;why i get forbidden error while writing and not in erase?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;for source i am using&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;uint32_t const data_32_1[6] = {&amp;#39;@&amp;#39;,&amp;#39;@&amp;#39;,&amp;#39;@&amp;#39;,&amp;#39;@&amp;#39;,&amp;#39;@&amp;#39;,&amp;#39;@&amp;#39;};&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: cant access flash when bootloader is present</title><link>https://devzone.nordicsemi.com/thread/192281?ContentTypeID=1</link><pubDate>Wed, 12 Jun 2019 09:04:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ce1a5c17-70c0-4c15-8f38-d5009fe41fb5</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;The events may get consumed by the Softdevice Handler before being read in your main loop. You should register a callback for SoC events at the end of ble_stack_init instead.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/**@brief Function for dispatching a system event to interested modules.
 *
 * @details This function is called from the System event interrupt handler after a system
 *          event has been received.
 *
 * @param[in] sys_evt  System stack event.
 */
static void sys_evt_dispatch(uint32_t sys_evt)
{
    //TODO: check sys_evt
}

/**@brief Function for initializing the BLE stack.
 *
 * @details Initializes the SoftDevice and the BLE event interrupt.
 */
static void ble_stack_init(void)
{
    ...

    // Register with the SoftDevice handler module for SoC events.
    err_code = softdevice_sys_evt_handler_set(sys_evt_dispatch);
    APP_ERROR_CHECK(err_code);
}
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: cant access flash when bootloader is present</title><link>https://devzone.nordicsemi.com/thread/191770?ContentTypeID=1</link><pubDate>Mon, 10 Jun 2019 06:24:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0e9a268b-02aa-474a-83bb-afe73f6d610a</guid><dc:creator>p_t</dc:creator><description>&lt;p&gt;old thread was made when i was was working on non-connectible application and new thread is which i am working on now, its connectible NUS ble service . I will make you the example to test.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;sd_flash_page_erase()&amp;nbsp; generate event which should be processed by sd_evt_get().&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;so add that code suggested here,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/48074/sd_flash_page_erase-error-code-success-but-flash-erase-fail/190421#190421"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/48074/sd_flash_page_erase-error-code-success-but-flash-erase-fail/190421#190421&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt; err_code_ = sd_flash_page_erase(erase_page);&lt;br /&gt; &lt;br /&gt; while (1) &lt;br /&gt; {&lt;br /&gt; sd_evt_get (&amp;amp;evt);&lt;br /&gt; if (evt == NRF_EVT_FLASH_OPERATION_SUCCESS || evt == NRF_EVT_FLASH_OPERATION_ERROR)&lt;br /&gt; break;&lt;br /&gt; }&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;i&amp;nbsp;never get the event ,&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: cant access flash when bootloader is present</title><link>https://devzone.nordicsemi.com/thread/190878?ContentTypeID=1</link><pubDate>Tue, 04 Jun 2019 15:33:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:41110586-baf5-483b-83de-9fcd1da7b21c</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;I see that you made a new thread: &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/48051/cant-access-flash-memory-after-ota"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/48051/cant-access-flash-memory-after-ota.&lt;/a&gt; Lets continue the discussion there.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: cant access flash when bootloader is present</title><link>https://devzone.nordicsemi.com/thread/190650?ContentTypeID=1</link><pubDate>Tue, 04 Jun 2019 06:01:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:59473878-c064-4c0e-abfd-309694f93d41</guid><dc:creator>p_t</dc:creator><description>&lt;p&gt;(NRF_UICR-&amp;gt;BOOTLOADERADDR/NRF_FICR-&amp;gt;CODEPAGESIZE) - 2&lt;/p&gt;
&lt;p&gt;This page i am trying to erase....&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I read in bootloader about application reserve data too which data doesnt get erased while ble dfu.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I have set&amp;nbsp; it to this,&lt;/p&gt;
&lt;p&gt;#define DFU_APP_DATA_RESERVED&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;CODE_PAGE_SIZE * 100&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: cant access flash when bootloader is present</title><link>https://devzone.nordicsemi.com/thread/190559?ContentTypeID=1</link><pubDate>Mon, 03 Jun 2019 14:15:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1d0be978-ff9d-4be7-b073-0167018562eb</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;What are the page numbers you pass to&amp;nbsp;sd_flash_page_erase()?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: cant access flash when bootloader is present</title><link>https://devzone.nordicsemi.com/thread/190357?ContentTypeID=1</link><pubDate>Sat, 01 Jun 2019 08:21:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c4efa1ba-6e59-4240-affb-ee6e746f389e</guid><dc:creator>p_t</dc:creator><description>&lt;p&gt;i made sure that i am not erasing bootloader page or any application pages. i don&amp;#39;t think that the issue is of the softdevice. I believe that flash access issue is somehow because of bootloader code.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: cant access flash when bootloader is present</title><link>https://devzone.nordicsemi.com/thread/161405?ContentTypeID=1</link><pubDate>Wed, 12 Dec 2018 11:32:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e5e49c6a-aa99-43f2-ac6b-989f309bf617</guid><dc:creator>p_t</dc:creator><description>&lt;p&gt;i tried both functions...&lt;/p&gt;
&lt;p&gt;sd_flash_page_erase return NRF_SUCCESS and sd_flash_write return NRF_BUSY&lt;/p&gt;
&lt;p&gt;code doesnt hang up.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;but after performing erase ,cant load app.zip from nrfconnect...&lt;/p&gt;
&lt;p&gt;page i am erasing is&amp;nbsp;NRF_FICR-&amp;gt;CODESIZE - 20&lt;/p&gt;
&lt;p&gt;am i erasing my bootloader page?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Program Size: Code=29700 RO-data=520 RW-data=452 ZI-data=10988&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: cant access flash when bootloader is present</title><link>https://devzone.nordicsemi.com/thread/161378?ContentTypeID=1</link><pubDate>Wed, 12 Dec 2018 09:30:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aed1e333-8e7a-41e3-99a8-bf063df7f7e1</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Yes, you can use the softdevice flash API (&lt;a title="sd_flash_page_erase" href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s130.api.v2.0.1/group___n_r_f___s_o_c___f_u_n_c_t_i_o_n_s.html?cp=3_7_2_1_0_2_7_2_7#ga9c93dd94a138ad8b5ed3693ea38ffb3e"&gt;sd_flash_page_erase&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a title="sd_flash_write" href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s130.api.v2.0.1/group___n_r_f___s_o_c___f_u_n_c_t_i_o_n_s.html?cp=3_7_2_1_0_2_7_2_9#ga8b49f2e72e97291aecc18ce396956eed"&gt;sd_flash_write&lt;/a&gt;)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: cant access flash when bootloader is present</title><link>https://devzone.nordicsemi.com/thread/161374?ContentTypeID=1</link><pubDate>Wed, 12 Dec 2018 09:24:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:62bb011b-bbef-49d8-9c4e-997fc20b3ee8</guid><dc:creator>p_t</dc:creator><description>&lt;p&gt;i am performing flash access after enabling softdevice. i have read that direct flash access is resticted when softdevice is active.but is there any way to do that then.. should i have to disable softdevice before performing flash access?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: cant access flash when bootloader is present</title><link>https://devzone.nordicsemi.com/thread/161368?ContentTypeID=1</link><pubDate>Wed, 12 Dec 2018 09:13:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ad0180f8-10f9-404e-a475-d4cd49f004f4</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Are you performing the flash operations before you enable the softdevice? Note that it is not possible to access NVMC directly when the softdevice is enabled. Also, what flash pages are you erasing?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: cant access flash when bootloader is present</title><link>https://devzone.nordicsemi.com/thread/161366?ContentTypeID=1</link><pubDate>Wed, 12 Dec 2018 09:12:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:307f6291-7996-4de1-ac80-2ddb49097235</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Are you performing the flash operations before you enable the softdevice? Note that it is not possible to access NVMC directly when the softdevice is enabled. Also, what flash pages are you erasing?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>