<?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>Flash Write in BLE event</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/54600/flash-write-in-ble-event</link><description>Hi. 
 I saw lots of questions but I could&amp;#39;t find answer about BLE &amp;amp; flash write func. 
 Setup is nrf52832, S332, SDK 15.3.0. 
 using ble, ant+, gpio, timer, adc, 
 in code, I try to flash write UICR 4bytes in ble event. 
 flash write func is execute when</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 21 Nov 2019 05:53:48 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/54600/flash-write-in-ble-event" /><item><title>RE: Flash Write in BLE event</title><link>https://devzone.nordicsemi.com/thread/221195?ContentTypeID=1</link><pubDate>Thu, 21 Nov 2019 05:53:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7e433776-9233-4280-b49d-d05f370dc990</guid><dc:creator>BEN_HB</dc:creator><description>&lt;p&gt;is there any other way? to use flag?&lt;/p&gt;
&lt;p&gt;in code, main loop is just execute&amp;nbsp;nrf_pwr_mgmt_run();&lt;/p&gt;
&lt;p&gt;other things execute when interrupt is happend&lt;/p&gt;
&lt;p&gt;if flag input the main loop, it works very well. however I think it is like polling. it is not nice code.&lt;/p&gt;
&lt;p&gt;like register event handler and and so on..&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash Write in BLE event</title><link>https://devzone.nordicsemi.com/thread/221194?ContentTypeID=1</link><pubDate>Thu, 21 Nov 2019 05:45:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:51addc9d-2231-429f-bdcd-989c9bb9e678</guid><dc:creator>BEN_HB</dc:creator><description>&lt;p&gt;Thank you. I write only once in uicr. and then execute just read.&lt;/p&gt;
&lt;p&gt;I change wirte func in main loop. it is works.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash Write in BLE event</title><link>https://devzone.nordicsemi.com/thread/221116?ContentTypeID=1</link><pubDate>Wed, 20 Nov 2019 14:18:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b0731f93-7b65-40f7-8ee1-7955c2f6140b</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
[quote user=""]I thought that use callback or other event handler, escape ble event, and try flash write.[/quote]
&lt;p&gt;&amp;nbsp;That sounds like a good plan.&lt;/p&gt;
&lt;p&gt;Maybe you call the flash write function inside a BLE event? If so, try to set a flag, and call the flash write in the main context (from your main-loop). That should allow for the flash operation to start, something it wouldn&amp;#39;t if you try to call it from the BLE event handler.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Then remember to wait for the flash event handler before you try to read the flash again, to ensure that the write is complete before you try to read it.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I would recommend to use the &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v15.3.0%2Flib_fds_usage.html" rel="noopener noreferrer" target="_blank"&gt;FDS library&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Are you sure you want to write the data to the UICR area? Is there any particular reason for this? I believe this has restricted access while the softdevice is running. In addition, it is not that easy to update the value you store here. It is intended to only write to once, and then leave it for the lifetime of the product. That is why you should use the &amp;quot;normal&amp;quot; flash, which it will use if you use FDS.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>