<?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>nRF52840 not advertising after disconnect</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/61789/nrf52840-not-advertising-after-disconnect</link><description>I&amp;#39;m developing a product using an nRF52840 and an accelerometer. 
 I have created a Service with characteristic that sends accelerometer data over ble to the phone through notification. I have a problem that I do not know how to solve with disconnecting</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 28 May 2020 09:13:22 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/61789/nrf52840-not-advertising-after-disconnect" /><item><title>RE: nRF52840 not advertising after disconnect</title><link>https://devzone.nordicsemi.com/thread/252115?ContentTypeID=1</link><pubDate>Thu, 28 May 2020 09:13:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0eccaba2-d6d1-4193-83cd-a822f5bb3d5c</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;You are executing an sd_ble_gatts_*() procedure at some time, and there is no response from the peer, causing an:&lt;br /&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s140.api.v7.0.1/group___b_l_e___g_a_t_t_s___t_i_m_e_o_u_t___m_s_c.html"&gt;https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s140.api.v7.0.1/group___b_l_e___g_a_t_t_s___t_i_m_e_o_u_t___m_s_c.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If you are able to find which sd_ble_gatts_*() that is called and not responded that would help. Maybe an on-air sniffer log can be done.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 not advertising after disconnect</title><link>https://devzone.nordicsemi.com/thread/251751?ContentTypeID=1</link><pubDate>Tue, 26 May 2020 14:45:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:82457eea-eb06-4fe3-abfa-bfd0bee64fb0</guid><dc:creator>akaun</dc:creator><description>&lt;p&gt;It looks like GATT_Server_Timeout why the error happens.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;case BLE_GATTS_EVT_TIMEOUT:
            // Disconnect on GATT Server timeout event.
            NRF_LOG_DEBUG(&amp;quot;GATT Server Timeout.&amp;quot;);
            err_code = sd_ble_gap_disconnect(p_ble_evt-&amp;gt;evt.gatts_evt.conn_handle,
                                             BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
            APP_ERROR_CHECK(err_code);
            break;&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 not advertising after disconnect</title><link>https://devzone.nordicsemi.com/thread/251747?ContentTypeID=1</link><pubDate>Tue, 26 May 2020 14:17:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:50b5d861-39d6-421f-becd-e35b705ea654</guid><dc:creator>akaun</dc:creator><description>&lt;p&gt;Ok so I added app_error_check to timers, seems to be ok there. My ADV_EVT_IDLE does tell the device to go to sleep, but adding start_advertise did&amp;#39;t do anything. If I try to add start_advertising inside disconnect I get error, see picture attached.&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/Screenshot_5F00_20200526_5F00_081503.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context)
{
    ret_code_t err_code = NRF_SUCCESS;

    switch (p_ble_evt-&amp;gt;header.evt_id)
    {
        case BLE_GAP_EVT_DISCONNECTED:
            NRF_LOG_INFO(&amp;quot;Disconnected.&amp;quot;);
            m_conn_handle = BLE_CONN_HANDLE_INVALID;

            ret_code_t err_code = ble_advertising_start(&amp;amp;m_advertising, BLE_ADV_MODE_FAST);
            APP_ERROR_CHECK(err_code);

            //Work around for device not advertising
            //NVIC_SystemReset();
            //*******^

            // LED indication will be changed when advertising starts.
            break;&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 not advertising after disconnect</title><link>https://devzone.nordicsemi.com/thread/251706?ContentTypeID=1</link><pubDate>Tue, 26 May 2020 11:54:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9cee4d55-d60b-4b67-8e77-017560f280ad</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;You should add error check of&amp;nbsp;app_timer_start() and&amp;nbsp;app_timer_stop(), to check if there is any error.&lt;/p&gt;
&lt;p&gt;Also you can typically on&amp;nbsp;BLE_GAP_EVT_DISCONNECTED event add that you want to start advertisement again.&lt;/p&gt;
&lt;p&gt;You may also look into what your application is setup to do on&amp;nbsp;BLE_ADV_EVT_IDLE event if you are using the advertisement module. For instance do you want to go to sleep or start advertisement again?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>