Wireless Channel Access Mechanism (Carrier Sense Multiple Access/Collision Avoidance – CSMA/CA)
As wireless medium is a shared medium so there should be one rule to allow one station to transmit at one particular time. Simple rule is “Listen before talk”. Wireless medium follows Carrier-sense multiple access with collision avoidance (CSMA/CA). Let’s understand it in simple way.
♣ How carrier sense is done in Ethernet? Why 802.11 cannot follow the same?
“Carrier-sense multiple access with collision detection (CSMA/CD)” is a media access control (MAC) method used by early local area network. The main concept is, any transmitting Ethernet device can detect any collision while it’s transmitting.
This method cannot be taken in as it is into WLAN because wireless device is half duplex and it cannot detect any collision while it’s transmitting. Wireless device can either transmit or receive at one particular time. WLAN device can avoid collision as much as possible that it, it cannot do more than this.
♣ Flow chart for CSMA/CA:
Here is the flow chart for CSMA/CA
♣ Steps for CSMA/CA:
If we understand the flow chart then it’s easy to remember these steps.
1. There are two types of carrier sense: Physical carrier sense (CCA) and Virtual carrier sense. Both are used to check if wireless medium (WM) is busy. From flow chart diagram we can see first step is to check if CCA says medium is free and NAV = 0, then we can proceed for next step. If one of the above (CCA or NAV) indicates medium is busy then go to START.
2. If step1 is YES then wireless device can wait for appropriate IFS (Inter frame spacing) interval.
3. After step2 time has been passed, then choose a random backoff value if it’s not chosen already.
4. Now start decrementing backoff time by one slot and follow the loop to check if backoff timer = 0. If backoff timer is 0 and still CCA indicates medium is free and NAV = 0, then transmit the frame.
5. After a frame has been transmitted successfully then repeat the same steps from step1.
♠Important Notes♠
a. Wireless device always checks if CCA says medium is free and NAV = 0 in each step mentioned above.
♦Example♦
At step4 if it is found that CCA says medium is busy or NAV is not 0 then that device has to pause decrementing backoff timer and go to START. And again coming to step4 when CCA says medium is free and NAV=0, then start decrementing from last resumed value. No need to choose a new random backoff number. Suppose a device choose random backoff number 7 and when the random backoff number reaches 4 after decrementing and it’s found that medium is not free or NAV is not 0. Then station pause at 4 and go to START. After coming to step3 station has random backoff value 4, no need of choosing new random backoff number. So proceed to step4 and start decrementing like before as long as CCA says medium is free and NAV=0.
b. After following all these steps if both stations transmit at same time then there will be collision. So, it’s understood that in wireless medium we cannot detect collision; it can hardly try to avoid it. But if collision happens, then both stations will follow some steps and do retransmission.
♣ Why do we need virtual carrier sense (NAV) where CCA is present?
The simple reason is double confirmation about medium is free or not. So evenif there is CCA in physical layer, there is NAV in MAC layer (Data Link Layer).
♣ Conclusion:
This article is just to explain CSMA/CA steps in simple way. There are many more topics to be discussed like types of carrier sense (CCA, NAV), IFS, slot time etc. We will have them in future posts.
♥♥If you have any doubts or query please let me know in comment section or send mail at feedback@wifisharks.com.♥♥