<?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>About Bluetooth connection failure (gatt error) and automatic disconnection in the middle of the connection process</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/91020/about-bluetooth-connection-failure-gatt-error-and-automatic-disconnection-in-the-middle-of-the-connection-process</link><description>Hi, 
 At present, our products have started production, but customers have reported three Bluetooth problems, which need technical assistance from Nordic to solve them as soon as possible.Using SDK17.1 flash_s140_nrf52_7.3.0_softdevice. 
 1、gatt error</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 22 Aug 2022 09:14:18 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/91020/about-bluetooth-connection-failure-gatt-error-and-automatic-disconnection-in-the-middle-of-the-connection-process" /><item><title>RE: About Bluetooth connection failure (gatt error) and automatic disconnection in the middle of the connection process</title><link>https://devzone.nordicsemi.com/thread/382603?ContentTypeID=1</link><pubDate>Mon, 22 Aug 2022 09:14:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a5ce8dbb-9fd2-422c-9da0-45656b62e6af</guid><dc:creator>Mikey</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#define NRF_SDH_CLOCK_LF_SRC 2
#define NRF_SDH_CLOCK_LF_ACCURACY 1&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I&amp;#39;ll test this modification.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: About Bluetooth connection failure (gatt error) and automatic disconnection in the middle of the connection process</title><link>https://devzone.nordicsemi.com/thread/382599?ContentTypeID=1</link><pubDate>Mon, 22 Aug 2022 09:07:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:83765067-5509-4636-a2e0-5d13abe0c780</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;&lt;span&gt;Try to set&amp;nbsp;NRF_SDH_CLOCK_LF_ACCURACY to 1 (500ppm), and see if you see any changes in the behavior.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: About Bluetooth connection failure (gatt error) and automatic disconnection in the middle of the connection process</title><link>https://devzone.nordicsemi.com/thread/382592?ContentTypeID=1</link><pubDate>Mon, 22 Aug 2022 08:43:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:147a9e7a-67d9-4b86-9ff9-9a331f844292</guid><dc:creator>Mikey</dc:creator><description>&lt;p&gt;I test whether NRF_CLOCK_LF_SRC_SYNTH is valid for s22.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: About Bluetooth connection failure (gatt error) and automatic disconnection in the middle of the connection process</title><link>https://devzone.nordicsemi.com/thread/382590?ContentTypeID=1</link><pubDate>Mon, 22 Aug 2022 08:41:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6dfcd0da-28a9-450c-81cb-0f74a5e655b4</guid><dc:creator>Mikey</dc:creator><description>&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1661157684984v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: About Bluetooth connection failure (gatt error) and automatic disconnection in the middle of the connection process</title><link>https://devzone.nordicsemi.com/thread/382582?ContentTypeID=1</link><pubDate>Mon, 22 Aug 2022 08:03:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:635f1fcd-86fc-48ee-841f-ed0811c1352d</guid><dc:creator>Sigurd</dc:creator><description>[quote user="wfagly"]Another situation is that the Samsung s22 initiates a connection within 200ms, but the device does not respond[/quote]
&lt;p&gt;Do you have a external LF crystal on your board?&lt;br /&gt;In sdk_config.h, what are these currently configured to?&lt;/p&gt;
&lt;div&gt;&lt;a href="https://devzone.nordicsemi.com/support-private/support/293765"&gt;&lt;/a&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;&lt;pre class="ui-code" data-mode="text"&gt;NRF_SDH_CLOCK_LF_SRC
NRF_SDH_CLOCK_LF_RC_CTIV
NRF_SDH_CLOCK_LF_RC_TEMP_CTIV
NRF_SDH_CLOCK_LF_ACCURACY
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span&gt;Check&amp;nbsp;&lt;/span&gt;&lt;span&gt;both&amp;nbsp;&lt;/span&gt;&lt;span&gt;application project sdk_config.h and the bootloader sdk_config.h&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;As an test, could you try to set&amp;nbsp;NRF_SDH_CLOCK_LF_ACCURACY to 1 (i.e. 500 ppm) ?&lt;/p&gt;
&lt;p&gt;If it&amp;#39;s already set to 1 (500ppm), try set&amp;nbsp;NRF_SDH_CLOCK_LF_SRC to 2(NRF_CLOCK_LF_SRC_SYNTH) as well.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: About Bluetooth connection failure (gatt error) and automatic disconnection in the middle of the connection process</title><link>https://devzone.nordicsemi.com/thread/382298?ContentTypeID=1</link><pubDate>Thu, 18 Aug 2022 13:37:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0de339b1-915e-4ddc-a8ed-50900c974e79</guid><dc:creator>Mikey</dc:creator><description>&lt;p&gt;&lt;span&gt;1) Yes, we have technical support with nordic to capture packets and analyze this problem.There are two cases, one is that the Samsung s22 mobile phone sends a request, but it does not actually capture the connected data packets, causing nrf connect to generate a gatt error (mobile phone problem). Another situation is that the Samsung s22 initiates a connection within 200ms, but the device does not respond (this situation has not been reproduced in nordic&amp;#39;s laboratory, so it is not resolved).&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/s22-gatt-normal.pcapng"&gt;devzone.nordicsemi.com/.../s22-gatt-normal.pcapng&lt;/a&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/s22-gatt-error.pcapng"&gt;devzone.nordicsemi.com/.../s22-gatt-error.pcapng&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;This is the packet captured in normal and error cases. Can you help us analyze it?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;2)It has been working normally, and I don&amp;#39;t understand why the customer&amp;#39;s mobile phone does not broadcast. So no changes, add operations.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thank you for your reply.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: About Bluetooth connection failure (gatt error) and automatic disconnection in the middle of the connection process</title><link>https://devzone.nordicsemi.com/thread/382155?ContentTypeID=1</link><pubDate>Thu, 18 Aug 2022 07:46:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4ad08601-4456-43f5-82c1-f213685c27e1</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;1) Does it happen every time you try to connect? Could you take a sniffer trace of the behavior?&amp;nbsp;&lt;a href="https://www.nordicsemi.com/Products/Development-tools/nrf-sniffer-for-bluetooth-le"&gt;https://www.nordicsemi.com/Products/Development-tools/nrf-sniffer-for-bluetooth-le&lt;/a&gt;&lt;br /&gt;2) So it&amp;#39;s now working?&lt;/p&gt;
&lt;p&gt;3) OK, good that it&amp;#39;s working now.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: About Bluetooth connection failure (gatt error) and automatic disconnection in the middle of the connection process</title><link>https://devzone.nordicsemi.com/thread/382062?ContentTypeID=1</link><pubDate>Wed, 17 Aug 2022 13:35:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f579db12-86d8-45f8-875c-7bd490fa8e4b</guid><dc:creator>Mikey</dc:creator><description>&lt;p&gt;1)&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;This is something we sometimes see on lower-end phones, and is a phone-issue. What phone did you see this happening on?&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I found this on samsung s22, when I tested and found that s22 produced &amp;quot;gatt error&amp;quot; error, my product didn&amp;#39;t receive connection event request. This is a problem. When I went to the nrf connect interface again, I found that the broadcast interval at that time was grayed out. I don&amp;rsquo;t know if the signal was not good, but I tested it at the same location (regardless of whether there is an error in the connection).&lt;/p&gt;
&lt;p&gt;2）&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;You need to start the advertising again in your code when you get the event BLE_GAP_EVT_DISCONNECTED &lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;In ble_advvertising.c, I added this to start broadcasting, and then I didn&amp;#39;t add it in my ble_evt_handler.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;
/**@brief Function for handling the Disconnected event.
 *
 * @param[in] p_advertising Advertising module instance.
 * @param[in] p_ble_evt Event received from the BLE stack.
 */
static void advertising_on_disconnected(ble_advertising_t * const p_advertising, ble_evt_t const * p_ble_evt)
{
    uint32_t ret;

    p_advertising-&amp;gt;whitelist_temporarily_disabled = false;

    if (p_ble_evt-&amp;gt;evt.gap_evt.conn_handle == p_advertising-&amp;gt;current_slave_link_conn_handle &amp;amp;&amp;amp;
        p_advertising-&amp;gt;adv_modes_config.ble_adv_on_disconnect_disabled == false)
    {
       ret = ble_advertising_start(p_advertising, BLE_ADV_MODE_DIRECTED_HIGH_DUTY);
       if ((ret != NRF_SUCCESS) &amp;amp;&amp;amp; (p_advertising-&amp;gt;error_handler != NULL))
       {
           p_advertising-&amp;gt;error_handler(ret);
       }
    }
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;3)&lt;/p&gt;
&lt;p&gt;PM_HANDLER_SEC_DELAY_MS currently modifies it to 1000ms, don&amp;#39;t know if it works. We test ok for now.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: About Bluetooth connection failure (gatt error) and automatic disconnection in the middle of the connection process</title><link>https://devzone.nordicsemi.com/thread/382020?ContentTypeID=1</link><pubDate>Wed, 17 Aug 2022 12:03:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e0fcc284-28c6-4126-8423-e48f4e0840b8</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;1)&lt;/p&gt;
[quote userid="107719" url="~/f/nordic-q-a/91020/about-bluetooth-connection-failure-gatt-error-and-automatic-disconnection-in-the-middle-of-the-connection-process"]There will be an error 133 when the mobile phone applies for a connection, so is there any other solution for this?[/quote]
&lt;p&gt;This is something we sometimes see on lower-end phones, and is a phone-issue. What phone did you see this happening on?&lt;/p&gt;
&lt;p&gt;2)&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
[quote userid="107719" url="~/f/nordic-q-a/91020/about-bluetooth-connection-failure-gatt-error-and-automatic-disconnection-in-the-middle-of-the-connection-process"]When the Android phone is disconnected autonomously, nrf52833 does not open adv.[/quote]
&lt;p&gt;You need to start the advertising again in your code when you get the event&amp;nbsp;&lt;em&gt;BLE_GAP_EVT_DISCONNECTED&lt;/em&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;3)&lt;/span&gt;&lt;/p&gt;
[quote userid="107719" url="~/f/nordic-q-a/91020/about-bluetooth-connection-failure-gatt-error-and-automatic-disconnection-in-the-middle-of-the-connection-process/381939"]Today, together with nordic&amp;#39;s technology, we solved the third problem. [/quote]
&lt;p&gt;&lt;span&gt;Great! Not sure if the name of that config is correct, in SDK 17 at least I believe&amp;nbsp;it&amp;#39;s called&amp;nbsp;PM_HANDLER_SEC_DELAY_MS Try setting it at 4000 , ref:&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/48097/pm_handler_sec_delay_ms"&gt;PM_HANDLER_SEC_DELAY_MS&lt;/a&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: About Bluetooth connection failure (gatt error) and automatic disconnection in the middle of the connection process</title><link>https://devzone.nordicsemi.com/thread/381939?ContentTypeID=1</link><pubDate>Wed, 17 Aug 2022 09:05:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6b9399fa-1c97-46b7-8c98-071a63381787</guid><dc:creator>Mikey</dc:creator><description>&lt;p&gt;Today, together with nordic&amp;#39;s technology, we solved the third problem. The time we gave for SECURITY_REQUEST_DELAY was only 400ms, which resulted in the incomplete security response of ios devices. For a normal connection, the &amp;quot;p_evt-&amp;gt;evt_id&amp;quot; entering the pm_evt_handler() function is &amp;quot;1-&amp;gt;0-&amp;gt;9-&amp;gt;15-&amp;gt;2-&amp;gt;3-&amp;gt;9-&amp;gt;6, 2-&amp;gt;3-&amp;gt;9&amp;quot;. In the case of error disconnection, &amp;quot;p_evt-&amp;gt;evt_id&amp;quot; is &amp;quot;1-&amp;gt;0-&amp;gt;9-&amp;gt;15-&amp;gt;2-&amp;gt;3-&amp;gt;9-&amp;gt;6&amp;quot;. So, how much should I adjust this time to? 1000ms and 4000ms, it has the sequence of events when it connects correctly.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#define SECURITY_REQUEST_DELAY          APP_TIMER_TICKS(400)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>