nRF5 SDK v17.1.0
Experimental: GATT Module
This information applies to the following SoftDevices: S132, S140

To allow faster communication, a GATT client can request to change parameters for a Bluetooth low energy connection. The GATT server then replies with the parameter value that it can or wants to support, and the parameter value is adjusted accordingly.

The GATT Module (API documentation) can be used to handle this parameter exchange. The module also keeps track of the current parameters for all active links. The following connection parameters can be handled by the module:

Maximum ATT_MTU size

The Bluetooth Attribute Protocol (ATT) defines the default Maximum Transmission Unit (MTU) size to be BLE_GATT_ATT_MTU_DEFAULT bytes. This means that in a connection, each transaction between a GATT server and GATT client can contain a maximum of BLE_GATT_ATT_MTU_DEFAULT bytes. Of these BLE_GATT_ATT_MTU_DEFAULT bytes, only 21 can be used for the actual payload. Note that this is defined in the Bluetooth specification and thus is no limitation of this module. Increase the maximum ATT_MTU size to achieve longer payloads by sending several packets for one transaction.

The default value that the module uses is NRF_SDH_BLE_GATT_MAX_MTU_SIZE, which is set to 251 bytes.

Data length

The default data length for a radio packet is 27 bytes. Increase the data length to use bigger radio packets, so that more data can be sent in one packet.

The default value that the module uses is NRF_SDH_BLE_GAP_DATA_LENGTH, which is set to 27 bytes. The maximum allowed value is 251, which is the maximum value that the SoftDevice allows for this setting.

When a new connection is established in the application, the module starts an ATT_MTU exchange procedure followed by a data length update procedure.

Both procedures are carried out as necessary, thus only if the module's default values (either global or for a specific connection) are different from the stack's default: BLE_GATT_ATT_MTU_DEFAULT for ATT_MTU values and 27 bytes for data length.


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.

The SoftDevice handler module automatically configures the SoftDevice to support up to NRF_SDH_BLE_GATT_MAX_MTU_SIZE bytes of ATT_MTU when nrf_sdh_ble_default_cfg_set is called.

To set a new data length, use nrf_ble_gatt_data_length_set. A new data length can be set for an existing connection or before a connection is established by passing BLE_CONN_HANDLE_INVALID to nrf_ble_gatt_data_length_set.

The SoftDevice requires no additional configuration to use non-default data length values.

After the new parameter value has been negotiated, the callback function is called with the value that has been agreed.

At any time, you can call nrf_ble_gatt_eff_mtu_get or nrf_ble_gatt_data_length_get to retrieve the current parameter value for a given connection.

For a complete usage example, see the Experimental: ATT_MTU Throughput Example.

Documentation feedback | Developer Zone | Subscribe | Updated