<?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>bt_gatt: No buffer available to send notification</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/93251/bt_gatt-no-buffer-available-to-send-notification</link><description>Hello, As for my peripheral BLE NUS service under NCS 1.9.2, when I search and connect it from my Windows PC running nRF Connect for Desktop BLE Standalone 4.0.0, I found that the ATT MTU default value (23) is insufficient to allow the transmission of</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 26 Aug 2024 06:45:19 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/93251/bt_gatt-no-buffer-available-to-send-notification" /><item><title>RE: bt_gatt: No buffer available to send notification</title><link>https://devzone.nordicsemi.com/thread/499661?ContentTypeID=1</link><pubDate>Mon, 26 Aug 2024 06:45:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:68eb2176-8806-42ea-a63b-e8d85deffd80</guid><dc:creator>Gabriele</dc:creator><description>&lt;p&gt;I&amp;#39;ve defined this&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static void exchange_func(struct bt_conn *conn, uint8_t err,
    struct bt_gatt_exchange_params *params)
{
    if (!err) {
        /* According to 3.4.7.1 Handle Value Notification off the ATT protocol.
         * Maximum supported notification is ATT_MTU - 3 */
        uint32_t bt_max_send_len = bt_gatt_get_mtu(conn) - 3;
        LOG_INF(&amp;quot;max send len is %d&amp;quot;, bt_max_send_len);
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;On connection event, I do this&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/* maximize ATT MTU at peer side (CONFIG_BT_L2CAP_TX_MTU)*/
    exchange_params.func = exchange_func;
LOG_INF(&amp;quot;sending ATT MTU to peer..&amp;quot;);
rc = bt_gatt_exchange_mtu(current_conn, &amp;amp;exchange_params);
if (rc) {
    LOG_ERR(&amp;quot;failed to negotiate maximum mtu with peer [%d]&amp;quot;, rc);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;In prj.conf, set this (or wahtever you want)&lt;/p&gt;
&lt;p&gt;CONFIG_BT_L2CAP_TX_MTU=247&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: bt_gatt: No buffer available to send notification</title><link>https://devzone.nordicsemi.com/thread/499650?ContentTypeID=1</link><pubDate>Sun, 25 Aug 2024 21:37:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8c9dc81d-c7b4-425b-9ada-463f74a7d00c</guid><dc:creator>lcj</dc:creator><description>&lt;p&gt;What settings did you change in the prj.conf?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: bt_gatt: No buffer available to send notification</title><link>https://devzone.nordicsemi.com/thread/392761?ContentTypeID=1</link><pubDate>Thu, 27 Oct 2022 08:07:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ae26d0f2-4da9-42ba-8b30-155b92b928e1</guid><dc:creator>Gabriele</dc:creator><description>&lt;p&gt;&lt;span&gt;Hi Hieu,&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;calling bt_gatt_exchange_mtu&amp;nbsp;right after connection and adjusting some constants in prj.conf do the job.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thank you so much&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: bt_gatt: No buffer available to send notification</title><link>https://devzone.nordicsemi.com/thread/392687?ContentTypeID=1</link><pubDate>Wed, 26 Oct 2022 15:57:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7d3e6bab-bf52-45ad-a727-0952b09d6f54</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Hi Gabriele,&lt;/p&gt;
[quote user=""]Can this be fixed programmatically on the peripheral side ?&lt;br /&gt;Alternatively, can the default setting be changed on the host application ?[/quote]
&lt;p&gt;Yes, it can be done both in the peripheral side and in the central side.&lt;/p&gt;
&lt;p&gt;In the NCS peripheral side, you can take a look at &lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/connectivity/bluetooth/api/gatt.html#c.bt_gatt_exchange_mtu"&gt;bt_gatt_exchange_mtu()&lt;/a&gt;&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;For the central side, I found that Android&amp;nbsp;provides&amp;nbsp;&lt;a href="https://developer.android.com/reference/android/bluetooth/BluetoothGatt#requestMtu(int)"&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;requestMtu()&lt;/span&gt;&lt;/a&gt;.&lt;br /&gt;For Windows, I found &lt;a href="https://github.com/WebBluetoothCG/web-bluetooth/issues/383"&gt;this thread&lt;/a&gt; with quite in-depth discussions and information. &lt;br /&gt;For iOS, I found &lt;a href="https://stackoverflow.com/questions/68375433/change-ios-ble-mtu-size-to-512-swift"&gt;this thread&lt;/a&gt; which says at least in 2021, it is not possible to request MTU.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Please note that the maximum&amp;nbsp;ATT MTU is also limited by several Kconfig settings in NCS. You can see more information in this DevZone Q&amp;amp;A:&amp;nbsp;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/87829/updating-mtu-size-for-tx-and-rx-with-android-ble-client"&gt;Updating MTU Size for Tx and Rx with Android BLE Client&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Hieu&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>