Related Article: What is wireless communication network packet loss?
Ebyte Internet of Things wireless communication technicians sorted out the processing mechanism that can reduce the network packet loss rate, as shown below:
①PHY layer packet loss reduction mechanism:
Packet loss at the physical layer means that the sender sends a signal, but the receiver does not receive the signal. This is also the simplest and most common reason, usually the power of the transmitter is low, and the transmitter is too far away from the receiver.
In such a situation, the usual solution is to increase the transmission power so that the signal can be transmitted farther. However, according to Shannon's law, under the same channel bandwidth, the less information the signal carries, the lower the requirement for SNR, and the lower the requirement for SNR means the lower the requirement for power.
At this time, in addition to increasing the power, there is another way to spread spectrum. For example, the DSSS spread spectrum used on a typical ZigBee wireless module, the original ZigBee channel bandwidth is 2MHz, that is, it can output 2M 0 or 1 signals within 1 second. Usually we use 8 0 or 1 signals to represent a byte, but under the action of DSSS, 64 0 or 1 signals are required to represent a byte. In this way, using a wireless signal to transmit a byte requires 64 0s or 1s. Even if the signal is distorted during transmission, the receiving end can correct the signal. This is why the transmission stability of ZigBee is better than 433MHz communication. Under normal circumstances, the transmission distance of ZigBee can reach 1 km when the transmission power is 20dBm.
Network packet loss rate reduction mechanism
Another situation is the antenna problem. Any kind of antenna has antenna gain factor and directivity. Usually, the gain of an external antenna is better than that of a PCB antenna, so try to choose an external antenna when there is sufficient space for the device. The directivity of the antenna is also a factor to be considered. For example, the signal coverage of the rod antenna is an oblate sphere. The position signal of the parallel antenna is very good, but the position signal of the extension line of the antenna axis is much worse.
②The mechanism of MAC layer to reduce packet loss:
Take the IEEE802.15.4 series protocol of ZigBee as an example, the MAC layer of the protocol has the following important functions.
Carrier sense and CSMA mechanism:
The IEEE802.15.4 protocol has a CSMA mechanism based on carrier sense. Before each signal transmission, the device will listen to whether the current channel is busy, and transmit signals when the channel is free. Many sub-G chips also have a carrier sense function, but lack a protocol mechanism like CSMA. CSMA stipulates the method of channel monitoring: before transmitting, continue to monitor the channel for a random time, so as to properly avoid two identical devices transmitting signals at the same time; try to send signals after the random time arrives, and then detect again if the transmission fails Listen once, and the next random time range will continue to expand (2 times), so as to avoid more devices transmitting signals at the same time; if multiple attempts fail and the maximum number of times is reached, then the signal will be considered packet loss.
Automatic response mechanism:
IEEE802.15.4 protocol MAC layer has two main communication methods: broadcast and on-demand. When ordering to the target, the target node will return an ACK frame. If the sending end does not receive the ACK frame, it will try to retransmit the signal. If the ACK is not received after multiple retransmissions, the packet will be lost. In addition, when the receiving end replies with MAC-ACK, it is not subject to the CSMA mechanism and can be forcibly sent. After the sending end successfully sends the on-demand signal under the CSMA mechanism, it only takes 0.2~0.5 milliseconds to receive the ACK.
Therefore, the common phenomena that cause packet loss at the MAC layer are packet loss due to CSMA failure and MAC-ACK failure. The difference from packet loss at the physical layer is that both types of packet loss can be detected by the sender itself. Usually when encountering this kind of packet loss, the processing on the application is retransmission. However, the retransmission also needs to be scientific. For example, the retransmission of the CSMA failure caused by malicious signal interference cannot be solved; the retransmission of the MAC-ACK failure caused by the non-existence of the receiving target cannot be solved.
A series of processing mechanisms in the PHY layer and MAC layer are designed to reduce packet loss, but there is no guarantee that there will be absolutely no packet loss. Therefore, the most critical thing in wireless application design is what to do when encountering packet loss.