I think this question is so trivial that it's nowhere explained (I would not find it) and the answer is probably trivial too. But I still wonder how codes in a typical CDMA system are distributed? They act like symmetric keys in a crypto system: both parties need to know them and there is a complexity of O(N) to share them (N being all possible users).

For example, in a WCDMA cellphone system, there is an "infinite" number N of possible nodes (e.g. a roaming user coming to the US). The codes can't be statically assigned. And the wireless base station can't just try all possible codes.

So I assume that the first communication of a handset and base station does not go over CDMA but the base station somehow detects that there is a new handset, creates a new code and sends this code to the handset. Afterwards the communication goes over CDMA. For handover between different stations, the base station could distribute the code among its neighbor stations.

How does it work in practice? And am I correct that the seed to an LSFR generating the chipping sequence is distributed as opposed to the chipping sequence itself?


2 Answers 2


I don't know how WCDMA does it, but CDMA2000 encodes the data twice or three times (it's been a while): once with a "long code" (42 or 43 bits, so it takes days to cycle through even at chip rates in the MHz), once with a "short code" (16 bits, with zero-stuffing so that the cycle is exactly 65536 chips long, and the spectrum is flat), and IIRC once with a 64-bit long Walsh code. But There's a channel that's only encoded with the long code; that one is used by the base station to assign a specific set of codes and timings to the phone.

So, basically, it's done dynamically.

The CDMA2000 specs are out there. When I looked (over ten years ago, which is why this answer is a bit fuzzy) the "real" spec was behind a paywall, but there were draft specifications that were pretty close.


In most cases the codes for CDMA specifically are predetermined and set the "channel" to use. This is no different than FDMA where each frequency within a coverage area is assigned for a particular use (whether it be user or data packet etc; it is how the medium is divided and used among multiple users).

GPS is a good simple example of CDMA in practice: Each satellite is given a different code to use and is identified by that code. Given the medium (the frequency band allocated for GPS) is divided among the users (the satellites) by code, all satellites transmit on the same frequency but their transmissions are distinguished through the use of the orthogonal codes. The codes in this sense have nothing to do with cryptography or covertness, they are simply a means to share the medium.

  • 1
    $\begingroup$ I think this does not really answer my question. Could you elaborate with the cellphone example? (GPS is straight forward: Only 33 satellites) Say, there are N=100 million CDMA handsets worldwide. CDMA uses 128 bit Gold codes, so each BTS can support K=128 simultanuous users (and more by increasing interference). What, when and how do the N cellphones get their codes assigned? A random 128 bit number (=initial state of an LFSR??) at the time of manufacturing? How does the BTS know which codes to use for decoding? It can't decode all possible 2^128 codes! $\endgroup$
    – divB
    Nov 26, 2019 at 0:42
  • $\begingroup$ For CDMA reverse link, the code to use is allocated per sector via medium access control (mac) - so the “channel” or code to use is set via a control channel But is only concerned with operation in that limited sector. $\endgroup$ Nov 26, 2019 at 0:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.