<?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 initialization hangs/returns NO_SWAP error on nRF52840</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/89886/fds-initialization-hangs-returns-no_swap-error-on-nrf52840</link><description>Hi, 
 I am working with NRF52840 where I use the FDS library from the nRF5 SDK, currently SDK v15.3.0. 
 My issue is that I have seen my hardware suddently halts/hangs due to faillure to initialize FDS under boot. The function &amp;quot;fds_init&amp;quot; returns the error</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 13 Jul 2022 12:11:59 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/89886/fds-initialization-hangs-returns-no_swap-error-on-nrf52840" /><item><title>RE: FDS initialization hangs/returns NO_SWAP error on nRF52840</title><link>https://devzone.nordicsemi.com/thread/376778?ContentTypeID=1</link><pubDate>Wed, 13 Jul 2022 12:11:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bb9e9d7e-a089-4196-9e37-3c144ffed986</guid><dc:creator>Ulrik Jensen</dc:creator><description>&lt;p&gt;Hi Simon,&lt;/p&gt;
&lt;p&gt;Thank you very much for your reponse! Really appreciate it.&lt;/p&gt;
&lt;p&gt;I tried this morning replacing the &amp;quot;FDS source files&amp;quot; from SDK 17.1.0 with those I currently use from SDK 15.3.0. Besides some return value defines having their name changed (FDS_SUCCESS -&amp;gt; NRF_SUCCESS), I got my code to compile with the new FDS source files. Of course the best (= safest) solution is most likely to update the whole SDK to the latest version but that decision is not mine to make.&lt;/p&gt;
&lt;p&gt;I have a device which is unable to boot due to &amp;quot;fds_init&amp;quot; that hangs/halts during device boot. I will try to see if the device can be recovered with the new FDS version (I have JTAG access) without having to re-format the Flash memory used for FDS.&lt;/p&gt;
&lt;p&gt;Thank you again!&lt;/p&gt;
&lt;p&gt;Br,&lt;/p&gt;
&lt;p&gt;Ulrik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FDS initialization hangs/returns NO_SWAP error on nRF52840</title><link>https://devzone.nordicsemi.com/thread/376710?ContentTypeID=1</link><pubDate>Wed, 13 Jul 2022 06:59:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f1721b59-4369-447c-b067-a424ec06a8ce</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi Ulrik&lt;/p&gt;
&lt;p&gt;Yes, either moving to SDK v17.1.0 or implementing these fixes yourself should solve your issues as well. The &amp;quot;prevent re-init when fds_init() returns NO_PAGES or NO_SWAP is reported here:&amp;nbsp;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/68770/fds---initializing-flag-not-unset-when-fds-init-returns-with-error-potential-bug"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/68770/fds---initializing-flag-not-unset-when-fds-init-returns-with-error-potential-bug&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;The other bug is reported in a private ticket, but the fix is as follows:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;In &amp;lt;sdk folder&amp;gt;/components/libraries/fds/fds.c, in the function init_execute(), in the switch case FDS_OP_INIT_PROMOTE_SWAP, remove the lines:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;            // When promoting the swap, keep the write_offset set by pages_init().
            ret = page_tag_write_data(m_swap_page.p_addr);&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;In the same switch case, add the following lines right before the break:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;            // Promote the old swap page to data, but do this at the end
            // because we can re-enter this function; we must update have
            // updated the page in RAM before that.
            ret = page_tag_write_data(p_old_swap);&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;So that the full case FDS_OP_INIT_PROMOTE_SWAP now looks like this:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;        case FDS_OP_INIT_PROMOTE_SWAP:
        {
            p_op-&amp;gt;init.step       = FDS_OP_INIT_TAG_SWAP;

            uint16_t const         gc         = m_gc.cur_page;
            uint32_t const * const p_old_swap = m_swap_page.p_addr;

            // Execute the swap.
            m_swap_page.p_addr = m_pages[gc].p_addr;
            m_pages[gc].p_addr = p_old_swap;

            // Copy the offset from the swap to the new page.
            m_pages[gc].write_offset = m_swap_page.write_offset;
            m_swap_page.write_offset = FDS_PAGE_TAG_SIZE;

            m_pages[gc].page_type = FDS_PAGE_DATA;

            // Promote the old swap page to data, but do this at the end
            // because we can re-enter this function; we must update have
            // updated the page in RAM before that.
            ret = page_tag_write_data(p_old_swap);
        } break;&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Simon&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>