<?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>NO_PAGES error at fds pages_init() after boot: how to avoid it and how to recover from it?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/89562/no_pages-error-at-fds-pages_init-after-boot-how-to-avoid-it-and-how-to-recover-from-it</link><description>Hi there, Thanks in advance for your time and attention. We started to see some cases where our devices boots and gets a NO_PAGES error after having been turned off(or at very low power) for a while. The scenario is a battery discharge. I was wondering</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 06 Jul 2022 09:11:52 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/89562/no_pages-error-at-fds-pages_init-after-boot-how-to-avoid-it-and-how-to-recover-from-it" /><item><title>RE: NO_PAGES error at fds pages_init() after boot: how to avoid it and how to recover from it?</title><link>https://devzone.nordicsemi.com/thread/375707?ContentTypeID=1</link><pubDate>Wed, 06 Jul 2022 09:11:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:30598fb0-0f43-40ba-9d11-53dc2f124832</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Andrea,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;1. Yes the modification will enter in effect after the DFU update. However, if you decrease the number of pages , fds may run into a problem that it couldn&amp;#39;t find the swap page. For increasing it might be OK. The best way of doing it when you change the configuration of fds is to reinitialize the pages as you did in the workaround.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;2. The fds will use all pages to store the 3 files. It doesn&amp;#39;t matter if you have 3 files or 1 file, or if you have 3 page or 10 pages. All the flash area will be utilized to store data. It can start first with one single page, but other pages will be used when you update the data a long the road.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The reason for that is to avoid flash wear out, all pages configured for fds will be used. Every time you update the file, a new record of the file will be stored in the blank area. And this process continues when you update your files. So after a while all pages will be used. When there isn&amp;#39;t any blank area left, garbage collection will be executed and the previous records (marked as old) will be erased.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NO_PAGES error at fds pages_init() after boot: how to avoid it and how to recover from it?</title><link>https://devzone.nordicsemi.com/thread/375543?ContentTypeID=1</link><pubDate>Tue, 05 Jul 2022 11:26:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d757086e-d927-4fb5-887b-e63e43fc6736</guid><dc:creator>AndreaF33</dc:creator><description>&lt;p&gt;Hi Hung,&lt;br /&gt;&lt;br /&gt;Thanks for the response.&lt;br /&gt;&lt;br /&gt;Just a few follow-up questions, to check if I am understanding correctly:&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Regarding the Data Section, the area dedicated to the fds pages. If I modify the size of the section and I upload the application with the updated boundaries by DFU, the modification will enter in effect after the update. Right?&lt;/li&gt;
&lt;li&gt;So if I have 3 files of 40 bytes, how many pages will be used? 3? or just 120 bytes of 1 page?&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For the moment we can live with losing data, as the records saved in the fds were getting corrupted so we implemented a restoring system.&lt;br /&gt;&lt;br /&gt;Thanks again!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NO_PAGES error at fds pages_init() after boot: how to avoid it and how to recover from it?</title><link>https://devzone.nordicsemi.com/thread/375535?ContentTypeID=1</link><pubDate>Tue, 05 Jul 2022 11:13:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6c1e3af5-fbcc-46b0-a71d-82a57414115c</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Andrea,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;When you modify the&amp;nbsp;size of data section (I assume you are talking about the number of page for fds) the configuration is hardcoded in the application image.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Have you managed to reproduce the issue with a not locked chip ? It&amp;#39;s very useful to be able to read the flash pages that got the issue.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Regarding your workaround, as far as I can see it would most of the time help the device to overcome the issue. However there is a risk that the issue will happen again. If the odd of the issue is low enough I think it can be consider as a solution. But if it happens very often then your device will just keep losing data all the time.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Each file in the fds file system occupy only the flash page needed for it plus some header bytes. They are&amp;nbsp;allocated&amp;nbsp;in the 3 flash pages that you dedicated for fds. Every time you update a file, a new record of it is written to flash and the original record will be marked as garbage.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NO_PAGES error at fds pages_init() after boot: how to avoid it and how to recover from it?</title><link>https://devzone.nordicsemi.com/thread/375479?ContentTypeID=1</link><pubDate>Tue, 05 Jul 2022 08:30:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9634419e-1591-457d-acc4-d2cb9806deae</guid><dc:creator>AndreaF33</dc:creator><description>&lt;p&gt;Hi Hung,&lt;br /&gt;&lt;br /&gt;Thanks for the message.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;I would follow up both targets: understanding why and a runtime workaround, if you don&amp;#39;t mind.&lt;br /&gt;&lt;br /&gt;Problem RC:&lt;br /&gt;&lt;br /&gt;After a few hours of investigation we ended up having just two scenarios possible:&lt;br /&gt;&lt;br /&gt;1st scenario: The device has very low current, but it&amp;#39;s being supplied a little bit from another source, so a continuous reset scenario is indeed possible. Every time we boot we run&amp;nbsp;a quick check to verify the integrity of our records, but I suspect we rarely end up deleting anything.&lt;br /&gt;&lt;br /&gt;2nd scenario: The device is flashed with production flags which make debugging very difficult. By reflashing the image, we end up in such scenario. Could it be caused by the reflashing process?&amp;nbsp;&lt;br /&gt;When I modify the size of the data section in flash, such information is stored in the settings or in the application image?&lt;br /&gt;&lt;br /&gt;Problem workaround:&lt;br /&gt;&lt;br /&gt;We currently have an assert around the fds_init() call.&amp;nbsp;&lt;br /&gt;What I did, and the board was happy with it, was:&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;    if (fds_init() != NRF_SUCCESS)
    {
        for(int i = 0; i&amp;lt; FLASH_CONTENT_COUNT; i++)
        {
            //delete record if we find it
        }
        APP_ERROR_CHECK(fds_init());
    }&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;What do you think?&lt;br /&gt;&lt;br /&gt;Bonus question: does each file reserve a full page or is managed dynamically by the SoftDevice and the fds?&lt;br /&gt;&lt;br /&gt;Thanks and kind regards,&lt;br /&gt;Andrea&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NO_PAGES error at fds pages_init() after boot: how to avoid it and how to recover from it?</title><link>https://devzone.nordicsemi.com/thread/375343?ContentTypeID=1</link><pubDate>Mon, 04 Jul 2022 13:51:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c82729b6-0db7-414d-9b74-612791139255</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Andrea,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;We need to study why the fds throwing NO_SWAP or NO_PAGES.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;In normal operation NO_SWAP should not happens. I don&amp;#39;t think increase the number of pages would completely fix the problem.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;NO_PAGES&amp;nbsp;happens when the pages reserved for fds is corrupted or overwritten and the tags are missing on the pages.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;To be able to detect what went wrong here we need to read the flash pages out (You can do a hex dump using nrfjprog --readcode)&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I would suggest to step into the code and have a look at&amp;nbsp;pages_init() to see what exactly happens when fds initialize.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Do you do any flash activity when booting ? I suspect that the battery on discharging can get to the point that it make the chip rebooting repeatedly for many times.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Could you please have a look at this case and check if it&amp;#39;s the same issue that you are facing ?&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/53687/fds---missing-swap-page"&gt;FDS - missing swap page&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Of course if you are fine with reinitialize the fds&amp;nbsp;and scrap&amp;nbsp;the data then the solution can be just to erase the pages and call&amp;nbsp;fds_init() again, but I think it&amp;#39;s better to find the root cause.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NO_PAGES error at fds pages_init() after boot: how to avoid it and how to recover from it?</title><link>https://devzone.nordicsemi.com/thread/375269?ContentTypeID=1</link><pubDate>Mon, 04 Jul 2022 09:27:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f7fba9bc-74ff-4052-9979-78378042697f</guid><dc:creator>AndreaF33</dc:creator><description>&lt;p&gt;PS: The fixes for the fds.c to protect from power failure, present in the SDKs 16 and higher, were applied.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>