<?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 wear-leveling not working</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/18445/fds-wear-leveling-not-working</link><description>Hi 
 I&amp;#39;ve just done a few tests with the FDS system of the SDK12.2. My observation is, that the FDS doesn&amp;#39;t properly use all assigned flash pages to reach a maximal lifetime. 
 I have a configuration with the space for the FDS is set to 4 pages. The</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 09 Jan 2017 15:44:44 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/18445/fds-wear-leveling-not-working" /><item><title>RE: FDS wear-leveling not working</title><link>https://devzone.nordicsemi.com/thread/71183?ContentTypeID=1</link><pubDate>Mon, 09 Jan 2017 15:44:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b73d7070-b13e-4065-a86f-e4679a179de2</guid><dc:creator>Adrian Eggenberger</dc:creator><description>&lt;p&gt;I know that there is a risk for power failure when moving records to other pages. In the solution we used previously this was ensured by a integrity field in the record header. The system could recover the data integrity after a power failure.&lt;/p&gt;
&lt;p&gt;I agree that unnecessairy GC action should be avoided to get best wear leveling performance.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FDS wear-leveling not working</title><link>https://devzone.nordicsemi.com/thread/71182?ContentTypeID=1</link><pubDate>Mon, 09 Jan 2017 15:31:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6aec60c6-b125-4a0d-a717-6ffabd4ffd0f</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;The main point of doing a gc in our implementation is to rearrange the records in the page to make biggest free space on the same page. Not to have more free empty page. We try to keep the complexity at low level.&lt;/p&gt;
&lt;p&gt;There is one small risk with your approach is to keep track of the moving process, how to recover when there is a power failure occur when gc is happening, to avoid duplicated data ?&lt;/p&gt;
&lt;p&gt;From our point of view gc should only be called when the flash is nearly full (using fds_stat) this to make sure wear leveling will be effective and to avoid unnecessary flash activity. But I do agree this can be an issue if there are lots of data coming and we need to be quick to store them before overloading the RAM. We don&amp;#39;t want to do gc at that point. But this can be avoided by checking with fds_stat.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FDS wear-leveling not working</title><link>https://devzone.nordicsemi.com/thread/71179?ContentTypeID=1</link><pubDate>Mon, 09 Jan 2017 11:38:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3013b34a-08f3-4676-bc79-8f4fe282c7da</guid><dc:creator>Adrian Eggenberger</dc:creator><description>&lt;p&gt;Your suggestion was my first though as well. I have a simulation of our device where I can see the flash usage. This allows a good view to how the FDS behaves. The problem with your proposed way is that the GC process of the FDS doesn&amp;#39;t create empty pages in most cases. If the cleaned page has still some valid records in it the cleaned up page will contain the same record. This would end in too much garbage collection.&lt;/p&gt;
&lt;p&gt;We used previously an own implementation for the FDS management that had a different approach for GC. The records of the page to clean up were moved to normal valid pages one by one. As soon as all records are moved the page was erased. A swap page was not necessary with this approach. With this implementation the strategy was to wait until no full page was available. The GC process checked what page has most wasted space and clean it up.&lt;/p&gt;
&lt;p&gt;I understand and like the generic thinking when creating your libraries. With the FDS this might be a bit tricky as the generic way should include a lot of possible usages of the FDS in term of file size and other parameters. A guideline or a recommendation on &amp;quot;How  to use&amp;quot; the FDS incl. its garbage collection would be really helpful. The documentation in the fds.h doesn&amp;#39;t provide the needed information.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FDS wear-leveling not working</title><link>https://devzone.nordicsemi.com/thread/71184?ContentTypeID=1</link><pubDate>Mon, 09 Jan 2017 10:23:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:53bb6a6f-82a0-476d-be06-249e03ccaeed</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;I see. This could be an use case we should think about. When we make our library, we usually choose to take generic solution just to make the library simple and easy to use. Other customer may expect a solution to only call gb when it&amp;#39;s full to avoid unexpected CPU occupation from the fds.&lt;/p&gt;
&lt;p&gt;My suggestion for you is maybe only do gb when there is no free page . Meaning when you first moved to the last free page, you start the gb collection, this will avoid using only 2 pages for swap page.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FDS wear-leveling not working</title><link>https://devzone.nordicsemi.com/thread/71181?ContentTypeID=1</link><pubDate>Fri, 06 Jan 2017 17:13:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5df90153-b1ea-4af4-a288-8ad841ff3eaa</guid><dc:creator>Adrian Eggenberger</dc:creator><description>&lt;p&gt;Hi Hung
Your guess is correct. Our systems have mostly a lot of idle time. I personally prefer the strategy to clean up to flash storage when idle time is available to avoid the FDS is full case normally. I&amp;#39;m aware that it can happen, but it shouldn&amp;#39;t be the regular case.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FDS wear-leveling not working</title><link>https://devzone.nordicsemi.com/thread/71180?ContentTypeID=1</link><pubDate>Fri, 06 Jan 2017 16:00:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bc46621c-edc8-4670-bbbb-c594fea91ecc</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Adrian,&lt;/p&gt;
&lt;p&gt;Could you explain a little bit more on what you want to achieve with your strategy ? I guess you want to take advantage of the CPU idle time so you can do gb collection instead of waiting till the fds system is full and flash storing will have to wait for gb collection?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FDS wear-leveling not working</title><link>https://devzone.nordicsemi.com/thread/71178?ContentTypeID=1</link><pubDate>Fri, 06 Jan 2017 14:42:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:41e6d749-3f2f-4fbf-944f-4b19a922fc60</guid><dc:creator>Adrian Eggenberger</dc:creator><description>&lt;p&gt;It could be correct that the wear leveling is ok if the GC is only called if the FDS is full. In my case I modified the FDS to follow a different strategy. I&amp;#39;ve added a function to the FDS that can be called if the system is idle. This function will check if it makes sense to cleanup one of the pages based on various thresholds. If the function returns true the classic fds_gc() may be called to cleanup the page.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FDS wear-leveling not working</title><link>https://devzone.nordicsemi.com/thread/71177?ContentTypeID=1</link><pubDate>Mon, 19 Dec 2016 16:58:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:88710c5a-b419-48aa-a86e-13ec86a31f82</guid><dc:creator>emdi</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;if you run garbage collection when the flash is full then the swap page will be moved around as you would expect and wear leveling will be maximized.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FDS wear-leveling not working</title><link>https://devzone.nordicsemi.com/thread/71176?ContentTypeID=1</link><pubDate>Mon, 19 Dec 2016 15:36:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bd9b2613-3d85-4ccf-89c0-aef9790ae902</guid><dc:creator>Adrian Eggenberger</dc:creator><description>&lt;p&gt;Hi Hung
In our solution the GC is called as soon as in the FDS the number of freeable_words exceeds a given threshold. This triggers a GC as soon as the system is idle. We are not really sure what is the best strategy for the GC call. Waiting until the error FDS_ERR_NO_SPACE_IN_FLASH is called seams also a bit odd in my opinion. What is your recommended way for calling GC?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FDS wear-leveling not working</title><link>https://devzone.nordicsemi.com/thread/71175?ContentTypeID=1</link><pubDate>Mon, 19 Dec 2016 10:09:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ed41046c-f050-41a0-a906-52b545c53714</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Adrian,&lt;/p&gt;
&lt;p&gt;As I understand, the behaviour you described only happens if you call fds_gc() every time the first page is full. Actually I don&amp;#39;t know how you can get an event when one page is full. We only have FDS_ERR_NO_SPACE_IN_FLASH event when all pages are full.&lt;/p&gt;
&lt;p&gt;In the case when all pages are full, and fds_gc() is called by the main application, each page in the fds file system that got erased will be used as swap page.&lt;/p&gt;
&lt;p&gt;So I think it won&amp;#39;t be just 2 pages out of 4 will be used as swap page, but rotating around ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>