<?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>Using FDS with BLE and Scheduler</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/28531/using-fds-with-ble-and-scheduler</link><description>Hey guys, 
 I&amp;#39;m trying to make the FDS work with BLE and the scheduler.
But something doesn&amp;#39;t right when I use the Softdevice and scheduler with the FDS. 
 Must I register something in my ble_stack_init() , I read something about sys_evt_dispatch(</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 22 Dec 2017 09:15:10 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/28531/using-fds-with-ble-and-scheduler" /><item><title>RE: Using FDS with BLE and Scheduler</title><link>https://devzone.nordicsemi.com/thread/112999?ContentTypeID=1</link><pubDate>Fri, 22 Dec 2017 09:15:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cedb184f-9a0c-4ce5-b463-250d66f009e5</guid><dc:creator>Sorrow91</dc:creator><description>&lt;p&gt;I don&amp;#39;t understand why the &lt;code&gt;NRF_LOG_INFO&lt;/code&gt; function not executed properly, after the &lt;code&gt;fds_setup()&lt;/code&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using FDS with BLE and Scheduler</title><link>https://devzone.nordicsemi.com/thread/112998?ContentTypeID=1</link><pubDate>Fri, 22 Dec 2017 08:59:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5d54159c-5bc7-42e0-b26a-647363ed9503</guid><dc:creator>Sorrow91</dc:creator><description>&lt;p&gt;Hey emdi, thanks for your answer. I updated my code a bit in my main post.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using FDS with BLE and Scheduler</title><link>https://devzone.nordicsemi.com/thread/112997?ContentTypeID=1</link><pubDate>Fri, 22 Dec 2017 08:42:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5bdec260-e694-45ba-8f24-56fe52ab15d8</guid><dc:creator>emdi</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;when dispatching system events through the scheduler, the check&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; while(write_flag == 0);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;in your main function will never pass, since the code that is supposed to set that flag is run in
app_scheduler_exec(), in the foor loop, that you never reach.&lt;/p&gt;
&lt;p&gt;What you could do is to schedule the operations in the fds event handler:
after receiving the INIT event, schedule the WRITE.&lt;/p&gt;
&lt;p&gt;Does that make sense?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using FDS with BLE and Scheduler</title><link>https://devzone.nordicsemi.com/thread/112996?ContentTypeID=1</link><pubDate>Thu, 21 Dec 2017 22:11:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:715afb21-aa6c-40b1-a963-06ce6eb86cb8</guid><dc:creator>Sorrow91</dc:creator><description>&lt;p&gt;Hey Jørgen,
I uploaded my code again.
If I only want to write a FDS record, the FDS handler I initialize never gave a something back.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; case FDS_EVT_WRITE:
    {
        if (p_evt-&amp;gt;result == FDS_SUCCESS)
        {
							NRF_LOG_INFO(&amp;quot;FDS_EVT_WRITE&amp;quot;);
        }
    } break;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For me it seems, that the events are not called right from the schedueler.
I know that I did something from, but I can&amp;#39;t figure out what...&lt;/p&gt;
&lt;p&gt;And thank you again for your effort to help me!&lt;/p&gt;
&lt;p&gt;Kevin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using FDS with BLE and Scheduler</title><link>https://devzone.nordicsemi.com/thread/112995?ContentTypeID=1</link><pubDate>Wed, 20 Dec 2017 13:35:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6c28a58a-da9e-449e-94f0-9b802cc6db5f</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t think the code on GitHub that you linked is updated. It only have &lt;a href="https://github.com/Sorrow91/cube/blob/master/main.c#L1829"&gt;&lt;code&gt;scheduler_ncs_s_file_update&lt;/code&gt;&lt;/a&gt;, which will end in &lt;code&gt;FDS_ERR_NOT_FOUND&lt;/code&gt; error in the FDS event handler. I changed the code to schedule &lt;code&gt;ncs_s_file_create()&lt;/code&gt; instead, and this seems to work. However, I get a &lt;code&gt;FDS_ERR_NOT_FOUND&lt;/code&gt; error code from the scheduled call to &lt;code&gt;ncs_s_file_read()&lt;/code&gt; right after.&lt;/p&gt;
&lt;p&gt;You do not have any mechanism to make sure the record is written before reading it. Note that &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v14.1.0/lib_fds.html?cp=4_0_1_3_50"&gt;FDS writes are asynchronous&lt;/a&gt;, meaning that it will schedule the write/erase event between softdevice/BLE events. You must wait until for the &lt;code&gt;FDS_EVT_WRITE&lt;/code&gt;/&lt;code&gt;FDS_EVT_UPDATE&lt;/code&gt; event in the FDS event handler before you can read the record.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using FDS with BLE and Scheduler</title><link>https://devzone.nordicsemi.com/thread/112993?ContentTypeID=1</link><pubDate>Tue, 19 Dec 2017 12:47:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:97246b18-3e2f-450c-927c-beeb0afbc8a5</guid><dc:creator>Sorrow91</dc:creator><description>&lt;p&gt;Yes sorry I forget to uncomment:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;//		err_code = fds_setup();
//		APP_ERROR_CHECK(err_code);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Can you try to write and read something by uncomment this lines:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;//		ncs_settings.sync = 5;
//		ncs_settings.buffer = ncs_settings.sync;
//		ncs_settings.file = 1;
//		ncs_settings.key = 1;
//				
//		err_code = app_sched_event_put(NULL, 0, scheduler_fds_write);
//		read_error(err_code);
//		APP_ERROR_CHECK(err_code);
//	
//		err_code = app_sched_event_put(NULL, 0, scheduler_fds_read);
//		read_error(err_code);
//		APP_ERROR_CHECK(err_code);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This doesn&amp;#39;t work and after &lt;code&gt;fds_setup()&lt;/code&gt; the &lt;code&gt;NRF_LOG_INFO()&lt;/code&gt; function doesnt work right.&lt;/p&gt;
&lt;p&gt;Thanks for your affort&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using FDS with BLE and Scheduler</title><link>https://devzone.nordicsemi.com/thread/112992?ContentTypeID=1</link><pubDate>Tue, 19 Dec 2017 12:23:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:55abffb5-6c7f-4207-be53-b3598a4c4ba6</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;I can&amp;#39;t see anything wrong with your code. I commented in call to &lt;code&gt;ncs_s_file_setup()&lt;/code&gt; in your main.c file (as this was the only reference, except peer_manager, I could find in your code to &lt;code&gt;fds_init()&lt;/code&gt; function). This is the output I see on RTT:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; 0&amp;gt; &amp;lt;info&amp;gt; app: log_init
 0&amp;gt; &amp;lt;info&amp;gt; app: timers_init
 0&amp;gt; &amp;lt;info&amp;gt; app: buttons_leds_init
 0&amp;gt; &amp;lt;info&amp;gt; app: ble_stack_init
 0&amp;gt; &amp;lt;info&amp;gt; app: scheduler_init
 0&amp;gt; &amp;lt;info&amp;gt; app: gap_params_init
 0&amp;gt; &amp;lt;info&amp;gt; app: gatt_init
 0&amp;gt; &amp;lt;info&amp;gt; app: peer_manager_init
 0&amp;gt; &amp;lt;info&amp;gt; app: services_sr_init
 0&amp;gt; &amp;lt;info&amp;gt; app: advertising_init
 0&amp;gt; &amp;lt;info&amp;gt; app: db_discovery_init
 0&amp;gt; &amp;lt;info&amp;gt; app: services_init
 0&amp;gt; &amp;lt;info&amp;gt; app: conn_params_init
 0&amp;gt; &amp;lt;info&amp;gt; app: gpiote_init
 0&amp;gt; &amp;lt;info&amp;gt; app: saadc_init
 0&amp;gt; &amp;lt;info&amp;gt; app: twi_init
 0&amp;gt; &amp;lt;info&amp;gt; ncs_s_file_m: FDS initialization success.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I am able to see the device advertising, and connect to it. What is the issue?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using FDS with BLE and Scheduler</title><link>https://devzone.nordicsemi.com/thread/112994?ContentTypeID=1</link><pubDate>Tue, 19 Dec 2017 09:31:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:af2ae4ba-5b09-417c-ab8e-68817eb36bc0</guid><dc:creator>Sorrow91</dc:creator><description>&lt;p&gt;Hey Jørgen, did you found what I&amp;#39;m doing wrong in my code? Thanks for you help&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using FDS with BLE and Scheduler</title><link>https://devzone.nordicsemi.com/thread/112990?ContentTypeID=1</link><pubDate>Fri, 15 Dec 2017 21:19:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f35e529e-0cf2-4998-a2a9-0470d71beb12</guid><dc:creator>Sorrow91</dc:creator><description>&lt;p&gt;Hey I tried to debug it, but I can&amp;#39;t figure out whats wrong. I uploaded my project to github for you: &lt;a href="https://github.com/Sorrow91/cube"&gt;LINK&lt;/a&gt;
SDK: 14.2. I hope you can see what I&amp;#39;m doing wrong, thanks for your help anyways. And I&amp;#39;m sorry for any noobi things I do in my code, I&amp;#39;m at the beginning... :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using FDS with BLE and Scheduler</title><link>https://devzone.nordicsemi.com/thread/112991?ContentTypeID=1</link><pubDate>Fri, 15 Dec 2017 13:50:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:21de8384-966c-4fe7-a95c-02909d7f90fe</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;It should not be a problem to register another user with FDS along Peer Manager. The call to &lt;code&gt;fds_init&lt;/code&gt; will simply realize FDS is already initialized and return success. You should debug your application to see exactly where it hangs. If you need help with this, please upload your entire project for debugging.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using FDS with BLE and Scheduler</title><link>https://devzone.nordicsemi.com/thread/112988?ContentTypeID=1</link><pubDate>Tue, 12 Dec 2017 19:59:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6c12951e-c561-44fd-8e3c-af502517c4e8</guid><dc:creator>Sorrow91</dc:creator><description>&lt;p&gt;Found that it&amp;#39;s the peer manager, if I comment it out the &lt;code&gt;fds_init&lt;/code&gt; and &lt;code&gt;fds_register&lt;/code&gt; function work normal as they should.
Here is my &lt;a href="https://www.pastiebin.com/5a2f0867433e0"&gt;skd_config.h&lt;/a&gt;, do I forgot something?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using FDS with BLE and Scheduler</title><link>https://devzone.nordicsemi.com/thread/112989?ContentTypeID=1</link><pubDate>Tue, 12 Dec 2017 11:22:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3ad40b63-c89d-4786-a210-ee61bdb77f12</guid><dc:creator>Sorrow91</dc:creator><description>&lt;p&gt;Thanks for your answer. It doesn&amp;#39;t work when I disable the scheduler too.
It seems that it hangs anywere after &lt;code&gt;init_fds()&lt;/code&gt;.
The &lt;code&gt;fds_init&lt;/code&gt; and the &lt;code&gt;fds_register&lt;/code&gt; gave me &lt;code&gt;NRF_SUCCESS&lt;/code&gt;.
Can it be a problem with the order in my initialization in my main()?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using FDS with BLE and Scheduler</title><link>https://devzone.nordicsemi.com/thread/112987?ContentTypeID=1</link><pubDate>Mon, 11 Dec 2017 14:27:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8bac3a59-3f84-461e-9274-7dad22d3d117</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Could you describe the issue in more detail, what is not working? Have you tried &lt;a href="https://devzone.nordicsemi.com/question/60125/my-device-is-freezing-and-restarting/"&gt;debugging&lt;/a&gt; to see if there are any error codes? &lt;code&gt;sys_evt_dispatch&lt;/code&gt; was replaced by &lt;code&gt;NRF_SDH_SOC_OBSERVER&lt;/code&gt; macro in SDK 14, as described in the &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v14.0.0/migration.html?resultof=%22%73%79%73%5f%65%76%74%5f%64%69%73%70%61%74%63%68%22%20#migration_ble_sdhandler"&gt;Migration Guide&lt;/a&gt;. Is FDS working without scheduler?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>