The retransmission mechanisms of BLE and WiFi are both based on ARQ (Automatic Repeat reQuest), which uses ACK to confirm errors or lost packets. However, there are some differences in their mechanisms. Below, we will conduct a simple comparative analysis.
- BLE Retransmission Mechanism
The retransmission in BLE typically occurs at the link layer and is conducted while in a connected state. Therefore, retransmission targets the data physical channel, and the header of the data physical channel PDU contains a sequence number field, where both NESN and SN are only one bit.
- SN—Sequence Number, the identifier for the current data PDU sent by the sender, used to distinguish between new packets and retransmitted packets.
- NESN—Next Expected Sequence Number, primarily used to carry the ACK information from the other party.
By combining SN and NESN, implicit ACK functionality can be achieved. The following two examples illustrate this:During normal reception, SN and NESN will flip with each transmission, meaning 0 becomes 1, and the next time 1 becomes 0.
When the master side has a packet that was not received correctly, it sets the NESN bit to inform the slave side.
In BLE retransmission, there is no explicit number of retransmissions to determine whether to abandon a frame. Typically, the final retransmission conclusion is determined by the supervision timeout, which means that as long as the transmission is unsuccessful, retransmission can continue indefinitely. Of course, the upper-layer application can decide whether to re-establish the connection based on the number of retransmissions.
- WiFi Retransmission Mechanism
In the WiFi MAC header, there is a sequence control field that contains a 12-bit sequence number, and there is a retry bit in the frame control field.
Each MPDU packet has a corresponding sequence number. Each time a packet is sent, the sequence number increments by 1. If the packet is a retransmission, the sequence number remains unchanged, and the retry bit in the frame control field is set to 1.A previous article mentioned the channel access method of WiFi.Analysis of WiFi Channel AccessThe retransmission and backoff mechanism of WiFi is also related to the backoff time. In EDCA channel access, the backoff time for the four queues AC_BK, AC_BE, AC_VI, and AC_VO equals CW*SlotTime, where the CW value is determined by the range specified by CWmin and CWmax.
During the initial transmission attempt, CW=CWmin. Each time a retransmission fails, CW doubles exponentially until it does not exceed CWmax. Once the transmission is successful, CW resets to CWmin.Assuming CWmin=15, initially CW=CWmin=15, and the random range is [0,15]; if 7 is selected, the backoff time=7xSlotTime.If the transmission is unsuccessful and needs to be retransmitted, CW doubles, CW=31, and the random range changes to [0,31]; if 12 is selected, the backoff time=12xSlotTime.The purpose of this is to reduce the probability of collisions, which is known as the principle of collision avoidance.WiFi protocols also have measures to reduce or optimize retransmissions:
- Using RTS/CTS interactions to reduce collisions that lead to retransmissions.
- Setting different retransmission counts for long and short packets.
- For AMPDU, retransmitting only the erroneous MPDU to improve retransmission efficiency.
In summary, the BLE retransmission mechanism is relatively simple and mainly targets low throughput scenarios, while the WiFi retransmission mechanism emphasizes real-time performance and incorporates a backoff mechanism, making it more suitable for high throughput scenarios.End!