nRF5 SDK v12.2.0
Experimental: GATT Module
This information applies to the following SoftDevices: S130, S132, S332

The Bluetooth Attribute Protocol (ATT) defines the default Maximum Transmission Unit (MTU) size to be 23 bytes. This means that in a connection, each transaction between a GATT server and GATT client can contain a maximum of 23 bytes. Of these 23 bytes, only 21 can be used for the actual payload.

To allow faster communication, a GATT client can request to increase the maximum ATT_MTU size for a connection. The GATT server then replies with the size it wants to support, and the MTU size is adjusted accordingly.

The GATT Module (API documentation) can be used to handle this exchange of the MTU size. The module also keeps track of the current MTU size for all active links.

Usage

To set a new maximum MTU size, use nrf_ble_gatt_att_mtu_periph_set for peripheral devices and nrf_ble_gatt_att_mtu_central_set for central devices. The new ATT_MTU value is a static value. It must be set before the connection is established.

After the new maximum MTU size has been negotiated, the callback function is called with the size that has been agreed.

At any time, you can call nrf_ble_gatt_eff_mtu_get to retrieve the current ATT_MTU size for a given connection.


Documentation feedback | Developer Zone | Subscribe | Updated