<?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>Write to FLASH after BLE init</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/26015/write-to-flash-after-ble-init</link><description>I am working in sdk14 nrf52832
I want to write flash after BLE initializing ,but write flash it has no action 
 while(sd_flash_page_erase(64) != NRF_SUCCESS){} //address = 0x40000
while(sd_flash_write((uint32_t *)0x40000,(uint32_t *)&amp;amp;ptr,((sizeof(TypedefBle</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 16 Nov 2017 12:12:13 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/26015/write-to-flash-after-ble-init" /><item><title>RE: Write to FLASH after BLE init</title><link>https://devzone.nordicsemi.com/thread/102514?ContentTypeID=1</link><pubDate>Thu, 16 Nov 2017 12:12:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8202a9f5-e236-4109-b1ce-1426833faa8b</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Could you tell what exactly you did for testing with your my_fs  ? Seems like you are using fs_event_handler() from the fds ? You should define your own handler.
Have you tried to follow the example code in the link to fstorage documentation above ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write to FLASH after BLE init</title><link>https://devzone.nordicsemi.com/thread/102513?ContentTypeID=1</link><pubDate>Thu, 16 Nov 2017 03:41:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9150f47a-06a6-4761-bb7d-3bf3b4d55274</guid><dc:creator>Hung Alan</dc:creator><description>&lt;p&gt;I register an application with fstorage.&lt;/p&gt;
&lt;p&gt;NRF_FSTORAGE_DEF(nrf_fstorage_t my_fs) =
{
.evt_handler = fs_event_handler,
.start_addr = 0x00040000,
.end_addr = 0x00041000,
};&lt;/p&gt;
&lt;p&gt;But  an error occurred when connected:
case PM_EVT_PEER_DATA_UPDATE_FAILED:
{
// Assert.
APP_ERROR_CHECK(p_evt-&amp;gt;params.peer_data_update_failed.error);
} break;&lt;/p&gt;
&lt;p&gt;error_code = NRF_ERROR_NULL ...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write to FLASH after BLE init</title><link>https://devzone.nordicsemi.com/thread/102511?ContentTypeID=1</link><pubDate>Wed, 18 Oct 2017 10:29:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ef6b7b2c-4279-4807-9a66-53cfcf63db4e</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;NRF_EVT_FLASH_OPERATION_SUCCESS &amp;#39;s one of the system events. You need to register a callback function as an observer for system events by using NRF_SDH_SOC_OBSERVER&lt;/p&gt;
&lt;p&gt;But in ble_app_hids_keyboard example, we already use fstorage, I would suggest to register an application with fstorage and use the fstorage API to do flash operation. Read more about fstorage &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v14.0.0/lib_fstorage.html?cp=4_0_0_3_49"&gt;here&lt;/a&gt;, example included.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write to FLASH after BLE init</title><link>https://devzone.nordicsemi.com/thread/102512?ContentTypeID=1</link><pubDate>Wed, 18 Oct 2017 01:40:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7174e2d3-5e3f-4904-ac66-541d192606c9</guid><dc:creator>Hung Alan</dc:creator><description>&lt;p&gt;Where to wait for the flash callback event?
I am working in sdk14 ble_app_hids_keyboard&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write to FLASH after BLE init</title><link>https://devzone.nordicsemi.com/thread/102510?ContentTypeID=1</link><pubDate>Tue, 17 Oct 2017 09:12:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b1a00696-4e03-40af-a370-202ea61b11c9</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Putting the function call inside a loop won&amp;#39;t guarantee that the flash operation is finished after the loop.&lt;/p&gt;
&lt;p&gt;As in the documentation of sd_flash_page_erase and sd_flash_write, you need to wait for the flash callback event :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;NRF_EVT_FLASH_OPERATION_SUCCESS - The command was successfully completed.
NRF_EVT_FLASH_OPERATION_ERROR - The command could not be started.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Before you proceed to the next command. If you want to reset after you write, you need to wait for the NRF_EVT_FLASH_OPERATION_SUCCESS callback event of the write command.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>