<?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 packet drop during transmission</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/111601/ble-data-packet-drop-during-transmission</link><description>.Hi Nordic Support team, 
 
 I&amp;#39;m using NRF52832, SoftDevice S132, SDK version is nRF5_SDK_17.1.0_ddde560. 
 I want to transmit 9 bytes of data collected from an I2C sensor every 2.5ms via BLE. The sensor has an internal buffer so I can queue up to 288</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 10 Jun 2024 20:37:35 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/111601/ble-data-packet-drop-during-transmission" /><item><title>RE: BLE data packet drop during transmission</title><link>https://devzone.nordicsemi.com/thread/488192?ContentTypeID=1</link><pubDate>Mon, 10 Jun 2024 20:37:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7c19f34b-30b5-42d9-aef6-412cfc06aea9</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Hi Xander,&lt;/p&gt;
&lt;p&gt;Thank you&amp;nbsp;for the kind words. Sorry again for the&amp;nbsp;bad information I gave.&lt;/p&gt;
&lt;p&gt;I hope your issue is resolved now. If so, please feel free to close this ticket at your convenience.&lt;/p&gt;
&lt;p&gt;Hope to see you again too &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Hieu&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE data packet drop during transmission</title><link>https://devzone.nordicsemi.com/thread/488179?ContentTypeID=1</link><pubDate>Mon, 10 Jun 2024 18:08:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7b616f6e-baf7-4341-864b-e482f8fd3266</guid><dc:creator>Xander To</dc:creator><description>&lt;p&gt;Hi Hieu,&lt;/p&gt;
&lt;p&gt;Thank you for the explanation and the amendment. I understand them now.&amp;nbsp;I hope you a great day and I will see you again somewhere on this forum in the future&amp;nbsp;&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/263a.svg" title="Relaxed"&gt;&amp;#x263a;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Xander&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE data packet drop during transmission</title><link>https://devzone.nordicsemi.com/thread/488155?ContentTypeID=1</link><pubDate>Mon, 10 Jun 2024 13:26:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c9bd35df-cedb-4b7b-b739-9fbc2bfce0c9</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Hi Xander,&lt;/p&gt;
&lt;p&gt;My apologies. I am totally wrong about &lt;span&gt;NRF_SDH_BLE_GAP_EVENT_LENGTH. It&amp;nbsp;is not negotiated. I will have to edit all of my previous replies with a note up top to highlight this &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f61e.svg" title="Disappointed"&gt;&amp;#x1f61e;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The configurations tell the device how long it can stay in the connection. When it runs out of data to send, or when the peer device wants to stop the connection event, then the connection event will end.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Increasing it could help&amp;nbsp;the device to utilize as much as possible of the connection interval to transmit data.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Hieu&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE data packet drop during transmission</title><link>https://devzone.nordicsemi.com/thread/487581?ContentTypeID=1</link><pubDate>Wed, 05 Jun 2024 21:47:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:18f2be9d-bfa6-4a76-846c-88d766b67b2d</guid><dc:creator>Xander To</dc:creator><description>&lt;p&gt;Hi Hieu,&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t understand. What I see in the screenshot is MTU size only. Where does it mention&amp;nbsp;&lt;span&gt;Connection Event Length?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;br /&gt;Best regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Xander&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE data packet drop during transmission</title><link>https://devzone.nordicsemi.com/thread/487490?ContentTypeID=1</link><pubDate>Wed, 05 Jun 2024 11:31:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7c2773e6-cca6-4677-bfb6-c5e336fed830</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Hi Xander,&lt;/p&gt;
[quote user="Xander To"]&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;cursor:zoom-in;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/8168.pastedimage1717020766741v1.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;[/quote]
&lt;p&gt;Your log here shows the negotiated Connection Event Length. nrf_ble_gatt.c has the parameter logged at L315-L322. The unit is us.&lt;/p&gt;
&lt;p&gt;Please try to tune the Connection Event Length to see if there are any differences.&amp;nbsp;But as noted before, the Connection Event Length, Connection Interval, Data Length are all ultimately decided by the central devices. If the central device in your case are smart phones/tablets, then you should setup your device to be as flexible as possible. In your case, that would be handling NRF_ERROR_RESOURCES from&amp;nbsp;&lt;span&gt;sd_ble_gatts_hvx() gracefull, and deriving a fallback/failsafe mechanism in case the BLE connection cannot consume data from the sensor fast enough (discard oldest data, or newest data, and/or include a notification that data was not consumed quickly enough).&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Hieu&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE data packet drop during transmission</title><link>https://devzone.nordicsemi.com/thread/487391?ContentTypeID=1</link><pubDate>Tue, 04 Jun 2024 23:48:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e0c585ba-21f6-4b64-8224-4fa2dbdd584a</guid><dc:creator>Xander To</dc:creator><description>&lt;p&gt;Hi Hieu,&lt;/p&gt;
&lt;p&gt;Is there any way to verify the negotiated&amp;nbsp;&lt;span&gt;NRF_SDH_BLE_GAP_EVENT_LENGTH value?&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Xander&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE data packet drop during transmission</title><link>https://devzone.nordicsemi.com/thread/487347?ContentTypeID=1</link><pubDate>Tue, 04 Jun 2024 13:29:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d2fd5c4b-1181-4169-b611-d6c96a8a6c93</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Hi Xander,&lt;/p&gt;
[quote user="Xander To"]&lt;p&gt;I&amp;#39;m a bit confused here. I thought the&amp;nbsp;&lt;span&gt;NRF_SDH_BLE_GAP_EVENT_LENGTH&amp;nbsp; is a parameter of NRF that won&amp;#39;t need to be negotiated between NRF and other peers. So if I set 6, it means 6 will be applied no matter what. But you said:&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;div&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/111601/ble-data-packet-drop-during-transmission/487058"&gt;Hieu said:&lt;/a&gt;&lt;/div&gt;&lt;div&gt;From your log, GAP Data Length was successfully updated to 251.&lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;/div&gt;
&lt;p&gt;I though 251 is like MTU packet size and has nothing to do with GAP event length. Can you please explain this to me?&lt;/p&gt;[/quote]
&lt;p&gt;My apology. I read&amp;nbsp;&lt;span&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/group__nrf__sdh__ble__config.html#gae8ebe11ee1b9ed9b0f57e6b0df122070"&gt;NRF_SDH_BLE_GAP_&lt;strong&gt;EVENT&lt;/strong&gt;_LENGTH&lt;/a&gt; but in my head I perceived &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/group__nrf__sdh__ble__config.html#ga0e2b6fffdd2381c0f02052a20c6add6b"&gt;NRF_SDH_BLE_GAP_&lt;strong&gt;DATA&lt;/strong&gt;_LENGTH&lt;/a&gt;&amp;nbsp;for some reasons.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Update: The following crossed out information about Connection Event (Length) is incorrect. See&amp;nbsp;my next reply for the correct information.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration:line-through;"&gt;But Event Length is also a part of the connection parameter negotiation, and the value you give is not the value that will be applied no matter what. &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration:line-through;"&gt;In most common cases, the negotiated value will be the lower one between the two peers, and&amp;nbsp;modern smart&amp;nbsp;phones usually&amp;nbsp;are capable of higher&amp;nbsp;length, thus make the Event Length effectively the value you set with&amp;nbsp;NRF_SDH_BLE_GAP_EVENT_LENGTH.&lt;/span&gt;&lt;/p&gt;
[quote user="Xander To"]I&amp;#39;m also confused with &amp;quot;Connection Event Length Extension&amp;quot;. Does it extend the connection interval when there is less data to transmit to save power, or does it spend more time sending data per connection interval?[/quote]
&lt;p&gt;With &amp;quot;Connection Event Length Extension,&amp;quot; the Connection Interval is not extended. The Connection Event within the Interval is extended. It&amp;#39;s technically &amp;quot;spending more time sending data per connection interval.&amp;quot;&lt;/p&gt;
&lt;p&gt;For more information, see&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/sds_s140/SDS/s1xx/multilink_scheduling/extend_connection_event.html"&gt;Connection timing with Connection Event Length Extension&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Hieu&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE data packet drop during transmission</title><link>https://devzone.nordicsemi.com/thread/487164?ContentTypeID=1</link><pubDate>Mon, 03 Jun 2024 17:15:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:94f1e76f-15de-4712-9b74-f66987cf276b</guid><dc:creator>Xander To</dc:creator><description>&lt;p&gt;Hi Hieu,&lt;/p&gt;
&lt;p&gt;I&amp;#39;m a bit confused here. I thought the&amp;nbsp;&lt;span&gt;NRF_SDH_BLE_GAP_EVENT_LENGTH&amp;nbsp; is a parameter of NRF that won&amp;#39;t need to be negotiated between NRF and other peers. So if I set 6, it means 6 will be applied no matter what. But you said:&lt;/span&gt;&lt;/p&gt;
[quote userid="9456" url="~/f/nordic-q-a/111601/ble-data-packet-drop-during-transmission/487058"]From your log, GAP Data Length was successfully updated to 251.[/quote]
&lt;p&gt;I though 251 is like MTU packet size and has nothing to do with GAP event length. Can you please explain this to me?&lt;/p&gt;
&lt;p&gt;I&amp;#39;m also confused with &amp;quot;Connection Event Length Extension&amp;quot;. Does it extend the connection interval when there is less data to transmit to save power, or does it spend more time sending data per connection interval?&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span&gt;Best regards,&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;Xander&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE data packet drop during transmission</title><link>https://devzone.nordicsemi.com/thread/487058?ContentTypeID=1</link><pubDate>Mon, 03 Jun 2024 08:56:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:887d53ef-f99a-4ec0-8c6e-7c68350aac49</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Hi Xander,&lt;/p&gt;
&lt;p&gt;&lt;span&gt;NRF_SDH_BLE_GAP_EVENT_LENGTH&amp;nbsp;is better for power concern. &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Lowering the connection interval usually increases power consumption.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;However, are you sure&amp;nbsp;NRF_SDH_BLE_GAP_EVENT_LENGTH&amp;nbsp;is 6? From your log, GAP Data Length was successfully updated to 251.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Hieu&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE data packet drop during transmission</title><link>https://devzone.nordicsemi.com/thread/486768?ContentTypeID=1</link><pubDate>Fri, 31 May 2024 05:23:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c029ff94-2dfd-473d-89d6-c77fea673ebc</guid><dc:creator>Xander To</dc:creator><description>&lt;p&gt;Hi Hmolesworth,&lt;/p&gt;
&lt;p&gt;Should I increase&amp;nbsp;&lt;span&gt;NRF_SDH_BLE_GAP_EVENT_LENGTH&amp;nbsp; first or should I lower the connection interval first? Which one is better for low-power consumption applications?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Xander&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE data packet drop during transmission</title><link>https://devzone.nordicsemi.com/thread/486757?ContentTypeID=1</link><pubDate>Fri, 31 May 2024 01:36:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c08209a8-634d-4fa6-b737-a446c3c18728</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;Maybe try testing in a clean BLE- WiFi- etc- free environment and see if the problem goes away; Radio congestion leads to multiple attempts to send BLE packets until they succeed, which means some transmission effective rates are much slower than expected (in periodic intervals) and hence NRF_ERROR_RESOURCES error follows. Typically fix by using much larger intermediate buffers for packets than expected.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;NRF_ERROR_BUSY For @ref BLE_GATT_HVX_INDICATION Procedure already in progress. Wait for a @ref BLE_GATTS_EVT_HVC event and retry&lt;/em&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE data packet drop during transmission</title><link>https://devzone.nordicsemi.com/thread/486752?ContentTypeID=1</link><pubDate>Thu, 30 May 2024 22:40:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2ac8fd8a-f894-4f7a-bf04-06ccc8aded4a</guid><dc:creator>Xander To</dc:creator><description>&lt;p&gt;Hi Hieu,&lt;/p&gt;
&lt;p&gt;I have checked Hung&amp;#39;s suggestion. However, it still doesn&amp;#39;t explain why I have a queue-being-full issue.&lt;/p&gt;
&lt;p&gt;TX queue size is 18, which still causes this error,&amp;nbsp;meaning the BLE cannot keep up with the data rate I require. So I think it&amp;#39;s something in BLE parameters I need to reconfigure, instead of keep tracking the remaining slots in the queue. So I want to understand the mismatch between my calculation and the actual behaviour of BLE. Because I thought&amp;nbsp;&lt;span&gt;NRF_SDH_BLE_GAP_EVENT_LENGTH&amp;nbsp;&lt;/span&gt;&lt;span&gt;is 6, MTU size = 247 bytes, min connection interval = max connection interval = 60ms&amp;nbsp;and slave latency is 4 should be adequate for 216 bytes every 60ms + 2 bytes every 10 seconds.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Xander&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE data packet drop during transmission</title><link>https://devzone.nordicsemi.com/thread/486744?ContentTypeID=1</link><pubDate>Thu, 30 May 2024 19:34:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b8d4ba57-5347-4cfb-b6c8-635134f44f22</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Hi Xander,&lt;/p&gt;
&lt;p&gt;Yes, sd_ble_gatts_hvx() returning NRF_ERROR_RESOURCES means that the queue is full.&lt;/p&gt;
&lt;p&gt;The &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s140.api.v7.2.0/group___b_l_e___g_a_t_t_s___f_u_n_c_t_i_o_n_s.html#ga313fe43c2e93267da668572e885945db"&gt;documentation&lt;/a&gt; of the function contains some note on this exact error. It might give more insight it to check the relevant &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.api.v7.2.0/s132_msc_overview.html"&gt;Message Sequence Charts&lt;/a&gt;&amp;nbsp;as well.&lt;/p&gt;
&lt;p&gt;With such information in mind, please try to analyze the code and run some&amp;nbsp;testing to see if there are anything unexpected.&lt;/p&gt;
&lt;p&gt;Our colleague Hung discussed a little about handling the notification queue&amp;nbsp;in this DevZone case as well:&amp;nbsp;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/83204/sd_ble_gatts_hvx-returns-nrf-error-resources-while-transferring-bytes"&gt;sd_ble_gatts_hvx  returns NRF ERROR RESOURCES while transferring bytes&lt;/a&gt;&amp;nbsp;.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Hieu&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE data packet drop during transmission</title><link>https://devzone.nordicsemi.com/thread/486741?ContentTypeID=1</link><pubDate>Thu, 30 May 2024 19:23:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:58b90c12-a688-46be-99cd-9e2fe54a2a76</guid><dc:creator>Xander To</dc:creator><description>&lt;p&gt;Hi Hieu,&lt;/p&gt;
&lt;p&gt;Sorry for my mistake. It should be the function&amp;nbsp;&lt;span&gt;sd_ble_gatts_hvx, which means I cannot queue more in TX queue right?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Xander&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE data packet drop during transmission</title><link>https://devzone.nordicsemi.com/thread/486740?ContentTypeID=1</link><pubDate>Thu, 30 May 2024 19:22:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:db558461-2524-401b-b070-e9b995846a1c</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Hi Xander,&lt;/p&gt;
&lt;p&gt;What&amp;nbsp;function is returning NRF_ERROR_RESOURCES? I know in your opening post, you said sd_ble_gatts_value_set(), but according to &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s140.api.v7.2.0/group___b_l_e___g_a_t_t_s___f_u_n_c_t_i_o_n_s.html#ga2760c51ea71853bd74e2e7e7117ef52a"&gt;documentation&lt;/a&gt;, that function doesn&amp;#39;t return NRF_ERROR_RESOURCES.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Hieu&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE data packet drop during transmission</title><link>https://devzone.nordicsemi.com/thread/486736?ContentTypeID=1</link><pubDate>Thu, 30 May 2024 17:43:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dc80a12b-4db7-49a6-86ac-15d595b60572</guid><dc:creator>Xander To</dc:creator><description>&lt;p&gt;Hi Hieu,&lt;/p&gt;
[quote userid="9456" url="~/f/nordic-q-a/111601/ble-data-packet-drop-during-transmission/486709"]If you find that NRF_ERROR_RESOURCES is being thrown constantly, you should review your usage of the function that is returning that error, and consider changing configurations to&amp;nbsp;provide&amp;nbsp;the resource necessary, or handle the error differently.[/quote]
&lt;p&gt;But I still don&amp;#39;t understand why the&amp;nbsp;&lt;span&gt;NRF_ERROR_RESOURCES appears if we only send 1 MTU per 60ms (1 connection event). Every 10 seconds, there will be another MTU of 2 bytes being sent from the temperature characteristic. &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;As mentioned above, I have tried to increase the TX size to 18, so queue size shouldn&amp;#39;t be a problem but only the throughput is the problem. For every 1 connection interval (60ms), as I set&amp;nbsp;NRF_SDH_BLE_GAP_EVENT_LENGTH = 6, which means it will spend 7.5ms to send data for every 1 connection interval, right? And I think 1-2 MTU packets + a few more bytes for the packet header will still take less than 7.5ms to be sent over BLE, right? Can you please let me know if I misunderstood anything? I want to know what factor caused the&amp;nbsp;NRF_ERROR_RESOURCES&amp;nbsp;error in this case. Is it the connection interval, or is it the&amp;nbsp;NRF_SDH_BLE_GAP_EVENT_LENGTH&amp;nbsp;, or another parameter?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best&amp;nbsp; regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Xander&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE data packet drop during transmission</title><link>https://devzone.nordicsemi.com/thread/486709?ContentTypeID=1</link><pubDate>Thu, 30 May 2024 14:05:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7097655a-cd09-4dbb-a480-d3bf40c84361</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Hi Xander,&lt;/p&gt;
[quote user="Xander To"]I mean the NRF52832 has the I2C queue limits to 255 bytes. The sensor has no such limitation.[/quote]
&lt;p&gt;Ah OK. I would think that you could simply get all of the sensor&amp;#39;s buffer in two transactions instead, but your approach is just fine. I think I prefer that too.&lt;/p&gt;
[quote user="Xander To"]Where can I find an example of how to use DLE?[/quote]
&lt;p&gt;Your log suggests the GATT Module is being used, and the configurations are already done so that Data Length is&amp;nbsp;set to the maximum of 251. Not the max_rx_octets and max_tx_octets in the log.&lt;/p&gt;
[quote user="Xander To"]GAP events look fine to me. By the way, 1 interesting I found on this screenshot is on the line &amp;quot;Peer on connection 0x0 requested an ATT MTU of 527 bytes.&amp;quot;. Does this mean the other device (my PC) have requested 523 bytes?&amp;nbsp;I believe NRF52832 won&amp;#39;t support this high MTU size so both ends agree at 247 bytes MTU size?&amp;nbsp;[/quote]
&lt;p&gt;Your guess is completely correct.&lt;/p&gt;
[quote user="Xander To"]Connection intervals look correct to me as well from debug message as well.[/quote]
&lt;p&gt;I agree.&lt;/p&gt;
[quote user="Xander To"]We currently don&amp;#39;t do APP_ERROR_CHECK() for any data written to the BLE queue buffer because we believe this data rate must be able to handle these BLE parameters. I think data loss will happen because we ignore the&amp;nbsp;&lt;span&gt;NRF&lt;/span&gt;&lt;span&gt;_ERROR&lt;/span&gt;&lt;span&gt;_RESOURCES, which indicates data cannot be queued in the BLE TX queue.&lt;/span&gt;[/quote]
&lt;p&gt;APP_ERROR_CHECK() is actually just a sample handling of error. It is useful in various&amp;nbsp;corner cases, but for more common failures, it is better that a graceful handling is added in.&amp;nbsp;If you find that NRF_ERROR_RESOURCES is being thrown constantly, you should review your usage of the function that is returning that error, and consider changing configurations to&amp;nbsp;provide&amp;nbsp;the resource necessary, or handle the error differently.&lt;/p&gt;
[quote user="Xander To"]By the way, it&amp;#39;s nice to meet a Viet guy on this forum&amp;nbsp;&lt;span title="Handshake"&gt;&lt;img src="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/1f91d.svg" style="max-height:32px;max-width:32px;" alt="Handshake" /&gt;&lt;/span&gt;[/quote]
&lt;p&gt;The feeling is mutual &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE data packet drop during transmission</title><link>https://devzone.nordicsemi.com/thread/486526?ContentTypeID=1</link><pubDate>Wed, 29 May 2024 21:42:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:261c2e85-469f-4cd8-8b61-0309af80607f</guid><dc:creator>Xander To</dc:creator><description>&lt;p&gt;Hi Hieu,&lt;/p&gt;
[quote userid="9456" url="~/f/nordic-q-a/111601/ble-data-packet-drop-during-transmission/486479"]It is weird that the sensor can queue 288 bytes, but only allow 255 bytes read at a time.[/quote]
&lt;p&gt;I mean the NRF52832 has the I2C queue limits to 255 bytes. The sensor has no such limitation.&lt;/p&gt;
[quote userid="9456" url="~/f/nordic-q-a/111601/ble-data-packet-drop-during-transmission/486479"]However,&amp;nbsp;60ms should be more than enough to transmit 216 bytes, with or without DLE. So, something&amp;nbsp;is not right here.[/quote]
&lt;p&gt;I just simplified the real scenario. In my app, I poll the sensor every 60ms, returning 216 bytes. However, I hold them in a buffer and wait until the buffer size exceeds 243 bytes since this is the nearest multiple of 9 smaller than MTU size 247 bytes (I verified this number from the connection event). Therefore,&amp;nbsp;the first time the 60ms timer is timeout, there won&amp;#39;t be any MTU packet being sent (216 bytes &amp;lt; 243 bytes). But the second time timer timeout, 243 bytes of data from the buffer will be sent (with some remaining data left which will be sent from the third time timer timeout,... ). However, I don&amp;#39;t think this won&amp;#39;t be an issue as there cannot be any timeout 2 MTU packets will be sent.&lt;/p&gt;
[quote userid="9456" url="~/f/nordic-q-a/111601/ble-data-packet-drop-during-transmission/486479"]You don&amp;#39;t have to worry about connection event length, but you should use Data Length Extension (DLE), because the amount of overhead at that data size is too much.[/quote]
&lt;p&gt;Where can I find an example of how to use DLE?&lt;/p&gt;
[quote userid="9456" url="~/f/nordic-q-a/111601/ble-data-packet-drop-during-transmission/486479"]&lt;p&gt;To debug what the actual connection interval is, please check the GAP events.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;[/quote]
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1717020766741v1.png" /&gt;&lt;/p&gt;
&lt;p&gt;GAP events look fine to me. By the way, 1 interesting I found on this screenshot is on the line &amp;quot;Peer on connection 0x0 requested an ATT MTU of 527 bytes.&amp;quot;. Does this mean the other device (my PC) have requested 523 bytes?&amp;nbsp;I believe NRF52832 won&amp;#39;t support this high MTU size so both ends agree at 247 bytes MTU size?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1717022114249v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Connection intervals look correct to me as well from debug message as well.&lt;/p&gt;
[quote userid="9456" url="~/f/nordic-q-a/111601/ble-data-packet-drop-during-transmission/486479"]Furthermore, in BLE, packets cannot be dropped. If a packet is drop, the connection itself is also dropped, so if you don&amp;#39;t see a disconnection, but data is lost, then it might indicate a problem with preprocessing the data to be sent, or postprocessing the data received.&amp;nbsp;[/quote]
&lt;p&gt;We currently don&amp;#39;t do APP_ERROR_CHECK() for any data written to the BLE queue buffer because we believe this data rate must be able to handle these BLE parameters. I think data loss will happen because we ignore the&amp;nbsp;&lt;span&gt;NRF&lt;/span&gt;&lt;span&gt;_ERROR&lt;/span&gt;&lt;span&gt;_RESOURCES, which indicates data cannot be queued in the BLE TX queue.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;By the way, it&amp;#39;s nice to meet a Viet guy on this forum&amp;nbsp;&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f91d.svg" title="Handshake"&gt;&amp;#x1f91d;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE data packet drop during transmission</title><link>https://devzone.nordicsemi.com/thread/486479?ContentTypeID=1</link><pubDate>Wed, 29 May 2024 13:44:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:285916ea-d25d-4ec9-bfa1-3aba86b645c7</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Hi Xander,&lt;/p&gt;
[quote user=""]I want to transmit 9 bytes of data collected from an I2C sensor every 2.5ms via BLE. The sensor has an internal buffer so I can queue up to&amp;nbsp;288 bytes (80ms from empty to full sensor buffer). However, I2C can only receive 255 bytes per queue, so I only collect data from the sensor every 60ms, because for 60ms, the sensor produces 216 bytes of data and it is within 1 MTU packet ( configure it to be 247 bytes per MTU). That means I will send 1 MTU every 60ms. That means I only need a connection interval of 60ms. Am I correct?[/quote]
&lt;p&gt;It is weird that the sensor can queue 288 bytes, but only allow 255 bytes read at a time.&lt;/p&gt;
&lt;p&gt;Otherwise, this seems correct.&amp;nbsp;&lt;/p&gt;
[quote user=""]In my BLE structure, I also have another different characteristic that reports the device temperature (takes only 2 bytes) every 10 seconds (yes, second not milliseconds). However, from my experiment, 60ms cannot keep up with this data rate from both characteristics. Do I misunderstand anything? Should I use the connection event extension length?&amp;nbsp;[/quote]
&lt;p&gt;You don&amp;#39;t have to worry about connection event length, but you should use Data Length Extension (DLE), because the amount of overhead at that data size is too much.&lt;/p&gt;
&lt;p&gt;However,&amp;nbsp;60ms should be more than enough to transmit 216 bytes, with or without DLE. So, something&amp;nbsp;is not right here.&lt;/p&gt;
&lt;p&gt;To&amp;nbsp;change GAP Data Length, you can change &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/group__nrf__sdh__ble__config.html#ga0e2b6fffdd2381c0f02052a20c6add6b"&gt;NRF_SDH_BLE_GAP_DATA_LENGTH&lt;/a&gt;&amp;nbsp;in sdk_config.h.&lt;/p&gt;
[quote user=""]&lt;p&gt;&lt;span&gt;Here are my BLE parameters: NRF_SDH_BLE_GAP_EVENT_LENGTH&amp;nbsp;&lt;/span&gt;is 6. TX queue length is 1. Min connection interval = Max connection interval = 60ms. Save lantecy is 4.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I also have tried to increase the TX queue length to 18. Set Min connection interval = 30ms, Max connection interval = 120ms&lt;/p&gt;[/quote]
&lt;p&gt;For this, I would like to reuse my answer in another case:&lt;/p&gt;
[quote userid="9456" url="~/f/nordic-q-a/111122/simultaneous-connection-in-le-coded-phy/484666"]&lt;p&gt;Furthermore, please know that this is just what the&amp;nbsp;peripheral &amp;quot;proposes&amp;quot; to the central device. It is still the central device that decides the actual connection interval. To debug what the actual connection interval is, please check the GAP events.&lt;/p&gt;
&lt;p&gt;At the beginning of a connection,&amp;nbsp;BLE_GAP_EVT_CONNECTED is received, and the connection parameters can be&amp;nbsp;found in &lt;span&gt;ble_evt_t.&lt;/span&gt;ble_gap_evt_t.connected.&lt;/p&gt;
&lt;p&gt;After that, the connection parameters may be updated, BLE_GAP_EVT_CONN_PARAM_UPDATE&amp;nbsp;is received, and the connection parameters can be found in&amp;nbsp;&lt;span&gt;ble_evt_t.&lt;/span&gt;&lt;span&gt;ble_gap_evt_t.conn_param_update.&lt;/span&gt;&lt;/p&gt;[/quote]
&lt;p&gt;Furthermore, in BLE, packets cannot be dropped. If a packet is drop, the connection itself is also dropped, so if you don&amp;#39;t see a disconnection, but data is lost, then it might indicate a problem with preprocessing the data to be sent, or postprocessing the data received.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Hieu&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>