<?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>How to reduce the response time of read requests</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/15276/how-to-reduce-the-response-time-of-read-requests</link><description>Hi, 
 I am working on the heart_rate_collector example code of nrf51-ble-driver_linux_0.5.0 . I try to modify the example code let it can connect the Environmental Sensing Service (ESS profile) peripheral. 
 The ESS peripheral have temperature(Assigned</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 28 Jul 2016 01:49:26 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/15276/how-to-reduce-the-response-time-of-read-requests" /><item><title>RE: How to reduce the response time of read requests</title><link>https://devzone.nordicsemi.com/thread/58356?ContentTypeID=1</link><pubDate>Thu, 28 Jul 2016 01:49:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1659bf7e-c973-40cb-a26b-1276cb40ecb6</guid><dc:creator>Ryan Huang</dc:creator><description>&lt;p&gt;Hi Hung Bui,&lt;/p&gt;
&lt;p&gt;Thank you for your detailed explanation, I understand the root cause of this issue.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to reduce the response time of read requests</title><link>https://devzone.nordicsemi.com/thread/58357?ContentTypeID=1</link><pubDate>Wed, 27 Jul 2016 13:51:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:38d12ef9-0723-4617-a4fe-b08a6396f2e5</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;@Ryan: Could you try to increase the timer to something longer than 1s ? I&amp;#39;m seeing from the sniffer trace that just after the first notification, you already have stacked up the buffer (MoreData (MD) bit was set) .
In addition, I&amp;#39;m seeing that you have two function to send notification, humidity_measurement_send and temperature_measurement_send() this will queue two packet per 1 seconds and since you can only send one packet per connection event. It will pile up the queue.
If you don&amp;#39;t want to increase the timeout to say 2seconds, you can try to change the connection interval to 300ms, so that it would be able to handle your data throughput (2 packet per seconds ).
You can think of integrate the 2 characteristics into one if you don&amp;#39;t have to many bytes (less than 20 in total) and send one notification for both of them.&lt;/p&gt;
&lt;p&gt;Also please check and make sure you don&amp;#39;t have authorization properties on your characteristic. This authorization requires the application to accept before it send the read response back.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to reduce the response time of read requests</title><link>https://devzone.nordicsemi.com/thread/58358?ContentTypeID=1</link><pubDate>Wed, 27 Jul 2016 02:23:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b05d0331-190e-4e46-91cb-fa6b6088934c</guid><dc:creator>Ryan Huang</dc:creator><description>&lt;p&gt;Hi Hung Bui,&lt;/p&gt;
&lt;p&gt;I start a timer and then setting 1s timeout to sample data and and send data with hvx.&lt;/p&gt;
&lt;p&gt;Please see &lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/example.c"&gt;code snippet&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Ryan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to reduce the response time of read requests</title><link>https://devzone.nordicsemi.com/thread/58355?ContentTypeID=1</link><pubDate>Tue, 26 Jul 2016 13:11:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ce2ae34d-d69c-44dc-9269-29c93e026ecd</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;The peripheral should queue the notification packet. Could you let me know how do you send the notification ? Adding some code snippet in the question would help. How frequent do you sample data and send data with hvx ? I can see that the connection interval is 1s if you have timer interval shorter than that, you will stack up the queue.
If you don&amp;#39;t want to use timer, you can use the BLE_EVT_TX_COMPLETE event to queue the next data. BLE_EVT_TX_COMPLETE event return when there is a packet sent in the last connection event.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to reduce the response time of read requests</title><link>https://devzone.nordicsemi.com/thread/58354?ContentTypeID=1</link><pubDate>Tue, 26 Jul 2016 11:47:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4ac2410f-a38e-49e1-9fa2-81e7022d2965</guid><dc:creator>Ryan Huang</dc:creator><description>&lt;p&gt;Hi Hung Bui,&lt;/p&gt;
&lt;p&gt;Thanks for your reply!&lt;/p&gt;
&lt;p&gt;Which one will queue notification packets, peripheral or central? According to your first answer, the peripheral have used a timer to get a data, and then call sd_ble_gatts_hvx function to send notification with this data.&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to reduce the response time of read requests</title><link>https://devzone.nordicsemi.com/thread/58353?ContentTypeID=1</link><pubDate>Tue, 26 Jul 2016 10:38:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a8881743-ae19-4d47-b5ff-a79356a11198</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Ryan,&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;You can use a timer instead of queuing when you have data, so you only send notification (cal hvx function) every 1 second for example.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Yes, this only applies if you plan to have shorter connection interval for the whole operation. It may not be effective if you only switch to short interval for the read request and then switch back again. (But still it will be shorter than the 7 seconds latency as the connection param request will be sent without waiting for the queue of notification to be finished).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The one on &lt;a href="https://github.com/NordicSemiconductor/pc-ble-driver"&gt;github&lt;/a&gt; is the latest one and can be used. I don&amp;#39;t think we will release new official ble_driver_pc soon.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to reduce the response time of read requests</title><link>https://devzone.nordicsemi.com/thread/58352?ContentTypeID=1</link><pubDate>Tue, 26 Jul 2016 02:19:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:41cd7b4e-7167-4852-bc42-4d96e4155875</guid><dc:creator>Ryan Huang</dc:creator><description>&lt;p&gt;Hi Hung Bui,&lt;/p&gt;
&lt;p&gt;Thanks for your reply!&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;The solution for it is to not to queue too many notification so that the read response can be sent earlier. How can I implement this solution on ble driver or its application?&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;you can temporary change the connection interval so the read response will arrive faster. Your mean when the central send read request, central use the &amp;quot;sd_ble_gap_conn_param_update&amp;quot; function set new connection interval again. Is right? But the peripheral will send the BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST event again, so then central need respond this event again. This event will always occur in cycles.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;When will you release a new S130 version for this ble driver? The release will important for me when we develop our platform.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to reduce the response time of read requests</title><link>https://devzone.nordicsemi.com/thread/58351?ContentTypeID=1</link><pubDate>Mon, 25 Jul 2016 12:44:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:17d71d92-6322-40dc-b5a8-0fdacaef29aa</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Update: I missed the part you said that it was faster if no notification enabled. What happened was that the S130 only allow one packet per connection event, and if you already queued 8 notification packets, the read response will have to wait for these 8 packets to be transmitted before it can transmit.
Since the S130 only allow one packet per connection event, it take 7 events to transmit all of them.&lt;/p&gt;
&lt;p&gt;In your case with Android phone, there are more packet per connection interval allowed, so you can see the response come sooner.&lt;/p&gt;
&lt;p&gt;The solution for it is to not to queue too many notification so that the read response can be sent earlier. Or you can temporary change the connection interval so the read response will arrive faster (but this will consume more power).&lt;/p&gt;
&lt;p&gt;Another option is to use newer S130 version, but the official version of ble driver is not released yet. You can have a look &lt;a href="https://github.com/NordicSemiconductor/pc-ble-driver"&gt;here&lt;/a&gt; for the latest driver that use S130 v2.0.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to reduce the response time of read requests</title><link>https://devzone.nordicsemi.com/thread/58350?ContentTypeID=1</link><pubDate>Mon, 25 Jul 2016 12:22:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:43ad7889-a037-454e-a409-ec78fd970fee</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;@Ryan: Do you have authorization set for the characteristic ?
If you don&amp;#39;t send notification packets does the response still take a lot of time to come ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>