<?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>Dropped packets</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/55187/dropped-packets</link><description>Test Setup: 
 SD 6.1.0 
 SDK 15.2.0 
 Peripheral: nRF52840 
 Central: iOS 13.1 
 Central is connected to two peripherals, each peripheral is sending 50 pkt/s, each packet has 13 bytes of payload. Connection interval is 30ms. Over hundreds of hours of</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 16 Dec 2019 15:23:20 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/55187/dropped-packets" /><item><title>RE: Dropped packets</title><link>https://devzone.nordicsemi.com/thread/225710?ContentTypeID=1</link><pubDate>Mon, 16 Dec 2019 15:23:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ee414c2a-d94e-4f6b-8e12-14bd6289e8bd</guid><dc:creator>mchartier</dc:creator><description>&lt;p&gt;There is nothing more I can do for this issue except wait for another occurrence and then analyze the logs. Please close this ticket.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dropped packets</title><link>https://devzone.nordicsemi.com/thread/225551?ContentTypeID=1</link><pubDate>Mon, 16 Dec 2019 09:05:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c0d05db9-55c9-4614-a369-d486e4e74669</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;There should be no downside to increasing MTU and LL size no. If you are only able to send 1 packet/interval, a sniffer log may be helpful:&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Download:&lt;br /&gt;&lt;/span&gt;&lt;span&gt;&lt;a href="https://www.nordicsemi.com/Software-and-tools/Development-Tools/nRF-Sniffer-for-Bluetooth-LE"&gt;https://www.nordicsemi.com/Software-and-tools/Development-Tools/nRF-Sniffer-for-Bluetooth-LE&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;span&gt;Documentation:&lt;br /&gt;&lt;/span&gt;&lt;span&gt;&lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fug_sniffer_ble%2FUG%2Fsniffer_ble%2Fintro.html"&gt;https://infocenter.nordicsemi.com/index.jsp?topic=%2Fug_sniffer_ble%2FUG%2Fsniffer_ble%2Fintro.html&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Then we can find if the peripheral have set the MD (more data) bit when transmitting packets, and if indeed iOS ignore it.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;br /&gt;Kenneth&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dropped packets</title><link>https://devzone.nordicsemi.com/thread/225235?ContentTypeID=1</link><pubDate>Thu, 12 Dec 2019 17:25:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a480b6ba-8167-4a68-9e9e-a792d6503907</guid><dc:creator>mchartier</dc:creator><description>&lt;p&gt;I made all the code changes I listed above and I confirmed the queue size has increased and the SD is able to send multiple packets per connection interval.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I will also consider your suggestion to increase ATT MTU size to 247 bytes. Is there any downside to making this change? I imagine it will require more memory but that will not be a problem.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Side note: The SD always reports a single packet was transmitted when I receive the event&amp;nbsp;BLE_GATTS_EVT_HVN_TX_COMPLETE. In my case it seems the TX_COMPLETE event is sent for every single packet even when the SD is able to transmit multiple packets in the connection interval.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dropped packets</title><link>https://devzone.nordicsemi.com/thread/225034?ContentTypeID=1</link><pubDate>Wed, 11 Dec 2019 20:38:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5ccf8750-e06f-4ca3-9cdf-e773d8b9a99f</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Have in mind that&amp;nbsp;max_rx_time and&amp;nbsp;max_tx_time is just how long a single packet can be transmitted/received, so these large numbers typically apply to coded phy where the on-air packet is much longer in time due to slower on-air data rate. These two values do not impact throughput.&lt;/p&gt;
&lt;p&gt;You can find throughput numbers here depending on configuration:&lt;br /&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/sds_s140/SDS/s1xx/ble_data_throughput/ble_data_throughput.html?cp=4_5_3_0_16"&gt;https://infocenter.nordicsemi.com/topic/sds_s140/SDS/s1xx/ble_data_throughput/ble_data_throughput.html?cp=4_5_3_0_16&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Using maximum&amp;nbsp;ATT MTU size (247bytes)/LL payload size&lt;span style="font-size:10px;"&gt;(251bytes)&lt;/span&gt;&amp;nbsp;is my best recommendation to increase throughput.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dropped packets</title><link>https://devzone.nordicsemi.com/thread/224813?ContentTypeID=1</link><pubDate>Tue, 10 Dec 2019 19:13:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e2121706-7c76-4c34-9539-bcef24a5d3f8</guid><dc:creator>mchartier</dc:creator><description>&lt;p&gt;Another data point:&amp;nbsp; I enabled debug logging in the GATT module and I see this in the logs:&lt;/p&gt;
&lt;pre&gt; nrf_ble_gatt: Updating data length to 53 on connection 0x0.
 nrf_ble_gatt: Data length updated to 53 on connection 0x0.
 nrf_ble_gatt: max_rx_octets: 53
 nrf_ble_gatt: max_tx_octets: 53
 nrf_ble_gatt: max_rx_time: 2120
 nrf_ble_gatt: max_tx_time: 2120&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;The data length is correct. However max_tx_time is 2120us which seems&amp;nbsp;very short given that I set NRF_SDH_BLE_GAP_EVENT_LENGTH to 100 which equates to 125ms. By my calculations 2120 is almost exactly the time required to transmit 4 packets with a payload of 49B.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;49B Tx Time = 8 * (49 + 17) / 10^6 = 528us&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;2120us / 528us = 4.01&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-weight:400;"&gt;Therefore my code changes are not having the desired affect. In fact increasing the GAP event length to 200 had no effect on the max_tx_time.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dropped packets</title><link>https://devzone.nordicsemi.com/thread/224801?ContentTypeID=1</link><pubDate>Tue, 10 Dec 2019 17:55:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:48c33900-8ade-41d8-a4ca-c7f0cfa3eb24</guid><dc:creator>mchartier</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/53909/sending-multiple-packets-at-every-interrupt-interval/218004#218004"&gt;This ticket &lt;/a&gt;seems relevant to my issue. I read at least 20 related tickets and some are contradictory, so please let me know if the referenced ticket is misleading in any way. I based my code changes on this ticket.&lt;/p&gt;
&lt;p&gt;I looked through all possible error codes for&amp;nbsp;&lt;span&gt;sd_ble_gatts_hvx() and the most likely error is&amp;nbsp;NRF_ERROR_RESOURCES. I only send 13B packets at 50hz so fundamentally this is not a throughput issue. Instead I believe the central may have a problem keeping up and/or there is a radio issue. Those are events I cannot control, but I do need to design the system so it can handle a certain number of packet retransmissions causing delays causing packets to accumulate in the Tx queue. So I need a &amp;quot;good&amp;quot; sized queue and I need to make sure the SD is configured properly so it can drain the queue when the radio link is good. This means sending multiple packets per connection interval until the queue is drained. How can I make sure my configuration is correct.&amp;nbsp;I have no visibility into the number of retransmissions or the queue size or the number of packets sent per connection interval. All I can do is configure the SD in a way that I think is optimal for my application. So to that end here is the configuration I plan to try. Please let me know if you see any way to improve on this:&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;nRF is acting as peripheral with just 1 BLE link to the central&lt;/li&gt;
&lt;li&gt;Maximum notification packet size 49B, typical packet size is 13B&lt;/li&gt;
&lt;li&gt;Notifications are sent at 50hz&lt;/li&gt;
&lt;li&gt;LFCLK accuracy = 100ppm&lt;/li&gt;
&lt;li&gt;GAP data length = 49+4&lt;/li&gt;
&lt;li&gt;GAP event length = 100&lt;/li&gt;
&lt;li&gt;GATT max MTU size = 49&lt;/li&gt;
&lt;li&gt;Tx queue size is determined by the SD. Should I override this somehow?&lt;/li&gt;
&lt;li&gt;Connection interval 30ms&lt;/li&gt;
&lt;li&gt;Slave latency 0&lt;/li&gt;
&lt;li&gt;Connection supervision timeout 3s&lt;/li&gt;
&lt;li&gt;Connection event extension = enabled&lt;/li&gt;
&lt;/ul&gt;
&lt;pre&gt;&lt;/pre&gt;
&lt;p&gt;&lt;span&gt;The last setting is unclear to me. If I do not explicitly enable connection event extension, does that mean the SD will only send 1 packet per connection interval?&amp;nbsp; And what is the downside (or tradeoff) when this setting is enabled?&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The queue size chosen by the SD seems to be limited by the length of the connection interval. I would double that queue size if I could so the system could tolerate longer periods of time when packet retransmits are required. &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;But whatever the queue size, I need to define the application behavior when the queue becomes full. Several tickets suggest waiting for the system to transmit one packet from the queue before trying to send any new packets. However I don&amp;#39;t see how this changes anything. My application will just keep&amp;nbsp;calling&amp;nbsp;sd_ble_gatts_hvx() and simply count the errors. Implementing a busy flag just complicates the logic without any obvious benefit, or am I missing something.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;pre&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dropped packets</title><link>https://devzone.nordicsemi.com/thread/224036?ContentTypeID=1</link><pubDate>Thu, 05 Dec 2019 21:31:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1ca84921-e2f6-4cac-b27c-02ddf04220ea</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Not saying Apple have an issue, just trying to say that an lfclk out of of tolerance (either to due to hardware or timing issue&amp;nbsp;in scheduler) would give the same symptoms &amp;quot;dropped packets&amp;quot;.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dropped packets</title><link>https://devzone.nordicsemi.com/thread/224026?ContentTypeID=1</link><pubDate>Thu, 05 Dec 2019 17:58:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8b6e01a2-f115-437c-a677-586e87fd17a7</guid><dc:creator>mchartier</dc:creator><description>&lt;p&gt;Ahh, now I remember that setting. LF accuracy is indeed set to 20ppm. I assume there would be a power penalty if I increase the setting to 100ppm. Should I assume the clock accuracy of the iPhone is not published and not well known? I am no expert on these oscillators but I know they only cost $0.20 for a good one so it just seems unlikely Apple would use a cheaper part with worse accuracy.&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dropped packets</title><link>https://devzone.nordicsemi.com/thread/224022?ContentTypeID=1</link><pubDate>Thu, 05 Dec 2019 16:39:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c8c92cc3-0ef6-4b30-ad3c-1d0e12b1b083</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;In your project you should find a&amp;nbsp;NRF_SDH_CLOCK_LF_ACCURACY value. This is typically used in&amp;nbsp;nrf_sdh_enable_request() when calling&amp;nbsp;sd_softdevice_enable(). You can set this value to something larger than the tolerance of the physical crystal you have in your design, by setting it larger you can compensate for a peer that may be slightly out of it&amp;#39;s own tolerance spec. For instance if you have 20ppm in your design you likely have used&amp;nbsp;NRF_CLOCK_LF_ACCURACY_20_PPM, however you may set it to&amp;nbsp;NRF_CLOCK_LF_ACCURACY_100_PPM.&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dropped packets</title><link>https://devzone.nordicsemi.com/thread/223988?ContentTypeID=1</link><pubDate>Thu, 05 Dec 2019 15:06:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b1857939-b791-4075-83f6-0ba6eea175f1</guid><dc:creator>mchartier</dc:creator><description>&lt;p&gt;Not sure how I would change the LF clock tolerance. Is that a setting in the SD or would I need to replace the physical crystal?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dropped packets</title><link>https://devzone.nordicsemi.com/thread/223928?ContentTypeID=1</link><pubDate>Thu, 05 Dec 2019 13:41:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d84f1a95-0268-4d64-8a3c-d1769f7fec4f</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;I have seen in the past that sometimes the peer device have an lfclk which exceed their reported tolerance, to compensate for this it is possible to set the tolerance of the local clock to be a bit relaxed. So it may be worth trying&amp;nbsp;&lt;span&gt;+- 100ppm just to see if that may be help here (though I doubt).&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Kenneth&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dropped packets</title><link>https://devzone.nordicsemi.com/thread/223726?ContentTypeID=1</link><pubDate>Wed, 04 Dec 2019 23:39:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4971b06f-e014-460c-b19d-179851dd064c</guid><dc:creator>mchartier</dc:creator><description>&lt;p&gt;#define NRFX_CLOCK_CONFIG_LF_SRC 1&lt;/p&gt;
&lt;p&gt;LF clock tolerance is +- 20ppm&lt;/p&gt;
&lt;p&gt;Yes iOS 13 is a bugger of a release which gives us an easy out with the customer in the short term.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dropped packets</title><link>https://devzone.nordicsemi.com/thread/223704?ContentTypeID=1</link><pubDate>Wed, 04 Dec 2019 18:45:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b8cb32c9-4c7a-45b7-8f34-768e41ed1521</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;If this is with an iOS device, then check out:&lt;br /&gt;&lt;a href="https://developer.apple.com/accessories/Accessory-Design-Guidelines.pdf"&gt;https://developer.apple.com/accessories/Accessory-Design-Guidelines.pdf&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Also in general, it may be worth asking the customer to install the latest iOS version (even Beta), they are fixing issues constantly, and I have seen that Beta have solved issues in the past. Though, a sniffer log would be very helpful to prove one way or the other.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;What lfclk source and tolerance have you configured here?&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dropped packets</title><link>https://devzone.nordicsemi.com/thread/223668?ContentTypeID=1</link><pubDate>Wed, 04 Dec 2019 15:14:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9d79ae9a-f60f-446b-9ae3-098f642a10f2</guid><dc:creator>mchartier</dc:creator><description>&lt;p&gt;I should have clarified I was sending notifications with sd_ble_gatts_hvx() so your guess was spot on.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The problem was never seen in ~9mo of development. We only see this in one customer device so we will try to get that device and see if we can dupe the problem in the lab. My hunch is that iOS is nack&amp;#39;ing enough to cause an overflow in the Tx buffer, although I don&amp;#39;t understand why iOS would consistently send nacks for one peripheral and not the other when they are both sending notifications at the same rate. The nRF application will just ignore the error and proceed with the next notification. I can add some error counters and capture the return code from sd_ble_gatts_hvx() and find a way to send that information over to the central so it can be logged.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Should I be looking closer at the BLE connection parameters? I know the peripheral must negotiate with central to get the preferred connection parameters, but how would I know if the Central is not cooperating?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Dropped packets</title><link>https://devzone.nordicsemi.com/thread/223510?ContentTypeID=1</link><pubDate>Wed, 04 Dec 2019 09:22:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8999b7ab-5f4d-4517-8da5-94c7007afe39</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;All communication in BLE should be reliable, does&amp;nbsp;sd_ble_gatts_hvx() return any error code in this situation? Do you have any on-air sniffer log that show the issue?&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>