tarpn_logo
 home      FAQs

CSMA - Carrier Sense Multiple Access

packet radio with two stations

If you had two packet radio stations and your own private frequency your two stations could transmit packets back and forth pretty much as soon as the data was queued up in the TNC to send. Even if both ends got the idea to transmit at the same time it would quickly get sorted out that they were colliding and you'd end up with the two stations alternating back and forth. This is what the timing would look like for two stations, Sergey and Sigmund. It takes about 2 seconds to do a single exchange between two stations with 80 characters in the packet, or 40 characters per second. If there were 210 characters in the packet, it would take about 3.5 seconds, giving us approximately 70 characters per second. A further optimization would be to send characters in the return packet sent by Sigmund, or to send more than one data packet at a time from Sergey. Both of these optimizations are permitted by AX.25 packet radio protocol.

packet radio with five stations

What if there were more than 2 stations in the same local group? If one keyed up when another was transmitting there would be a collision and packet data would be lost. The example above is rather blind to that possibility. The end result would be great throughput, see above, when only one station had something to send, and zero throughput if more than one had something to send. What packet radio systems do to improve on this is implement Carrier Sense Multiple Access, or CSMA. CSMA describes the system packet radio stations use to avoid trouncing on another station's transmission. This is what is actually implemented in the TNCs and node software we use for packet radio. Here's how it works:
When a TNC has a packet ready to go, it performs a carrier sense (look at the frequency) to see if anybody is sending a packet already. If the frequency is clear, the station watches the frequency for a SLOT-TIME period, and if the frequency stays clear for SLOT-TIME, the TNC it does a random number calculation generating a value of 0 through 255. If the result is lower than the PPERSIST setting for that station, the station starts generating a packet and sets its radio to transmit. If the PPERSIST number is lower than the random figure, then the station waits for the channel to be clear and stay clear for SLOT-TIME and then does the random calculation again.

PPERSIST is usually set to 256 ÷ number of stations that can be heard by the station I'm sending to, which could mean "all stations minus one." If we presume there are 5 operators on the channel and that the TNCs are set up appropriately then this is what we get.

csma_5_stations002_no_hill
Since each of the 5 operators knows that there are 4 other stations, they all have their number set to 64. SLOT-TIME is set for a number which works out to how long a station could be moving from receive to transmit, yet not putting out a recognize-able signal that the other TNCs could detect. SLOT-TIME is therefore set to the number for the slowest station on the channel. Let's assume that Bob's Alinco DR435 at 400mS is the slowest.

If a transmission is made, the station it is connected to will answer with the same rules.

In this scenario we'll assume for simplicity sake that each message is sent in a single packet, i.e. MAXFRAME is set to 1 and all of the messages are short enough that the outgoing packet is only 80 characters long. We'll assume that with a 4:1 chance of keying when no activity, that it takes 4 both times.

That's what a perfect packet transaction in a CSMA domain set up for 5 stations looks like. The rate of transaction is about 80 characters on the channel per 5 seconds, or 14 characters per second (cps). If we have 5 stations actually on-the-air and if we set up so each station generates a new 80 character packet every 30seconds, and we spread them out so each generates a packet every 6 seconds, then based on the numbers we got we usually don't get collisions. This is because each transaction (send + acknowledge) is clear of the channel in about 5 seconds, sometimes shorter, sometimes longer and because the chances are pretty good that a pending sender will hear the other pending senders and jamming won't take place. TNCs, and some TNC emulators, must be configured to have PPERSIST and SLOTTIME delays, like this, in order to permit multiple access to the channel. The default configuration for TNCs includes values like these, though usually the numbers selected for SLOTTIME are way too short for the radios actually used for packet. Note that those delays are used verbatim, whether or not there are more or less than 5 stations actually using the channel.

It may be an interesting historical note that almost all Amateur Radio packet does channel management to avoid collision using CSMA. CSMA was a method implemented into Amateur radio packet before the capability of doing on-channel repeating of packets was introduced. CSMA is foiled by hidden transmitters.

In the 1990s (starting before that date) the software packages supporting TCP/IP over packet radio were capable of dynamically adjusting the persistance values based on actually channel performance. This capability is sometimes called BACKOFF-AND-RETRY. BACKOFF-AND-RETRY automatically tracks how long to wait after sending each message before resending. Every time the wait is exceeded with no answer, it increases the wait by alot. Every time an answer arrives in time, it decreases the wait by a little. This resulted in a mechanism where each station would operate at the right delay for the current operating conditions.

See also FAQ: Hidden Transmitter Syndrome & Exposed Receiver Syndrome

© Tadd Torborg, 2014↝2017 -- all rights reserved