<?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 random disconnection</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/87850/nrf52840-random-disconnection</link><description>Good morning, 
 We have a new equipment based on the nRF52840 and s140. 
 Just now, a new problem has appeared and it is very strange, as it seems to be a ‘random’ error: 
 
 We have already assembled tens of equipment, and most of them are perfectly</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 07 Jun 2022 10:17:22 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/87850/nrf52840-random-disconnection" /><item><title>RE: nRF52840 random disconnection</title><link>https://devzone.nordicsemi.com/thread/371099?ContentTypeID=1</link><pubDate>Tue, 07 Jun 2022 10:17:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d212bf79-6dce-40a6-96f8-af9ddf03e846</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Dani,&amp;nbsp;&lt;br /&gt;It&amp;#39;s good to hear. The sniffer trace really helped here :)&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 random disconnection</title><link>https://devzone.nordicsemi.com/thread/371053?ContentTypeID=1</link><pubDate>Tue, 07 Jun 2022 07:54:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f223ffed-6cc4-44fb-a61c-91dcb05e4bcd</guid><dc:creator>Dani</dc:creator><description>&lt;p&gt;Hi again,&lt;/p&gt;
&lt;p&gt;Now, with PM_HANDLER_SEC_DELAY_MS set to 1000 all devices are working fine: even my Mi8 and the Galaxy Tab A.&lt;/p&gt;
&lt;p&gt;So, it seems we have found the key!!!&lt;/p&gt;
&lt;p&gt;Dani&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 random disconnection</title><link>https://devzone.nordicsemi.com/thread/371042?ContentTypeID=1</link><pubDate>Tue, 07 Jun 2022 07:24:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8d6344a5-1f74-4cfe-bcf9-3bd62e17cd6e</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi&lt;span&gt;&amp;nbsp;&lt;/span&gt;Daniel,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Having a delay before the slave request security is a good thing to do . So setting&amp;nbsp;&lt;span&gt;PM_HANDLER_SEC_DELAY_MS&amp;nbsp; to 1000 definitely something you should keep.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;sd_ble_gatts_service_changed() is called inside&amp;nbsp;gscm_local_database_has_changed(). That funciton, in turn, is called inside&amp;nbsp;ble_dfu_buttonless_bootloader_start_prepare(). So you need to check if that function is called or not. Usually it&amp;#39;s only used when the central trying to put the device to DFU mode. But this might be not the reason of the disconnection. I would suggest to try capture more sniffer traces if you still see the issue after changing the&amp;nbsp;PM_HANDLER_SEC_DELAY_MS&amp;nbsp;&amp;nbsp;to 1000ms.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;BLE_GAP_EVT_DATA_LENGTH_UPDATE_REQUEST : shouldn&amp;#39;t be the issue, at least from what I can see in the trace.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;SLAVE_LATENCY: Shouldn&amp;#39;t cause any issue, at least from what I can see in the trace.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Could you confirm now that after the&amp;nbsp;PM_HANDLER_SEC_DELAY_MS&amp;nbsp;&amp;nbsp; change everything works as it should ? If not please try to capture a new sniffer trace.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 random disconnection</title><link>https://devzone.nordicsemi.com/thread/371026?ContentTypeID=1</link><pubDate>Tue, 07 Jun 2022 06:38:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dac1a022-1db1-43d6-991d-7e0be5005577</guid><dc:creator>Dani</dc:creator><description>&lt;p&gt;Good morning Hung,&lt;/p&gt;
&lt;p&gt;What&amp;#39;s your opinion about last findings?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Dani&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 random disconnection</title><link>https://devzone.nordicsemi.com/thread/370914?ContentTypeID=1</link><pubDate>Fri, 03 Jun 2022 14:16:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a4d75d72-7ff1-43b6-a236-2173aab24b2d</guid><dc:creator>Dani</dc:creator><description>&lt;p&gt;Hi Hung,&lt;/p&gt;
&lt;p&gt;Now, by having set&amp;nbsp;&lt;span&gt;PM_HANDLER_SEC_DELAY_MS to 1000, even the TAB A is working!!!!!!&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Please, let me know information I was asking in my previous answer.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;And what about SLAVE_LATENCY? Do you recommend to set it back to 0?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Dani.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 random disconnection</title><link>https://devzone.nordicsemi.com/thread/370897?ContentTypeID=1</link><pubDate>Fri, 03 Jun 2022 13:17:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:880a8525-da5e-4288-a6e1-edb26993b7b8</guid><dc:creator>Dani</dc:creator><description>&lt;p&gt;Hi Hung,&lt;/p&gt;
&lt;p&gt;I really appreciate your support: it is very important for us...&lt;/p&gt;
&lt;p&gt;In what regards your questions:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;1.- pm_conn_secure() is not called.&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; PM_HANDLER_SEC_DELAY_MS is set to o --&amp;gt; I&amp;#39;ll set it to 1000&lt;/p&gt;
&lt;p&gt;2.- I never use &amp;#39;sd_ble_gatts_service_changed&amp;#39;. Using nRF tool, I have seen that the Generic Attribute with UUID 0x1801 is set as INDICATE. How can I change this? All my other services are sending notifications. Please, find a screenshot showing the Generic Attribute and my first service (all of them have same setup).&lt;/p&gt;
&lt;p&gt;Moreover, I&amp;#39;m using the DFU service defined as shown in the second screenshot. As far as I know, the&amp;nbsp;NRF_SDH_BLE_SERVICE_CHANGED has to be set to 1 for the DFU to work, right?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;And what about&amp;nbsp;&lt;span&gt;BLE_GAP_EVT_DATA_LENGTH_UPDATE_REQUEST? Which is the suitable implementation?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Dani&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/2210.Screen_5F00_1.jpg" /&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/7418.Screen_5F00_2.jpg" /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 random disconnection</title><link>https://devzone.nordicsemi.com/thread/370878?ContentTypeID=1</link><pubDate>Fri, 03 Jun 2022 12:29:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c75ddcb5-e62d-465f-98fd-4982d1a4c3cb</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Daniel,&amp;nbsp;&lt;br /&gt;This might be the missing sniffer trace that we have been looking for.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;There are a few&amp;nbsp;potential issue that I can find here:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;1. I can see a security request was sent right after the connection has been established. Did you call&amp;nbsp;pm_conn_secure() inside&amp;nbsp;BLE_GAP_EVT_CONNECTED event ?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1654259061446v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;If you did please remove it. Also please check if you have&amp;nbsp;PM_HANDLER_SEC_DELAY_MS set to something in sdk_config.h ? Please try set it to 1000 , by default it&amp;#39;s 400ms. It&amp;#39;s for interoperability as mentioned in the description.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;2. I can see service changed indication that&amp;#39;s sent by the slave:&lt;br /&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1654259079818v2.png" alt=" " /&gt;&lt;br /&gt;Did you change the attribute table ? And did you have something in your code to send the service changed indication ?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;3. The central send a confirmation 30 seconds into the connection:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1654259188220v3.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I&amp;#39;m not so sure what the confirmation for, for which indication, but it&amp;#39;s most likely for the service changed indication. But it came too late and the softdevice disconnected due to&amp;nbsp;&lt;span&gt;BLE_GATTS_EVT_TIMEOUT . The slave&amp;nbsp;terminate the connection right after that.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Please try to check the points I listed here and also try to capture another sniffer trace if it has the same pattern we may be able to pin point the problem.&amp;nbsp;&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: nRF52840 random disconnection</title><link>https://devzone.nordicsemi.com/thread/370812?ContentTypeID=1</link><pubDate>Fri, 03 Jun 2022 07:59:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:64c802ef-81eb-4809-81ce-c006bc9f5cf7</guid><dc:creator>Dani</dc:creator><description>&lt;p&gt;HI again,&lt;/p&gt;
&lt;p&gt;I have reproduced again the disconnection with the Xiaomi Mi8. I have the code in the same way it was last specified: with SLAVE_LATENCY set to 15. But I have set (for sniffer purposes) SEC_PARAM_LESC=0.&lt;/p&gt;
&lt;p&gt;I have proceeded in the same way: equipment desinchronized from my central (Xiaomi Mi8), and then (with Wireshark ready) I have bonded peripheral to my Xiaomi, and I have manually disconnected it several times unless last time: in this last time, it has been disconnected alone after about 30&amp;quot;.&lt;/p&gt;
&lt;p&gt;Please, find attached this trace. Please, let me know any finding.&lt;/p&gt;
&lt;p&gt;Furthermore, in what regards&amp;nbsp;BLE_GAP_EVT_DATA_LENGTH_UPDATE_REQUEST event, which is the right implementation. Could it affect in this behavior?&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/3_5F00_06_5F00_22_5F00_Android_5F00_Connection_5F00_Bonding_5F00_Connection_5F00_Mi8.pcapng"&gt;devzone.nordicsemi.com/.../3_5F00_06_5F00_22_5F00_Android_5F00_Connection_5F00_Bonding_5F00_Connection_5F00_Mi8.pcapng&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 random disconnection</title><link>https://devzone.nordicsemi.com/thread/370810?ContentTypeID=1</link><pubDate>Fri, 03 Jun 2022 07:50:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1c3cb6e2-6d4f-45b9-95f9-c0a6f7ca4dbb</guid><dc:creator>Dani</dc:creator><description>&lt;p&gt;Hi Hung,&lt;/p&gt;
&lt;p&gt;An other question: up to now, I&amp;#39;m working with&amp;nbsp;SEC_PARAM_LESC=1 (except when connecting the sniffer). In production mode, what do you recommend?&amp;nbsp;SEC_PARAM_LESC to 0 or to 1? Which is the main difference?&lt;/p&gt;
&lt;p&gt;Dani&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 random disconnection</title><link>https://devzone.nordicsemi.com/thread/370735?ContentTypeID=1</link><pubDate>Thu, 02 Jun 2022 14:12:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6933e881-1766-4205-971f-ff9871fef308</guid><dc:creator>Dani</dc:creator><description>&lt;p&gt;Hi Hung,&lt;/p&gt;
&lt;p&gt;I had already tested this: no way, I have tested it again by switching off bluetooth and even reseting the TabA.&lt;/p&gt;
&lt;p&gt;I would assume this is related with this tablet model.&lt;/p&gt;
&lt;p&gt;The most important thing is the problem I had with Xiaomi Mi8 and other models, that now seems to be solved --&amp;gt; definetely it seems related with slave latency!!! Does it has sens?? Now, I will need to check the same with other models (Huawey P20 Pro, Oppo A74,...) and be sure this problem is not happening again.&lt;/p&gt;
&lt;p&gt;Dani.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 random disconnection</title><link>https://devzone.nordicsemi.com/thread/370726?ContentTypeID=1</link><pubDate>Thu, 02 Jun 2022 13:43:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1fdb8a66-c4ae-41bd-9115-5b6fd29df729</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Daniel,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;No&amp;nbsp;&lt;span&gt;pm_conn_secure() is not needed. It&amp;#39;s used when the peripheral want to trigger bonding process. Usually the peripheral should let the central start the bonding process.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;If you test by turn off and on bluetooth on the TabA, would you be able to use the TabA to connect ?&amp;nbsp;&lt;br /&gt;&lt;br /&gt;I think it&amp;#39;s an issue with the TabA and not has anything to do with our chip/stack.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 random disconnection</title><link>https://devzone.nordicsemi.com/thread/370625?ContentTypeID=1</link><pubDate>Thu, 02 Jun 2022 09:07:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:95bc9f02-8f96-4251-bac2-0ac8f48e7702</guid><dc:creator>Dani</dc:creator><description>&lt;p&gt;Hi Hung,&lt;/p&gt;
&lt;p&gt;Already implemented and tested without success.&lt;/p&gt;
&lt;p&gt;I have proceeded in the same way as before&amp;nbsp;&lt;span&gt;with the TabA (Galaxy Tab A 2016, SM-T580):&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Desinchrnozed Peripheral from TabA&lt;/li&gt;
&lt;li&gt;Bonding and Connection with Peripheral: it connects perfectly&lt;/li&gt;
&lt;li&gt;Manual Disconnection&lt;/li&gt;
&lt;li&gt;Connection again with the already bonded peripheral: impossible to connect again&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Please, find attached the trace.&lt;/p&gt;
&lt;p&gt;Furthermore, in the code you have just sent to me, you call &amp;#39;pm_conn_secure&amp;#39;. I do not use this call in my code. Is it required? (I think I already sent my implementation to you)&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Dani.&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/Android_5F00_Connection_5F00_Bonding_5F00_Connection_5F00_Galaxy_5F00_TabA_5F00_2_5F00_06_5F00_22.pcapng"&gt;devzone.nordicsemi.com/.../Android_5F00_Connection_5F00_Bonding_5F00_Connection_5F00_Galaxy_5F00_TabA_5F00_2_5F00_06_5F00_22.pcapng&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 random disconnection</title><link>https://devzone.nordicsemi.com/thread/370604?ContentTypeID=1</link><pubDate>Thu, 02 Jun 2022 07:58:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:10cd283d-785f-44dc-87de-bfd2f661e71f</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Dani,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It&amp;#39;s the same issue as earlier, LL_PING_RSP sent without a LL_PING_REQ before that.&amp;nbsp;&lt;br /&gt;I have checked internally and found other reports about this issue dated back to 2019. It usually happens with Qualcomm Bluetooth/Wifi chip . I don&amp;#39;t know which exact version of your Tab A is but you can check.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/1142x332/__key/communityserver-discussions-components-files/4/pastedimage1654156619110v2.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;We don&amp;#39;t really have a workaround for that as it&amp;#39;s the issue of the Central device. However, there were a workaround for another issue related to this I think it worth to try. Could you try to add the following code to your ble_evt_handler in main.c ?&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1654156597661v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;            opt.gap_opt.auth_payload_timeout.conn_handle= m_conn_handle;
            opt.gap_opt.auth_payload_timeout.auth_payload_timeout= 3000;
            err_code = sd_ble_opt_set(BLE_GAP_OPT_AUTH_PAYLOAD_TIMEOUT, &amp;amp;opt);
            APP_ERROR_CHECK(err_code);&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 random disconnection</title><link>https://devzone.nordicsemi.com/thread/370461?ContentTypeID=1</link><pubDate>Wed, 01 Jun 2022 13:16:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:75d234d7-2bf8-4c56-97ec-cafe4e8da8f7</guid><dc:creator>Dani</dc:creator><description>&lt;p&gt;Hi Hung,&lt;/p&gt;
&lt;p&gt;I have taken the Mi8 (with LESC=0) and TabA (with LESC=0) and I have proceeded in the same way.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;First, with the Mi8:
&lt;ul&gt;
&lt;li&gt;Desinchrnozed Peripheral from Mi8&lt;/li&gt;
&lt;li&gt;Bonding and Connection with Peripheral&lt;/li&gt;
&lt;li&gt;Manual Disconnection&lt;/li&gt;
&lt;li&gt;Connection again with the already bonded peripheral&lt;/li&gt;
&lt;li&gt;Manual Disconnection&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; In this case, everything is running OK (I have kept Slave_Latency to 15)&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Second, with the TabA:
&lt;ul&gt;
&lt;li&gt;Desinchrnozed Peripheral from TabA&lt;/li&gt;
&lt;li&gt;Bonding and Connection with Peripheral: it connects perfectly&lt;/li&gt;
&lt;li&gt;Manual Disconnection&lt;/li&gt;
&lt;li&gt;Connection again with the already bonded peripheral: impossible to connect again&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; In this case,&amp;nbsp;connection is only running OK the first time, when bonding. The second time, it is impossible to connect.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Please, find attached sniffer traces in both cases.&lt;/p&gt;
&lt;p&gt;Dani&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/Android_5F00_Connection_5F00_Bonding_5F00_Connection_5F00_Mi8.pcapng"&gt;devzone.nordicsemi.com/.../Android_5F00_Connection_5F00_Bonding_5F00_Connection_5F00_Mi8.pcapng&lt;/a&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/Android_5F00_Connection_5F00_Bonding_5F00_Connection_5F00_Galaxy_5F00_TabA.pcapng"&gt;devzone.nordicsemi.com/.../Android_5F00_Connection_5F00_Bonding_5F00_Connection_5F00_Galaxy_5F00_TabA.pcapng&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 random disconnection</title><link>https://devzone.nordicsemi.com/thread/370406?ContentTypeID=1</link><pubDate>Wed, 01 Jun 2022 10:55:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d3df01be-94e9-41c0-b22c-dff488a28052</guid><dc:creator>Dani</dc:creator><description>&lt;p&gt;Hi Hung,&lt;/p&gt;
&lt;p&gt;Ok, I will save this trace.&lt;/p&gt;
&lt;p&gt;Nevertheless, now, with these changes I have made, if I connect first to Mi8, then to tablet, and then back again to Mi8, Mi8 is always working fine, without any disconnection.&lt;/p&gt;
&lt;p&gt;Dani.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 random disconnection</title><link>https://devzone.nordicsemi.com/thread/370376?ContentTypeID=1</link><pubDate>Wed, 01 Jun 2022 09:15:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:757ac094-cc61-4b73-a8ef-1ae869c7edb5</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Dani,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Your change is mainly about the Slave latency and it usually wouldn&amp;#39;t affect the connection except for slower communication.&amp;nbsp;&lt;br /&gt;Could you try to only change one setting at a time. In your case you change both the Slave Latency and the Conn supervision Timeout.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;As explained in the last response the &lt;span&gt;GATT CONN TIMEOUT issue happened because the tablet was violating the spec. Do you experience the same issue when you test the tablet with other example ?&amp;nbsp;&lt;br /&gt;Btw, the log where you captured&amp;nbsp;GATT_CONN_TIMEOUT was a very good attempt of capturing sniffer trace when the connection is encrypted and re-encrypted. There were no &amp;quot;decrypted incorrectly&amp;quot; packet.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;If you can do the same with the&amp;nbsp;Xiaomi Mi 8 we maybe able to figure out what&amp;#39;s the problem. (If you are going to do it with multiple central, try to stop the sniffer before bonding with the second central, then start again when you return to test the first central)&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 random disconnection</title><link>https://devzone.nordicsemi.com/thread/370280?ContentTypeID=1</link><pubDate>Tue, 31 May 2022 15:21:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:82598b19-129b-497c-b534-fa09618bba52</guid><dc:creator>Dani</dc:creator><description>&lt;p&gt;Hi Hung,&lt;/p&gt;
&lt;p&gt;I have a DK but I&amp;#39;m using it as a sniffer: I have ordered a new one to make these tests.&lt;/p&gt;
&lt;p&gt;Meanwhile, I&amp;#39;m doing some more testing and I have just found something important with my Xiaomi Mi 8.&lt;/p&gt;
&lt;p&gt;Up to now, I was working with the following parameters:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#define MIN_CONN_INTERVAL                   MSEC_TO_UNITS(7.5, UNIT_1_25_MS)
#define MAX_CONN_INTERVAL                   MSEC_TO_UNITS(100, UNIT_1_25_MS)
#define SLAVE_LATENCY                       0                              
#define CONN_SUP_TIMEOUT                    MSEC_TO_UNITS(4000, UNIT_10_MS) &lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Now, I have set these parameters:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#define MIN_CONN_INTERVAL                   MSEC_TO_UNITS(7.5, UNIT_1_25_MS)
#define MAX_CONN_INTERVAL                   MSEC_TO_UNITS(100, UNIT_1_25_MS)
#define SLAVE_LATENCY                       15                              
#define CONN_SUP_TIMEOUT                    MSEC_TO_UNITS(5000, UNIT_10_MS) &lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Considering this last setting, my Xiaomi Mi8 does not disconnect after around 30&amp;quot;: I have tested the different scenarios detailed above, and now it seems to be working perfectly. (Even, I have tested the scenario in which I was connecting my device with the Galaxy Tab and then with the Mi8, and now the Mi8 is also working). How could you explain this??&lt;/p&gt;
&lt;p&gt;In what regards the Galaxy Tab, it continues doing the same: perfect connection the first time (when bonding) but impossible to connect next times (already bonded): GATT CONN TIMEOUT always received.&lt;/p&gt;
&lt;p&gt;Could you explain such improvement with the Mi8? I&amp;#39;m now lost with this behavior...&lt;/p&gt;
&lt;p&gt;Do you think any other setting using these parameters would make the Galaxy Tab A to work?&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Dani&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 random disconnection</title><link>https://devzone.nordicsemi.com/thread/370179?ContentTypeID=1</link><pubDate>Tue, 31 May 2022 11:17:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:786e1f49-6f0b-4091-a9b2-02bd34d13736</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Daniel,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you run an SDK example on your device and doesn&amp;#39;t have any issue with bonding (and reconnect) with multiple centrals then it must have something to do with your implementation.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you can flash your application on a DK and can reproduce the issue on the DK, then you can send us that application and we can test here.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 random disconnection</title><link>https://devzone.nordicsemi.com/thread/370168?ContentTypeID=1</link><pubDate>Tue, 31 May 2022 10:49:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1971e33e-6c30-4bea-86ac-02d8d1753022</guid><dc:creator>Dani</dc:creator><description>&lt;p&gt;More info....&lt;/p&gt;
&lt;p&gt;It seems that connection with a central depends on the connection of the prveious connected central.&lt;/p&gt;
&lt;p&gt;This is the test I have done:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Considerations:
&lt;ul&gt;
&lt;li&gt;Central #1 bonded: Xiaomi Mi8&lt;/li&gt;
&lt;li&gt;Central #2 bonded: Galaxy Tab A&lt;/li&gt;
&lt;li&gt;Central #3 bonded: Galaxy A13&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Test procedure sequence:
&lt;ul&gt;
&lt;li&gt;Central #1 connects correctly to equipment and we force then disconnection&lt;/li&gt;
&lt;li&gt;Central #2: trying to connect but it is not possible (only possible the first time when bonding)&lt;/li&gt;
&lt;li&gt;Central #1: trying to connect --&amp;gt; impossible to connect, or disconnection after about 30&amp;quot;&lt;/li&gt;
&lt;li&gt;Central #3: connects perfectly and we force then disconnection&lt;/li&gt;
&lt;li&gt;Central #1: trying again to connect --&amp;gt; It connects perfectly&lt;/li&gt;
&lt;li&gt;Central #2: trying to connect but it is not possible (only possible the first time when bonding)&lt;/li&gt;
&lt;li&gt;Central #3: connects perfectly and we force then disconnection&lt;/li&gt;
&lt;li&gt;Central #1: trying again to connect --&amp;gt; It connects perfectly but disconnects after 30&amp;quot;&lt;/li&gt;
&lt;li&gt;Central #3: Always correct&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Very strange. For me, it seems clear is something related with bonding information&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 random disconnection</title><link>https://devzone.nordicsemi.com/thread/370155?ContentTypeID=1</link><pubDate>Tue, 31 May 2022 09:20:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b54d25de-f20f-4ebe-b293-191b44893b2e</guid><dc:creator>Dani</dc:creator><description>&lt;p&gt;Hi Hung,&lt;/p&gt;
&lt;p&gt;I have logged bond info, and in my current device now is set to 3.&lt;/p&gt;
&lt;p&gt;As you suggested, it seems as bond info was somehow corrupted (it should not): once I connect to a second central, when coming back to first central, it disconnects after around 30&amp;quot;....&lt;/p&gt;
&lt;p&gt;How can I avoid this? Any workaround?&lt;/p&gt;
&lt;p&gt;Dani&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 random disconnection</title><link>https://devzone.nordicsemi.com/thread/370122?ContentTypeID=1</link><pubDate>Tue, 31 May 2022 07:48:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4501d496-1202-4d1f-ab14-217e79125961</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Dani,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Yes if you delete bond all the time then new pairing process will be performed. However, if the phone still have the bond information (no&amp;nbsp;delete on the phone) then the phone will try to re-encrypt with previously stored key. In that case the peripheral will reject the re-encrypt request and disconnect.&lt;br /&gt;So when you delete bond, it should be deleted on both sides.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Have you managed to add logging to your application ? With that you can check if the delete bond is entered and if the check for 8 bonds is hit or not.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You can consider not calling that function and test.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I also suspect that there could be a chance that the new bond actually overwriting the previous bond. But this should be handled properly with the peer manager library unless there is some modification of the module.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 random disconnection</title><link>https://devzone.nordicsemi.com/thread/370114?ContentTypeID=1</link><pubDate>Tue, 31 May 2022 07:34:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4e935b43-f434-4c01-ab7e-16e9f44bd954</guid><dc:creator>Dani</dc:creator><description>&lt;p&gt;Good morning Hung,&lt;/p&gt;
&lt;p&gt;If I delete bonds all the time (before a new central connect), then will I be requested to enter pin code all the times if a different central has connected?&lt;/p&gt;
&lt;p&gt;Now, I&amp;#39;m using this &amp;#39;delete_bonds&amp;#39; function:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static void delete_bonds(void)
{
    ret_code_t err_code;   
	
		if(pm_peer_count()&amp;gt;8)
		{
			pm_peer_id_t peer_id_to_delete;
			err_code = pm_peer_ranks_get(NULL,NULL,&amp;amp;peer_id_to_delete,NULL); //Older bond
			APP_ERROR_CHECK(err_code);
			err_code = pm_peer_delete(peer_id_to_delete);
			APP_ERROR_CHECK(err_code);
		}
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;And it is called in:&lt;/p&gt;
&lt;p&gt;- At the beginning of main (After all initialization)&lt;/p&gt;
&lt;p&gt;- At the &amp;#39;BLE_GAP_EVT_DISCONNECTED&amp;#39; event&lt;/p&gt;
&lt;p&gt;If number of bond is higher than 8, then bond information is deleted.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;With examples, I have no problems.&lt;/p&gt;
&lt;p&gt;Dani.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 random disconnection</title><link>https://devzone.nordicsemi.com/thread/370111?ContentTypeID=1</link><pubDate>Tue, 31 May 2022 07:26:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d0d96991-db17-4f8d-9c59-561cea38bce4</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Daniel,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Regarding the issue with Galaxy Tab A. I think it&amp;#39;s because of a violation from the master (Tab A) you can see here:&amp;nbsp;&lt;br /&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1653981810796v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;The PING response was sent without a Ping request from the slave. The sniffer also notice this violation. By spec our stack will immediately disconnect result in the timeout you found.&amp;nbsp;&lt;br /&gt;I don&amp;#39;t know why the TAB A acted that way but it&amp;#39;s a wrong implementation. I would assume this does happen on all devices ?&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Regarding the issue with Xiaomi , I think you may want to double check how the bond information is stored and if there is any chance that the delete_bonds function actually delete the bond of the previous central after a new central connected to it.&amp;nbsp;&lt;br /&gt;Before your test please do a chip erase just to be sure all the bond information has been deleted.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;I assume that when you test using our example (gls for example) you don&amp;#39;t have the same issue ?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 random disconnection</title><link>https://devzone.nordicsemi.com/thread/370038?ContentTypeID=1</link><pubDate>Mon, 30 May 2022 15:26:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:807eb452-d1f6-4936-ba50-7f3d1d89fb3c</guid><dc:creator>Dani</dc:creator><description>&lt;p&gt;Hi again,&lt;/p&gt;
&lt;p&gt;As I told you, the problem with Xiaomi Mi8 seems to appear when I connect to it (bonding already done) after having been connected to an other device: now, I have bonded to Mi8 and I have connected and disconnected (manually) so many times, and it has been impossible to get disconnected after 30&amp;quot;.&lt;/p&gt;
&lt;p&gt;But then, I have done the same test with the Galaxy Tab A tablet: first time (when bonding) there are no problems with connection. But when trying to connect a second time, GATT_CONN_TIMEOUT is received in the nRF tool log --&amp;gt; Please, find attached this trace.&lt;/p&gt;
&lt;p&gt;Regards.&lt;/p&gt;
&lt;p&gt;Dani&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/Android_5F00_pairing_5F00_30_5F00_05_5F00_22-2.pcapng"&gt;devzone.nordicsemi.com/.../Android_5F00_pairing_5F00_30_5F00_05_5F00_22-2.pcapng&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 random disconnection</title><link>https://devzone.nordicsemi.com/thread/370035?ContentTypeID=1</link><pubDate>Mon, 30 May 2022 14:55:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0957735e-5c78-4941-a494-b320cda3b256</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Dani,&amp;nbsp;&lt;br /&gt;Could you explain why you want to test with 2 central devices here ?&amp;nbsp;&lt;br /&gt;If you only test with one single central would the issue appear ?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The sniffer is not designed to store bond information for 2 different central.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I think it&amp;#39;s the best to train you to use our sniffer and would know when the connection is decrypted properly by the sniffer or not.&amp;nbsp;&lt;br /&gt;I attached here the sniffer trace that I used my phone to test with the gls example.&amp;nbsp;&lt;br /&gt;It&amp;#39;s the stock example from SDK v17.1 the only modification I made was to change&amp;nbsp;&lt;/p&gt;
&lt;p&gt;#define SEC_PARAM_LESC&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&amp;nbsp;&lt;/p&gt;
&lt;p&gt;So what it does is Legacy pairing with passkey.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Next I use my phone to connect and pair, I have to enter the passkey printed on UART (please test using a DK) to the sniffer and the phone.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/6237.pastedimage1653921526466v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;After that I can see the&amp;nbsp;initial bonding happen in the sniffer and can see all packets (check the time and packet number):&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/1366x256/__key/communityserver-discussions-components-files/4/3404.pastedimage1653921930270v3.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Then I disconnect then connect again:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;br /&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/1378x280/__key/communityserver-discussions-components-files/4/6131.pastedimage1653921966129v4.png" /&gt;&lt;/p&gt;
&lt;p&gt;You can see that after the START_ENC_RSP I don&amp;#39;t have the &amp;quot;encrypted packet decrypted incorrectly&amp;quot;. This means the reconnection and re-encrypt can be decrypted by the sniffer.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Before testing please make sure you unplug and plug the dongle and reset wireshark before testing.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Also you may want to use this filter:&amp;nbsp;&lt;strong&gt;!(btle.data_header.length == 0)&lt;/strong&gt; to filter out empty packets.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Please test using only one single central.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/5875.pastedimage1653922353190v5.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/6445.ble_5F00_app_5F00_gls.zip"&gt;devzone.nordicsemi.com/.../6445.ble_5F00_app_5F00_gls.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/8182.SnifferTraceExplain.pcapng"&gt;devzone.nordicsemi.com/.../8182.SnifferTraceExplain.pcapng&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>