<?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>Persistent storage manager writing problem for one block</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/5504/persistent-storage-manager-writing-problem-for-one-block</link><description>Hello Everyone , 
 I want to use pstorage for my project.i get the example code from here
 devzone.nordicsemi.com/.../ 
and its working properly(i.e read and write operation). but when i modified it for my requirement as given below its not to read</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 12 Feb 2015 07:24:24 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/5504/persistent-storage-manager-writing-problem-for-one-block" /><item><title>RE: Persistent storage manager writing problem for one block</title><link>https://devzone.nordicsemi.com/thread/19226?ContentTypeID=1</link><pubDate>Thu, 12 Feb 2015 07:24:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:48179f16-093f-4e9b-8e6f-5a13694be40c</guid><dc:creator>asma</dc:creator><description>&lt;p&gt;Thanks Bill. it works.i have posted another question at this link related to pstorage update. can you please check it.  &lt;a href="https://devzone.nordicsemi.com/question/29547/pstorage-update-problem-call-back-is-not-getting-called/"&gt;https://devzone.nordicsemi.com/question/29547/pstorage-update-problem-call-back-is-not-getting-called/&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Persistent storage manager writing problem for one block</title><link>https://devzone.nordicsemi.com/thread/19225?ContentTypeID=1</link><pubDate>Mon, 09 Feb 2015 13:05:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f6bb1df0-7e32-4ddd-88d7-43c7fd22d0d4</guid><dc:creator>Bill Siever</dc:creator><description>&lt;p&gt;Hi (updated post. I replaced my earlier answer with the following)&lt;/p&gt;
&lt;p&gt;It looks like both the pstorage_clear and the pstorage_store are queued.  You should wait for each to complete before proceeding to the next since they are working on the same block. That is, do:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    pstorage_block_identifier_get(&amp;amp;handle, 0, &amp;amp;block_0_handle);

    pstorage_wait_handle = block_0_handle.block_id;        // Specify which pstorage handle to wait for

    pstorage_wait_flag = 1;                                // Set the wait flag.
    pstorage_clear(&amp;amp;block_0_handle, 16);                   // Clear 16 bytes
    while(pstorage_wait_flag)  power_manage();             // Wait for clear

    pstorage_wait_flag = 1;                                // Set the wait flag. 
    pstorage_store(&amp;amp;block_0_handle, source_data_0, 16, 0); // Write to flash
    while(pstorage_wait_flag) power_manage();              // Wait for store

    pstorage_load(dest_data_0, &amp;amp;block_0_handle, 16, 0);    // Read from flash, 
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You should probably also change:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;static uint8_t pstorage_wait_flag = 0;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;to:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; static volatile uint8_t pstorage_wait_flag = 0;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In your earlier version:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;clear was queued&lt;/li&gt;
&lt;li&gt;write was queued&lt;/li&gt;
&lt;li&gt;you wait for a command on the block to complete. You get an acknowledgement when the CLEAR completes.&lt;/li&gt;
&lt;li&gt;you do the load, which loads the cleared values. The write is still in the queue.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;I believe when you used the additional breakpoint the extra delay allowed the write to complete.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>