<?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>Flash FDS initialization failure</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/26132/flash-fds-initialization-failure</link><description>When the nRF52 micro-controller is programmed through batch file i.e. nrfjprog utility, the flash fds fails to initialize.
Every time, flash fds initialization fails, I have code for soft_Reset. 
 Initialization fails 3 times and then Flash FDS initializes</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 24 Jul 2018 07:51:08 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/26132/flash-fds-initialization-failure" /><item><title>RE: Flash FDS initialization failure</title><link>https://devzone.nordicsemi.com/thread/141095?ContentTypeID=1</link><pubDate>Tue, 24 Jul 2018 07:51:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:26599b99-7d76-4492-8a75-806296126ad4</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;I would recommend you to post your issue in a new question, where you describe the issue in details. Please include what SDK and softdevice version you are using. Including code snippets showing how you initialize and use FDS would also be helpful for solving your issue.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash FDS initialization failure</title><link>https://devzone.nordicsemi.com/thread/138729?ContentTypeID=1</link><pubDate>Tue, 03 Jul 2018 10:19:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7905fc52-cdf1-4bb0-8a26-f6ff3ad5470e</guid><dc:creator>Pedro Ferreira</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I am having the exact same issue&lt;span&gt;&amp;nbsp;&lt;/span&gt;with the aggravating factor of the event handler not reacting to the write operation after FDS becomes available (after the three reboots). The fds_write function returns FDS_SUCCESS but the handler is not triggered.&amp;nbsp;&lt;/p&gt;
[quote userid="21522" url="~/f/nordic-q-a/26132/flash-fds-initialization-failure/102982"]Best way to do this is to initialize soft-device first followed by all the fds users[/quote]
&lt;p&gt;Could you please explain how to do this? I&amp;#39;m running the FDS initialization at the top of the main function of my program, and I am a bit lost in the BLE and NRF code.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m running this at a TY51822r3 Switch Science board.&lt;/p&gt;
&lt;p&gt;Thank you in advance for your help!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash FDS initialization failure</title><link>https://devzone.nordicsemi.com/thread/102982?ContentTypeID=1</link><pubDate>Thu, 02 Nov 2017 21:40:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0435afd2-6b7e-45e4-82b9-b318171c38e8</guid><dc:creator>Shreyas Shivalkar</dc:creator><description>&lt;p&gt;I found my mistake.&lt;/p&gt;
&lt;p&gt;I was initialing peer manager before soft-device and then custom fds user.
This why fds was initialization state when custom fds user was register. I didn&amp;#39;t get callback for peer manager or custom fds user.&lt;/p&gt;
&lt;p&gt;Best way to do this is to initialize soft-device first followed by all the fds users.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash FDS initialization failure</title><link>https://devzone.nordicsemi.com/thread/102981?ContentTypeID=1</link><pubDate>Wed, 01 Nov 2017 19:43:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4c969a2c-8c12-4d3b-8036-fddac09aa7dd</guid><dc:creator>Shreyas Shivalkar</dc:creator><description>&lt;p&gt;Following is the sequence of initialization&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;ret_code_t flash_fds_init(void)
{
    ret_code_t ret = fds_register(flash_fds_evt_handler);
	if (ret != FDS_SUCCESS)
{
    return ret;
}
ret = fds_init();
if (ret != FDS_SUCCESS)
{
        return ret;
}
return NRF_SUCCESS;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Both return with NRF_SUCCESS.&lt;/p&gt;
&lt;p&gt;Edit: Added code snippet for entire function&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash FDS initialization failure</title><link>https://devzone.nordicsemi.com/thread/102983?ContentTypeID=1</link><pubDate>Wed, 01 Nov 2017 08:45:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b40efff5-12b9-4e6d-884e-8ad990797583</guid><dc:creator>emdi</dc:creator><description>&lt;p&gt;Could you show how you initialize fds?&lt;/p&gt;
&lt;p&gt;Are you calling fds_init() after fds_register()?&lt;/p&gt;
&lt;p&gt;You won&amp;#39;t receive the initialization event otherwise.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash FDS initialization failure</title><link>https://devzone.nordicsemi.com/thread/102980?ContentTypeID=1</link><pubDate>Wed, 01 Nov 2017 01:54:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b1b3fbb5-2c2c-4900-83a5-8f7bdf86d35e</guid><dc:creator>Shreyas Shivalkar</dc:creator><description>&lt;p&gt;I knew about this issue. So, I have already added this. Still, it did not fix the problem.&lt;/p&gt;
&lt;p&gt;I have added code snippet for your reference.&lt;/p&gt;
&lt;p&gt;Following is part of sys_evt_dispatch(uint32_t sys_evt) function call:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;fs_sys_event_handler(sys_evt);
ble_advertising_on_sys_evt(sys_evt);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Following is part of ble_stack_init() function call:
// Register with the SoftDevice handler module for BLE events.
err_code = softdevice_ble_evt_handler_set(ble_evt_dispatch);
APP_ERROR_CHECK(err_code);&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;// Register with the SoftDevice handler module for System events.
err_code = softdevice_sys_evt_handler_set(sys_evt_dispatch);
APP_ERROR_CHECK(err_code);
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash FDS initialization failure</title><link>https://devzone.nordicsemi.com/thread/102979?ContentTypeID=1</link><pubDate>Tue, 31 Oct 2017 08:16:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6c2c65a8-0f54-4be5-881f-628480d3b078</guid><dc:creator>emdi</dc:creator><description>&lt;p&gt;You forgot to add the fstorage system event handler.
If you look at the main C file there should be a function called sys_evt_dispatch.
Add a call to fs_sys_evt_handler() there and pass it the system event received in that function.&lt;/p&gt;
&lt;p&gt;This is not necessary after the new SoftDevice handler was introduced, but SDK 12.2 didn&amp;#39;t have that.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash FDS initialization failure</title><link>https://devzone.nordicsemi.com/thread/102976?ContentTypeID=1</link><pubDate>Mon, 30 Oct 2017 19:00:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dfad28d7-1e1d-49d6-9a47-a5ccfed54a74</guid><dc:creator>Shreyas Shivalkar</dc:creator><description>&lt;p&gt;fds_init_complete falg is volatile.&lt;/p&gt;
&lt;p&gt;I checked the m_cb_table and m_users, both show that my custom evt_handler is added.
Adding sd_app_evt_wait() did not help. I didn&amp;#39;t get any callback.&lt;/p&gt;
&lt;p&gt;Is there a way to check these evt_handlers were present in a queue or similar data-structure.
Any insight will be helpful.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash FDS initialization failure</title><link>https://devzone.nordicsemi.com/thread/102975?ContentTypeID=1</link><pubDate>Fri, 27 Oct 2017 07:35:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fac4e898-7129-4762-8b1b-1be94798ccba</guid><dc:creator>emdi</dc:creator><description>&lt;p&gt;Well , this looks more reasonable. I would add an &amp;#39;sd_evt_wait()&amp;#39; call into the while loop.
Does that work for you? Also, is the flag you are waiting on declared &lt;em&gt;volatile&lt;/em&gt;? Some compilers require you to explicitely declare it as such.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash FDS initialization failure</title><link>https://devzone.nordicsemi.com/thread/102974?ContentTypeID=1</link><pubDate>Thu, 26 Oct 2017 19:03:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:279f56e3-b635-4000-b604-c3672367d77a</guid><dc:creator>Shreyas Shivalkar</dc:creator><description>&lt;p&gt;The rational behind waiting for the callback is make sure that the FDS is initialized and it is ok to load custom parameters for device name, etc.&lt;/p&gt;
&lt;p&gt;If I didn&amp;#39;t wait and callback event handler is never called, BLE starts advertising without Device Name.&lt;/p&gt;
&lt;p&gt;I am trying to find-out why callback event handler is never called?&lt;/p&gt;
&lt;p&gt;I have added the original snippet below&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;ble_stack_init();

// fds must be initialized after the Softdevice, as it uses the system event to run
flash_fds_init();           
// must wait for fds to initializ
while(!fds_init_complete)   
{}
// use fds to get the auth params (first time though, this Writes the default auth params) 
load_auth_params();
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Any insight will be helpful.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash FDS initialization failure</title><link>https://devzone.nordicsemi.com/thread/102978?ContentTypeID=1</link><pubDate>Tue, 24 Oct 2017 09:17:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b591aebb-8687-49e8-951e-fcb977d4929d</guid><dc:creator>emdi</dc:creator><description>&lt;p&gt;I don&amp;#39;t quite understand the logic behind the snippet that you posted.&lt;/p&gt;
&lt;p&gt;It seems to me that you attempt to initialize fds, which is an asynchronous operation.
Then, immediately after returning from the call flash_fds_init() you check that the operation has completed, and if it has not you wait one second and reset. That doesn&amp;#39;t make much sense to me.&lt;/p&gt;
&lt;p&gt;That code you posted will reset the chip until the initialization becomes a synchronous operation and you receive a callback before the flash_fds_init() function returns  and thus the flag is already set when you check it.&lt;/p&gt;
&lt;p&gt;Did I explain it well enough? :)&lt;/p&gt;
&lt;p&gt;Regards,
emdi&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash FDS initialization failure</title><link>https://devzone.nordicsemi.com/thread/102972?ContentTypeID=1</link><pubDate>Mon, 23 Oct 2017 19:39:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7dfd87bb-649b-4c11-8e1f-53fe922eb7b6</guid><dc:creator>Shreyas Shivalkar</dc:creator><description>&lt;p&gt;I am not sure what you mean by that.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash FDS initialization failure</title><link>https://devzone.nordicsemi.com/thread/102977?ContentTypeID=1</link><pubDate>Mon, 23 Oct 2017 19:12:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:173c9dd1-eef4-4fc2-9158-ca9eef1efac3</guid><dc:creator>Shreyas Shivalkar</dc:creator><description>&lt;p&gt;If the callback event handler is never called, FDS initialization never completes.
The firmware keeps waiting for the FDS initialization (which never happens). I don&amp;#39;t know if there is any other way to recover.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash FDS initialization failure</title><link>https://devzone.nordicsemi.com/thread/102971?ContentTypeID=1</link><pubDate>Mon, 23 Oct 2017 10:56:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:023b2fc8-c81e-4e68-9fea-694399f56ff9</guid><dc:creator>emdi</dc:creator><description>&lt;p&gt;Are you using the nvmc backend?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash FDS initialization failure</title><link>https://devzone.nordicsemi.com/thread/102970?ContentTypeID=1</link><pubDate>Mon, 23 Oct 2017 10:55:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:33e8c095-fd86-4a12-9cea-cb304c846e54</guid><dc:creator>Luis</dc:creator><description>&lt;p&gt;I faced very similar problem in SDK14. I have been told it was fixed in new version SDK14.1, but I haven&amp;#39;t had the time to check it. You should try SDK14.1.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash FDS initialization failure</title><link>https://devzone.nordicsemi.com/thread/102973?ContentTypeID=1</link><pubDate>Mon, 23 Oct 2017 08:39:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:162e103c-35a5-4012-b37e-799252110198</guid><dc:creator>emdi</dc:creator><description>&lt;p&gt;Why would you reset while fds is initializing?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>