This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

maximal notification size in s132

Looking at the ble_nus service, I see that the SoftDevice allows notifications to be more than 20 bytes long:

uint32_t ble_nus_string_send(ble_nus_t * p_nus, uint8_t * p_string, uint16_t length)
{
    ble_gatts_hvx_params_t hvx_params;

    ...

    if (length > BLE_NUS_MAX_DATA_LEN)   // 155 bytes
    {
        return NRF_ERROR_INVALID_PARAM;
    }

    ...

    hvx_params.type   = BLE_GATT_HVX_NOTIFICATION;

    return sd_ble_gatts_hvx(p_nus->conn_handle, &hvx_params);
}

As far as I remember the standard does not allow notifications larger than 20 bytes.

Is this limitation circumvented handled internally by the SoftDevice?

Parents
  • Hi,

    According to the BLE specification the notification length can be max ATT_MTU - 3. The 3 bytes subtracted is the 3-byte header(OP-code (operation, 1 byte) and the attribute handle (2 bytes)).

    In BLE 4.1 the ATT_MTU is 23 bytes, but in BLE 4.2 the ATT_MTU can be negotiated up to 247 bytes. Support for Configurable ATT MTU size(longer packets than previously (23 ) was added in S132 version 3.0.0

Reply
  • Hi,

    According to the BLE specification the notification length can be max ATT_MTU - 3. The 3 bytes subtracted is the 3-byte header(OP-code (operation, 1 byte) and the attribute handle (2 bytes)).

    In BLE 4.1 the ATT_MTU is 23 bytes, but in BLE 4.2 the ATT_MTU can be negotiated up to 247 bytes. Support for Configurable ATT MTU size(longer packets than previously (23 ) was added in S132 version 3.0.0

Children
No Data
Related