I was wondering what was the maximum packet length in Bluetooth Low Energy. The 20 bytes limit if often said, for example here
"BLE allow you transfer maximum is 20 bytes."
"You are correct that the BLE specification doesn't allow write operations to exceed 20 bytes."
However, reading the Bluetooth Core Specification, we can see that the ATT_MTU value is written with 2 bytes, meaning that it can go up to 65 535 bytes.
What's the truth behind all this ?
For Bluetooth 4.0, the BLE Radio is capable of transmitting 1 symbol per microsecond and one bit of data can be encoded in each symbol. This gives a raw radio bitrate of 1 Megabit per second (Mbps).
It allows up to 254 bytes of advertising data in the packet payload.
The data length extension feature allows the LE controller to send data channel packet data units (PDUs) with payloads of up to 251 bytes of application data, while in the connected state. Furthermore, a new PDU size can be negotiated by either side at any time during a connection.
Specification is always right !
In Bluetooth 4.0, BLE was introduced with a maximum payload of 33 bytes (not including Access Address and CRC fields). Each layer in the protocol stack takes its cut:
With an ATT write request (or notification), 3 bytes are used by command type and attribute ID, 20 bytes are left for the attribute data.
At the ATT level, this limit may be enlarged in two ways:
Using fragmentation at the L2CAP level:
L2CAP will split ATT PDUs in 27 bytes fragments (23 for the first one).
Drawbacks:
Using packet length extension introduced in Bluetooth 4.2:
Up to 251 bytes at the radio level (255 with MIC), so 242 bytes available for attribute data.
Drawbacks:
Still new, needs hardware support, so not implemented everywhere (even if announcing BLE 4.2 support),
Packet with longer airtime will have more chances of getting jammed, so longer packets implies more retransmissions.
If both methods are used, L2CAP may use bigger fragments.
Whatever low-level splitting of ATT PDU, Attribute value length is limited to 512 by 3.F 3.2.9.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With