<?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>FDS: Updating existing records with fds_record_update</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/15290/fds-updating-existing-records-with-fds_record_update</link><description>I have been debugging this problem for a few days and have exhausted all of my options. I am relatively new to embedded development so user error is not out of the question. 
 To start, I am using SDK 11 and leveraging the experimental Flash Data Storage</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 19 Sep 2016 05:30:55 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/15290/fds-updating-existing-records-with-fds_record_update" /><item><title>RE: FDS: Updating existing records with fds_record_update</title><link>https://devzone.nordicsemi.com/thread/58406?ContentTypeID=1</link><pubDate>Mon, 19 Sep 2016 05:30:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d83e8ad0-0a59-42ab-9fe6-786a25daef95</guid><dc:creator>saiteja</dc:creator><description>&lt;p&gt;hi is it possible to store foo[20][20] to the flash by
record_chunk.p_data = foo;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FDS: Updating existing records with fds_record_update</title><link>https://devzone.nordicsemi.com/thread/58405?ContentTypeID=1</link><pubDate>Fri, 16 Sep 2016 12:22:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ddd5f97d-18b1-4a0f-8c98-7c0cedd4ff78</guid><dc:creator>emdi</dc:creator><description>&lt;p&gt;I think I see the problem now and it&amp;#39;s what Terje was onto as well:&lt;/p&gt;
&lt;p&gt;Upon receiving the event, you actually iterate ALL the records with a given key and then return a pointer to the data of the LAST record you iterated over. So each time you are printing the same item (the last record). When you have no records and write them for the fist time, it works. Then, when you boot with 9 records, each time you update you print the data of the last record with that key, which has 9 as the value of the field you are printing.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FDS: Updating existing records with fds_record_update</title><link>https://devzone.nordicsemi.com/thread/58404?ContentTypeID=1</link><pubDate>Sat, 27 Aug 2016 17:32:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:32cee7a8-9070-4e2f-8b0c-a284a42c6fd2</guid><dc:creator>emdi</dc:creator><description>&lt;p&gt;I see now that there is considerable delay in the loop. This might not be the case then,
but I hope it gives you more insight into the problem.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FDS: Updating existing records with fds_record_update</title><link>https://devzone.nordicsemi.com/thread/58403?ContentTypeID=1</link><pubDate>Sat, 27 Aug 2016 17:28:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a6b1088c-5fab-4ba8-9c06-26b71e3704ba</guid><dc:creator>emdi</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;My guess is that by the time fds attempts to write &amp;#39;foo&amp;#39; to flash, the loop has already finished, and &amp;#39;foo.&amp;#39;someId&amp;#39; has value 9. Therefore, all the update operations will go through, but the data being written will be the same because at the time the records are updated (which happens asynchronously), the static data that you fed to fds does not change anymore. It is in fact the same. This is why fds is updating the record with someId=9 several times.&lt;/p&gt;
&lt;p&gt;Remember, fds will not buffer your data. This is why it has to be &amp;#39;alive&amp;#39; at the time the write/update happens.&lt;/p&gt;
&lt;p&gt;I would suggest to write the records one by one, changing &amp;#39;someId&amp;#39; in the static &amp;#39;foo&amp;#39; variable after you have received the callback from fds which notifies that the update has taken place.&lt;/p&gt;
&lt;p&gt;Hope this helps. Regards,&lt;/p&gt;
&lt;p&gt;E&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FDS: Updating existing records with fds_record_update</title><link>https://devzone.nordicsemi.com/thread/58402?ContentTypeID=1</link><pubDate>Fri, 29 Jul 2016 13:47:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0d130415-4734-4faa-9f8a-9485e01e6212</guid><dc:creator>tesc</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I think that you are close with your suspicion that there is something going on with &lt;code&gt;record_chunk.p_data&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;From the FDS documentation, &lt;a href="http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v11.0.0%2Flib_fds_usage.html&amp;amp;cp=6_0_0_3_30_2_2&amp;amp;anchor=lib_fds_usage_retrieve"&gt;Retrieving data&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;the data pointed to by the fds_flash_record_t structure might change at any time after the record is closed. So if you need to access the data after closing the record, you must open it again.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;If you change the code so that instead of returning a pointer you copy the contents to a separate instance of Foo, do you still get the same behaviour?&lt;/p&gt;
&lt;p&gt;Regards, Terje&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FDS: Updating existing records with fds_record_update</title><link>https://devzone.nordicsemi.com/thread/58401?ContentTypeID=1</link><pubDate>Thu, 21 Jul 2016 15:07:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e0b5bc7e-d13a-4a3e-abf2-32e0890dbb12</guid><dc:creator>gortok</dc:creator><description>&lt;p&gt;I have an open ticket 29065 about this; and I also have  github repo that reproduces this issue. Currently I&amp;#39;m Delete, Run GC, and Write to perform an update. &lt;a href="https://github.com/Jewelbots/nordic-flash-data-storage"&gt;github.com/.../nordic-flash-data-storage&lt;/a&gt; I also have this issue in the SDK 10 known issues: &lt;a href="https://devzone.nordicsemi.com/question/71366/what-are-sdk-1100-known-issues/"&gt;devzone.nordicsemi.com/.../&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>