<?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>Discovery service dosen&amp;#39;t work always</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/20204/discovery-service-dosen-t-work-always</link><description>When I keep this function : 
 static void vMain_iInitDeviceManager_Exe(bool erase_bonds)
{
 uint32_t err_code;
 dm_init_param_t init_param = {.clear_persistent_data = erase_bonds};
 dm_application_param_t register_param;

// Initialize persistent</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 07 Mar 2017 09:30:09 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/20204/discovery-service-dosen-t-work-always" /><item><title>RE: Discovery service dosen't work always</title><link>https://devzone.nordicsemi.com/thread/78715?ContentTypeID=1</link><pubDate>Tue, 07 Mar 2017 09:30:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:05d676fa-1212-4835-a55a-b2f4b936253f</guid><dc:creator>ToTo</dc:creator><description>&lt;p&gt;Yah, that is what i meant. Thank you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Discovery service dosen't work always</title><link>https://devzone.nordicsemi.com/thread/78717?ContentTypeID=1</link><pubDate>Tue, 07 Mar 2017 09:27:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d6712543-e216-48de-9c98-77098321c4cb</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;What did you mean by &amp;quot;data manager&amp;quot; , you meant &amp;quot;device manager&amp;quot; ? &amp;quot;Device manager&amp;quot; needed only if you want to do DFU with bonding forwarded. If not you don&amp;#39;t need device manager.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Discovery service dosen't work always</title><link>https://devzone.nordicsemi.com/thread/78716?ContentTypeID=1</link><pubDate>Mon, 06 Mar 2017 16:17:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e9e16191-626e-4774-9be7-bc37465eacee</guid><dc:creator>ToTo</dc:creator><description>&lt;p&gt;Thanks for your help, All I did to avoid this problem is to added&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;				case BLE_GATTS_EVT_SYS_ATTR_MISSING:
					// No system attributes have been stored.
					sd_ble_gatts_sys_attr_set(m_conn_handle, NULL, 0, 0);
			 
			break;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;to the function :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;static void on_ble_evt(ble_evt_t * p_ble_evt)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and now it is ok.&lt;/p&gt;
&lt;p&gt;another question, if you can help, is the data manager mandatory for the DFU ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Discovery service dosen't work always</title><link>https://devzone.nordicsemi.com/thread/78720?ContentTypeID=1</link><pubDate>Mon, 06 Mar 2017 15:12:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eeed3240-6b4c-4d1a-a68a-5e973a49db0c</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Yes you have to  &amp;quot;handle the event BLE_GATTS_EVT_SYS_ATTR_MISSING and call that function under it&amp;quot;.
But this is only applied if you don&amp;#39;t store bond information and system attribute belong to that central. If you store bond information and want to re-init the system attribute (for example remember and automatically allow notification when the same central re-connect) you need to use the correct data instead of NULL. Other than that you can use NULL.
Please look for BLE_GATTS_EVT_SYS_ATTR_MISSING event in the ble_app_uart to see how we handled it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Discovery service dosen't work always</title><link>https://devzone.nordicsemi.com/thread/78714?ContentTypeID=1</link><pubDate>Mon, 06 Mar 2017 14:57:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0901d72f-8076-4b3f-b456-de7ae22c972c</guid><dc:creator>ToTo</dc:creator><description>&lt;p&gt;You are right, it is because of that. I find that that event is handled under the dm_manager event handler.
So can you please tell me how can I avoid that? I mean , I should use &lt;code&gt;sd_ble_gatts_sys_attr_set(m_conn_handle, NULL, 0, 0);&lt;/code&gt; in the main and it is ok ? or i have tohandle the event BLE_GATTS_EVT_SYS_ATTR_MISSING  and call that function under it  ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Discovery service dosen't work always</title><link>https://devzone.nordicsemi.com/thread/78713?ContentTypeID=1</link><pubDate>Mon, 06 Mar 2017 13:47:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e8570c95-adbf-42d6-8714-fa814d8c28db</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;If you don&amp;#39;t use devicemanager, have you handled BLE_GATTS_EVT_SYS_ATTR_MISSING event ? This is needed in the case that the CCCD is not initialized. Usually you can call             &lt;code&gt;err_code = sd_ble_gatts_sys_attr_set(m_conn_handle, NULL, 0, 0);&lt;/code&gt;
Please follow what we do in the ble_app_uart example.&lt;/p&gt;
&lt;p&gt;If you already handled that even could be that the device crashed, could you check if there if it still run after that ? If it didn&amp;#39;t crash, could you tell which disconnected reason it is ? (inside DISCONNECTED event check for the reason inside p_ble_evt)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Discovery service dosen't work always</title><link>https://devzone.nordicsemi.com/thread/78719?ContentTypeID=1</link><pubDate>Mon, 06 Mar 2017 13:20:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f7819b84-3c7e-4e99-85b9-8fc5e3a3ceb5</guid><dc:creator>ToTo</dc:creator><description>&lt;p&gt;Yah , i do have pstorage init in other function when i comment this one.
I edited my question, you can see the error in the image attached&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Discovery service dosen't work always</title><link>https://devzone.nordicsemi.com/thread/78718?ContentTypeID=1</link><pubDate>Mon, 06 Mar 2017 12:16:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d17c8ade-a500-41a9-b3d4-19b82b3581a6</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;What do you see when discovery service doesn&amp;#39;t work ? Which error ?
Note that if you use pstorage you need to call pstorage_init(). If you remove vMain_iInitDeviceManager_Exe then the pstorage_init() is not called.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>