<?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 event handler is not occur.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/69517/fds-event-handler-is-not-occur</link><description>Hi, 
 
 I am developing using nRF52820 / SDK 17.0.2 
 In order to store data in FDS, the handlers were registered and initialized as follows. 
 
 
 FDS_Event_handler does not occur after fds_record_update(). 
 Why the event is not occurring? 
 An event</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 30 Dec 2020 09:36:54 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/69517/fds-event-handler-is-not-occur" /><item><title>RE: FDS event handler is not occur.</title><link>https://devzone.nordicsemi.com/thread/286963?ContentTypeID=1</link><pubDate>Wed, 30 Dec 2020 09:36:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3c65b74f-a6af-4dee-8ab0-79ed248a5370</guid><dc:creator>Vidar Berg</dc:creator><description>[quote userid="83275" url="~/f/nordic-q-a/69517/fds-event-handler-is-not-occur/286961#286961"]update on an interrupt[/quote]
&lt;p&gt;I guess it has the same or higher priority than the Softdevice events, so the wait loop ends up blocking the FDS callback forever. Yes, please try removing the wait function.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FDS event handler is not occur.</title><link>https://devzone.nordicsemi.com/thread/286961?ContentTypeID=1</link><pubDate>Wed, 30 Dec 2020 09:33:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:23e1e094-9d84-4c25-8455-dffd73386975</guid><dc:creator>moon.kim</dc:creator><description>[quote userid="4240" url="~/f/nordic-q-a/69517/fds-event-handler-is-not-occur/286957#286957"]Is it a wait loop that blocks the program until FDS_Event_handler() comes through? In that case, can you try to remove it? It sounds like it may become blocking in some way.[/quote]
&lt;p&gt;Yet I am not considering removing this loop. Could this loop be a problem?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote userid="4240" url="~/f/nordic-q-a/69517/fds-event-handler-is-not-occur/286957#286957"]Do you use the app scheduler in your application, or is the update function called from an interrupt?[/quote]
&lt;p&gt;Yes,&amp;nbsp;Do not use the scheduler. Instead, it calls the update on an interrupt.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FDS event handler is not occur.</title><link>https://devzone.nordicsemi.com/thread/286957?ContentTypeID=1</link><pubDate>Wed, 30 Dec 2020 09:27:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cb67c2fc-e60c-4505-996b-cb18c88ad391</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Is it a wait loop that blocks the program until FDS_Event_handler() comes through? In that case, can you try to remove it? It sounds like it may become blocking in some way.&lt;/p&gt;
&lt;p&gt;Do you use the app scheduler in your application, or is the update function called from an interrupt? &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FDS event handler is not occur.</title><link>https://devzone.nordicsemi.com/thread/286668?ContentTypeID=1</link><pubDate>Mon, 28 Dec 2020 10:08:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4b1f6bfd-00c4-4e02-9b99-c9c4e1c491d4</guid><dc:creator>moon.kim</dc:creator><description>&lt;p&gt;Yes, After executing fds_record_update(), it waits until FDS_Event_handler() occurs.&lt;/p&gt;
&lt;p&gt;This is to check if the FDS update is complete.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FDS event handler is not occur.</title><link>https://devzone.nordicsemi.com/thread/286661?ContentTypeID=1</link><pubDate>Mon, 28 Dec 2020 09:57:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b35ecf4f-8831-4527-863a-d19f2b51cf9a</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;I see the NRF_EVT_FLASH_OPERATION_SUCCESS events are reported several times when the PM updates data in FDS, but not when you update fds from main(). Does logging stop after the &amp;quot;record update error code : 0x0&amp;quot; line?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FDS event handler is not occur.</title><link>https://devzone.nordicsemi.com/thread/286647?ContentTypeID=1</link><pubDate>Mon, 28 Dec 2020 08:18:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6766051d-5124-42f2-8980-d504b14c3539</guid><dc:creator>moon.kim</dc:creator><description>&lt;p&gt;This is the log that added the FDS update error code.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;00&amp;gt; 
00&amp;gt; BLE_GAP_EVT_CONNECTED
00&amp;gt; PM_EVT_(0x05) 
00&amp;gt; PM_EVT_CONN_SEC_START
00&amp;gt; PM_EVT_(0x05) 
00&amp;gt; PM_EVT_CONN_SEC_SUCCEEDED
00&amp;gt; SoC event: 0x2.
00&amp;gt; SoC event: 0x2.
00&amp;gt; SoC event: 0x2.
00&amp;gt; SoC event: 0x2.
00&amp;gt; PM_EVT_PEER_DATA_UPDATE_SUCCEEDED
00&amp;gt; FDS_Event_handler occurred. ID : 0x1, Result : 0x0
00&amp;gt; SoC event: 0x2.
00&amp;gt; SoC event: 0x2.
00&amp;gt; SoC event: 0x2.
00&amp;gt; SoC event: 0x2.
00&amp;gt; PM_EVT_PEER_DATA_UPDATE_SUCCEEDED
00&amp;gt; FDS_Event_handler occurred. ID : 0x1, Result : 0x0
00&amp;gt; SoC event: 0x2.
00&amp;gt; SoC event: 0x2.
00&amp;gt; SoC event: 0x2.
00&amp;gt; SoC event: 0x2.
00&amp;gt; PM_EVT_PEER_DATA_UPDATE_SUCCEEDED
00&amp;gt; FDS_Event_handler occurred. ID : 0x1, Result : 0x0
00&amp;gt; SoC event: 0x2.
00&amp;gt; SoC event: 0x2.
00&amp;gt; SoC event: 0x2.
00&amp;gt; SoC event: 0x2.
00&amp;gt; PM_EVT_PEER_DATA_UPDATE_SUCCEEDED
00&amp;gt; FDS_Event_handler occurred. ID : 0x1, Result : 0x0
00&amp;gt; Start FDS update
00&amp;gt; record update error code : 0x0&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;FDS update is executed even at boot time, but in that case, FDS handler occurs normally.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FDS event handler is not occur.</title><link>https://devzone.nordicsemi.com/thread/286645?ContentTypeID=1</link><pubDate>Mon, 28 Dec 2020 07:59:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1722a550-13c3-4b86-99a0-6195d1a63280</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;You should register all FDS users before fds_init() is called from pm_init(), but I don&amp;#39;t think that is related to the problem. From the snippet you posted I noticed that you are not doing any error checks. Can you check if fds_record_update() is being called, and if it is returning an error code or not?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FDS event handler is not occur.</title><link>https://devzone.nordicsemi.com/thread/286625?ContentTypeID=1</link><pubDate>Mon, 28 Dec 2020 04:31:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ef3b46a6-4f65-4772-b3ad-349262929b8a</guid><dc:creator>moon.kim</dc:creator><description>&lt;p&gt;Hi.&lt;/p&gt;
&lt;p&gt;Sorry for the late reply&lt;/p&gt;
&lt;p&gt;I tested it as you told me.&lt;/p&gt;
&lt;p&gt;Softdevice event did not occur after FDS update was executed.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;00&amp;gt; BLE_GAP_EVT_CONNECTED
00&amp;gt; PM_EVT_(0x05) 
00&amp;gt; PM_EVT_CONN_SEC_START
00&amp;gt; PM_EVT_(0x05) 
00&amp;gt; PM_EVT_CONN_SEC_SUCCEEDED
00&amp;gt; SoC event: 0x2.
00&amp;gt; SoC event: 0x2.
00&amp;gt; SoC event: 0x2.
00&amp;gt; SoC event: 0x2.
00&amp;gt; PM_EVT_PEER_DATA_UPDATE_SUCCEEDED
00&amp;gt; SoC event: 0x2.
00&amp;gt; SoC event: 0x2.
00&amp;gt; SoC event: 0x2.
00&amp;gt; SoC event: 0x2.
00&amp;gt; PM_EVT_PEER_DATA_UPDATE_SUCCEEDED
00&amp;gt; SoC event: 0x2.
00&amp;gt; SoC event: 0x2.
00&amp;gt; SoC event: 0x2.
00&amp;gt; SoC event: 0x2.
00&amp;gt; PM_EVT_PEER_DATA_UPDATE_SUCCEEDED
00&amp;gt; SoC event: 0x2.
00&amp;gt; SoC event: 0x2.
00&amp;gt; SoC event: 0x2.
00&amp;gt; SoC event: 0x2.
00&amp;gt; PM_EVT_PEER_DATA_UPDATE_SUCCEEDED
00&amp;gt; Start FDS update&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I run an FDS update to store the Peer ID in FDS after pairing.&lt;/p&gt;
&lt;p&gt;But the FDS event handler(fds_evt_handler) I added doesn&amp;#39;t &lt;span&gt;executed&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;Is it because of the peer manager?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FDS event handler is not occur.</title><link>https://devzone.nordicsemi.com/thread/285065?ContentTypeID=1</link><pubDate>Tue, 15 Dec 2020 12:36:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dc29270e-a705-42f5-a6cc-404463bb337a</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Any chance you could upload a minimal version of your project here so I can try to debug it? I don&amp;#39;t see any obvious problems in the code you have posted.&lt;/p&gt;
&lt;p&gt;A suggestion if you want to try debug this yourself is to place a breakpoint inside nrf_sdh_soc.c::nrf_sdh_soc_evts_poll() after sd_evt_get() to check if you receive any Softdevice flash events at all.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FDS event handler is not occur.</title><link>https://devzone.nordicsemi.com/thread/284967?ContentTypeID=1</link><pubDate>Tue, 15 Dec 2020 09:15:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e291a734-a979-4dc3-a48b-407d97235009</guid><dc:creator>moon.kim</dc:creator><description>&lt;p&gt;I initialize the peer manager as in the example code.&lt;br /&gt;It was confirmed that pds_init() was called in pm_init().&lt;/p&gt;
&lt;p&gt;So, fds_init() was not executed again, and only event handlers were registered.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;ret_code_t pds_init()
{
    ret_code_t ret;

    // Check for re-initialization if debugging.
    NRF_PM_DEBUG_CHECK(!m_module_initialized);

    ret = fds_register(fds_evt_handler);
    if (ret != NRF_SUCCESS)
    {
        NRF_LOG_ERROR(&amp;quot;Could not initialize flash storage. fds_register() returned 0x%x.&amp;quot;, ret);
        return NRF_ERROR_INTERNAL;
    }

    ret = fds_init();
    if (ret != NRF_SUCCESS)
    {
        NRF_LOG_ERROR(&amp;quot;Could not initialize flash storage. fds_init() returned 0x%x.&amp;quot;, ret);
        return NRF_ERROR_STORAGE_FULL;
    }

    peer_id_init();
    peer_ids_load();

    m_module_initialized = true;

    return NRF_SUCCESS;
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FDS event handler is not occur.</title><link>https://devzone.nordicsemi.com/thread/284961?ContentTypeID=1</link><pubDate>Tue, 15 Dec 2020 08:53:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8f7eb9fb-459d-49fb-bf64-a44f3b97fe5b</guid><dc:creator>Henry_Chou</dc:creator><description>&lt;p&gt;So wait for FDS init &amp;amp; fds_state(&amp;amp;state);&lt;/p&gt;
&lt;p&gt;Have you done that?&lt;/p&gt;
&lt;p&gt;Actually&amp;nbsp;fds_gc() will trigger the handle id,but I am not sure your code for init &amp;amp; pre-procedure.&lt;/p&gt;
&lt;p&gt;But&amp;nbsp;fds_record_update() will also trigger one, if execute write_enqueue();&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FDS event handler is not occur.</title><link>https://devzone.nordicsemi.com/thread/284958?ContentTypeID=1</link><pubDate>Tue, 15 Dec 2020 08:48:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c5188f33-ef9c-454c-b77d-9da0d07dedb3</guid><dc:creator>moon.kim</dc:creator><description>&lt;p&gt;I know that fds_init() is done in peer_manager_init()&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FDS event handler is not occur.</title><link>https://devzone.nordicsemi.com/thread/284956?ContentTypeID=1</link><pubDate>Tue, 15 Dec 2020 08:47:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:602f5935-351b-4918-8ffc-6c0e07649969</guid><dc:creator>Henry_Chou</dc:creator><description>&lt;p&gt;Have ever done the fds_init() in your code? It seems like no initialization FDS.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>