-
Notifications
You must be signed in to change notification settings - Fork 516
MTU Negotiation
Dariusz Seweryn edited this page Sep 14, 2020
·
2 revisions
MTU: Maximum Transfer Unit
By default (and according to Bluetooth 4.0 Specification) the MTU size is equal to 23 bytes for the GATT layer this means that if a device needs to read/write a characteristic that needs more data there is a need to perform multiple operations i.e:
- There is a need to write characteristic with a value that is 42 bytes long. To write all of this data with MTU of 23 bytes three packets need to be transferred over the air (each GATT layer packet may contain 23 bytes but for each write 3 bytes are the header) 42 / (23-3) > 2. If an MTU of 46 is negotiated then only one header needs to be set for every 46 bytes (of GATT layer). This does not necessarily means that the write can be made with a single on-air write packet (this is dependent on other factors) though it will be possible to send the value in just two packets: (23-3) + (23) = 43 bytes
It is possible to negotiate MTU by setting the requested value when establishing connection
Note:
- iOS by default negotiates up to 187 byte MTU upon connection. Android does need to have this value specified.