<?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>NV RAM Persistant Storage Question</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/55631/nv-ram-persistant-storage-question</link><description>Hi. 
 - Is it the case that before every write to persistent storage via nrf_fstorage_write, the page written to has to be erased first (via nrf_fstorage_erase) since only 0 bits can be written? 
 - Are there a limited number of nrf_fstorage_erase&amp;#39;s that</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 17 Dec 2019 08:01:31 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/55631/nv-ram-persistant-storage-question" /><item><title>RE: NV RAM Persistant Storage Question</title><link>https://devzone.nordicsemi.com/thread/225802?ContentTypeID=1</link><pubDate>Tue, 17 Dec 2019 08:01:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e7bcf0cf-b9df-472b-82b7-5f19cde8bbc7</guid><dc:creator>Susheel Nuguru</dc:creator><description>[quote user="kevyk"]Thanks Susheel. Do you know why the 10,000 flash endurance is not documented in the data sheet (that I can find!)? That&amp;#39;s kind of important information I think, no?[/quote]
&lt;p&gt;&amp;nbsp;I thought it was documented in the spec, but cannot find them now. Might have missed to update it when we were moving our documentation servers. I will try to make a note of it. Yes, this is important information and should be easily visible.&amp;nbsp;&lt;/p&gt;
[quote user="kevyk"]These libraries look great but they are marked &amp;quot;experimental&amp;quot;. Do you know why?&amp;nbsp;[/quote]
&lt;p&gt;&amp;nbsp;That is a good question, these libraries are out there for quite sometime now and in many many products. They should not be marked experimental, as they are very mature in my opinion. Please ignore the experimental tag and use them as one of the other production quality libraries. It must be a mistake to still keep them marked as experimental. I can clearly see that they are NOT marked experimental in the sdk files, so it must be a documentation bug.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NV RAM Persistant Storage Question</title><link>https://devzone.nordicsemi.com/thread/225760?ContentTypeID=1</link><pubDate>Mon, 16 Dec 2019 19:37:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6d9857f7-b296-4bec-b160-fc9002f751da</guid><dc:creator>Kevin Kachikian</dc:creator><description>&lt;p&gt;Thanks Susheel. Do you know why the 10,000 flash endurance is not documented in the data sheet (that I can find!)? That&amp;#39;s kind of important information I think, no?&lt;/p&gt;
&lt;p&gt;These libraries look great but they are marked &amp;quot;experimental&amp;quot;. Do you know why?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks again for the help!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NV RAM Persistant Storage Question</title><link>https://devzone.nordicsemi.com/thread/225685?ContentTypeID=1</link><pubDate>Mon, 16 Dec 2019 14:11:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:db63e557-e657-48f7-a080-da40f34a2229</guid><dc:creator>Susheel Nuguru</dc:creator><description>[quote user=""]Are there a limited number of&amp;nbsp;nrf_fstorage_erase&amp;#39;s that are allowed per page before that part of NVRAM becomes non-writable. IOW, is some kind of level wearing needed?[/quote]
&lt;p&gt;&amp;nbsp;&lt;span&gt;On the nRF52, flash endurance is 10,000 cycles.&lt;/span&gt;&lt;/p&gt;
[quote user=""] Is it the case that&amp;nbsp;before every write to persistent storage via&amp;nbsp;nrf_fstorage_write, the page written&amp;nbsp;to has to be erased first (via nrf_fstorage_erase) since only 0 bits can be written?[/quote]
&lt;p&gt;You need to erase the page only if there is already if the contents of the memory you are trying to write is not empty. (that is if the memory contains 0 bits instead of all &amp;#39;1&amp;#39;s at the address you are writing to). If the contents of the memory are all 1&amp;#39;s (oxFFFF FFFF) then you can write to that location without erasing the page.&amp;nbsp;&lt;/p&gt;
[quote user=""]-&amp;nbsp;Aren&amp;#39;t there going to be BLE connection issues or BLE dropping when doing NV writes or erases because the data sheet says that the CPU is halted for up to 89.7ms worst case (page 30 of &amp;quot;nRF52832 - Product Specification v1.0&amp;quot;)? 43ms&amp;nbsp;is required worst case when writing a whole page worth of data in one shot (338us * 128).[/quote]
&lt;p&gt;Most of the libraries/drivers use sd_flash_write/sd_erase_write when they are accessing flash in the combination of BLE activity. And the BLE stack (softdevice) makes sure that these two operations (flash access) and the radio activity&amp;nbsp; blends well together. So the application do not need to be worried about the exact scenario you mentioned when using sd_flash_XXX API&lt;/p&gt;
[quote user=""]- Is there some good library that can be used which handles these issues and simplifies persistent storage usage?[/quote]
&lt;p&gt;&lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_nrf5_v16.0.0%2Flib_fds.html&amp;amp;cp=6_1_3_56"&gt;FDS &lt;/a&gt;and &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_nrf5_v16.0.0%2Flib_fstorage.html&amp;amp;cp=6_1_3_57"&gt;FStorage &lt;/a&gt;are libraries that you can use on high level abstraction. These libraries will take care of checking the memory to see if it&amp;nbsp; has already some data and uses a SWAP page to first transfer all the contents of the page you are writing to to the swap page and then erase the page, and copy back from swap page to the page in your interest&amp;nbsp; EXCEPT the memory location you want to update.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>