<?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>old data gets overwritten in fds when i read the data after setting a new one.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/50525/old-data-gets-overwritten-in-fds-when-i-read-the-data-after-setting-a-new-one</link><description>I have written a flash code using fds in which i am trying to save the data 7pages(1024 each). I have defined array of record key and fie ID for it.The problem it saves for first time but then due to some pointer problem or something, it gets old data</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 20 Aug 2019 10:18:34 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/50525/old-data-gets-overwritten-in-fds-when-i-read-the-data-after-setting-a-new-one" /><item><title>RE: old data gets overwritten in fds when i read the data after setting a new one.</title><link>https://devzone.nordicsemi.com/thread/204985?ContentTypeID=1</link><pubDate>Tue, 20 Aug 2019 10:18:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:db7da12d-2c17-496e-ba6b-5ead96be8ae4</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;I haven&amp;#39;t seen this issue before. If you can provide some code that we can reproduce the issue here we can try to have a look on why this happens.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Please double check if the old record marked as dirty (header is written 0xFFFF0000).&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: old data gets overwritten in fds when i read the data after setting a new one.</title><link>https://devzone.nordicsemi.com/thread/204703?ContentTypeID=1</link><pubDate>Mon, 19 Aug 2019 10:40:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ef7dca21-6d40-4b43-8969-628eb19b37f4</guid><dc:creator>oyomj343</dc:creator><description>&lt;p&gt;So when i set the data in different records, and read&amp;nbsp; anyone, the same data is getting copied everywhere.Everything seems fine to me too.I am using same file ID and different keys.I also tried for initializing descriptor and flash_record_t every time.But nothing helped. Can give some tips if you have encountered a similar issue before?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: old data gets overwritten in fds when i read the data after setting a new one.</title><link>https://devzone.nordicsemi.com/thread/202885?ContentTypeID=1</link><pubDate>Wed, 07 Aug 2019 15:02:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d678cef8-1ff3-4580-8285-03eef81e9026</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Yes, the record should be marked as dirty (header =&amp;nbsp;0xFFFF0000). Could you check in the flash if you see the header&amp;nbsp;0xFFFF0000 ? You can read the whole flash dump using nrfjprog.exe --readcode&lt;/p&gt;
&lt;p&gt;If you can provide an example code (a project with source) that reproduce the issue it would be much easier for us.&lt;/p&gt;
&lt;p&gt;Could you provide the link to the similar cases ?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Be careful when defining large virtual page. Could you try to test setting the&amp;nbsp;FDS_VIRTUAL_PAGE_SIZE =&amp;nbsp;FDS_PHY_PAGE_SIZE = 1024 ?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: old data gets overwritten in fds when i read the data after setting a new one.</title><link>https://devzone.nordicsemi.com/thread/202743?ContentTypeID=1</link><pubDate>Wed, 07 Aug 2019 07:10:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:16391f9d-4e7c-4569-865d-146b167619c7</guid><dc:creator>oyomj343</dc:creator><description>&lt;p&gt;Yes it does create a new record with same&amp;nbsp;&lt;span&gt;File id and key, but i am initialising all descriptors and token every time i do a read or write.So why on read would i get the old data because it is invalidated.And also now i am using one file ID and also one page of 8kb to store all the data. I have seen this issue is also faced by other people here and i don&amp;#39;t think they&amp;#39;ve got the solution.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: old data gets overwritten in fds when i read the data after setting a new one.</title><link>https://devzone.nordicsemi.com/thread/202659?ContentTypeID=1</link><pubDate>Tue, 06 Aug 2019 13:45:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bc2137c5-3424-4b6f-9ca8-4140030101a3</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;I suspect that&amp;nbsp;instead of updating the record, the code actually creating new record with same File id and key. Note that, fds allow to have multiple record having same file ID and key. Each time you use&amp;nbsp;fds_record_find() with the previous token, it will try to find the next record that matches File ID and key.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Please add some debug log especially inside&amp;nbsp;get_flash_data()&lt;/p&gt;
&lt;p&gt;I would suggest instead of using&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;if (err_code == FDS_SUCCESS)&lt;/p&gt;
&lt;p&gt;if (err_code == FDS_ERR_NOT_FOUND)&lt;/p&gt;
&lt;p&gt;You use :&amp;nbsp;&lt;/p&gt;
&lt;p&gt;else {if (err_code == FDS_ERR_NOT_FOUND)&lt;/p&gt;
&lt;p&gt;And then check if there is any other err_code.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;And on each of the return code of any other API call, you need to check if it&amp;#39;s success or not.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: old data gets overwritten in fds when i read the data after setting a new one.</title><link>https://devzone.nordicsemi.com/thread/202613?ContentTypeID=1</link><pubDate>Tue, 06 Aug 2019 12:31:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2b6627e5-d7b5-44a5-80f3-a0aa8d853353</guid><dc:creator>oyomj343</dc:creator><description>&lt;p&gt;I tried your example and it worked properly.As you have seen my code, I declared an array of record &amp;amp; file id to save different records at different pages.The data that i am saving is -&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;1.Array of structs[100](pg 0-4).&lt;/p&gt;
&lt;p&gt;2.One separate struct(pg 5)&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;So whenever i get and set the data, i provide the index also for record,file ID.If there is no record, it creates a new one.When i updates any file, it invalidates the old one.But when i reads it, i gets one step back and&amp;nbsp; gives the old data.If i keep reading, it goes one step back everytime.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: old data gets overwritten in fds when i read the data after setting a new one.</title><link>https://devzone.nordicsemi.com/thread/202542?ContentTypeID=1</link><pubDate>Tue, 06 Aug 2019 08:39:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:27970c97-33f4-4d28-a6d0-2b82b24fb481</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Please post your full source on how you test it. It looks fine in the posted code.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Have you tried testing using our flash_fds example in the nRF5 SDK ?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: old data gets overwritten in fds when i read the data after setting a new one.</title><link>https://devzone.nordicsemi.com/thread/202516?ContentTypeID=1</link><pubDate>Tue, 06 Aug 2019 06:42:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:195e37a5-5fbe-42da-a3b4-b365d3f0269e</guid><dc:creator>oyomj343</dc:creator><description>&lt;p&gt;i am testing it on nrf52832. So when i do the update(set_flash_data), it invalidates the old data, but then when i read it&amp;#39;s the old one always.Can you pls tell how is this happening in my code?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: old data gets overwritten in fds when i read the data after setting a new one.</title><link>https://devzone.nordicsemi.com/thread/202204?ContentTypeID=1</link><pubDate>Fri, 02 Aug 2019 15:11:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:69647879-ee48-4f7b-ac34-a9d462134045</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Could you explain a little bit more how you test this ?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You need to store 7kB ?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;We have a simple example &lt;a href="https://github.com/NordicPlayground/nRF5-flash-storage-examples/blob/master/fds_example/main.c"&gt;here&amp;nbsp;&lt;/a&gt;&amp;nbsp;that you can try. If you can modify the example to show the issue you have, it would be nice.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>