<?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>handling softdevice soc event handler in SDK 14.1.0</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/29726/handling-softdevice-soc-event-handler-in-sdk-14-1-0</link><description>Hi, 
 I am trying to write and update a record in flash but not receiving event callbacks FDS_EVT_WRITE and FDS_EVT_UPDATE. I found that i need to add the following code in my main.c 
 static void sys_evt_dispatch(uint32_t sys_evt)
{
// Dispatch the</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 25 Jan 2018 18:19:36 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/29726/handling-softdevice-soc-event-handler-in-sdk-14-1-0" /><item><title>RE: handling softdevice soc event handler in SDK 14.1.0</title><link>https://devzone.nordicsemi.com/thread/117932?ContentTypeID=1</link><pubDate>Thu, 25 Jan 2018 18:19:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:af5c4f6f-1877-4e78-b36c-677bec10aa2d</guid><dc:creator>kvskt</dc:creator><description>&lt;p&gt;Hi Petter, you were right. I was running in interrupt context which is leading to this behavior.  Now i moved it to main and everything is working fine. Thanks for the help&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: handling softdevice soc event handler in SDK 14.1.0</title><link>https://devzone.nordicsemi.com/thread/117931?ContentTypeID=1</link><pubDate>Thu, 25 Jan 2018 11:56:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:53c0a383-8587-414e-b9e6-0a1100a4e989</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;I really sounds like you are running in interrupt context and the flags aren&amp;#39;t set because the interrupt is in the same context, but okay. Are you using a scheduler? Would it be possible for you to upload your complete project so I can test it here?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: handling softdevice soc event handler in SDK 14.1.0</title><link>https://devzone.nordicsemi.com/thread/117930?ContentTypeID=1</link><pubDate>Thu, 25 Jan 2018 10:39:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5973765b-c7e4-4153-ac93-68f4e2b12cbb</guid><dc:creator>kvskt</dc:creator><description>&lt;p&gt;I am using loop while(!write) and while(!updated) to wait for the event completion in the main context. and yes the result am getting is 0x00000000 (NRF_SUCCESS) whenever i receive the event.&lt;/p&gt;
&lt;p&gt;What am seeing now is that, when i remove this loop, the event is seen couple of seconds later i.e flags written/updated are getting true.  but when using the loop, the system waits  forever and i have to reset the board. Is there any way i notify main context that the event happened instead of waiting for the flags in loop.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: handling softdevice soc event handler in SDK 14.1.0</title><link>https://devzone.nordicsemi.com/thread/117928?ContentTypeID=1</link><pubDate>Thu, 25 Jan 2018 08:43:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ec08111d-656b-4522-a981-da3335f3309e</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;In which context are you waiting in this loop? Main context? If you are in interrupt context, that could be the problem. Then your event handler may not get executed.&lt;/p&gt;
&lt;p&gt;I would also recommend checking the result of the operation, check that it is 0x00000000 (NRF_SUCCESS)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: handling softdevice soc event handler in SDK 14.1.0</title><link>https://devzone.nordicsemi.com/thread/117929?ContentTypeID=1</link><pubDate>Thu, 25 Jan 2018 05:49:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cbbabf58-b67a-45bb-867f-6b8b87173d43</guid><dc:creator>kvskt</dc:creator><description>&lt;p&gt;Hi Petter, Thanks for the reply. I am able to write and update, but not always.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;i am using fds_evt_handler initiated by peer_manager to know write/update events completed. when ever a write or update event is completed i try to update a flag and read it to know that event is completed. But not all write/update operations is triggering the handler and my code is struck as in while loop waiting for the flag to get changed.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Is there any way i can get know that the event is completed .&lt;/p&gt;
&lt;p&gt;This is how my current evnt handler looks like:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; switch (p_fds_evt-&amp;gt;id)
    {
        case FDS_EVT_WRITE:
              written = true;
             break;
        case FDS_EVT_UPDATE:
             updated = true;
             break;
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: handling softdevice soc event handler in SDK 14.1.0</title><link>https://devzone.nordicsemi.com/thread/117927?ContentTypeID=1</link><pubDate>Wed, 24 Jan 2018 12:01:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:46a15166-86af-45e0-b0bb-5d219fe6cb30</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;In SDK 14.1.0 there are quite a few changes to the SoftDevice handler library. You don&amp;#39;t need to call softdevice_sys_evt_handler_set() anymore. Instead the NRF_SDH_SOC_OBSERVER() macro is used.&lt;/p&gt;
&lt;p&gt;This macro is already included in the fstorage library in SDK 14.1.0, so you shouldn&amp;#39;t really need to do it either. You can see the following in nrf_fstorage_sd.h:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;/* Define a nrf_sdh_soc event observer to receive SoftDevice system events. */
NRF_SDH_SOC_OBSERVER(m_sys_obs, 0, nrf_fstorage_sys_evt_handler, NULL);
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>