<?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>low peripheral gatt data transmit throughput with s132-5.0</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/29228/low-peripheral-gatt-data-transmit-throughput-with-s132-5-0</link><description>i took the original sdk 14.2.0 s132-5.0 ble-uart nus-service example for reference measurements to send data from a 52832 to an android device running nrf uart v2.0 
 to provide a measurable data stream i do not get data from the hw uart, but from a</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 16 Jan 2018 20:41:44 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/29228/low-peripheral-gatt-data-transmit-throughput-with-s132-5-0" /><item><title>RE: low peripheral gatt data transmit throughput with s132-5.0</title><link>https://devzone.nordicsemi.com/thread/116262?ContentTypeID=1</link><pubDate>Tue, 16 Jan 2018 20:41:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a4110dd3-271a-446e-a1ae-5a19e99f1703</guid><dc:creator>efiLabs</dc:creator><description>&lt;p&gt;thanks to Petter Myhre :&lt;/p&gt;
&lt;p&gt;your last suggestion of increasing hvn_tx_queue_size to a larger number worked&lt;/p&gt;
&lt;p&gt;i used the code as suggested below with the exception of setting it to 20 instead of 4&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/question/180809/changing-hvn_tx_queue_size-with-s132-v51/"&gt;devzone.nordicsemi.com/.../&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;here is my code in ble_stack_init&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;ret_code_t err_code ;

err_code = nrf_sdh_enable_request () ;
APP_ERROR_CHECK (err_code) ;

	// Configure the BLE stack using the default settings.
	// Fetch the start address of the application RAM.
uint32_t ram_start = 0 ;
err_code = nrf_sdh_ble_default_cfg_set (APP_BLE_CONN_CFG_TAG, &amp;amp;ram_start) ;
APP_ERROR_CHECK (err_code) ;

	// Max Packets Per Connection Event
ble_cfg_t ble_cfg ;
::memset (&amp;amp;ble_cfg, 0, sizeof ble_cfg) ;
ble_cfg.conn_cfg.conn_cfg_tag = CONN_CFG_TAG ;
ble_cfg.conn_cfg.params.gatts_conn_cfg.hvn_tx_queue_size = 20 ;
err_code = sd_ble_cfg_set (BLE_CONN_CFG_GATTS, &amp;amp;ble_cfg, ram_start) ;
APP_ERROR_CHECK (err_code) ;

	// Enable BLE stack.
err_code = nrf_sdh_ble_enable (&amp;amp;ram_start) ;
APP_ERROR_CHECK (err_code) ;

	// Register a handler for BLE events.
NRF_SDH_BLE_OBSERVER (m_ble_observer, APP_BLE_OBSERVER_PRIO, ::Ble_evt_handler, NULL) ;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;the inserted code is under the &amp;quot;// Max Packets Per Connection Event&amp;quot; comment&lt;/p&gt;
&lt;p&gt;i also added the following line in add_config.h&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#define NRF_SDH_BLE_GAP_EVENT_LENGTH 30
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;the data send throughput in ble_nus_string_send -&amp;gt; sd_ble_gatts_hvx
is now 120 byte strings in 20 byte chunks at a 45 ms period ... 120 * 22 = 2640 bytes / sec&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: low peripheral gatt data transmit throughput with s132-5.0</title><link>https://devzone.nordicsemi.com/thread/116261?ContentTypeID=1</link><pubDate>Tue, 16 Jan 2018 08:36:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3693686c-13f0-4060-b890-14eff88ac3f0</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;Thanks for the traces. What if you increase hvn_tx_queue_size to 6? This is set when you enable the SoftDevice.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: low peripheral gatt data transmit throughput with s132-5.0</title><link>https://devzone.nordicsemi.com/thread/116260?ContentTypeID=1</link><pubDate>Tue, 16 Jan 2018 03:35:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:73daa5b2-2ce7-412b-8ac3-d9626725340c</guid><dc:creator>efiLabs</dc:creator><description>&lt;p&gt;hi Petter : and thanks for the help so far&lt;/p&gt;
&lt;p&gt;i made the following change #define NRF_SDH_BLE_GAP_EVENT_LENGTH 39 in app_config.h, but nothing changed&lt;/p&gt;
&lt;p&gt;i also revised my testing including new wireshark traces as can be seen in a question addendum&lt;/p&gt;
&lt;p&gt;being not too versed with ble, i do not know what to change or improve the sdk 14.2.0 results&lt;/p&gt;
&lt;p&gt;looking at your statement : you have a connection interval of 48.75 ms&lt;/p&gt;
&lt;p&gt;as well as looking at the data provided by ble_evt_handler -&amp;gt; BLE_GAP_EVT_CONNECTED i also saw the &amp;quot;39&amp;quot; * 1.25 = 48.75 ms&lt;/p&gt;
&lt;p&gt;i assume that this can not be changed since it is enforced by the android nexus 7 central device ... or is there a way to talk the central device into it (specifically the nexus 7 or other android devices) ???&lt;/p&gt;
&lt;p&gt;now, the sdk 12.2.0 seems to send 6 times 20 byte gatt data packages per connection interval ... can this be changed to more than 6 ???&lt;/p&gt;
&lt;p&gt;why does the sdk 14.2.0 only seem to handle 4 or sometimes 5 times 20 byte gatt data packages per connection interval ???&lt;/p&gt;
&lt;p&gt;how can this be changed to 6 or more ???&lt;/p&gt;
&lt;p&gt;i read plenty of the nordic forum articles, but on some i just would not understand all the details, especially on how and where to make changes&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: low peripheral gatt data transmit throughput with s132-5.0</title><link>https://devzone.nordicsemi.com/thread/116259?ContentTypeID=1</link><pubDate>Mon, 15 Jan 2018 15:32:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:22aa9590-3579-4b79-8823-87a63ef148f6</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;From the sniffer trace I can see that you have a connection interval of 48.75 ms. This means that you should set the event length to 39.&lt;/p&gt;
&lt;p&gt;I can also see that you have some packet loss, maybe 1 out of 4-5 packets are re-transmitted.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: low peripheral gatt data transmit throughput with s132-5.0</title><link>https://devzone.nordicsemi.com/thread/116258?ContentTypeID=1</link><pubDate>Mon, 15 Jan 2018 04:50:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8737a923-4054-4e0a-b6b4-e6767fc6b9b2</guid><dc:creator>efiLabs</dc:creator><description>&lt;p&gt;hi Petter :&lt;/p&gt;
&lt;p&gt;thanks so far for your support ... i added a single wireshark trace taken from my heavy modified firmware, but the one with just the send data feed being altered from org shows the same errors in terms of dropped data ... if you could please have a quick look and maybe you can spot what&amp;#39;s wrong with the setup&lt;/p&gt;
&lt;p&gt;i can provide a side by side of slow and normal with the least altered firmware setups, but it&amp;#39;s a more elaborate setup for me to create it&lt;/p&gt;
&lt;p&gt;this trace &amp;quot;nrf52832-slow-varsz.pcapng&amp;quot; reflects test strings of
&amp;quot;123456789_ABCDEFGHI_JKLMNOPQR_STUVWXYZ0_123456789_abcdefghi_jklmnopqr_stuvwxyz0_123456789_&amp;quot;
data being put into the my send queue at 100 ms periods starting with &amp;quot;1\r\n&amp;quot; and then incremented to &amp;quot;12\r\n&amp;quot; and so on until the max length and then decremented the length by 1 and so on&lt;/p&gt;
&lt;p&gt;they are taken out of this sent queue in junks of up to 20 bytes at 5 ms periods and finally sent&lt;/p&gt;
&lt;p&gt;please let me now if this would be sufficient for starting&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: low peripheral gatt data transmit throughput with s132-5.0</title><link>https://devzone.nordicsemi.com/thread/116255?ContentTypeID=1</link><pubDate>Wed, 10 Jan 2018 10:01:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2f21d135-8348-42db-8b51-e63cc1e216c1</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;Please send me two sniffer traces first, and we will take it from there.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: low peripheral gatt data transmit throughput with s132-5.0</title><link>https://devzone.nordicsemi.com/thread/116256?ContentTypeID=1</link><pubDate>Wed, 10 Jan 2018 07:32:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e1646448-7a2a-4d79-a9d0-f6ab8b329936</guid><dc:creator>efiLabs</dc:creator><description>&lt;p&gt;to the question performance i would like to mention that the &amp;quot;Experimental: ATT_MTU Throughput Example&amp;quot; is a really nice idea, however i hope my needs for now are of easier nature like having an everyday android (nexus 7 2013) device supporting ble 4.0 communicating with the pca10040&lt;/p&gt;
&lt;p&gt;maybe all the suggested tests with 2 pca10040 talking to each other or the larger mtu along with the data length extension are i believe options for later revs after ble 4.0, like ble 4.2 and 5.0 ... i could be wrong, sorry&lt;/p&gt;
&lt;p&gt;i did not have a chance to repeat the wireshark traces ... no time today, but i will do it ... it&amp;#39;s quite an elaborate setup, switching all the different firmware projects along with the right softdevices, saving the data and verifying the integrity and i&amp;#39;m not a wireshark expert ... worked last with it when it was called ethereal on tcp/ip pkgs i believe&lt;/p&gt;
&lt;p&gt;with respect to the connection interval, i believe it&amp;#39;s the central device (nexus 7) which mostly dictates the setup ... also the initial setup data is the same for both ble nus example versions 12.2 vs 14.2&lt;/p&gt;
&lt;p&gt;measurements and observations are some stretchable terms one can be measured in time units and or data over time ... i used the term observation for the following undisturbed data amount over time&lt;/p&gt;
&lt;p&gt;i send the following data lines, one every defined time period = 100 ms&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;1\r\n
12\r\n
123\r\n
1234\r\n
12345\r\n
... fill in the missing data lines
123456789_ABCDEFGHI_JKLMNOPQR_STUVWXYZ0_123456789_abcdefghi_jklmnopqr_stuvwxyz0_1234567\r\n
123456789_ABCDEFGHI_JKLMNOPQR_STUVWXYZ0_123456789_abcdefghi_jklmnopqr_stuvwxyz0_12345678\r\n
123456789_ABCDEFGHI_JKLMNOPQR_STUVWXYZ0_123456789_abcdefghi_jklmnopqr_stuvwxyz0_123456789\r\n
123456789_ABCDEFGHI_JKLMNOPQR_STUVWXYZ0_123456789_abcdefghi_jklmnopqr_stuvwxyz0_12345678\r\n
... fill in the missing data lines
124\r\n
123\r\n
12\r\n
1\r\n
123\r\n
1234\r\n
... fill in the data missing lines
and on and on
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;the result of this test is that as soon as the line lengths exceed about a total of 80 chars i observe (realtive measure) some data drop ... i would call this kind of setup a high level real world test setup&lt;/p&gt;
&lt;p&gt;now the comparison measurement on a sdk 12.2 setup exhibits those data drops at a line repeat time of 30 ms which relates to a data throughput range of 3 times of the 14.2 setup&lt;/p&gt;
&lt;p&gt;the question would be now, would this qualify as a quantified value ?&lt;/p&gt;
&lt;p&gt;the fact from my point of view, again i could be wrong, is that both ble nus examples are as much as possible out of the box and unaltered ... the only change is that a timer feeds the nus data string of up to 20 bytes at a defined period ... the global ble configuration seems to be the same as well&lt;/p&gt;
&lt;p&gt;i did not write either ble nus examples, nor am i an expert on the internals and details of the sdk api and softdevices ... all i provide is a measurable repeatable determined data flow into the ble nus example&lt;/p&gt;
&lt;p&gt;so how could i effectively debug the differences of the code i didn&amp;#39;t write&lt;/p&gt;
&lt;p&gt;all i&amp;#39;m really doing is to feed the ble_nus_string_send function my data in a timed and measurable way and i do this the same way in both examples and this goes after 10 line of code directly into the soft device&lt;/p&gt;
&lt;p&gt;the overall setup and other callback and glue is part of the example code from nordic&lt;/p&gt;
&lt;p&gt;yes, i&amp;#39;m not using keil or other approved tools, my setup is in a managed project setup in eclipse&lt;/p&gt;
&lt;p&gt;i can zip up the projects and send them to you if desired&lt;/p&gt;
&lt;p&gt;i can also provide the wireshark traces once i repeat the testing in a couple of days&lt;/p&gt;
&lt;p&gt;sorry for being such a pest ... all i really want to do right now is to receive and send nus data (preferably fast) and add my app code and ship it&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: low peripheral gatt data transmit throughput with s132-5.0</title><link>https://devzone.nordicsemi.com/thread/116257?ContentTypeID=1</link><pubDate>Tue, 09 Jan 2018 11:29:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9a23a050-2604-4936-a2b1-d63079131b06</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;What kind of performance tests do you actually want to do? Are you aware of &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v14.2.0/ble_sdk_app_att_mtu.html?cp=4_0_0_4_2_1_0"&gt;this&lt;/a&gt;?&lt;/p&gt;
&lt;p&gt;You mention sniffer traces, do you have these? Could you upload them so I can take a look at them?&lt;/p&gt;
&lt;p&gt;Anyways, if you want to want to measure throughput in the ble_app_uart example the first step is to have some way of measuring it, so that you have a quantified value, not just observations.&lt;/p&gt;
&lt;p&gt;You can call conn_evt_len_ext_set() from main(), like in ble_app_att_mtu_throughput example.&lt;/p&gt;
&lt;p&gt;Status should be true if you want to enable CLE, false if you want to disable CLE.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: low peripheral gatt data transmit throughput with s132-5.0</title><link>https://devzone.nordicsemi.com/thread/116253?ContentTypeID=1</link><pubDate>Mon, 08 Jan 2018 21:27:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c89b4b2e-8a65-4dd5-9cce-845b5a4a3a56</guid><dc:creator>efiLabs</dc:creator><description>&lt;p&gt;sdk version 12.2 gets about 3 x throughput based upon the observation of data overflow at up to 100 bytes at 30 ms periods and version 14.2 experiences this overflow already at up to 100 bytes at the slower 100 ms periods&lt;/p&gt;
&lt;p&gt;the ble nus example code has not been changed as well as any parameter #define values or any sdk_config.h values ... the sdk_config.h in each test case is the one from the matching example version&lt;/p&gt;
&lt;p&gt;the connection interval settings on both versions are equal 20 min, 75 max and i have not changed them&lt;/p&gt;
&lt;p&gt;the following code snippet i placed in both ble_evt_handler(s) display a min and max of 39 upon connection&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;switch (p_ble_evt-&amp;gt;header.evt_id) {
case BLE_GAP_EVT_CONNECTED :
  .........
  ble_gap_conn_params_t parm = p_ble_evt-&amp;gt;evt.gap_evt.params.connected.conn_params ;
  uint min = parm.min_conn_interval ;
  uint max = parm.max_conn_interval ;
  PRINT (&amp;quot; ble : Conn min %d max %d \r\n&amp;quot;, min, max) ;
}
break ;	// BLE_GAP_EVT_CONNECTED
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;i have increased, as suggested, the #define NRF_SDH_BLE_GAP_EVENT_LENGTH value from it&amp;#39;s initial value of 3 in some steps up to 15 without any really noticeable improvements&lt;/p&gt;
&lt;p&gt;thank you for the conn_evt_len_ext_set code snippet, but where is it supposed to be placed and what value is the status parameter supposed to be or where would it come from&lt;/p&gt;
&lt;p&gt;the android device for testing is a nexus 7 2013 running android 6.0.1 marshmallow&lt;/p&gt;
&lt;p&gt;since both ble nus examples are being used in an out of the box fashion with the same minor test mods applied one would expect an equal behavior or even a slightly better one from the 14.2 sdk&lt;/p&gt;
&lt;p&gt;it&amp;#39;s hard, for a not too ble experienced person, to make freely changes not really knowing of their impacts&lt;/p&gt;
&lt;p&gt;so far i have made many successful changes in implementing my own code, which is not ble related, like adc, uart, timer, intrs and application related classes and more, but in an other project and it&amp;#39;s progressing fine&lt;/p&gt;
&lt;p&gt;i just need to button up this ble performance issue and the ble related part of the app should be solved&lt;/p&gt;
&lt;p&gt;sorry, but i&amp;#39;m at a beginner level when it comes to ble.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: low peripheral gatt data transmit throughput with s132-5.0</title><link>https://devzone.nordicsemi.com/thread/116254?ContentTypeID=1</link><pubDate>Mon, 08 Jan 2018 13:29:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:795fc7ff-89fe-47ff-9b97-34caf6a6d8bd</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;What throughput do you get with 12.2 versus 14.2? Do you have the same connection interval?&lt;/p&gt;
&lt;p&gt;Have you tried to increase the event length? NRF_SDH_BLE_GAP_EVENT_LENGTH&lt;/p&gt;
&lt;p&gt;Have you enabled connection event length extension?&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;static 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;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>