<?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 SDK13 : Failure to initialise from time to time</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/23918/fds-sdk13-failure-to-initialise-from-time-to-time</link><description>So I have been integrating FDS into a project under SDK13. It&amp;#39;s based on an example that Hung updated for SDK12.1. So after init of fds the method fds_test_find_and_delete() is called. However I am having trouble with it not initialising from time to</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 31 Jul 2017 13:42:54 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/23918/fds-sdk13-failure-to-initialise-from-time-to-time" /><item><title>RE: FDS SDK13 : Failure to initialise from time to time</title><link>https://devzone.nordicsemi.com/thread/94134?ContentTypeID=1</link><pubDate>Mon, 31 Jul 2017 13:42:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0e862ea4-d514-4fc4-b4b8-2802f971d526</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;I suppose the documentation can always be improved.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FDS SDK13 : Failure to initialise from time to time</title><link>https://devzone.nordicsemi.com/thread/94135?ContentTypeID=1</link><pubDate>Mon, 31 Jul 2017 09:37:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ad15bac6-d1e5-442b-9c57-3eb8f9f9c624</guid><dc:creator>RichieJH</dc:creator><description>&lt;p&gt;Ok I see, perfectly logical.  This is quite a key point but doesn&amp;#39;t seem to be drawn out very well in the demos nor in the FDS documentation.  So what I did was raise the write_flag in the init step, so the next call had to wait until the flag cleared.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;static void my_fds_evt_handler(fds_evt_t const * const p_fds_evt)
{
    switch (p_fds_evt-&amp;gt;id)
    {
        case FDS_EVT_INIT:
            if (p_fds_evt-&amp;gt;result != FDS_SUCCESS)
            {

                APP_ERROR_CHECK(p_fds_evt-&amp;gt;result);
                // Initialization failed.
            }
            if (p_fds_evt-&amp;gt;result == FDS_SUCCESS)
            {
                write_flag=1;

            }
            break;
	case FDS_EVT_WRITE:
            if (p_fds_evt-&amp;gt;result == FDS_SUCCESS)
            {
		write_flag=1;
            }
            break;
        default:
            break;
    }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;On a quick test this seems to have solved the problem entirely.  Surprised it&amp;#39;s not suggested as standard practice just like the flag on the other elements of FDS?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FDS SDK13 : Failure to initialise from time to time</title><link>https://devzone.nordicsemi.com/thread/94133?ContentTypeID=1</link><pubDate>Mon, 31 Jul 2017 06:15:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5257ad9e-d2c2-4a54-89c5-479ad92d9664</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Are you waiting for the FDS_INIT callback after calling fds_init()? It sounds like you are trying to do FDS operations before the module is porperly initiated. Refer to the &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v13.1.0/lib_fds_usage.html?cp=4_0_0_3_43_2"&gt;FDS documentation&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Initialization, like all other
operations in FDS that involve writing
or erasing flash memory, is an
asynchronous operation.&lt;/p&gt;
&lt;/blockquote&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FDS SDK13 : Failure to initialise from time to time</title><link>https://devzone.nordicsemi.com/thread/94132?ContentTypeID=1</link><pubDate>Sun, 30 Jul 2017 10:57:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9407a41f-407d-4cd2-a3f7-03c69a349aaf</guid><dc:creator>RichieJH</dc:creator><description>&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;After much searching I got it to work by adding &lt;code&gt;nrf_delay_ms(2)&lt;/code&gt; between fds_init() and fds_test_find_and_delete().  Then it began working.  Out of interest I then commented out the nrf_delay_ms(2) and it still works!  I&amp;#39;ll keep an eye on it since it seems a little unstable.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;UPDATE 2:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;During the course of the day I notice that FDS will fail from time to time.  At one stage it failed even when the delays was 2ms, but changing it to 10ms solved it.  It seems in my case there can be a delay in FDS initing that needs to be taken into account.  I am not sure if this is expected behaviour or not, but that&amp;#39;s my observation.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>