<?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>nrf51 pstrorage write zeros to flash memory</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/16328/nrf51-pstrorage-write-zeros-to-flash-memory</link><description>I&amp;#39;m trying to write some data to flash memory (32 bytes) every 1 minute. the data are not NULL but then I noticed that sometimes (not always) the pstroage module write zeros to flash memory. I can check that it&amp;#39;s NULL data which are written by dumpting</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 12 Sep 2016 05:11:35 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/16328/nrf51-pstrorage-write-zeros-to-flash-memory" /><item><title>RE: nrf51 pstrorage write zeros to flash memory</title><link>https://devzone.nordicsemi.com/thread/62403?ContentTypeID=1</link><pubDate>Mon, 12 Sep 2016 05:11:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:33a6475d-8904-419e-8b8f-7da8f3805b51</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;You can only write once to a certain flash memory area. If you want to write to it again you must erase it first. Erase is performed on a whole page.&lt;/p&gt;
&lt;p&gt;The pstorage module queues the flash operations, e.g. pstorage_store and pstorage_clear, so you dont really need to wait for the pstorage_clear to finish before calling pstorage_store, pstorage module will take care of that. You do however need to wait for pstorage_store and pstorage_clear before reading the flash memory (with e.g. pstorage_load) because reads are read directly from flash and are not in queue in pstorage module. Otherwise you will read the flash contents before it is written/erased.&lt;/p&gt;
&lt;p&gt;There is pstorage example available &lt;a href="https://devzone.nordicsemi.com/question/15271/how-can-i-write-10kb-of-data-to-internal-flash/?answer=17300#post-id-17300"&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>