<?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 determine the number of packets per connection interval</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/57230/how-to-determine-the-number-of-packets-per-connection-interval</link><description>Hi, 
 I am currently working on a project to transfer data from a computer to an embedded device. During the implementation, I encountered problems to achieve the required data throughput. I noticed that the measured 20kB/s did not come close to the expectations</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 10 Feb 2020 09:15:29 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/57230/how-to-determine-the-number-of-packets-per-connection-interval" /><item><title>RE: How to determine the number of packets per connection interval</title><link>https://devzone.nordicsemi.com/thread/233456?ContentTypeID=1</link><pubDate>Mon, 10 Feb 2020 09:15:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:99b1fe24-be2b-4af6-848d-7afd95cd9fdb</guid><dc:creator>Sigurd</dc:creator><description>[quote user="Harinben"]Are there any known reports that have measured the BLE throughput with the PCA10059 in combination with the pc-ble-driver?[/quote]
&lt;p&gt;&amp;nbsp;No, unfortunately not.&lt;/p&gt;
[quote user="Harinben"]Or are there any useful examples?[/quote]
&lt;p&gt;&amp;nbsp;For pc-ble-driver we have the&amp;nbsp;&lt;a title="heart_rate_collector" href="https://github.com/NordicSemiconductor/pc-ble-driver/tree/master/examples/heart_rate_collector"&gt;heart_rate_collector&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a title="heart_rate_monitor" href="https://github.com/NordicSemiconductor/pc-ble-driver/tree/master/examples/heart_rate_monitor"&gt;heart_rate_monitor&lt;/a&gt;&amp;nbsp;example. For measuring throughput, we have the&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/ble_sdk_app_att_mtu.html?resultof=%22%62%6c%65%5f%61%70%70%5f%61%74%74%5f%6d%74%75%5f%74%68%72%6f%75%67%68%70%75%74%2c%22%20"&gt;ble_app_att_mtu_throughput example&lt;/a&gt; in the SDK, but nothing on the pc-ble-driver side.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to determine the number of packets per connection interval</title><link>https://devzone.nordicsemi.com/thread/233201?ContentTypeID=1</link><pubDate>Fri, 07 Feb 2020 08:44:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8818a9d3-73f0-4bbb-8324-fef97c9f8475</guid><dc:creator>Harinben</dc:creator><description>&lt;p&gt;The primary issue has been resolved for me. I will mark the correct answer.&lt;br /&gt;&lt;br /&gt;But I have one last question. Are there any known reports that have measured the BLE throughput with the PCA10059 in combination with the pc-ble-driver? Or are there any useful examples?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to determine the number of packets per connection interval</title><link>https://devzone.nordicsemi.com/thread/232868?ContentTypeID=1</link><pubDate>Wed, 05 Feb 2020 14:34:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0b763840-6d0f-4198-982a-4b16ce459086</guid><dc:creator>Sigurd</dc:creator><description>[quote user="Harinben"]Because of this I achieve higher data throughput[/quote]
&lt;p&gt;&amp;nbsp;Great!&lt;/p&gt;
[quote user="Harinben"]Is it correct that the &amp;quot;Get&amp;quot;-function does not work?[/quote]
&lt;p&gt;&amp;nbsp;That is correct.&amp;nbsp;sd_ble_opt_get is not supported for this option.&lt;/p&gt;
[quote user="Harinben"]Is this delay of the master fixed or can it be configured by a parameter?[/quote]
&lt;p&gt;You cannot change this, it takes longer time to send a long packet.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to determine the number of packets per connection interval</title><link>https://devzone.nordicsemi.com/thread/232729?ContentTypeID=1</link><pubDate>Wed, 05 Feb 2020 07:42:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b0efc740-20a7-4040-aa3c-13b2521981c0</guid><dc:creator>Harinben</dc:creator><description>&lt;p&gt;Sorry for the delay. I did some tests yesterday.&lt;/p&gt;
&lt;p&gt;I was able to get several packets with MTU size 247 per connection interval sent yesterday. Because of this I achieve higher data throughput&lt;/p&gt;
&lt;p&gt;As recommended I have looked at the option extended BLE connection event. It was already set on the firmware side. But I can&amp;#39;t make an exact statement on the PC side (sd_api_v3), because the function&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;sd_ble_opt_get(BLE_COMMON_OPT_CONN_EVT_EXT, &amp;amp;opt);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;returns an NRF_ERROR_NOT_SUPPORTED error. But the &amp;quot;Set&amp;quot;-function does not return an error, so I assume that it works. Is it correct that the &amp;quot;Get&amp;quot;-function does not work?&lt;/p&gt;
[quote userid="15146" url="~/f/nordic-q-a/57230/how-to-determine-the-number-of-packets-per-connection-interval/232405"]You are sending write commands from the master, and sending notifications from the slave? [/quote]
&lt;p&gt;Right. To maximize the data throughput I decided to acknowledge the data with notifications on application level.&lt;/p&gt;
[quote userid="15146" url="~/f/nordic-q-a/57230/how-to-determine-the-number-of-packets-per-connection-interval/232405"]Could you save and upload the sniffer log ?[/quote]
&lt;p&gt;Sure.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/7612.MTU_5F00_size_5F00_227.pcapng"&gt;devzone.nordicsemi.com/.../7612.MTU_5F00_size_5F00_227.pcapng&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/6138.MTU_5F00_size_5F00_247.pcapng"&gt;devzone.nordicsemi.com/.../6138.MTU_5F00_size_5F00_247.pcapng&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I noticed something else. In the sniffer data (MTU size 227) you can see that the slave answers with a lower latency (~1ms), but the master sends the next packet with a delay of &amp;gt;2ms. Is this delay of the master fixed or can it be configured by a parameter?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to determine the number of packets per connection interval</title><link>https://devzone.nordicsemi.com/thread/232405?ContentTypeID=1</link><pubDate>Mon, 03 Feb 2020 16:35:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f0246cfd-96d8-4973-8cfe-f80d0e67e49f</guid><dc:creator>Sigurd</dc:creator><description>[quote user="Harinben"]If I have understood it correctly, it would be best if I set NRF_SDH_BLE_GAP_EVENT_LENGTH &lt;span&gt;equal to connection interval. Correct?&lt;/span&gt;[/quote]
&lt;p&gt;It depends. By setting it even higher you&amp;nbsp;should be able to queue more packets.&lt;/p&gt;
&lt;p&gt;You might also want to enable&amp;nbsp;&lt;span&gt;extended BLE connection events:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;void conn_evt_len_ext_set(bool status)
{
    ret_code_t err_code;
    ble_opt_t  opt;

    memset(&amp;amp;opt, 0x00, sizeof(opt));
    opt.common_opt.conn_evt_ext.enable = status ? 1 : 0;

    err_code = sd_ble_opt_set(BLE_COMMON_OPT_CONN_EVT_EXT, &amp;amp;opt);
    APP_ERROR_CHECK(err_code);

}&lt;/pre&gt;&lt;/p&gt;
[quote user="Harinben"]Is it possible that there is a limitation on the USB dongle firmware?[/quote]
&lt;p&gt;&amp;nbsp;There could be some added latency, but the MD-bit indicats the the SoftDevice&amp;nbsp;had more data to send. You are sending write commands from the master, and sending notifications from the slave? Could you save and upload the sniffer log ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to determine the number of packets per connection interval</title><link>https://devzone.nordicsemi.com/thread/232396?ContentTypeID=1</link><pubDate>Mon, 03 Feb 2020 15:22:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:27f04aed-d83e-4af5-b8ee-f3c757738213</guid><dc:creator>Harinben</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Thank you for the quick response.&lt;/p&gt;
&lt;p&gt;If I have understood it correctly, it would be best if I set NRF_SDH_BLE_GAP_EVENT_LENGTH &lt;span&gt;equal to connection interval. Correct?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I have checked these parameters in my test setup.&amp;nbsp;NRF_SDH_BLE_GAP_EVENT_LENGTH is set to 12 (*1.25ms = 15ms) in sdk_config.h. This value should also allow more than one packet with MTU size 247 bytes.&lt;/p&gt;
&lt;p&gt;On the PC side, BLE_CONN_BW_HIGH is already set as suggested in your code snippet.&lt;/p&gt;
&lt;p&gt;Is it possible that there is a limitation on the USB dongle firmware?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to determine the number of packets per connection interval</title><link>https://devzone.nordicsemi.com/thread/232342?ContentTypeID=1</link><pubDate>Mon, 03 Feb 2020 13:29:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aa234288-dd04-4786-91fb-b8cb6034e6bf</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;For SoftDevice v.6.x, as long as packets are&amp;nbsp;queued in the SoftDevice when the connection event starts, the Softdevice will try to send as many packets as it can in the the connection interval, as long as the&amp;nbsp;time set aside for the connection on every connection interval is not&amp;nbsp;exceeded, this limit can be&amp;nbsp;configured with &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.3.0/group__nrf__sdh__ble__config.html?cp=7_5_0_6_11_65_2_0_45#gae8ebe11ee1b9ed9b0f57e6b0df122070"&gt;NRF_SDH_BLE_GAP_EVENT_LENGTH &lt;/a&gt;(in sdk_config.h), and as long as there is still packets in the&amp;nbsp;&lt;span&gt;queue.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;For SoftDevice v.3, you can configure the bandwidth for the central like this (documentation&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.api.v3.0.0/structble__common__opt__conn__bw__t.html?cp=4_5_2_7_2_0_2_3_12"&gt;here&lt;/a&gt;):&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;     /*Configure bandwidth */
 ble_opt_t ble_opt;
 ble_common_opt_conn_bw_t conn_bw;
 memset(&amp;amp;conn_bw, 0x00, sizeof(conn_bw));
 memset(&amp;amp;ble_opt, 0x00, sizeof(ble_opt));

 conn_bw.conn_bw.conn_bw_rx = BLE_CONN_BW_HIGH;
 conn_bw.conn_bw.conn_bw_tx = BLE_CONN_BW_HIGH;
 conn_bw.role = BLE_GAP_ROLE_CENTRAL;
 
 ble_opt.common_opt.conn_bw = conn_bw;
 
 uint32_t err_code = sd_ble_opt_set(BLE_COMMON_OPT_CONN_BW, &amp;amp;ble_opt);
 APP_ERROR_CHECK(err_code);&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>