<?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>BLE data write delay</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/15320/ble-data-write-delay</link><description>Hello, all 
 I have a problem with ble data exchanging. 
 I have programmed an application which controls servo motors through phone application. 
 At the connection, ble data is sent immediately by clicking phone app button, 
 but the problem is</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 02 Aug 2016 01:58:50 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/15320/ble-data-write-delay" /><item><title>RE: BLE data write delay</title><link>https://devzone.nordicsemi.com/thread/58552?ContentTypeID=1</link><pubDate>Tue, 02 Aug 2016 01:58:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5750c5dc-3198-45f5-998b-e6fb3f8c0436</guid><dc:creator>FormerMember</dc:creator><description>&lt;p&gt;Thx! I understand what happened.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE data write delay</title><link>https://devzone.nordicsemi.com/thread/58551?ContentTypeID=1</link><pubDate>Mon, 01 Aug 2016 12:59:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d5084772-4059-40e9-ab71-bc7b4655dc2a</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;@TY: If you have a look at the trace, you can find that the peripheral sent a connection parameter update request 5 seconds after the connection. This is due to the FIRST_CONN_PARAMS_UPDATE_DELAY is set to 5 seconds in the application.&lt;/p&gt;
&lt;p&gt;In this case the phone accepted the request and change the connection interval to 650ms. This explains why you see it&amp;#39;s slower to send write request as you captured in your clips.&lt;/p&gt;
&lt;p&gt;So it&amp;#39;s due to the longer connection interval.&lt;/p&gt;
&lt;p&gt;I would need to see the trace when the connection terminated after 1m30s to besure why, but most likely it was because the phone reject the connection parameter request and then the connection parameter negotiation module on the nRF5 tried 3 times and then gave up and did a disconnection, as you found in the code.&lt;/p&gt;
&lt;p&gt;My suggestion is to find the connection max and min interval that the phone will accept. (if  you request too low connection interval, the phone will reject that).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE data write delay</title><link>https://devzone.nordicsemi.com/thread/58550?ContentTypeID=1</link><pubDate>Mon, 01 Aug 2016 09:06:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c5517185-1d9d-4817-a323-23d588a3a721</guid><dc:creator>FormerMember</dc:creator><description>&lt;p&gt;I find how to fix it.&lt;/p&gt;
&lt;p&gt;The problem is MAX_CONN_PARAMS_UPDATE_COUNT.&lt;/p&gt;
&lt;p&gt;MAX_CONN_PARAMS_UPDATE_COUNT is basically set to 3&lt;/p&gt;
&lt;p&gt;and NEXT_CONN_PARAMS_UPDATE_DELAY is set to 30.&lt;/p&gt;
&lt;p&gt;So after about 1m 30s, the ble_conn_params timeout event call on_conn_params_evt() and operate sd_ble_gap_disconnect().&lt;/p&gt;
&lt;p&gt;The solution is that set sd_ble_gap_disconnect() comment or remove in on_conn_params_evt().&lt;/p&gt;
&lt;p&gt;But I dont understand why it wasnt disconnceted if I set MIN_CONN_INTERVAL to 450, MAX_CONN_INTERVAL to 550 and CONN_SUP_TIMEOUT to 4000. It should be disconnected after 1m 30s technically but woldnt, only make delay and operate past data.&lt;/p&gt;
&lt;p&gt;Now I set MIN_CONN_INTERVAL, MAX_CONN_INTERVAL and CONN_SUP_TIMEOUT to whatever I want, I dont get delay and disconnection.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE data write delay</title><link>https://devzone.nordicsemi.com/thread/58546?ContentTypeID=1</link><pubDate>Mon, 01 Aug 2016 07:19:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f6fa6cec-76c5-45ca-8f7e-e853217fe543</guid><dc:creator>FormerMember</dc:creator><description>&lt;p&gt;Here is the &lt;a href="https://docs.google.com/uc?authuser=0&amp;amp;id=0BwzwAsUjgyoCTXFMQVc5MTNUdE0&amp;amp;export=download"&gt;capture&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This capture is showing that ble data exchanging has delay and operate past data even I dont press the app button after about 3~4 sec at the connection.&lt;/p&gt;
&lt;p&gt;please watch this &lt;a href="https://youtu.be/erkpoWwq2XE"&gt;video&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE data write delay</title><link>https://devzone.nordicsemi.com/thread/58547?ContentTypeID=1</link><pubDate>Wed, 27 Jul 2016 12:24:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d6b9e5a6-8dc4-4166-96da-8152b6818b7b</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;You should not set the connection interval to too large. For testing purpose you should try to set it as low as possible. Please try to capture a sniffer trace.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE data write delay</title><link>https://devzone.nordicsemi.com/thread/58549?ContentTypeID=1</link><pubDate>Wed, 27 Jul 2016 01:50:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ab1328aa-5fa2-4d14-aa42-0d5604f0eeab</guid><dc:creator>FormerMember</dc:creator><description>&lt;p&gt;Even I press the app button with slower speed, delay exist.
or if I set MIN_CONN_INTERVAL to MSEC_TO_UNITS(10000, UNIT_10_MS) or lager, disconnection must happen.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE data write delay</title><link>https://devzone.nordicsemi.com/thread/58548?ContentTypeID=1</link><pubDate>Tue, 26 Jul 2016 10:27:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:62944a3a-1069-4f97-832d-9b01812c516b</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;@TY: Could you capture some &lt;a href="https://www.nordicsemi.com/eng/Products/Bluetooth-Smart-Bluetooth-low-energy/nRF-Sniffer/(language)/eng-GB"&gt;sniffer trace&lt;/a&gt; when the issues happen ?&lt;/p&gt;
&lt;p&gt;If you don&amp;#39;t do writing but wait for a while or if you press the button with slower speed, would you have the delay and the disconnection ?&lt;/p&gt;
&lt;p&gt;I suspect that it could be either the phone buffer was over flow when you send to many write command , or it was the connection interval was changed to a longer one.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>