<- Back to blog

BLE Packets Acknowledgment


Bluetooth Low Energy (BLE) is a radio protocol providing a reliable way of exchanging data in a variety of environments using one of the most loaded frequency bands - 2.4 GHz. Reliability of BLE communication is guaranteed on a Link layer by implementing acknowledgment rules. The acknowledgment rules require a device to retransmit the data until it is acknowledged by a peer.

BLE specification defines rules of packets acknowledgment in the 4.5.9 Acknowledgment and flow control.

BLE Packet Structure

Let's take a look at a simplified BLE packet structure.

Header Payload CRC
... SN NESN Up to 251 bytes 3 bytes

Header contains several link-layer service fields, for our article the most interesting fields are Sequence number (SN) and Next expected sequence number (NESN). Both SN and NESN fields are just a single bit.

Packet payload contains the user-data transmitted by a device. It can have length from 0 to 251 bytes. 0-byte length empty packets are used to keep connection alive and to acknowledge data reception.

CRC field contains checksum of the packet content. A device receiving packet calculates CRC of packet content and compares it to the CRC field in the packet in order to check that the data content is not corrupted.

ACK/NAK

After verifying CRC of received packet, if the CRC is correct, the device acknowledges the packet (it is often referred to as ACK). If the CRC doesn't match, or packet was not received at all, the device doesn't acknowledge the packet (NAK or NACK).

The following rules apply when devices exchange data:

Example

Let's illustrate the ACK and NAK with an example of devices A and B exchanging data in a connection.

# Sender SN NESN Payload Peer received packet Comment
1 A 0 0 PA1 Yes A sends first data packet
2 B 0 1 (empty) Yes B acknowledges PA1
3 A 1 1 PA2 No A sends PA2, but B does not receive it
4 B 0 1 (empty) No B repeats last ACK (no new data received)
5 A 1 1 PA2 Yes A retransmits PA2
6 B 1 0 (empty) Yes B acknowledges PA2

Conclusion

By occupying only 2 bits of PDU header SN and NESN fields provide a simple way to make BLE connection a reliable transport.

A couple of important notes: