<?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>nRF Connect for android disconnects with Error 22: &amp;#39;gatt conn terminate local host&amp;#39;</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/30804/nrf-connect-for-android-disconnects-with-error-22-gatt-conn-terminate-local-host</link><description>Hi, 
 I&amp;#39;m testing stability of my firmware. As a part of tests I&amp;#39;m trying to maintain long term (multiple days) connection between nRF52 and nRF Connect for Android app running on Xiaomi Mi 2 (BLE5.0 capable hardware with Android 8.0). Every 24h or so</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 02 Nov 2020 15:13:33 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/30804/nrf-connect-for-android-disconnects-with-error-22-gatt-conn-terminate-local-host" /><item><title>RE: nRF Connect for android disconnects with Error 22: 'gatt conn terminate local host'</title><link>https://devzone.nordicsemi.com/thread/278130?ContentTypeID=1</link><pubDate>Mon, 02 Nov 2020 15:13:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e8ea2b94-0a30-427c-b261-114685504608</guid><dc:creator>tesc</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;To sum up, the issue is that the smartphone app has a GATT server, and it sends indications to the nRF device, even if the nRF device has changed application to something not expecting indications?&lt;/p&gt;
&lt;p&gt;Note that the nRF device, by default, will always use the same BLE address. So it might be the smartphone remembering from a previous session that the device of that address had enabled indications. However, from what I understand that should not happen unless the device is bonded... So if that is indeed what is happening then there is something wrong either in the app or in the BLE stack of the smartphone. It would still be worth trying the workaround from a previous answer in this thread:&lt;/p&gt;
[quote user="ivnn"]to solve this issue go to Android Settings-&amp;gt;Bluetooth-&amp;gt;Paired devices-&amp;gt; and unpair your dev[/quote]
&lt;p&gt;Regards,&lt;br /&gt;Terje&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF Connect for android disconnects with Error 22: 'gatt conn terminate local host'</title><link>https://devzone.nordicsemi.com/thread/270937?ContentTypeID=1</link><pubDate>Tue, 22 Sep 2020 18:46:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0785a681-7e91-4d06-bf98-c46d53356b8d</guid><dc:creator>Noon</dc:creator><description>&lt;p&gt;Hi, i have the same problem. And i&amp;#39;m really curious to know the answer to the previous question: &amp;quot;I&amp;#39;m not sure how is it possible to receive Indications if i&amp;#39;m not enabling any client feature in my device&amp;quot; ?&lt;/p&gt;
&lt;p&gt;Thx&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF Connect for android disconnects with Error 22: 'gatt conn terminate local host'</title><link>https://devzone.nordicsemi.com/thread/260447?ContentTypeID=1</link><pubDate>Thu, 16 Jul 2020 20:03:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:38809b45-cb0c-4275-9b91-b4ce5f376f17</guid><dc:creator>Sravanakumar</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;a class="internal-link view-user-profile" href="https://devzone.nordicsemi.com/members/liuked"&gt;liuked&lt;/a&gt;,&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp;I have disabled the indication for example GATT service, even though I am facing the same issue.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF Connect for android disconnects with Error 22: 'gatt conn terminate local host'</title><link>https://devzone.nordicsemi.com/thread/256072?ContentTypeID=1</link><pubDate>Mon, 22 Jun 2020 00:01:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2af0dd34-26d2-49ea-96ba-01e6b179e0c2</guid><dc:creator>liuked</dc:creator><description>&lt;p&gt;For anyone who ends up in this thread because of the nRF Connect &amp;quot;ERROR 22&amp;quot; issue, I just spent 2 h trying to figure out the reson in my case.&lt;/p&gt;
&lt;p&gt;So, just to recap&amp;nbsp;the details of the issue:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;my device (NRF52832QFAAE0) is a BLE peripheral serving as GATT Server, using SoftDevice s132 v7.0.1, SDK16.0.0.&lt;/li&gt;
&lt;li&gt;NRF_SDH_BLE_CENTRAL_LINK_COUNT&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;= 0&lt;/li&gt;
&lt;li&gt;NRF_SDH_BLE_PERIPHERAL_LINK_COUNT = 1&lt;/li&gt;
&lt;li&gt;my&lt;span&gt;&amp;nbsp;device was not showing any known or unknown or assertion fail&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;my device was correctly advertising and accepting connection (without bonding)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;after 30 seconds from each connection, my smartphone&amp;nbsp;(OnePlus 5T, android 9) is dropping the connection with error 22 (0x16)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;I was using nRF Connect version 4.24.1&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The 30 second timeout of my phone lead me to think that my device was probably not replying to a GATT query from my phone.&lt;br /&gt;After dumping all the BLE events, I noticed that I was receiving a HVX event of type INDICATION.&lt;/p&gt;
&lt;p&gt;At first I solved it with a simple call to:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;sd_ble_gattc_hv_confirm(p_ble_evt-&amp;gt;evt.gap_evt.conn_handle, p_ble_evt-&amp;gt;evt.gattc_evt.params.hvx.handle);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;A second inspection brought me to find out that my NRF app was configured with an example of GATT service and apparently was sending indication to my device. Disabling it solved my issue.&lt;br /&gt;&lt;br /&gt;Please, nRF Team, look into this, and maybe put a warning in the app if the server example is enabled by default.&lt;br /&gt;Still, I&amp;#39;m nos sure how is it possible to receive Indications if i&amp;#39;m not enabling any client feature in my device.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF Connect for android disconnects with Error 22: 'gatt conn terminate local host'</title><link>https://devzone.nordicsemi.com/thread/149921?ContentTypeID=1</link><pubDate>Sun, 23 Sep 2018 20:19:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b1e077d9-a658-4531-b9d8-eaa230db366f</guid><dc:creator>ivnn</dc:creator><description>&lt;p&gt;hi, &amp;quot;error 22&amp;quot; happened when you trying to reconnect&amp;nbsp; to already paired device&lt;/p&gt;
&lt;p&gt;to solve this issue go to Android Settings-&amp;gt;Bluetooth-&amp;gt;Paired devices-&amp;gt; and unpair your dev&lt;/p&gt;
&lt;p&gt;tested on Andr 8.1.0 xiaomi mia2 ble5.0&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF Connect for android disconnects with Error 22: 'gatt conn terminate local host'</title><link>https://devzone.nordicsemi.com/thread/123238?ContentTypeID=1</link><pubDate>Wed, 07 Mar 2018 12:19:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c09de555-4c58-4b44-a7f7-b10681861e82</guid><dc:creator>Keton</dc:creator><description>&lt;p&gt;I&amp;#39;m setting up recording of sniffer trace right now. I had to change the phone too as Mi2 switches to BLE 5.0 2Mbps mode automatically and sniffer looses track of the connection. I&amp;#39;ll record&amp;nbsp;trace of connection with Xiaomi Redmi 4X&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF Connect for android disconnects with Error 22: 'gatt conn terminate local host'</title><link>https://devzone.nordicsemi.com/thread/123230?ContentTypeID=1</link><pubDate>Wed, 07 Mar 2018 12:01:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6f0b4e19-40b5-4cf8-b584-6246df8ab387</guid><dc:creator>tesc</dc:creator><description>&lt;p&gt;Have you tried with another phone now, and/or gotten a sniffer trace?&lt;/p&gt;
&lt;p&gt;Any information that would let us get further in figuring out what is happening?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF Connect for android disconnects with Error 22: 'gatt conn terminate local host'</title><link>https://devzone.nordicsemi.com/thread/121817?ContentTypeID=1</link><pubDate>Fri, 23 Feb 2018 15:34:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:55a45637-435a-4758-b9dd-db882863c150</guid><dc:creator>Keton</dc:creator><description>&lt;p&gt;The phone was connected to the charger. I&amp;#39;m pretty confident that this is not doze related issue because nRFConnect is added to power saving exceptions and as far as I can tell the app wasn&amp;#39;t killed (unless this works differently in Android 8.0). I&amp;#39;ll try different phone next week just to be sure.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This setup doesn&amp;#39;t use bonding. As for reconnecting there will be auto reconnect procedure in the app but point of this exercise is to detect if nRF52 reboots or hangs. Early versions of this firmware had tendency to disappear from BLE after several weeks (no connection, no advertising).&lt;/p&gt;
&lt;p&gt;I&amp;#39;ll try to record sniffer trace of the disconnection, maybe this will tell us more.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF Connect for android disconnects with Error 22: 'gatt conn terminate local host'</title><link>https://devzone.nordicsemi.com/thread/121811?ContentTypeID=1</link><pubDate>Fri, 23 Feb 2018 14:36:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:918cc2c9-9371-4586-8e40-b32509c1398f</guid><dc:creator>Aleksander Nowakowski</dc:creator><description>&lt;p&gt;Hi, did you try with a different phone? Was your phone connected to power during the test? Could it be the Doze mode?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Are you using bonding? If so, you could advertise directly when it gets disconnected and Android should reconnect, I guess.&lt;/p&gt;
&lt;p&gt;nRF Connect doesn&amp;#39;t disconnect. It just displays events that it receives from the system...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>