<?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>Long time to disconnect</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/72834/long-time-to-disconnect</link><description>Hi, 
 Our NRF52840 (running 14.2) often takes a very long time to disconnect, from when a disconnection is initiated by the phone. It can take 30s, sometimes even more, for the disconnect to happen. Sometimes the disconnect happens immediately like it</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 11 May 2021 09:23:32 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/72834/long-time-to-disconnect" /><item><title>RE: Long time to disconnect</title><link>https://devzone.nordicsemi.com/thread/309160?ContentTypeID=1</link><pubDate>Tue, 11 May 2021 09:23:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8a13a917-2111-450c-ae74-74ae3c2e1f71</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello again Nordev,&lt;/p&gt;
[quote user="nordev"]This is the sniffer hex file I am using. I followed the sniffer setup steps months ago, so I don&amp;#39;t remember exactly where I got it from. But the instructions I used were &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fug_sniffer_ble%2FUG%2Fsniffer_ble%2Fintro.html"&gt;here&lt;/a&gt;. I am not sure that I got it from the SDK, but I am sure I got it straight from a Nordic source, and I definitely did not modify the sniffer prior to using it.&amp;nbsp;&amp;nbsp;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/2476.pastedimage1620322518866v1.png" style="cursor:zoom-in;" /&gt;[/quote]
&lt;p&gt;This seems to be our official sniffer firmware, yes. Thank you for clarifying.&lt;/p&gt;
[quote user="nordev"]I don&amp;#39;t know what changed, but suddenly I seem able to sniff the connection as expected:[/quote]
&lt;p&gt;I am glad to hear it is working as expected now, at least.&lt;br /&gt;For future reference, it would be better if you uploaded the trace instead of screenshots, so I may take a look at it myself.&lt;/p&gt;
[quote user="nordev"]The problem is if I let the phone screen go dark, it turns back to &amp;quot;bad mic&amp;quot;&amp;nbsp;[/quote]
&lt;p&gt;Are you saying that the sniffer will start reading bad mic packages if you let the screen on your phone go dark? Is this consistently happening?&lt;br /&gt;It would be great if you could upload a sniffer trace of this, and indicate which packet number this behavior starts on, so I may take a closer look.&lt;br /&gt;This sounds very strange to me, and I have never heard of anything like it before, but if this turns out to be correlated I suppose there have to be some other power saving setting setting in at the same time as the screen goes dark. Again, this sounds very strange to me, and I&amp;#39;d love to see a trace of this so I may try to understand it better.&lt;br /&gt;Bad mic packets primarily happens when the sniffer is unable to decrypt the packet, so unless the devices update this (without the sniffer seeing it), I dont immediately see how this could happen.&amp;nbsp;&lt;/p&gt;
[quote user="nordev"]&lt;strong&gt;Advertising PHY is LE 1M.&lt;/strong&gt; What does that mean? Low Energy 1Mbps?&amp;nbsp;[/quote]
&lt;p&gt;Correct.&lt;/p&gt;
[quote user="nordev"]&lt;p&gt;&lt;strong&gt;Sample captures while disconnecting are below:&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;When I press disconnect BEFORE the 30s is up, I get a lot of Empty PDU after I press disconnect on the phone.&lt;/p&gt;[/quote]
&lt;p&gt;Great detail to your explanation! It is good that you relate everything to the packet number. However, here it would be great for me to have the sniffer trace myself, so I can see more than just the packets included in the screenshot.&lt;br /&gt;Could you please provide me the complete trace - use the &amp;quot;Insert -&amp;gt; File&amp;quot; option here on DevZone - so I may go through your detailed explanation here, but rather see it in the trace directly? This would make the debugging much easier.&lt;/p&gt;
[quote user="nordev"]time 209.819[/quote]
&lt;p&gt;Please be advised that the &amp;#39;time&amp;#39; column is USB time (i.e when wireshark reads it from the sniffer device), and it is thus not as accurate as the&amp;nbsp;&lt;em&gt;delta time&lt;/em&gt; column, for example.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
[quote user="nordev"]Any ideas what is happening? Is there other data you want me to collect?[/quote]
&lt;p&gt;It is unfortunately not immediately clear from the description and screenshots alone. I find it very strange that the sniffer suddenly is unable to decrypt the packets, so it would be great to have a look at the packets leading up to this.&lt;br /&gt;Please provide the full trace file(s), so I may take a look for myself.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I look forward to getting to the bottom of this weird behavior you describe in your comment! &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Long time to disconnect</title><link>https://devzone.nordicsemi.com/thread/308619?ContentTypeID=1</link><pubDate>Thu, 06 May 2021 18:57:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8a2fd2bb-5027-4f80-8b9e-9a7e4d0ac98b</guid><dc:creator>nordev</dc:creator><description>&lt;p&gt;Hi Karl,&lt;/p&gt;
&lt;p&gt;This is the sniffer hex file I am using. I followed the sniffer setup steps months ago, so I don&amp;#39;t remember exactly where I got it from. But the instructions I used were &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fug_sniffer_ble%2FUG%2Fsniffer_ble%2Fintro.html"&gt;here&lt;/a&gt;. I am not sure that I got it from the SDK, but I am sure I got it straight from a Nordic source, and I definitely did not modify the sniffer prior to using it.&amp;nbsp;&amp;nbsp;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1620322518866v1.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t know what changed, but suddenly I seem able to sniff the connection as expected:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1620326319748v2.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The problem is if I let the phone screen go dark, it turns back to &amp;quot;bad mic&amp;quot;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;But I can just delete the bonds from the phone and let the sniffer sniff the pairing process. this should be good enough for testing, I think!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Advertising PHY is LE 1M.&lt;/strong&gt; What does that mean? Low Energy 1Mbps?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sample captures while disconnecting are below:&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;When I press disconnect BEFORE the 30s is up, I get a lot of Empty PDU after I press disconnect on the phone.&lt;/p&gt;
&lt;p&gt;A) Then I eventually got this (#21714, time 209.819):&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1620326548283v3.png" /&gt;&lt;/p&gt;
&lt;p&gt;B) Then I get this later (#21889, time 212.578)&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1620326568964v4.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I tried again keeping better track of time this time:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;all this stuff happened ~504 (pairing)&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1620327033489v5.png" /&gt;&lt;/p&gt;
&lt;p&gt;@ 512, got this:512.641&lt;span&gt; &lt;/span&gt;Master_0x5065659d&lt;span&gt; &lt;/span&gt;Control Opcode: LL_CHANNEL_MAP_IND&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;~519 pressed disconnect. Got this (mostly empty PDU, all packets were Bad Mic from 515 onward, but they are very sparse -- maybe 3 total packets before the final disconnection)&lt;br /&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1620327605760v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;~537 finally disconnected&amp;nbsp; Same kind of packet flow as B above, except instead of the actual opcode, I got &amp;quot;bad mic&amp;quot;&amp;nbsp;this time for the last message (I assume it was the termination opcode though)&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;If I wait MORE than 30s to disconnect, then I get this and it disconnects immediately.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1620327345736v6.png" /&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Any ideas what is happening? Is there other data you want me to collect?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Long time to disconnect</title><link>https://devzone.nordicsemi.com/thread/308467?ContentTypeID=1</link><pubDate>Thu, 06 May 2021 08:21:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:67092923-acd1-437d-901b-52eeaf7d1805</guid><dc:creator>Karl Ylvisaker</dc:creator><description>[quote user="nordev"]My sniffer is a Rigado BMD Development Kit with NRF52840 on it.[/quote]
&lt;p&gt;Which sniffer firmware and software are you using?&lt;br /&gt;As far as I know the nRF Sniffer is only compatible with the nRF52840 PCA10056 and PCA10059.&lt;br /&gt;Are you able to successfully sniff any other pairing process? i.e if you flash your DK with an unmodified example from the SDK, and connect to it with your phone, are you able to sniff this connection just fine?&lt;/p&gt;
[quote user="nordev"]I am not sure how to make sure my peripheral is only advertising on 1Mbps or that my sniffer is compatible with 2Mbps. Do you have guidance on this?[/quote]
&lt;p&gt;The nRF52840 is compatible with 2 Mbps PHY, so that is fine.&lt;br /&gt;Are you able to see the PHY used for the advertising of each packet in Wireshark? I.e when you see an advertising packet, are you able to tell with PHY it is being advertised on?&lt;br /&gt;The advertised PHY is what will be used when connecting.&lt;/p&gt;
[quote user="nordev"]I am sorry,&amp;nbsp;what is LTK?[/quote]
&lt;p&gt;Sorry, it is the long term encryption key. It is possible to provide this directly to the sniffer, if the sniffer is unable to sniff the bonding (such as when using LESC security). We should however first see if we can get the sniffer to work as expected, before moving to this approach.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Long time to disconnect</title><link>https://devzone.nordicsemi.com/thread/308403?ContentTypeID=1</link><pubDate>Wed, 05 May 2021 16:06:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:25d06a6e-6b94-4ff7-b239-a4d34066814d</guid><dc:creator>nordev</dc:creator><description>&lt;p&gt;Thanks, I hope you are well, too!&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Yes, I am using a newer iOS device as the central. Although the same thing happened when using an older Android device as the central. My sniffer is a Rigado BMD Development Kit with NRF52840 on it. I am not sure how to make sure my peripheral is only advertising on 1Mbps or that my sniffer is compatible with 2Mbps. Do you have guidance on this?&lt;/p&gt;
[quote userid="87869" url="~/f/nordic-q-a/72834/long-time-to-disconnect/308335#308335"]we might look into providing the LTK key manually to the sniffer,[/quote]
&lt;p&gt;I am sorry,&amp;nbsp;what is LTK?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Long time to disconnect</title><link>https://devzone.nordicsemi.com/thread/308335?ContentTypeID=1</link><pubDate>Wed, 05 May 2021 11:48:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1c75dd28-2a0b-40c8-a8e7-d58c21dd9856</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello again nordev,&lt;br /&gt;&lt;br /&gt;I hop you are well! :)&amp;nbsp;&lt;/p&gt;
[quote user="nordev"]Thank you again so, so much for your thorough replies. I was called away on other work for a while and am finally back on this.&amp;nbsp;[/quote]
&lt;p&gt;No problem at all, I am happy to help!&lt;br /&gt;We&amp;#39;ll continue this whenever you have the chance, no worries.&lt;/p&gt;
[quote user="nordev"]I tried sniffing by letting the sniffer sniff the pairing process, as you suggested, but then I got &lt;span&gt;no&lt;/span&gt; packets coming in on Wireshark[/quote]
&lt;p&gt;Are you using a newer iOS device as the central here? What device are you using as your sniffer?&lt;br /&gt;I know that never iOS devices switch to 2 Mbps PHY for the pairing if possible, so if you are using a nRF51 series device as your sniffer that might be why you are not seeing any packets for the pairing process. If it does not show up at all, this might be why.&lt;br /&gt;Could you make sure that you peripheral is only advertising on the 1 Mbps PHY, or that your sniffer device is compatible with 2 Mbps PHY?&lt;/p&gt;
[quote user="nordev"]then after connecting, I see a lot of &amp;quot;61623&lt;span&gt; &lt;/span&gt;805.470&lt;span&gt; &lt;/span&gt;Slave_0xaf9a83e0&lt;span&gt; &lt;/span&gt;Encrypted packet decrypted incorrectly (bad MIC)&lt;span&gt; &lt;/span&gt;LE 1M&lt;span&gt; &lt;/span&gt;LE LL&lt;span&gt; &lt;/span&gt;12&lt;span&gt; &lt;/span&gt;150µs&lt;span&gt; &lt;/span&gt;1&lt;span&gt; &lt;/span&gt;0&lt;span&gt; &lt;/span&gt;True&lt;span&gt; &lt;/span&gt;9382&amp;quot;&amp;nbsp;[/quote]
&lt;p&gt;Yes, this is to be expected - if the sniffer does not have the encryption key, it will not be able to decode the contents of the message, it will only see that a message is being exchanged.&amp;nbsp;&lt;/p&gt;
[quote user="nordev"]What is &amp;quot;Just Works&amp;quot;? Do you have other recommendations for sniffing the connection?[/quote]
&lt;p&gt;&lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.s140.api.v7.2.0%2Fgroup___b_l_e___g_a_p___f_u_n_c_t_i_o_n_s.html&amp;amp;anchor=ga609617ead17f7c32cd6b27e63d96fe3a"&gt;Just Works is one of the available security procedures&lt;/a&gt;. If we are unable to sniff the pairing procedure we might look into providing the LTK key manually to the sniffer, but let us keep trying with the sniffer first.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Long time to disconnect</title><link>https://devzone.nordicsemi.com/thread/308013?ContentTypeID=1</link><pubDate>Mon, 03 May 2021 20:07:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3d09b0e8-2e2e-4f12-8257-de3ecdc9d4f5</guid><dc:creator>nordev</dc:creator><description>&lt;p&gt;Hi Karl,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thank you again so, so much for your thorough replies. I was called away on other work for a while and am finally back on this.&amp;nbsp;&lt;/p&gt;
[quote userid="87869" url="~/f/nordic-q-a/72834/long-time-to-disconnect/301408#301408"]The trick for sniffing non-LESC connections is that the sniffer needs to be listening when the connection and bond is being established, so that it may save a copy of the key used for the encryption.[/quote]
&lt;p&gt;I tried sniffing by letting the sniffer sniff the pairing process, as you suggested, but then I got &lt;span&gt;no&lt;/span&gt; packets coming in on Wireshark -- I am not sure, maybe this is a Wireshark bug? If I have &lt;em&gt;already&lt;/em&gt; paired and I am just connecting, I see a lot of ADV_INV, and then after connecting, I see a lot of &amp;quot;61623&lt;span&gt; &lt;/span&gt;805.470&lt;span&gt; &lt;/span&gt;Slave_0xaf9a83e0&lt;span&gt; &lt;/span&gt;Encrypted packet decrypted incorrectly (bad MIC)&lt;span&gt; &lt;/span&gt;LE 1M&lt;span&gt; &lt;/span&gt;LE LL&lt;span&gt; &lt;/span&gt;12&lt;span&gt; &lt;/span&gt;150&amp;micro;s&lt;span&gt; &lt;/span&gt;1&lt;span&gt; &lt;/span&gt;0&lt;span&gt; &lt;/span&gt;True&lt;span&gt; &lt;/span&gt;9382&amp;quot;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I would expect if the sniffer has sniffed the encryption process, these Master / Slave packets would still be coming in, and they would have actual data. But I just get nothing. I get ADV_INV before connection, then after the connection, no packets, and when I disconnect, I get ADV_INV again. I am filtering to only look for data from a particular device.&lt;/p&gt;
&lt;p&gt;I saw &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fug_sniffer_ble%2FUG%2Fsniffer_ble%2Faction_paired.html"&gt;this resource&lt;/a&gt;&amp;nbsp;as well -- What is &amp;quot;Just Works&amp;quot;? Do you have other recommendations for sniffing the connection?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Long time to disconnect</title><link>https://devzone.nordicsemi.com/thread/301408?ContentTypeID=1</link><pubDate>Tue, 23 Mar 2021 11:46:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:90e1587a-d341-4b85-988f-ffdd28e70c5e</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello again nordev,&lt;br /&gt;&lt;br /&gt;Thank you for your patience with this.&amp;nbsp;&lt;/p&gt;
[quote user="nordev"]I am sorry, I am not sure how to tell for sure whether this is the case, but I don&amp;#39;t think so, because I have tried changing the parameters so they no longer match apple&amp;#39;s requirements, as such:[/quote]
&lt;p&gt;It would be implemented as part of your ble_evt_handler. If no case is implemented to disconnect on a rejected update request, or if an conn param update event is received, which does not match the peripheral&amp;#39;s requirements. If none of these cases is implemented, your peripheral will accept whatever the central sets.&lt;/p&gt;
[quote user="nordev"]I have tried this, but I couldn&amp;#39;t get the packets to be decrypted, even if I start watching the peripheral from the device dropdown menu prior to connection. Do you have other suggestions?[/quote]
&lt;p&gt;With the security parameters you have set there should be no issue sniffing this connection. It is really only LESC security that makes sniffing the connection hard.&lt;br /&gt;The trick for sniffing non-LESC connections is that the sniffer needs to be listening when the connection and bond is being established, so that it may save a copy of the key used for the encryption.&lt;br /&gt;So, if your android already is bonded with the device it will use its stored key, and the sniffer will only then get the BAD MIC packets, because it is unable to decrypt them.&lt;br /&gt;&lt;br /&gt;Please make sure to delete bonds on the peripheral and central side, and then restart the bonding process with the sniffer actively listening. Let me know if you still are unable to see the packets&amp;#39; content after doing this.&lt;/p&gt;
[quote user="nordev"]One last thing of note... I am not sure we have MITM and the passkey set up properly. Do you think this could contribute to the problem? I notice that on Android, the phone always requests a passkey to be entered before pairing. On iOS, using the same firmware, it never asks us for a passkey before pairing. This is the only other difference between iOS and Android, so maybe the problems are related?[/quote]
&lt;p&gt;This would be a lot easier to debug and pinpoint with a trace. Lets pursue getting the trace up and running, and then return to this once we see what is happening in the exchange.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Long time to disconnect</title><link>https://devzone.nordicsemi.com/thread/300775?ContentTypeID=1</link><pubDate>Thu, 18 Mar 2021 18:38:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d7108f35-c046-4f61-b4ef-1c91da31fad4</guid><dc:creator>nordev</dc:creator><description>[quote userid="87869" url="~/f/nordic-q-a/72834/long-time-to-disconnect/300702#300702"]What connection parameters are you using for your connection? [/quote]
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#define APP_BLE_OBSERVER_PRIO            3                                          /**&amp;lt; Application&amp;#39;s BLE observer priority. You shouldn&amp;#39;t need to modify this value. */
#define APP_BLE_CONN_CFG_TAG             1                                          /**&amp;lt; A tag for the SoftDevice BLE configuration. */

#define APP_ADV_INTERVAL                 244                                        /**&amp;lt; The advertising interval (in units of 0.625 ms. Value of 300 corresponds to 187.5 ms). */
#define APP_ADV_TIMEOUT_IN_SECONDS       0                                          /**&amp;lt; The advertising timeout in units of seconds. */

#define MIN_CONN_INTERVAL                MSEC_TO_UNITS(25, UNIT_1_25_MS)            /**&amp;lt; Minimum acceptable connection interval (0.1 seconds). */
#define MAX_CONN_INTERVAL                MSEC_TO_UNITS(1500, UNIT_1_25_MS)          /**&amp;lt; Maximum acceptable connection interval (0.2 second). */
#define SLAVE_LATENCY                    0                                          /**&amp;lt; Slave latency. */
#define CONN_SUP_TIMEOUT                 MSEC_TO_UNITS(5000, UNIT_10_MS)            /**&amp;lt; Connection supervisory timeout (4 seconds). */

#define FIRST_CONN_PARAMS_UPDATE_DELAY   APP_TIMER_TICKS(5000)                      /**&amp;lt; Time from initiating event (connect or start of notification) to first time sd_ble_gap_conn_param_update is called (5 seconds). */
#define NEXT_CONN_PARAMS_UPDATE_DELAY    APP_TIMER_TICKS(30000)                     /**&amp;lt; Time between each call to sd_ble_gap_conn_param_update after the first call (30 seconds). */
#define MAX_CONN_PARAMS_UPDATE_COUNT     2                                          /**&amp;lt; Number of attempts before giving up the connection parameter negotiation. */

#define SEC_PARAM_BOND                   1                                          /**&amp;lt; Perform bonding. */
#define SEC_PARAM_MITM                   0                                          /**&amp;lt; Man In The Middle protection required for Passkey */
#define SEC_PARAM_LESC                   0                                          /**&amp;lt; LE Secure Connections not enabled. */
#define SEC_PARAM_KEYPRESS               0                                          /**&amp;lt; Keypress notifications not enabled. */
#define SEC_PARAM_IO_CAPABILITIES        BLE_GAP_IO_CAPS_DISPLAY_ONLY               /**&amp;lt; Changed for Passkey */
#define SEC_PARAM_OOB                    0                                          /**&amp;lt; Out Of Band data not available. */
#define SEC_PARAM_MIN_KEY_SIZE           7                                          /**&amp;lt; Minimum encryption key size. */
#define SEC_PARAM_MAX_KEY_SIZE           16                                         /**&amp;lt; Maximum encryption key size. */

#define SECURITY_REQUEST_DELAY          APP_TIMER_TICKS(400)&lt;/pre&gt;&lt;/p&gt;
[quote userid="87869" url="~/f/nordic-q-a/72834/long-time-to-disconnect/300702#300702"]And, is your peripheral device programmed to terminate the link if the connection parameters does not follow its preferences?[/quote]
&lt;p&gt;I am sorry, I am not sure how to tell for sure whether this is the case, but I don&amp;#39;t think so, because I have tried changing the parameters so they no longer match apple&amp;#39;s requirements, as such:&lt;/p&gt;
[quote userid="85290" url="~/f/nordic-q-a/72834/long-time-to-disconnect/299915#299915"]but I followed all the parameters in section 36.6 &lt;a href="https://developer.apple.com/accessories/Accessory-Design-Guidelines.pdf"&gt;here&lt;/a&gt;, and the issue persisted. [/quote]
&lt;p&gt;and I was still able to connect.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;To be clear, if I let the iOS phone stay connected to the peripheral for longer than 30s, it will always disconnect immediately. It just seems like there is a minimum 30s waiting period before any disconnect request is processed.&amp;nbsp;&lt;/p&gt;
[quote userid="87869" url="~/f/nordic-q-a/72834/long-time-to-disconnect/300702#300702"]It would be great if you could produce a sniffer trace of a disconnect using an android, and another one when using an iOS device. [/quote]
&lt;p&gt;I have tried this, but I couldn&amp;#39;t get the packets to be decrypted, even if I start watching the peripheral from the device dropdown menu prior to connection. Do you have other suggestions?&lt;/p&gt;
&lt;p&gt;As you may (or may not) be able to see from my original post in this thread, the only thing I noticed was that after pressing disconnect, I would get &amp;quot;Empty PDU&amp;quot; for however many seconds it took until I started getting advertising packets again (signifying successful disconnection). If it was a good disconnection, I would go from getting packets (&amp;quot;BAD MIC&amp;quot;) to advertising almost immediately, without a lot of &amp;quot;Empty PDU&amp;quot; in between. When I set a breakpoint in the code, the call stack&amp;nbsp;for a &amp;quot;good&amp;quot; disconnection and a long disconnection look the same, except that the long disconnection just takes up to 30 seconds before it is actually triggered.&amp;nbsp;&lt;/p&gt;
[quote userid="85290" url="~/f/nordic-q-a/72834/long-time-to-disconnect/299908#299908"]I checked the call stack for when the disconnect is triggered and compared between my app and the Nordic example. It is the same exact thing in both cases (screenshot from bms app): &lt;img src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/0777.image.jpg" alt=" " style="cursor:zoom-in;" /&gt;[/quote]
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;One last thing of note... I am not sure we have MITM and the passkey set up properly. Do you think this could contribute to the problem? I notice that on Android, the phone always requests a passkey to be entered before pairing. On iOS, using the same firmware, it never asks us for a passkey before pairing. This is the only other difference between iOS and Android, so maybe the problems are related?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Long time to disconnect</title><link>https://devzone.nordicsemi.com/thread/300702?ContentTypeID=1</link><pubDate>Thu, 18 Mar 2021 14:07:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5fed9967-16de-49da-b059-f74debc8373f</guid><dc:creator>Karl Ylvisaker</dc:creator><description>[quote userid="85290" url="~/f/nordic-q-a/72834/long-time-to-disconnect/300208#300208"]thank you so much!!![/quote]
&lt;p&gt;No problem at all, nordev!&lt;/p&gt;
[quote userid="85290" url="~/f/nordic-q-a/72834/long-time-to-disconnect/300208#300208"]I am calling the disconnect via the disconnect button inside the NRF Connect app for iOS (v2.4.8), or within our custom iOS app, not via the bsp. The long disconnect only happens on iOS. When I try using NRF Connect for android (v4.24.2), it &lt;em&gt;always&lt;/em&gt; disconnects immediately, even when I try to disconnect immediately, like 1s after connecting.&amp;nbsp;[/quote]
&lt;p&gt;My apologies, I got this wrong when reading through the case history - I thought the problem was that the disconnect procedure did not start on the peripheral device.&lt;/p&gt;
[quote userid="85290" url="~/f/nordic-q-a/72834/long-time-to-disconnect/300208#300208"]My interrupt priorities are as follows:[/quote]
&lt;p&gt;Thank you for providing these.&lt;/p&gt;
[quote userid="85290" url="~/f/nordic-q-a/72834/long-time-to-disconnect/300208#300208"]The disconnect on iOS happens, without fail, exactly 30s after the initial connection. EX: if I start the connection at t=0, no matter if I press &amp;quot;disconnect&amp;quot; on the phone at t=7, t=12, t=20, etc., the disconnect will always trigger on the BT device at exactly t=30s. I would think if it were an interrupt priority problem, this time period would vary.&amp;nbsp;[/quote]
&lt;p&gt;What connection parameters are you using for your connection? And, is your peripheral device programmed to terminate the link if the connection parameters does not follow its preferences?&lt;br /&gt;&lt;br /&gt;It would be great if you could produce a sniffer trace of a disconnect using an android, and another one when using an iOS device. This way, we should be able to rule out a couple of possibilities right off the bat. The sniffer trace will tell us whether the problem lies with the iOS&amp;#39;s link termination packet or not.&lt;br /&gt;I think that currently, the case might be that the iOS device is demanding parameters that does not align with the configuration of the peripheral, and when these are not met, the peripheral triggers the disconnect after 30 s. However, I find it very strange that your attempt to trigger the disconnect is not working either.&lt;br /&gt;&lt;br /&gt;Make sure to select your peripheral device from the device drop down menu (shown in the included image) in Wireshark before starting the first connection, so that the sniffer will follow into the connection and be able to decrypt the packets being sent between the central and peripheral.&lt;br /&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/5076.wiresharkSourceDevice.PNG" /&gt;&lt;br /&gt;You could do multiple connections and reconnections in the same trace, to highlight the issue.&lt;br /&gt;&lt;br /&gt;Looking forward to resolving this issue together!&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Long time to disconnect</title><link>https://devzone.nordicsemi.com/thread/300208?ContentTypeID=1</link><pubDate>Tue, 16 Mar 2021 15:47:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ed1a5bae-1f17-4115-aae1-2e2076a5d3bb</guid><dc:creator>nordev</dc:creator><description>&lt;p&gt;Hi Karl, thank you so much!!!&lt;/p&gt;
&lt;p&gt;I am calling the disconnect via the disconnect button inside the NRF Connect app for iOS (v2.4.8), or within our custom iOS app, not via the bsp. The long disconnect only happens on iOS. When I try using NRF Connect for android (v4.24.2), it &lt;em&gt;always&lt;/em&gt; disconnects immediately, even when I try to disconnect immediately, like 1s after connecting.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;My interrupt priorities are as follows:&lt;/p&gt;
&lt;p&gt;#define SPI_DEFAULT_CONFIG_IRQ_PRIORITY 6&lt;br /&gt;#define UART_DEFAULT_CONFIG_IRQ_PRIORITY 3&lt;br /&gt;#define APP_TIMER_CONFIG_IRQ_PRIORITY 7&lt;/p&gt;
&lt;p&gt;The disconnect on iOS happens, without fail, exactly 30s after the initial connection. EX: if I start the connection at t=0, no matter if I press &amp;quot;disconnect&amp;quot; on the phone at t=7, t=12, t=20, etc., the disconnect will always trigger on the BT device at exactly t=30s. I would think if it were an interrupt priority problem, this time period would vary.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I know when the disconnect happens because inside&amp;nbsp;ble_evt_handler,&amp;nbsp;case BLE_GAP_EVT_DISCONNECTED: I put logs and I toggle an LED.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;One last piece of possibly useful info:&lt;/p&gt;
[quote userid="85290" url="~/f/nordic-q-a/72834/long-time-to-disconnect/299922#299922"]&lt;p&gt;on very very rare occasions, I also see a random disconnect with reason 0x08,&amp;nbsp;&lt;span&gt;/**&amp;lt; Connection Timeout. */&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Do you know what timeout this would be? I am just wondering if it is related because the fact that it takes a different amount of time each time to disconnect suggests that maybe we are waiting for some kind of timeout, and we just happen to start at a different place in the timeout each time.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;[/quote]
&lt;p&gt;(and by &amp;quot;different amount of time to connect,&amp;quot; i mean different amount of time from when the disconnect button was pressed, which is consistent with the 30s finding above).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Long time to disconnect</title><link>https://devzone.nordicsemi.com/thread/300186?ContentTypeID=1</link><pubDate>Tue, 16 Mar 2021 14:52:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0871a3da-9826-44cf-91d0-7fe180662499</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello again nordev,&lt;br /&gt;&lt;br /&gt;I will be taking over this ticket, as Joakim has been pulled away to other tasks for the time being.&lt;br /&gt;&lt;br /&gt;From your initial ticket and answers I am thinking that it is your call to disconnect is not being handled properly. Looking at the screenshot from the traces you sent, it seems that the disconnection is working as intended when it is sent, but that the termination packet is not being sent during the &amp;#39;long disconnect&amp;#39; intervals.&lt;br /&gt;I therefore think we should look to the sd_ble_gap_disconnect calls that you have earlier mentioned does not get triggered when stepping through the code. I am confident that this is an error in the application layer / code.&lt;br /&gt;&lt;br /&gt;I know from your other ticket that you have a lot of other tasks going immediately after a connection. I suspect that your call to disconnect takes a long time to trigger because of a priority mismatch.&lt;br /&gt;&lt;br /&gt;If you are attempting to trigger the disconnect using a button press, what priority are you using for your bsp handler? And, what is the priority of your other interrupt based functions?&lt;br /&gt;&lt;br /&gt;Looking forward to resolving this issue together!&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Long time to disconnect</title><link>https://devzone.nordicsemi.com/thread/299926?ContentTypeID=1</link><pubDate>Tue, 09 Mar 2021 00:29:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:60dbcecc-397f-43ed-82e0-d9f8a60679a2</guid><dc:creator>nordev</dc:creator><description>&lt;p&gt;Hi Joakim, are you still looking at this ticket? If not, should someone else be assigned to this ticket, perhaps?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thank you!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Long time to disconnect</title><link>https://devzone.nordicsemi.com/thread/299925?ContentTypeID=1</link><pubDate>Sat, 06 Mar 2021 01:57:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:808d2669-b2e3-478e-8ace-f34885b9c6c7</guid><dc:creator>nordev</dc:creator><description>&lt;p&gt;I have another clue:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The &amp;quot;long disconnect&amp;quot; only happens when we try to disconnect within 30s of starting a new connection.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If the device has been connected for more than 30s, it will disconnect immediately when the disconnect is initiated.&lt;/p&gt;
&lt;p&gt;If the device has been connected for less than 30s when the disconnect is initiated, it will disconnect 31 seconds after the initial connection, no matter whether the disconnect was initiated 10s, 15s, 20s, etc after the initial connection.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Again, the below is the only thing in my code that seems to use a 30s delay:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#define NEXT_CONN_PARAMS_UPDATE_DELAY    APP_TIMER_TICKS(30000)                     /**&amp;lt; Time between each call to sd_ble_gap_conn_param_update after the first call (30 seconds). */&lt;/pre&gt;But changing this parameter does not seem to affect the long disconnect.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;So, why might this be happening?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Long time to disconnect</title><link>https://devzone.nordicsemi.com/thread/299924?ContentTypeID=1</link><pubDate>Wed, 24 Feb 2021 15:01:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:009981b8-184d-4c57-99c5-712afecf5a92</guid><dc:creator>nordev</dc:creator><description>&lt;p&gt;I see... normally, when the long disconnect happens, it is with disconnect reason 0x13, which I think is normal: remote user terminated connection.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;are you saying that disconnect reason 0x08 “connection timeout” is when the central stops responding? Not the peripheral?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;i didn’t think this would matter, but I made some small changes to the SDK, I added the files suggested by Peter here:&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/29926/bug-in-peer-manager-in-sdk-14-2"&gt;https://devzone.nordicsemi.com/f/nordic-q-a/29926/bug-in-peer-manager-in-sdk-14-2&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;also&amp;nbsp;&lt;span style="font-weight:400;"&gt;In ‘app_bds_util.h’, comment out:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;typedef struct&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;{&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;uint16_t year;&lt;/span&gt;&lt;span style="font-weight:400;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;uint8_t&amp;nbsp; month;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;uint8_t&amp;nbsp; day;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;uint8_t&amp;nbsp; hours;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;uint8_t&amp;nbsp; minutes;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;uint8_t&amp;nbsp; seconds;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;} ble_date_time_t;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;&lt;/span&gt;&lt;span style="font-weight:400;"&gt;Then &lt;/span&gt;&lt;span style="font-weight:400;"&gt;#include ble_date_time.h&lt;/span&gt;&lt;span style="font-weight:400;"&gt; in app_bds_util.h&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;&lt;/span&gt;Although, the NRF example code I ran disconnects perfectly with no issue, so I don’t think it’s the SDK...&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;Are you using SDK 14.2? Out of curiosity what were the build errors and how did you resolve them?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Long time to disconnect</title><link>https://devzone.nordicsemi.com/thread/299923?ContentTypeID=1</link><pubDate>Wed, 24 Feb 2021 10:23:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:363573bd-9fba-4aa3-a349-22fc43e6d596</guid><dc:creator>Joakim Jakobsen</dc:creator><description>&lt;p&gt;Hi again.&lt;/p&gt;
&lt;p&gt;I had some trouble building the example you sent. When I did, I didn&amp;#39;t see any issue, so I&amp;#39;m still looking into this.&lt;/p&gt;
&lt;p&gt;The connection timeout is the disconnect reason that I would expect you to see. In your code the supervision timeout is defined: &lt;br /&gt;#define CONN_SUP_TIMEOUT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MSEC_TO_UNITS(5000, UNIT_10_MS)&lt;/p&gt;
&lt;p&gt;In your case, when the peripheral doesn&amp;#39;t receive any response from the central anymore. It should disconnect (with the timeout reason) after the defined timeout.&lt;/p&gt;
&lt;p&gt;Br, &lt;br /&gt;Joakim&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Long time to disconnect</title><link>https://devzone.nordicsemi.com/thread/299922?ContentTypeID=1</link><pubDate>Tue, 23 Feb 2021 21:38:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5d746df4-1c75-47f7-bb55-9a6e09c89207</guid><dc:creator>nordev</dc:creator><description>&lt;p&gt;I don&amp;#39;t know if this is maybe related, but in case it is a helpful clue, on very very rare occasions, I also see a random disconnect with reason 0x08,&amp;nbsp;&lt;span&gt;/**&amp;lt; Connection Timeout. */&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Do you know what timeout this would be? I am just wondering if it is related because the fact that it takes a different amount of time each time to disconnect suggests that maybe we are waiting for some kind of timeout, and we just happen to start at a different place in the timeout each time.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Can you let me know if you were able to duplicate the issue? Thanks.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Long time to disconnect</title><link>https://devzone.nordicsemi.com/thread/299921?ContentTypeID=1</link><pubDate>Thu, 18 Feb 2021 08:13:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9bb4d1d1-5a70-46a0-86b0-4e72e4c6c318</guid><dc:creator>nordev</dc:creator><description>&lt;p&gt;Thanks for the notice. Did you manage to find anything out yet? I have been thinking about it more... the softdevice should have the highest interrupt priority, so there must be something going on with the softdevice whenever i try to disconnect that prevents the disconnect from being processed for so long, right?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Long time to disconnect</title><link>https://devzone.nordicsemi.com/thread/299920?ContentTypeID=1</link><pubDate>Wed, 10 Feb 2021 10:12:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a3a67bfc-5d2b-42ef-aa0d-7ad1a4a8a691</guid><dc:creator>Joakim Jakobsen</dc:creator><description>&lt;p&gt;Thanks.&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve downloaded the .zip now, so you can disable sharing if you feel safer.&lt;/p&gt;
&lt;p&gt;I&amp;#39;ll start looking at your project today.&lt;/p&gt;
&lt;p&gt;Br, &lt;br /&gt;Joakim&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Long time to disconnect</title><link>https://devzone.nordicsemi.com/thread/299919?ContentTypeID=1</link><pubDate>Tue, 09 Feb 2021 16:54:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9abea7c8-5c70-4590-af0d-a82ebf39f152</guid><dc:creator>nordev</dc:creator><description>&lt;p&gt;Thank you - I just uploaded my files to the chat message. If you just delete the files later, I can turn off the sharing link, so that we don&amp;#39;t have to delete this ticket. It would be helpful to be able to refer to it later.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Long time to disconnect</title><link>https://devzone.nordicsemi.com/thread/299918?ContentTypeID=1</link><pubDate>Mon, 08 Feb 2021 20:29:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8f3ed22f-5db5-4183-9fff-f80fbb302d6f</guid><dc:creator>Joakim Jakobsen</dc:creator><description>&lt;p&gt;I saw you message.&lt;/p&gt;
&lt;p&gt;I turned this ticket private so that you can safely upload any sensitive information here.&lt;/p&gt;
&lt;p&gt;Only you and Nordic employees will have access to the content of this ticket from now on.&lt;/p&gt;
&lt;p&gt;Br, &lt;br /&gt;Joakim&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Long time to disconnect</title><link>https://devzone.nordicsemi.com/thread/299917?ContentTypeID=1</link><pubDate>Thu, 04 Feb 2021 19:33:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f555ab53-90c6-41c1-a603-1a7be0f53788</guid><dc:creator>nordev</dc:creator><description>&lt;p&gt;Yes, testing using NRF connect for mobile. App versions 2.4.7 and 2.3.2 on iOS, vsns 4.24.2 and 4.24.1 on Android. &lt;/p&gt;
&lt;p&gt;I sent you a note in private message, do you see it?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Long time to disconnect</title><link>https://devzone.nordicsemi.com/thread/299916?ContentTypeID=1</link><pubDate>Thu, 04 Feb 2021 11:31:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6078092c-6a72-4d9d-8bdb-ce27d1b9b67e</guid><dc:creator>Joakim Jakobsen</dc:creator><description>&lt;p&gt;Thank you for that information. The fact that the problem only exists on iOS is very useful.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I will check my inbox for the project.&lt;/p&gt;
&lt;p&gt;Are you testing this using our nRF Connect for mobile?&lt;/p&gt;
&lt;p&gt;Br, &lt;br /&gt;Joakim&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Long time to disconnect</title><link>https://devzone.nordicsemi.com/thread/299915?ContentTypeID=1</link><pubDate>Thu, 04 Feb 2021 07:53:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8308ac06-02b1-4134-9d6b-9c16b1840c3c</guid><dc:creator>nordev</dc:creator><description>&lt;p&gt;I will send it to you via private message.&lt;/p&gt;
&lt;p&gt;As a further update, I noticed that the long disconnect does not happen with Android devices, which all disconnect immediately. It only happens with iOS devices. I tried with multiple Android devices and multiple iOS devices.&lt;/p&gt;
&lt;p&gt;This would seem to suggest that maybe it is a phone issue, but the iOS devices disconnect just fine when I use one of the Nordic example apps. So it is maybe something to do with how the iOS BLE stack interacts with the softdevice?&lt;br /&gt;&lt;br /&gt;(I know Apple has particular requirements for the connection parameters, but I followed all the parameters in section 36.6 &lt;a href="https://developer.apple.com/accessories/Accessory-Design-Guidelines.pdf"&gt;here&lt;/a&gt;, and the issue persisted. Values I used are below)&lt;/p&gt;
&lt;p&gt;#define MIN_CONN_INTERVAL&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MSEC_TO_UNITS(15, UNIT_1_25_MS)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /**&amp;lt; Minimum acceptable connection interval (0.1 seconds). */&lt;br /&gt;#define MAX_CONN_INTERVAL&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MSEC_TO_UNITS(500, UNIT_1_25_MS)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /**&amp;lt; Maximum acceptable connection interval (0.2 second). */&lt;br /&gt;#define SLAVE_LATENCY&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /**&amp;lt; Slave latency. */&lt;br /&gt;#define CONN_SUP_TIMEOUT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MSEC_TO_UNITS(5000, UNIT_10_MS)&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Long time to disconnect</title><link>https://devzone.nordicsemi.com/thread/299914?ContentTypeID=1</link><pubDate>Tue, 02 Feb 2021 20:41:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5b8f46c9-af91-407b-9bd7-afe4f3becbb6</guid><dc:creator>Joakim Jakobsen</dc:creator><description>&lt;p&gt;Thanks.&lt;/p&gt;
&lt;p&gt;Do you have a minimized project&amp;nbsp; where I can reproduce this that you can upload here, so that I can test on my end. That way I can take a closer look at what is going on?&lt;/p&gt;
&lt;p&gt;Br, &lt;br /&gt;JOakim&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Long time to disconnect</title><link>https://devzone.nordicsemi.com/thread/299913?ContentTypeID=1</link><pubDate>Tue, 02 Feb 2021 16:18:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6f7516c5-f6e7-4d89-9b22-f867f9e5e0f4</guid><dc:creator>nordev</dc:creator><description>&lt;p&gt;I think I already answered your questions above, but for convenience, I have quoted them for you here: &lt;/p&gt;
[quote userid="20690" url="~/f/nordic-q-a/70359/long-time-to-disconnect/292492#292492"]What is the CONN_SUP_TIMEOUT defined as?[/quote]
&lt;p&gt;As you can see here, this is CONN_SUP_TIMEOUT is 5 seconds:&lt;/p&gt;
[quote userid="85290" url="~/f/nordic-q-a/70359/long-time-to-disconnect/288781#288781"]here is some code:&amp;nbsp;[/quote]
&lt;p&gt;#define CONN_SUP_TIMEOUT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MSEC_TO_UNITS(5000, UNIT_10_MS)&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote userid="20690" url="~/f/nordic-q-a/70359/long-time-to-disconnect/292492#292492"]Are you seeing this behaviour using the stock ble_app_bms example and nRF Connect?[/quote]
&lt;p&gt;As you can see here, I did not experience a delay using the stock ble_app_bms example.&lt;/p&gt;
[quote userid="85290" url="~/f/nordic-q-a/70359/long-time-to-disconnect/291904#291904"]i have tried loading a Nordic example to see if the issue persists. The one I used is ble_app_bms. The disconnects happen immediately, so the problem must be somewhere in my code[/quote]
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>