About CSMA-CA

Source: Internet
Author: User

This article mainly introduces CSMA mechanisms in the communication field. All documents in this article are from the network.

 

Network communication relies on the media to transmit data, modulated the data to the analog signal, and then transmitted to the distance through the media. It can be divided into wired network and wireless network based on different media. To connect devices produced by various network equipment manufacturers in the world, they must follow a certain "communication language", just like a Chinese person and an American person, if the devices they produce can only speak the "language of their own country", it means they cannot communicate with each other. To solve this problem, the IEEE organization has released two protocols, one for wired networks (IEEE 802.3) and the other for wireless networks (IEEE 802.11. At the underlying transmission level, both wired networks and wireless networks belong to broadcast networks. That is to say, when a node sends information, all nodes in the network can receive the information, if multiple nodes send data at the same time, it is easy to cause data congestion and collision, resulting in slow network speed.

To solve this problem, the CSMA Protocol specifies the CSMA mechanism to solve this problem. CSMA is called Carrier Sense Multiple Access, and the Chinese language is the carrier listener for multi-channel access. The specific processing method varies according to the transmission media. The wired network uses collision detection and the wireless network uses collision avoidance, which is similar in the literal sense, but the details are still somewhat different.

The following describes two methods to avoid conflicts.

CSMA/CD

In this way, the sender monitors whether the communication channel is idle before sending a signal. If it is idle, the system immediately sends data and listens to the channel while sending the data. If a conflict occurs, the system immediately stops sending data and notifies other nodes that a collision has been sent (sending blocking information ), wait for a period of time and then resend the data packet. When the listening channel is busy, you also need to wait for a period of time randomly. The time value is obtained through the exponential backoff algorithm. If the attempt fails several times, stop sending and send the notification to the upper layer.

The following describes the basic process of the Binary Index Backoff Algorithm:

1. determine the basic backoff time unit (2 TB). For Ethernet, It is 51.2us

2. Define a parameter K. The relationship between it and the number of retransmissions is k = min [N, 10].

3. From the K defined above, construct a discrete Integer Set [0, 1, 2, 3, 4 ..., (2 ^ k-1)]

4. Calculate the retransmission time. A random number is obtained from the discrete Integer Set, multiplied by the Basic backoff time unit, which is the backoff time.

 

CSMA/CA

Before sending data, the channel status is detected. After the channel is idle, wait for a while and then check whether the channel is idle again. If the channel is idle, send the data immediately. Otherwise, wait for a certain period of time, and send the detection again after the expiration time.

Before sending real data, the sender first transmits the real data to the request (RTS) sent to the target end. With this RTS-CTS mechanism, you can ensure that the next data is not collided. Since the RTS-CTS's packets are small, it does not increase the transmission overhead.

So how does CSMA/CA avoid conflicting sending? It adopts a mechanism with confirmation, similar to the ACK response of TCP. If the sender receives the ACK confirmation sent by the receiver to the data, no matter how crowded the air channel is, data packets are still difficult to send and receive packets from both sides, which means they receive ack signals.

CSMA/CA provides time-sharing access for wireless channels through the above three methods, channel idle detection, RTS-CTS and ACK validation.

There are three channels for idle channel detection. distribution is through energy detection, carrier detection, and energy carrier Hybrid Detection, collectively referred to as CCA.

For wired and wireless networks, the methods for detecting conflicts vary depending on different transmission media. In the traditional wired network, the detection method is to detect the conflict by changing the voltage in the cable. When the data transmission encounters a collision, the voltage in the cable changes. In wireless networks, air as the transmission medium must adopt other collision detection mechanisms. CSMA/CA provides three methods for detecting idle channels (CCA:

1. Energy Detection (ed): determines the energy size of the received signal. when the power is greater than a specific value, the channel is considered to be occupied.

2. Carrier Detection (CS): Compares the received signal with the local Pseudo-Random Code (PN Code). If the value exceeds a certain limit, the channel is considered to be occupied.

3. Mixed Energy and carrier detection (ED & CS)

 

Why does cable transmission and air transmission require different detection methods?

This is determined by the signal strength. In wired transmission, assume that the voltage value of the sent signal is 3.3 (instantaneous voltage). When a conflict is detected, that is, the signal from other devices is received, through the superposition of voltage, an instantaneous voltage of about 6 V may be obtained, which is easy to detect. However, in wireless transmission, the interference signal is not so strong. As the transmission distance increases, the signal attenuation is very fast. At the sending end, when other unexpected signals are disturbed, the voltage shifting is not so obvious, so the above mentioned CCA method is required.

 

Overview of CSMA/CA Algorithms

It is a flowchart of CSMA/CD mechanism for sending and receiving data.

In a wireless beacon network, the Coordinator in the network regularly sends the beacon to all perceptible nodes. All devices that want to send data compete for the right to use the transmission media through the CSMA/CA mechanism before sending data. The wireless network is divided into Beacon network and non-beacon network based on whether there is a credit mark in the network. In different network modes, CSMA/CA algorithm versions are different, which are divided into the beacon version slotted CSMA-CA and non-beacon version unslotted CSMA-CA algorithm.

The difference between the two is that in the standard version, the backoff time of all devices is aligned with the beacon frame transmission time of the Coordinator to ensure that data transmission starts at the beginning of each cap segment, to reduce the possibility of conflict.

 

In this algorithm, there are three important parameters:

NB (number of backticks, number of back): each time the channel is detected to be busy, this value will add 1. in IEEE 802.15.4, the maximum Nb value is 24. to optimize the efficiency, when the channel is still busy after four backoff delay detection, the transfer is abandoned. This value is initialized to 0 at the beginning of each transmission.

CW (collision Window Length, content Window Length): The wait time for each backoff operation. Unit: the time required to transmit 20 symbrs. The initial value of CW is 2 and the maximum value is 31. when the channel is determined to be busy, reset this value to 2. this parameter is only used in the beacon network.

Be (backoff index, backoff exponent): the maximum number of times the device attempts to backoff.

When the ble field in the received beacon frame is 0, be should be initialized to the macminbe value of the MAC layer. Otherwise, be value should be set to the smaller of 2 and macminbe. In IEEE 802.15.4, the maximum be value is 3.

Is the brief algorithm flowchart:

 

CSMA-CA Applicability

The CSMA-CA algorithm is suitable for transmitting data frames, Mac command frames with cap. It is not suitable for transmitting beacon frames, Ack frames or data frames in CFPs time in the beacon network. ACK frame and credit frame transmission, without the need for CSMA-CA mechanisms.

 

Reference Links: CSMA/CD and CSMA/CA

CSMA/CA

About CSMA-CA

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.