<?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>Understanding Maximum BT GATT notification size</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/111390/understanding-maximum-bt-gatt-notification-size</link><description>I&amp;#39;m working with a BLE peripheral application that must transfer large amounts of data to a phone central. The application uses the MTU negotiation to determine the max notification size it can send. I ran into a problem where the BLE stack reported a</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 22 May 2024 17:56:38 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/111390/understanding-maximum-bt-gatt-notification-size" /><item><title>RE: Understanding Maximum BT GATT notification size</title><link>https://devzone.nordicsemi.com/thread/485499?ContentTypeID=1</link><pubDate>Wed, 22 May 2024 17:56:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:faee538c-6716-4285-9ee9-6b6c3a4992fe</guid><dc:creator>timl2415</dc:creator><description>&lt;p&gt;&lt;span&gt;Thank you for confirming.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;The documentation for the callback states that&amp;nbsp;callback gets an updated TX ATT MTU and RX ATT MTU.&lt;/p&gt;
&lt;p&gt;- Being unfamiliar with BLE, i assumed this meant that there were two individual MTU&amp;#39;s, one in each direction. Every example using this callback prints these as tx:%d and rx:%d updated MTU, when in reality only the min of the two is used by both devices in the connection.&lt;/p&gt;
&lt;p&gt;- The &amp;quot;tx&amp;quot; and &amp;quot;rx&amp;quot; MTUs are actually &amp;quot;server&amp;quot; and &amp;quot;client&amp;quot; MTUs. On a&amp;nbsp;server device its locally supported MTU is reported as the &amp;quot;rx&amp;quot; MTU and the&amp;nbsp;client device MTU is the &amp;quot;tx&amp;quot;. From the&amp;nbsp;server perspective it doesn&amp;#39;t make a ton of sense to me why my MTU is the &amp;quot;rx&amp;quot; MTU when its just the MTU i can support for both incoming and outgoing messages.&lt;/p&gt;
&lt;p&gt;It would be nice if there was&amp;nbsp;some example that&amp;nbsp;uses the negotiated MTU values in the callback to determine&amp;nbsp;some notification size.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Understanding Maximum BT GATT notification size</title><link>https://devzone.nordicsemi.com/thread/485426?ContentTypeID=1</link><pubDate>Wed, 22 May 2024 12:54:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:15fdaab7-01ad-48e6-aa24-41dbc84020e2</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;You are right that the minimum will be used (as it must be supported by both peers). This is generally how most parameters are handled in Bluetooth. I did not get how the API documentation for the GATT callback is misleading, though?&lt;/p&gt;
&lt;p&gt;PS: In most cases an ATT MTU of 247 is use also for high throughput, as that is the largest that can fit in a BLE packet with data length extension (a longer ATT MTU will cause fragmentation on the physical layer so the throughput will not increase).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Understanding Maximum BT GATT notification size</title><link>https://devzone.nordicsemi.com/thread/485216?ContentTypeID=1</link><pubDate>Tue, 21 May 2024 19:29:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d8ed4648-7813-4b66-a291-6708d18d0114</guid><dc:creator>timl2415</dc:creator><description>&lt;p&gt;It seems I may have misunderstood the params of the att callback, in att.c, att_mtu_req takes the requested MTU from the client and the local MTU from the configured L2CAP buffer sizes and sets the MTU for the channel to the minimum of the two. So the maximum notification size should be the&amp;nbsp;min&amp;nbsp;of the client-requested and server-local MTU. From the BLE Core Spec 5.1:&lt;/p&gt;
&lt;div class="page" title="Page 1408"&gt;
&lt;div class="layoutArea"&gt;
&lt;div class="column"&gt;
&lt;p&gt;&lt;span&gt;When using an L2CAP channel with a fixed CID, the client and server may optionally exchange the maximum size of a packet that can be received using the ATT_EXCHANGE_MTU_REQ and ATT_EXCHANGE_MTU_RSP PDUs. Both devices then use the minimum of these exchanged values for all further communication &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;If that is the case then the documentation on the att_mtu_updated callback certainly seems misleading:&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt; /** &lt;/span&gt;&lt;span&gt;@brief&lt;/span&gt;&lt;span&gt; The maximum ATT MTU on a connection has changed.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt; *&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt; * This callback notifies the application that the maximum TX or RX&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt; * ATT MTU has increased.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt; *&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt; * &lt;/span&gt;&lt;span&gt;@param&lt;/span&gt;&lt;span&gt; conn Connection object.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt; * &lt;/span&gt;&lt;span&gt;@param&lt;/span&gt;&lt;span&gt; tx Updated TX ATT MTU.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt; * &lt;/span&gt;&lt;span&gt;@param&lt;/span&gt;&lt;span&gt; rx Updated RX ATT MTU.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt; */&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;void&lt;/span&gt;&lt;span&gt; (&lt;/span&gt;&lt;span&gt;*&lt;/span&gt;&lt;span&gt;att_mtu_updated&lt;/span&gt;&lt;span&gt;)(&lt;/span&gt;&lt;span&gt;struct&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;bt_conn&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;*&lt;/span&gt;&lt;span&gt;conn, &lt;/span&gt;&lt;span&gt;uint16_t&lt;/span&gt;&lt;span&gt; tx, &lt;/span&gt;&lt;span&gt;uint16_t&lt;/span&gt;&lt;span&gt; rx);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;It should be that tx is the MTU the client tx&amp;#39;d to the server and rx is the MTU the client rx&amp;#39;d from the server. Please correct me if I&amp;#39;m wrong.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>