<?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>[Qeustion] data send delay error</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/41058/qeustion-data-send-delay-error</link><description>HI, I am seungwoo 
 
 I am developing data transmission using nrf52810. 
 
 A 300-kilobyte file is divided into 220 bytes and transmitted continuously. 
 11-27 17:24:24.416 W 15138 lbs_tag_service woo send4 packetInteration = 212total = 1543 11-27 17</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 05 Dec 2018 06:55:55 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/41058/qeustion-data-send-delay-error" /><item><title>RE: [Qeustion] data send delay error</title><link>https://devzone.nordicsemi.com/thread/160306?ContentTypeID=1</link><pubDate>Wed, 05 Dec 2018 06:55:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c393c8a2-84dc-4308-a8e9-2b6f51eef52c</guid><dc:creator>seungwooWoo</dc:creator><description>&lt;p&gt;HI,&amp;nbsp;&lt;a class="internal-link view-user-profile" href="https://devzone.nordicsemi.com/members/afnowakowski"&gt;Aleksander Nowakowski&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I will contact you with further inquiries.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I tested with another device.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;SAME = MTU 256 , packet 1534&lt;/p&gt;
&lt;p&gt;1. Nexus5(central) -&amp;gt; Nexus5(BleUARTPeripheral)&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; -&amp;nbsp;&lt;a href="https://github.com/thejeshgn/BleUARTPeripheral/tree/v1.0"&gt;https://github.com/thejeshgn/BleUARTPeripheral/tree/v1.0(source &lt;/a&gt;code)&lt;/p&gt;
&lt;p&gt;12-05 15:47:15.609 W 8770 lbs_tag_service woo onCharacteristicWrite = 340total = 1543 status = 0&lt;br /&gt;12-05 15:47:15.610 E 2940 bt_att gatt_act_write() failed op_code=0x52 rt=143&lt;br /&gt;12-05 15:47:16.252 W 8770 lbs_tag_service woo onCharacteristicWrite = 341total = 1543 status = 0&lt;/p&gt;
&lt;p&gt;The same congested error occurs.&lt;br /&gt;But it only takes &lt;strong&gt;0.7 seconds&lt;/strong&gt; to send the next pack.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;2.&amp;nbsp;&lt;span&gt;Nexus5(central) -&amp;gt;&amp;nbsp;nrf52810(ble_app_uart)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;br /&gt;11-27 17:24:24.416 W 15138 lbs_tag_service woo send4 packetInteration = 212total = 1543&lt;br /&gt;11-27 17:24:24.418 E 2945 bt_att gatt_act_write() failed op_code=0x52 rt=143&lt;br /&gt;11-27 17:24:26.236 W 15138 lbs_tag_service woo send4 packetInteration = 213total = 1543&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The same congested error occurs.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;But it only takes&amp;nbsp;2&lt;strong&gt;&amp;nbsp;seconds&lt;/strong&gt;&amp;nbsp;to send the next pack.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Can you tell why this difference appears?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks you&lt;/span&gt;&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: [Qeustion] data send delay error</title><link>https://devzone.nordicsemi.com/thread/160167?ContentTypeID=1</link><pubDate>Tue, 04 Dec 2018 10:22:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4e25f4c6-28d2-4bfc-a176-2348a285a768</guid><dc:creator>seungwooWoo</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;a class="internal-link view-user-profile" href="https://devzone.nordicsemi.com/members/afnowakowski"&gt;Aleksander Nowakowski&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Thank you very much for your quick reply.&lt;/p&gt;
&lt;p&gt;I am currently testing through nexus5.&lt;br /&gt;The phone supports DLE.&lt;br /&gt;Therefore, even if the MTU size exceeds 200 bytes, it operates normally.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I think it is the fastest way to use Write Without Response.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;However, there is a delay due to GATT_CONNECTION_CONGESTED, which occurs when the queue is full on the bluetooth bleed stack.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I say precisely&lt;/p&gt;
&lt;p&gt;GATT_CONNECTION_CONGESTED does not occur, and we ask if we can send packet continuously.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Even if MTU size and interval are modified, the same GATT_CONNECTION_CONGESTED occurs.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://issuetracker.google.com/issues/37121017"&gt;https://issuetracker.google.com/issues/37121017&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;And above, it seems that the android queue is full.&lt;/p&gt;
&lt;p&gt;How can I fix this?&lt;/p&gt;
&lt;p&gt;&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: [Qeustion] data send delay error</title><link>https://devzone.nordicsemi.com/thread/159909?ContentTypeID=1</link><pubDate>Mon, 03 Dec 2018 09:23:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3a88c9cb-6d14-45d2-83be-ade463961d3e</guid><dc:creator>Aleksander Nowakowski</dc:creator><description>&lt;p&gt;What phone are you using for testing?&lt;/p&gt;
&lt;p&gt;The 2nd approach you mentioned:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span&gt; &amp;gt; 1 ~ 100 packet (&lt;/span&gt;&lt;span&gt;WRITE_TYPE_NO_RESPONSE)&amp;nbsp; -&amp;gt;101&amp;nbsp; packet (Write type default) -&amp;gt; 102&amp;nbsp; ~ 200&amp;nbsp;(WRITE_TYPE_NO_RESPONSE)&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;should not increase the transfer time a lot. When you send the data with WRITE_TYPE_NO_RESPONSE, the onCharacteristicWrite callback is called when the data are written to the outgoing queue, not when they were sent. That&amp;#39;s why it may seem as they were send super fast, while you just have filled the buffer, which is then processed much slower. The delay, which you get by putting the WRITE_TYPE_DEFAULT in the middle, or also at the end, is just to ensure that he buffer gets empty before you put more data into it. So the transfer indeed would be a bit slower, as the Write With Response takes the whole connection interval (1 packet instead of 6 is sent), but prevents from overflowing the buffer.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;To increase the speed you may experiment with different connection intervals, MTU, try phones supporting DLE (Data Length Extension, Android 6+ required, but not all phones support it). In longer connection interval you may fit more data if they are send without response.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Also, the slowest connection interval supported by Android is 11.25 ms (until Lollipop it was 7.5ms).&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;And remember, that you may send only MTU-3 bytes using Write Without Response in a single write. For example, the default MTU is 23, which is 20 bytes of data available.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [Qeustion] data send delay error</title><link>https://devzone.nordicsemi.com/thread/159906?ContentTypeID=1</link><pubDate>Mon, 03 Dec 2018 09:17:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ac153b8c-7ad9-480c-80c2-ca6780f3c1e8</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could you let me know what was your actual speed you achieved in your test ?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Note that there is no guarantee that you will have 6 packets per connection at interval 12ms. It&amp;#39;s depends on the phone and the size of your MTU. We need to have a sniffer trace to see what exactly happened over the air.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;When writing with response, you can&amp;#39;t achieve highest throughput because that command can&amp;#39;t be stacked, you need to wait for the first one to finish be fore you send the next one.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [Qeustion] data send delay error</title><link>https://devzone.nordicsemi.com/thread/159875?ContentTypeID=1</link><pubDate>Mon, 03 Dec 2018 08:06:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1a22ce1f-ef79-4ae9-b759-041984ebfbfc</guid><dc:creator>seungwooWoo</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;a class="internal-link view-user-profile" href="https://devzone.nordicsemi.com/members/afnowakowski"&gt;Aleksander Nowakowski&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Answer Thank you very much.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;If I look at the speed I currently calculate&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;Number of packets sent per second&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;1packet (MTU byte) * 6(Number of packets sent per Android 1 interval,&amp;nbsp; nexus5 6) * 83(interval 12ms) = 500 packet&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;However, as mentioned above, there are about 200 GATT_CONNECTION_CONGESTED problems.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;So I have two questions.&lt;/p&gt;
&lt;p&gt;1.&amp;nbsp;Does Nordic chip affect processing speed?&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; - I use&amp;nbsp;&lt;span&gt;nrf52810, ble_app_uart ( default , interval 12ms, buffer 256)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;2.&amp;nbsp;Can you improve on android side?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp;-&amp;nbsp;&amp;nbsp;I tried the test in the following way.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 1 ~ 100 packet (&lt;/span&gt;&lt;span&gt;WRITE_TYPE_NO_RESPONSE)&amp;nbsp; -&amp;gt;101&amp;nbsp; packet (Write type default) -&amp;gt; 102&amp;nbsp; ~ 200&amp;nbsp;(WRITE_TYPE_NO_RESPONSE)&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;In this case, &lt;strong&gt;the same problem does not occur.&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;However, it takes longer to transfer.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;In my opinion, the best way is to send data continuously with WRITE_TYPE_NO_RESPONSE with an MTU of 244 bytes.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;But this causes GATT_CONNECTION_CONGESTED to be a problem.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Can you tell me in detail what you need to fix or fix to improve?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;Thanks&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&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: [Qeustion] data send delay error</title><link>https://devzone.nordicsemi.com/thread/159717?ContentTypeID=1</link><pubDate>Fri, 30 Nov 2018 13:47:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1d3c40a3-374a-4085-92f3-9e23b779f0cf</guid><dc:creator>Aleksander Nowakowski</dc:creator><description>&lt;p&gt;Hi &lt;a href="https://devzone.nordicsemi.com/members/seungwoowoo"&gt;seungwooWoo&lt;/a&gt;,&lt;/p&gt;
&lt;p&gt;On Android, after calling writeCharacteristic, you have to wait for onCharacteristcWrite callback before you may call next operation, e.x. next writeCharacteristic. We recommend using our BLE Library (&lt;a href="https://github.com/NordicSemiconductor/Android-BLE-Library/"&gt;https://github.com/NordicSemiconductor/Android-BLE-Library/)&lt;/a&gt;, which handles all the queueing for you + handles most common problems. There is alternative, for example RxAndroidBLE etc.&lt;/p&gt;
&lt;p&gt;If you are sending data from the Android without response, on Android 5 and older you also have to ensure that the buffer doesn&amp;#39;t get overflown. To do this you may either send each n-th (n=~200) packet as Write With Response (Write type default), or use some other synchronization mechanizm. In DFU we were using notifications, which we called PRN (Packet Receipt Notification). They had to be sent every n packets from the peripheral when the device has received all n packets. Since Marshmallow the Android handles buffer overflow on it&amp;#39;s own and it just postpones the onCharacteristicWrite callback until the buffer is available again.&lt;/p&gt;
&lt;p&gt;Best Regards,&lt;/p&gt;
&lt;p&gt;Aleksander&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>