bt_gatt: No buffer available to send notification

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 messages from peripheral to host.
On the peripheral console I get

    <wrn> bt_att: No ATT channel for MTU 23
    <wrn> bt_gatt: No buffer available to send notification

Then I have to navigate through the "Update MTU" setting and type a larger value.
Can this be fixed programmatically on the peripheral side ?
Alternatively, can the default setting be changed on the host application ?

Parents Reply Children
  • I've defined this

    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("max send len is %d", bt_max_send_len);
        }
    }

    On connection event, I do this

    /* maximize ATT MTU at peer side (CONFIG_BT_L2CAP_TX_MTU)*/
        exchange_params.func = exchange_func;
    LOG_INF("sending ATT MTU to peer..");
    rc = bt_gatt_exchange_mtu(current_conn, &exchange_params);
    if (rc) {
        LOG_ERR("failed to negotiate maximum mtu with peer [%d]", rc);
    }

    In prj.conf, set this (or wahtever you want)

    CONFIG_BT_L2CAP_TX_MTU=247

Related