SEARCH

— 葡萄酒 | 威士忌 | 白兰地 | 啤酒 —

How to Detect Packet Loss? Common Methods Explained

BLOG 480
How to Detect Packet Loss

How to Detect Packet Loss

Packet loss retransmission is a crucial function in data communication applications, especially in wireless communications, where it is a key indicator of the sophistication of the communication protocol. Today, we will focus on how to detect packet loss, with a subsequent discussion on retransmission mechanisms.

How to Detect Packet Loss?

To retransmit lost packets, one must first detect them; without detecting packet loss, there is no retransmission. In wireless communications, packet loss detection typically involves two methods: carrier sensing and acknowledgment mechanisms.

  1. Carrier Sensing

Carrier sensing is a common method for detecting packet loss, and it has evolved into CSMA/CA (Carrier Sense Multiple Access with Collision Avoidance). CSMA/CA can also be considered a retransmission mechanism, commonly used in Wi-Fi and ZigBee. Before transmitting a message, communication devices turn on their receivers and maintain them for a short period. During this time, the wireless unit detects whether there are other interference signals on the same frequency band. For example, ZigBee devices not only detect Wi-Fi and Bluetooth signals but also other ZigBee signals during carrier sensing. If the interference signal is from Wi-Fi or Bluetooth, ZigBee devices measure its power. If the power is lower, they overpower it; if higher, they drop the packet. If the interference is from another ZigBee device, regardless of power, they will drop the packet to let the other device proceed.

  1. Acknowledgment Mechanism

Another method to determine packet loss is to add acknowledgment mechanisms, typically found in the OSI seven-layer model. Starting from the link layer, each layer can incorporate acknowledgment mechanisms, with lower layers closer to hardware providing faster responses.

OSI Seven-Layer Model

Taking ZigBee’s acknowledgment mechanism as an example, currently, only the MAC (Data Link) and APS (Transport) layers have acknowledgment mechanisms. However, in practical applications, acknowledgment mechanisms are often added to the application layer as well. The MAC-level acknowledgment, known as MAC-ACK, is the fastest and is usually generated automatically by ZigBee’s wireless transceiver hardware. The receiving device broadcasts a MAC-ACK within 120 microseconds after receiving a ZigBee data frame. MAC-ACK is the shortest frame in ZigBee, with a length of only 5 bytes, plus preamble and synchronization frames totaling 11 bytes. At a transmission rate of 250 kbps, each byte takes 32 microseconds, making the MAC-ACK frame’s duty cycle 352 microseconds. This means the sender will receive the corresponding MAC-ACK 472 microseconds (120 + 352) after sending a MAC frame. ZigBee’s MAC layer also stipulates that if the sender does not receive the corresponding MAC-ACK within 540 microseconds, it considers the packet lost.

MAC-ACK uses broadcast transmission, which reduces the address field in the MAC-ACK frame, shortening the frame length and duty cycle. The sender can determine if the MAC-ACK is for its frame based on the frame sequence number. Broadcast MAC-ACK also alerts other ZigBee devices of ongoing communication, allowing them to yield during carrier sensing. In ZigBee’s MAC layer, carrier sensing and MAC-ACK work together to ensure accurate packet loss detection. Note that broadcast messages in ZigBee do not generate MAC-ACK.

Diverse Packet Loss Detection Mechanisms

Besides the MAC layer, ZigBee’s transport and application layers also have acknowledgment mechanisms. ZigBee is a multi-hop Mesh network, and MAC-level transmission only supports single-hop. Therefore, ZigBee also implements acknowledgment at the transport layer, called APS-ACK. When a ZigBee sender transmits a message to a receiver, it passes through multiple ZigBee router nodes. The receiver sends APS-ACK back to the sender via the same route, confirming the message’s arrival. If the sender does not receive APS-ACK within 6 seconds (default), it considers the data lost

In ZigBee systems, interfaces are usually only exposed at the application layer, with the most common being the “AF Data Confirm” detection interface. It consolidates lower-layer packet loss information, including MAC-ACK and carrier sensing losses, network layer losses, and transport layer losses. ZigBee’s top-level applications can determine if the current message is lost.

Application Layer Acknowledgment

MAC and transport layer packet loss detection pertains to system-level losses. Another type of loss is application-layer loss, such as a dimmer switch sending a “set brightness to 50%” command to an air conditioner. If this command is not lost, the air conditioner will attempt to execute it, despite lacking brightness control. Application-layer acknowledgment can address this by having the air conditioner reply, “I’m not a light bulb.”

 

The prev: The next:

Related recommendations

Expand more!

Mo