<?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 send 25 packets of data each second</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/111335/how-to-send-25-packets-of-data-each-second</link><description>I am not able to send 25 array packets each second. array size is 244 bytes I am reading the sensor data continuosly and every 40 ms i am sending the data to bluetooth using gatt_notify Each second the receiver receiving different number of packets 1st</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 21 May 2024 11:43:00 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/111335/how-to-send-25-packets-of-data-each-second" /><item><title>RE: How to send 25 packets of data each second</title><link>https://devzone.nordicsemi.com/thread/485083?ContentTypeID=1</link><pubDate>Tue, 21 May 2024 11:43:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cfd7c2c9-bf46-40ec-b456-9b841ef81df5</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It&amp;#39;s true that the L2CAP_TX_MTU is not limited to 251 bytes, but the data length is:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;config BT_CTLR_DATA_LENGTH_MAX
	int &amp;quot;Maximum data length supported&amp;quot;
	depends on BT_CTLR_DATA_LENGTH
	default BT_BUF_ACL_RX_SIZE if BT_BUF_ACL_RX_SIZE &amp;lt; 251
	default 27
	range 27 BT_BUF_ACL_RX_SIZE if BT_BUF_ACL_RX_SIZE &amp;lt; 251
	range 27 251
	help
	  Set the maximum data length of PDU supported in the Controller.&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Once you send packets longer than this they will have to be segmented by the link layer, and the throughput will suffer as a result. The ideal situation is to negotiate a 251 byte data length, and send data packets of 244 bytes (leaving 7 bytes for the L2CAP and ATT headers).&amp;nbsp;&lt;/p&gt;
[quote user=""]I am reading the sensor data continuosly and every 40 ms i am sending the data to bluetooth using gatt_notify[/quote]
&lt;p&gt;Rather than sending the packets every 40ms I would recommend sending them as fast as possible, then you will be able to more efficiently fill the buffers in the Bluetooth stack, which will increase overall throughput.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to send 25 packets of data each second</title><link>https://devzone.nordicsemi.com/thread/485072?ContentTypeID=1</link><pubDate>Tue, 21 May 2024 11:30:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e397b3cf-74eb-4dd0-bbe1-8423f39d9521</guid><dc:creator>IvanR</dc:creator><description>&lt;p&gt;Where did you find that its maxed out at 291 bytes?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.6.0/kconfig/index.html#CONFIG_BT_L2CAP_TX_MTU"&gt;https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.6.0/kconfig/index.html#CONFIG_BT_L2CAP_TX_MTU&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to send 25 packets of data each second</title><link>https://devzone.nordicsemi.com/thread/485057?ContentTypeID=1</link><pubDate>Tue, 21 May 2024 11:11:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:23582931-df26-4eb5-8cea-87b3fde0b812</guid><dc:creator>Madhu Mohan Reddy</dc:creator><description>&lt;p&gt;In documentation and L2CAP_TX_MTU, it is showing that we can update upto 251 bytes only&lt;br /&gt;&lt;br /&gt;At a time i can send 494 bytes of array to receiver?&amp;nbsp;&lt;br /&gt;&lt;br /&gt;In my application i want to send 6000 bytes of array with in one second so this is not possible thats why every 40 ms i am sending 240&amp;nbsp; bytes of array&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to send 25 packets of data each second</title><link>https://devzone.nordicsemi.com/thread/485043?ContentTypeID=1</link><pubDate>Tue, 21 May 2024 10:43:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b96bf190-ab87-4233-bbb4-8aabb31dc7ba</guid><dc:creator>IvanR</dc:creator><description>&lt;p&gt;Devices can agree on what MTU they can use. Im checking it using code bellow. Ive not tried setting it manually as this fits my purpose. I then use that negotiatedMTU as size of the packet sent via notify.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;void exchange_mtu_result(struct bt_conn* conn, uint8_t err, struct bt_gatt_exchange_params* params) {
  if (err)
    printErr(&amp;quot;MTU exchange failed (Error: %d)&amp;quot;, err);
  else {
    negotiated_MTU = bt_gatt_get_mtu(conn) - 4; // INFO negotiated MTU is reduced by 4 as 3 bytes are ATT and 1 for null termination
  }
}

BT_CONN_CB_DEFINE(conn_callbacks) = {
  .connected           = connected,
  .disconnected        = disconnected,
  .le_param_req        = param_req,
  .le_param_updated    = param_updated,
  .le_phy_updated      = phy_updated,
  .le_data_len_updated = data_length_updated
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;div style="color:#f5f5f5;font-family:&amp;#39;Consolas&amp;#39;, &amp;#39;monospace-fallback&amp;#39;, &amp;#39;monospace&amp;#39;;font-size:14px;"&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;span style="background-color:#ff0000;color:#444e63;font-weight:bold;"&gt; MTU : 494 bytes&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to send 25 packets of data each second</title><link>https://devzone.nordicsemi.com/thread/485033?ContentTypeID=1</link><pubDate>Tue, 21 May 2024 10:15:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fd458fbc-1d8f-4641-8af7-1454e3b0c41b</guid><dc:creator>Madhu Mohan Reddy</dc:creator><description>&lt;p&gt;Hi IvanR,&lt;br /&gt;&lt;br /&gt;By default MTU for notify is 23 but we can update the MTU to 251&amp;nbsp; right?&lt;/p&gt;
&lt;p&gt;Thank you in advance&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to send 25 packets of data each second</title><link>https://devzone.nordicsemi.com/thread/484959?ContentTypeID=1</link><pubDate>Tue, 21 May 2024 06:24:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:af5564c0-b64b-43a6-b3c4-3e4c372e5b2b</guid><dc:creator>IvanR</dc:creator><description>&lt;p&gt;The typical MTU for notify is&amp;nbsp;&lt;span&gt;23 bytes.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Try setting auto update connection parms to y or set the desired length via&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;    struct bt_conn_le_data_len_param data_len = {
        .tx_max_len = 247,
        .tx_max_time = 1000,
    };

    err = bt_conn_le_data_len_update(NULL, &amp;amp;data_len);
    if (err) {
        printk(&amp;quot;LE Data Length update failed (err %d)\n&amp;quot;, err);
    }&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>