Reputation: 68
When writing an application to act as a Gatt server using Bluez's DBus API, the MTU given by calls to the ReadValue
and AcquireNotify
commands report the MTU as 517.
The maximum size of the data channel payload 251 bytes (27 without the Data length extension). Because of the 4 byte L2CAP header, we are left with a max MTU of 247.
Is the ATT_MTU independent of the link layer's data length limit? Is the data fragmented across a lower level and if so, what is the maximum ATT_MTU?
Upvotes: 3
Views: 8544
Reputation: 18452
The ATT_MTU is a 16-bit number and hence it can be at most 65535. However ATT_MTU is negotiated between the two devices and will be set to the minimum of both devices' max ATT_MTU.
But a characteristic can only be 512 bytes, so usually there is no use for such a large mtu like 65535. You would have to use "read multiple characteristics" or similar to make use of such a big mtu.
The ATT_MTU is completely independent of the link layer data length, and is automatically fragmented by hci and link layer. The L2CAP host is the one that usually reassembles the packets.
Upvotes: 5
Reputation: 13295
Yes, the ATT_MTU is independent of the link layer's data length limit. As the name suggests, ATT_MTU is related to the maximum amount of data that can be transferred at the ATT layer, whereas the normal packet length relates to the maximum amount of data that can be sent in the physical layer.
As you suggested, this means that if the ATT_MTU is larger than the maximum physical packet length, the data is fragmented in the lower (physical) layer. For example, if the maximum ATT_MTU is 517 while the maximum chunk BLE chunk is 251, this means that the data you are sending across will be divided into chunks of 251 bytes. This is why the ideal ATT_MTU/packet length combination is usually an ATT_MTU of 247 and a packet length of 251.
As for the maximum ATT_MTU, I believe that this isn't specified by the Bluetooth specification and should therefore be chip dependent. The Bluetooth spec does mention that the maximum length of an attribute should be 512 (Bluetooth Core Specification 5.2, Vol 3, Part F, section 3.2.9 Long attribute values):-
The maximum length of an attribute value shall be 512 octets.
Therefore an ATT_MTU of 515 or more will certainly be able to transfer the largest attribute allowed by the Bluetooth specification.
You can also have a look at the links below for more information:-
Upvotes: 5