<?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>General questions on sending multiple packets in a connection interval (how to queue multiple packets)</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/87501/general-questions-on-sending-multiple-packets-in-a-connection-interval-how-to-queue-multiple-packets</link><description>Hi Nordic Magicians, 
 
 I have a couple of general questions when it comes to sending large amounts of data (FAST). Ultimately, I&amp;#39;m looking to transmit data with a throughput of about 1 Mb/s (each individual packet of data is 65 Bytes). System power</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 06 May 2022 21:16:08 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/87501/general-questions-on-sending-multiple-packets-in-a-connection-interval-how-to-queue-multiple-packets" /><item><title>RE: General questions on sending multiple packets in a connection interval (how to queue multiple packets)</title><link>https://devzone.nordicsemi.com/thread/366788?ContentTypeID=1</link><pubDate>Fri, 06 May 2022 21:16:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0e2d0764-7f7b-4527-8147-f25d505605ad</guid><dc:creator>ryerye120</dc:creator><description>&lt;p&gt;Hi Einarh,&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;Your guidance proved super invaluable!! Thank you for clarifying the difference between connection event length and the connection interval. I checked my throughput through using the att_mtu_throughput example (and using all the same settings that I had in my personal firmware) and it ended up being wayyyyyy less than I thought (only around 300kbps vs 1mbps).&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;After finding more optimal bluetooth settings with the throughput example I was able to achieve the desired 1+ mbps throughput.&lt;/p&gt;
&lt;p&gt;In case anyone comes here with a similar problem, let me highlight the most important changes I made to my firmware.&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;br /&gt;1) enable data length extension (so that multiple packets could be sent during a single connection)&lt;br /&gt;2) Increase my HVN queue size to 400 (so that the notification system would queue any notifications that couldn&amp;#39;t be sent in time - this gives me a little leeway in case there are any flukes)&lt;br /&gt;3) Adjusting&amp;nbsp;other ble stack settings to achieve a theoretical throughput of 1.2 Mbps (I figured these out by&amp;nbsp;testing different parameters&amp;nbsp;in the ble_app_mtu_throughput example)&lt;br /&gt;4) I began double buffering and adding a check in the CPU to retry sending the packet if ble_nus_data_send doesn&amp;#39;t return &amp;#39;success&amp;#39; when it&amp;#39;s called the first time.&lt;/p&gt;
&lt;p&gt;Furthermore, in order to send multiple packets during a single connection, all you need to do is call ble_nus_data_send() multiple times. If you have an HVN queue large enough, all of your packets will get queued and sent without you having to worry.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Again, Einarh, thanks for your guidance and clarification!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Kindest regards,&lt;/p&gt;
&lt;p&gt;Ryan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: General questions on sending multiple packets in a connection interval (how to queue multiple packets)</title><link>https://devzone.nordicsemi.com/thread/365961?ContentTypeID=1</link><pubDate>Tue, 03 May 2022 11:28:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c7fcb738-d160-4084-b017-1c1cbdb51165</guid><dc:creator>Einarh</dc:creator><description>&lt;p&gt;Hello&lt;/p&gt;
&lt;p&gt;1 Mb/s throughput is a lot but should be possible. Looking at &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsds_s140%2FSDS%2Fs1xx%2Fble_data_throughput%2Fble_data_throughput.html&amp;amp;cp=4_7_4_0_16"&gt;this page in the documentation&lt;/a&gt; it looks like you&amp;#39;ll have to use 2M PHY, if you&amp;#39;re not doing that already. I would also recommend referring to &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_nrf5_v17.1.0%2Fble_sdk_app_att_mtu.html"&gt;the throughput sample&lt;/a&gt; for pointers on how these things are set up if you haven&amp;#39;t already looked at it.&lt;/p&gt;
&lt;p&gt;Then for your questions:&lt;/p&gt;
[quote user=""]Enabling &amp;quot;connection event length extension&amp;quot; &lt;strong&gt;(does this make a difference if my min connection interval = max connection interval?)&lt;/strong&gt;[/quote]
&lt;p&gt;I believe you might have some concepts confused here. The connection interval is how often a connection event occurs. The Connection event length is how much of the time between two such events are spent sending data, versus waiting for the next event. So the connection event length can be at most the same as the connection interval (which would mean you are sending data all the time).&lt;/p&gt;
[quote user=""]I need to increase my hvn_tx_queue_size, correct?[/quote][quote user=""]When sd_ble_gatts_hvx returns NRF_SUCCESS, does that mean the packet was successfully added to the queue, or successfully transferred over bluetooth?[/quote]
&lt;p&gt;According to&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.s140.api.v7.3.0%2Fgroup___b_l_e___g_a_t_t_s___f_u_n_c_t_i_o_n_s.html&amp;amp;anchor=ga313fe43c2e93267da668572e885945db"&gt;the documentation&lt;/a&gt;:&lt;/p&gt;
&lt;p&gt;The number of Handle Value Notifications that can be queued is configured by ble_gatts_conn_cfg_t::hvn_tx_queue_size.&lt;/p&gt;
&lt;p&gt;NRF_SUCCESS:&amp;nbsp;Successfully queued a notification or indication for transmission, and optionally updated the attribute value.&lt;/p&gt;
[quote user=""]There&amp;#39;s nothing else I need to change, right?[/quote][quote user=""]This means I should be able to just call it multiple times and it should handle everything for me, correct?[/quote]
&lt;p&gt;I believe so, but have you tested if it works as expected?&lt;/p&gt;
&lt;p&gt;Have you checked what is received at the other end?&lt;/p&gt;
&lt;p&gt;Have you tested your current throughput?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>