Stardate
20020410.2115 (Captain's log): Someone just found my CDMA FAQ (which happens quite often) and wrote to me and asked, "But how does CDMA actually work so that several people can simultaneously use the same frequency and actually have their transmitters on at once without anyone getting confused?"
I wrote a shorter answer to him, but it got me inspired and I decided to write up a longer explanation. So if you're not curious you may as well not read further. Otherwise, here we go:
It's kind of tricky. Let's break it down a bit and simplify things some; we'll start by ignoring the short and long codes entirely and just talk about the Walsh codes, and we'll shorten those to 8 chips. And we'll talk about the forward link (from cell to phone) and we'll assume temporarily that the speed of light is infinite (so there's no phase delay).
All the Walsh codes are orthogonal which means that if you XOR different ones, the result will be half ones and half zeros. But if you XOR one with itself, you get all 0's. This is critical and it's what makes the whole system work.
So there's users Alice and Betty and Charlie. Alice's Walsh code is 11110000. Betty's is 11001100. Charlie's is 10101010. 11110000 xor 11110000 is all zeros, a match. But 11110000 xor 11001100 is 00111100, and 11110000 xor 10101010 is 01011010. In each case, half ones and half zeros. (The pattern of 1's and 0's doesn't matter, as you'll see. What's important is how many of each there are.)
Alice's receiver runs an accumulator, and it adds for each match (each 0) and subtracts for each non-match (each 1). This requires us to differentiate between chips and bits. A chip is part of a bit. The cell system sends chips at a rate of 1.2288 MHz, but it takes a lot of chips to transmit one bit. Each chip contains a little piece of the information about each bit (hence the name). Right now in most CDMA systems the bit rate per phone is only 9600 per second in voice calls; the rest run 14400 per second. So there are a huge number of chips per bit.
What happens is that all the chips are checked and each one votes on what the bits should be. The majority rule. So if the cell wants to send a bit of 1 to Alice, it transmits a chip pattern of 11110000. Alice sees eight matches to her spreading code, which adds eight votes for "1", and interprets it as a bit of 1. Betty, on the other hand, sees four matches and four non-matches and doesn't interpret it as anything.
When the cell wants to send a "0" to Alice, it transmits 00001111. Alice sees eight non-matches, which adds eight votes for "0". Again, Betty sees four matches and four non-matches and doesn't see anything.
But what if the cell wants to send to both at the same time? The reason that works is that what the cell is sending is actually analog, not digital. It's the sum of all the digital chipstreams. So suppose that it wants to send bits of 1 to both Alice and to Betty. At this point it's better to think of them as being 1's and -1's instead of 1's and 0's. Here's how it works:
Alice |
1 |
1 |
1 |
1 |
-1 |
-1 |
-1 |
-1 |
Betty |
1 |
1 |
-1 |
-1 |
1 |
1 |
-1 |
-1 |
Sum |
2 |
2 |
0 |
0 |
0 |
0 |
-2 |
-2 |
That sum is what the cell actually transmits. Alice receives the signal and interprets it as follows:
Signal |
2 |
2 |
0 |
0 |
0 |
0 |
-2 |
-2 |
Code |
1 |
1 |
1 |
1 |
-1 |
-1 |
-1 |
-1 |
Result |
2 |
2 |
0 |
0 |
0 |
0 |
2 |
2 |
You get a multiply down and an add across. So the total energy is 8, which Alice interprets as a strongly positive signal as a bit value of "1".
Betty receives the signal and interprets it this way:
Signal |
2 |
2 |
0 |
0 |
0 |
0 |
-2 |
-2 |
Code |
1 |
1 |
-1 |
-1 |
1 |
1 |
-1 |
-1 |
Result |
2 |
2 |
0 |
0 |
0 |
0 |
2 |
2 |
The sum is still 8 (though in a sense it's a different 8) and Betty also interprets that as a "1".
Now suppose that the system wants to send a "1" to Alice but a "0" to Betty. To do that, it sends Alice's code normally but Betty's code inverted. Here's how it comes out:
Alice |
1 |
1 |
1 |
1 |
-1 |
-1 |
-1 |
-1 |
Betty |
-1 |
-1 |
1 |
1 |
-1 |
-1 |
1 |
1 |
Sum |
0 |
0
| |