<?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>No FDS events when SoftDevice is enabled</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/44341/no-fds-events-when-softdevice-is-enabled</link><description>Using SDK 15.2 on an nRF52832 using SoftDevice S132. FDS works OK unless the SoftDevice is enabled. None of the examples work. We&amp;#39;ve tried the peripheral example, GitHub examples, support samples, etc. but no luck. The basic flow is: 
 BLE stack init</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 05 Mar 2019 18:27:11 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/44341/no-fds-events-when-softdevice-is-enabled" /><item><title>RE: No FDS events when SoftDevice is enabled</title><link>https://devzone.nordicsemi.com/thread/174374?ContentTypeID=1</link><pubDate>Tue, 05 Mar 2019 18:27:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5027131c-0af5-4a62-b85d-320f908b7a09</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi Mike,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I&amp;#39;m sorry for the delayed response. The peer manager module already uses FDS to store bonding information to flash, have you tried to see if bonding works with your app? If it works, it would indicate the SoC (flash events) are correctly forwarded from the softdevice to the application at least.&lt;/p&gt;
&lt;p&gt;In&amp;nbsp;any&amp;nbsp;case, I have made a&amp;nbsp;minimal&amp;nbsp;example based on the ble_app_hrs example in SDK 15.2.0 which writes a new FDS record every second. Could you try to see if this code works on your side?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Diff:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="diff"&gt;diff --git a/examples/ble_peripheral/ble_app_hrs/main.c b/examples/ble_peripheral/ble_app_hrs/main.c
index d797b07..eea4a9f 100644
--- a/examples/ble_peripheral/ble_app_hrs/main.c
+++ b/examples/ble_peripheral/ble_app_hrs/main.c
@@ -946,15 +946,76 @@ static void idle_state_handle(void)
 }
 
 
+#include &amp;quot;nrf_delay.h&amp;quot;
+
+
+#define USER_DATA_RECORD_ID  0x1000
+#define USER_DATA_FILE_ID    0x1001
+
+
+
+void flash_callback(fds_evt_t const * p_evt)
+{
+    switch (p_evt-&amp;gt;id)
+    {
+        case FDS_EVT_INIT:
+            if(p_evt-&amp;gt;result == FDS_SUCCESS)
+            {
+                NRF_LOG_INFO(&amp;quot;FDS initialized&amp;quot;);
+            }
+            else 
+            {
+                NRF_LOG_INFO(&amp;quot;FDS initialization failed&amp;quot;);
+            }
+            break;
+            
+        case FDS_EVT_WRITE:
+        if(p_evt-&amp;gt;result == FDS_SUCCESS)
+            {
+                NRF_LOG_INFO(&amp;quot;New data record written to flash&amp;quot;);
+            }
+            break;
+        case FDS_EVT_UPDATE:
+        case FDS_EVT_DEL_RECORD:
+        case FDS_EVT_DEL_FILE:
+        case FDS_EVT_GC:
+          break;
+    }
+}
+
+void flash_storage_init(void)
+{
+    uint32_t err_code;
+
+    /*FDS is initalized by the peer manager module - 
+      only registering a new user here*/
+    err_code = fds_register(flash_callback);
+    APP_ERROR_CHECK(err_code);
+}
+
+
 /**@brief Function for application main entry.
  */
 int main(void)
 {
     bool erase_bonds;
+    uint32_t           err_code;
+    static uint32_t    test_word = 0xAAAAAAAA; 
+    fds_record_desc_t  record_desc;
+    fds_record_t       record;
+
+    memset(&amp;amp;record, 0, sizeof(record));
+
+    record.file_id           = USER_DATA_FILE_ID;
+    record.key               = USER_DATA_RECORD_ID;
+    record.data.length_words = 1;
+    record.data.p_data       = (uint8_t *) &amp;amp;test_word;
+
 
     // Initialize.
     log_init();
     timers_init();
+    flash_storage_init(); // call this function before peer_mananger_init()
     buttons_leds_init(&amp;amp;erase_bonds);
     power_management_init();
     ble_stack_init();
@@ -974,7 +1035,12 @@ int main(void)
     // Enter main loop.
     for (;;)
     {
-        idle_state_handle();
+        //idle_state_handle();
+        nrf_delay_ms(1000);
+        err_code = fds_record_write(&amp;amp;record_desc, &amp;amp;record);
+        APP_ERROR_CHECK(err_code);
+        NRF_LOG_PROCESS();
+
     }
 }
 
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;modified main.c for ble_app_hrs project:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-b3d90d8deb864d1c8b4df3f828994dcc/main.c"&gt;devzone.nordicsemi.com/.../main.c&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>