<?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>pstorage didn&amp;#39;t load correct data</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/5991/pstorage-didn-t-load-correct-data</link><description>Hi everybody, 
 I test the pstorage library. But it didn&amp;#39;t work. I print the result with uart, as the image shows. But as you see, It has some problem. And I have no idea why. 
 
 I show the code In the following. I hope somebody can help me find which</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 12 Mar 2015 06:52:43 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/5991/pstorage-didn-t-load-correct-data" /><item><title>RE: pstorage didn't load correct data</title><link>https://devzone.nordicsemi.com/thread/20908?ContentTypeID=1</link><pubDate>Thu, 12 Mar 2015 06:52:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5e7effa2-4961-4487-a06a-ff2e2316f989</guid><dc:creator>SamTsai</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;I found that I just forgot to add this code to dispatch a system event.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;static void sys_evt_dispatch(uint32_t sys_evt)
{
    pstorage_sys_event_handler(sys_evt);
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;After I add it, the program worked fine.&lt;/p&gt;
&lt;p&gt;Thanks for your help.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: pstorage didn't load correct data</title><link>https://devzone.nordicsemi.com/thread/20907?ContentTypeID=1</link><pubDate>Thu, 12 Mar 2015 06:45:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:29f3eed6-34f8-4cad-8af7-acef019487ab</guid><dc:creator>SamTsai</dc:creator><description>&lt;p&gt;Thanks a lot! I really appreciate your help.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: pstorage didn't load correct data</title><link>https://devzone.nordicsemi.com/thread/20905?ContentTypeID=1</link><pubDate>Thu, 12 Mar 2015 06:44:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:355df413-307a-4408-b5da-3161d2f9ff1a</guid><dc:creator>SamTsai</dc:creator><description>&lt;p&gt;Thanks a lot! I really appreciate your help.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: pstorage didn't load correct data</title><link>https://devzone.nordicsemi.com/thread/20906?ContentTypeID=1</link><pubDate>Wed, 11 Mar 2015 19:31:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d0a028d8-dccd-4e68-936f-d856c857dc39</guid><dc:creator>Annim</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;From the provided code, it looks fine but i guess you are missing one thing which is there in documentation , that is you should always call CLEAR api before storing any data to flash, and just trust on event based callback for pstorage, it ill process the queue for sure.&lt;/p&gt;
&lt;p&gt;Please call clear first, then store api, then you can able to read it back properly, and there is no need to introduce any delay anywhere, it just consume 100% cpu, instead, trust on callback approach, where u can set flag and then process or do make calls in main context every time.
Hope this will help you. It worked for me!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: pstorage didn't load correct data</title><link>https://devzone.nordicsemi.com/thread/20904?ContentTypeID=1</link><pubDate>Wed, 11 Mar 2015 17:00:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d6105d68-d09d-479c-83f1-17c893f98222</guid><dc:creator>John</dc:creator><description>&lt;p&gt;The 255 (0xFF) value is the erased value of the non volatile memory. Once you do the storage operation you must wait for the operation to complete before doing the load. Storage, erase etc. operations via pstorage merely queue a request that will be handled asynchronously. You will get a pass/fail event back indicating that the operation is complete. Then you can do the load and verify that you get what you wrote.&lt;/p&gt;
&lt;p&gt;There are a number of thread in this forum regarding how this works if you do a search on pstorage that can help you out.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>