<?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 avoid delays and retrieve the samples on time ?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/24054/how-to-avoid-delays-and-retrieve-the-samples-on-time</link><description>Sorry if these questions are discussed already. I&amp;#39;m a newbie to Bluetooth project. Let me explain in brief. I have a central and peripheral device. I am transmitting 10samples/10ms (dummy data) through BLE and the central device is receiving those samples</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 07 Aug 2017 18:16:04 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/24054/how-to-avoid-delays-and-retrieve-the-samples-on-time" /><item><title>RE: How to avoid delays and retrieve the samples on time ?</title><link>https://devzone.nordicsemi.com/thread/94713?ContentTypeID=1</link><pubDate>Mon, 07 Aug 2017 18:16:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c7ad984e-18ae-4da1-8e98-fe733711dd9c</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;This is great news and wise decision. That&amp;#39;s also the reason why I would be never afraid to use Write or Notify GATT methods on nRF5x with your stack. However there are other products and architectures which make this difficult (e.g. by splitting BLE stack lower then ATT between two microcontrolers with HCI or something similar) or simply are buggy/not so well implemented. So if we speak about (G)ATT data transfer in general we need to be (theoretically) careful...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to avoid delays and retrieve the samples on time ?</title><link>https://devzone.nordicsemi.com/thread/94712?ContentTypeID=1</link><pubDate>Mon, 07 Aug 2017 15:12:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:520e6b9f-2335-4db4-a96c-fbaf1a9b15c7</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;@Endnode: If the RX buffer on ATT layer is full, the softdevice will NACK the packet on LL. (this happens when you don&amp;#39;t fetch the events out of the stack and let them being collected there )
So, no, there will be no situation when your packet is missing on upper layer when on lower layer it&amp;#39;s ACKed.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to avoid delays and retrieve the samples on time ?</title><link>https://devzone.nordicsemi.com/thread/94710?ContentTypeID=1</link><pubDate>Mon, 07 Aug 2017 11:37:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:21104e87-b9a1-4dfa-a9fb-eb309ec9b8f0</guid><dc:creator>Nivetha</dc:creator><description>&lt;p&gt;Okay. @endnode that&amp;#39;s a big explanation. Thank you:)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to avoid delays and retrieve the samples on time ?</title><link>https://devzone.nordicsemi.com/thread/94711?ContentTypeID=1</link><pubDate>Mon, 07 Aug 2017 11:29:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:699406e5-1b04-4dc9-9773-a6b87b41309e</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;If the packet is &amp;quot;lost in radio ether&amp;quot; (meaning that receiving entity doesn&amp;#39;t hear it - either because there is some interference and part of the packet looks corrupted, or because it was out of reach end receiver&amp;#39;s sensitivity didn&amp;#39;t trigger the stack at all or for whatever else reason) then yes, LL will take care about re-transmitting it as long as it gets received by peer or connection time-outs completely. But if ATT/GATT data of Notify method get somehow lost in lower stack and don&amp;#39;t reach your app (being that embedded FW on Nordic nRF5x SoC on top of Nordic stack or some other stack like Zephyr or Mynewt or if your app is mobile app sitting on top of Android or iOS API sitting on top of BLE HCI and that sitting on top of low layer BLE stack in the chipset of your phone/tablet etc.) then you have problem. Luckily it seems this is not happening in the wild.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to avoid delays and retrieve the samples on time ?</title><link>https://devzone.nordicsemi.com/thread/94709?ContentTypeID=1</link><pubDate>Mon, 07 Aug 2017 11:09:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f8d5deb5-71bc-42d8-bf97-9a5120a048f4</guid><dc:creator>Nivetha</dc:creator><description>&lt;p&gt;So, when packets are lost in notifications, it will still be retransmitted right?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to avoid delays and retrieve the samples on time ?</title><link>https://devzone.nordicsemi.com/thread/94708?ContentTypeID=1</link><pubDate>Mon, 07 Aug 2017 09:53:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a872ec3b-1228-42b8-bb22-ff5bf82986d5</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;Yes, every LL packet on BT LE has 1-packet window ack. mechanism meaning that Link Layer doesn&amp;#39;t send next packet before indication in opposite direction shows it has received the packet. See how BT LE LL works in any BLE presentation/overview. On GATT layer Notifications are unacknowledged so what can happen is that LL layer in the controller receives it (so signals to the counterpart that all goes fine) but higher ATT/GATT layers are busy or running out of buffers or whatever and packet is lost there. This is real scenario and if you are afraid of it you must use Indications (and Write with Response in opposite direction). However there are no reports that this would ever happen with the stacks out there in the wild so that&amp;#39;s why everyone uses Notifications (because it gives you double the bandwidth against &amp;quot;double acked&amp;quot; Indication).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to avoid delays and retrieve the samples on time ?</title><link>https://devzone.nordicsemi.com/thread/94714?ContentTypeID=1</link><pubDate>Mon, 07 Aug 2017 08:55:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b52ddeb4-9c7a-447d-a454-4b9097d68dad</guid><dc:creator>Nivetha</dc:creator><description>&lt;p&gt;@Hung Bui: I am transmitting samples as Notifications. Are Notifications still Acked by the Link Layer? The BLE specification says that Indications are acknowledged by the GATT layer, while Notifications are not.
It also says, that each and every packet is acknowledged and, if necessary, retransmitted by the Link-Layer.
Retransmission will persist until either the packet is acknowledged or the link is dropped. This is true regardless of the transport method (Read / Write / Notification / Indication).
Please clarify.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to avoid delays and retrieve the samples on time ?</title><link>https://devzone.nordicsemi.com/thread/94715?ContentTypeID=1</link><pubDate>Fri, 04 Aug 2017 11:40:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e27289de-7678-4fc4-8224-76143d4463c0</guid><dc:creator>Nivetha</dc:creator><description>&lt;p&gt;@Hung Bui: I understand that BLE is a reliable protocol. I&amp;#39;m currently using for a medical application where there should be minimal retransmissions i.e. packets should be received on time for 90-95 percent of the cases. Although this application is not life threatening, it has to trigger other devices such as respiratory support based on the reception of data. Hence, I am looking at how to reduce delays/connection loss etc. @endnode: I got the nrf52 DK to act as a sniffer and trying to debug packet loss, etc. As you said, there could be something wrong with the data packing at the FW level. Looking into it. Thanks for the optimization ideas:)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to avoid delays and retrieve the samples on time ?</title><link>https://devzone.nordicsemi.com/thread/94706?ContentTypeID=1</link><pubDate>Fri, 04 Aug 2017 10:28:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2257c260-2cd5-40d7-b661-fb112aab8158</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;That&amp;#39;s why I would expect to see majority of transfers taking 1 connection interval (=10ms) and few being spread over 2/3/... and 0 (once there goes multiple PDUs per interval because interference is gone and stack is flushing all packets from the pipe). Do you agree? Any idea why Nivetha has it shifted on her graph by 1 interval?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to avoid delays and retrieve the samples on time ?</title><link>https://devzone.nordicsemi.com/thread/94707?ContentTypeID=1</link><pubDate>Fri, 04 Aug 2017 10:09:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:759382af-6513-4803-add5-f5a4e255b14e</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;@Nivetha: Note that BLE is a reliable protocol. A packet will be re-transmitted until it&amp;#39;s ACKed by the peer. So if you have some interference, packet will be re-transmitted and it can easily take 2 or more connection event to delivery a packet if there are lots of interference , wifi for example. It&amp;#39;s not possible to guarantee a hard real time requirement with BLE.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to avoid delays and retrieve the samples on time ?</title><link>https://devzone.nordicsemi.com/thread/94705?ContentTypeID=1</link><pubDate>Fri, 04 Aug 2017 09:50:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cc7e0d81-79e0-419b-9871-da6fa4a12563</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;Hard to say;) Are you waiting for &amp;quot;TX_COMPLETE&amp;quot; events (or their newer replacements in latest SDKs) or you just send data as SD call as soon as you have them ready? Also are you sure that time really makes it 10ms? But these things are hard to debug over the forum, that&amp;#39;s something you need to find with debugger, logical analyzer, sniffer...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to avoid delays and retrieve the samples on time ?</title><link>https://devzone.nordicsemi.com/thread/94704?ContentTypeID=1</link><pubDate>Fri, 04 Aug 2017 09:45:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7690ecd8-2f7b-4145-ba46-a6dfd2dc43a1</guid><dc:creator>Nivetha</dc:creator><description>&lt;p&gt;okay, Thanks! Queuing wrongly is more likely to be the central or the peripheral?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to avoid delays and retrieve the samples on time ?</title><link>https://devzone.nordicsemi.com/thread/94703?ContentTypeID=1</link><pubDate>Fri, 04 Aug 2017 09:41:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b38a85fa-52e7-41f8-bf94-800e7e280c30</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;The thing running on top of S140 which you compile into HEX:) It uses GAP&amp;amp;GATT API of the Soft Device and there shouldn&amp;#39;t be big space for big mistakes but still you can be queuing the packets wrongly and losing one connection interval... sniffer trace and/or some low-level RTT/UART debug trace showing timer ticks vs. GATT packet calls vs. GATT events&amp;#39; flow should be the way to debug and optimize.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to avoid delays and retrieve the samples on time ?</title><link>https://devzone.nordicsemi.com/thread/94702?ContentTypeID=1</link><pubDate>Fri, 04 Aug 2017 09:36:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e2660fab-17d6-4729-86b1-4c2a61c3a6f5</guid><dc:creator>Nivetha</dc:creator><description>&lt;p&gt;What did you refer as FW here?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to avoid delays and retrieve the samples on time ?</title><link>https://devzone.nordicsemi.com/thread/94716?ContentTypeID=1</link><pubDate>Thu, 03 Aug 2017 17:12:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1d5afcf0-e69d-4b6a-83d7-cb3d1530a584</guid><dc:creator>Nivetha</dc:creator><description>&lt;p&gt;Thanks a lot Jan for clarifying my doubts. At the central device, I used Realterm to connect to the port and logged the data. Then later used some scripts to analyse it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to avoid delays and retrieve the samples on time ?</title><link>https://devzone.nordicsemi.com/thread/94701?ContentTypeID=1</link><pubDate>Thu, 03 Aug 2017 16:19:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eb24a153-7271-45f0-ae61-06d0398944c6</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;Hi Nivetha,&lt;/p&gt;
&lt;p&gt;Your graph looks maybe strange on the first sight but in general you are almost there from my perspective:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;If you use Notifications to send data every 10ms then you should see major load on 10ms line with (possibly as few as possible) dots on 20ms (or even higher in case of some longer disturbance) and 0ms (this one compensates the loss when several packets waits in the stack and get finally transported within single connection interval) lines.&lt;/li&gt;
&lt;li&gt;The fact that you see very similar effect (maybe with too many re-transmissions on +10ms line) but with +10ms offset signals that you either use wrong GATT methods or that some part of the system waste all that.&lt;/li&gt;
&lt;li&gt;It can be inside your FW or it could simply be only by using UART output (how are the data linked between receiving event in your FW and UART driver?) or just simply systematic error on the PC host where you analyze UART serial data.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;BLE trace from (e.g. Nordic) sniffer will definitely help to understand if your BLE GATT protocol is optimal, then you can move forward in debugging.&lt;/p&gt;
&lt;p&gt;Cheers Jan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>