0
$\begingroup$

I'm trying to wrap my head around the process of selecting DS-CDMA spreading codes, and I'm having trouble understanding the tradeoffs of longer codes. For all scenarios described below, I'm using a Walsh matrix to select the orthogonal vectors, and we assume that I'm transmitting on a 1MHz channel and I'm using BPSK with no FEC (1 baud = 1 bit/second).

Let's say I choose a spreading code length of 2. This allows me to have two orthogonal codes:

v0 = (1,1)

v1 = (1,-1)

With a code length of 2, there are 2 users and each user can transmit at 1MHz/2 = 500k baud = 500kbit/sec. Since the two users can transmit simultaneously, total throughput is 1Mbit/sec.

Now let's say I have a code length of 4. Now I can have 4 orthogonal codes:

v0 = (1 1 1 1)

v1 = (1 -1 1 -1)

v2 = (1 1 -1 -1)

v3 = (1 -1 -1 1)

With a code length of 4, there are 4 users and each user can transmit at 1MHz/4 = 250k baud = 250kbit/sec. Since the four users can transmit simultaneously, total throughput is still 1Mbit/sec.

So regardless of the selected code length, the total channel throughput doesn't change and neither does the consumed frequency bandwidth. What I'm missing, though, is how this ties in with resiliency to interference. According to the Wiki page on DSSS, "the despreaded signal's signal-to-noise ratio is increased by the spreading factor, which is the ratio of the spreading-sequence rate to the data rate." This conceptually makes sense.

So in the first example above, it has a spreading factor of 2 (2 spread symbols per data symbol) and the second example has a spreading factor of 4 (4 spread symbols per data symbol). Therefore, this suggests that the second example should result in a much better SNR on the receiver, even though the total throughput is the same for both.

This would suggest that arbitrarily long spreading codes would have arbitrarily high SNR, and we should always select the longest possible spreading code. There is of course the argument that if you do that, each user has a lower data rate, but you could always assign multiple orthogonal spreading codes to the same user so that the summed data rate is equivalent.

What am I missing here? It can't be the case that a longer code length gets you higher SNR without any drawback. There's always a tradeoff.

$\endgroup$
2
  • $\begingroup$ You might find this answer of some help in resolving some of the issues that are confusing you. $\endgroup$ Aug 16, 2023 at 2:26
  • $\begingroup$ I did review this question previously but unfortunately, while it confirms that the total channel throughput remains the same regardless of the number of codes, it does not address my question on how changing the number/length of codes affects the SNR and why you might choose a larger code length over a smaller code length, or vice-versa. $\endgroup$
    – Jordan
    Aug 16, 2023 at 12:57

1 Answer 1

1
$\begingroup$

So in the first example above, it has a spreading factor of 2 (2 spread symbols per data symbol) and the second example has a spreading factor of 4 (4 spread symbols per data symbol). Therefore, this suggests that the second example should result in a much better SNR on the receiver, even though the total throughput is the same for both.

Wait! This increased SNR is per user. And that's OK – the higher the spreading factor, the longer the user transmits one data symbol, so that each symbol has more energy, assuming you keep the transmit power of each transmitter the same, no matter the spreading factor.

But that's a problem right there: in that model, 4 users using a spreading factor (SF) of 4 put twice the power on the channel than 2 users using SF=2.

So, now your system has power proportional to spreading factor, which, yes, means the receiver sees more power at constant noise.

This would suggest that arbitrarily long spreading codes would have arbitrarily high SNR,

Yep, as long as you have non-zero transmit power, a longer code means more energy per data symbol, means more SNR after despreading.

and we should always select the longest possible spreading code.

… as limited by coherence of the channel and TX and RX clocks.

There is of course the argument that if you do that, each user has a lower data rate, but you could always assign multiple orthogonal spreading codes to the same user so that the summed data rate is equivalent.

But that means you need to split the power your transmitter has available between these two codes, and then you win nothing.

$\endgroup$
7
  • $\begingroup$ Thank you, this is a very helpful answer. This brings us to the question I was initially struggling with that led me to this post though: how does one decide what length of spreading code to use? If my transmit power per user is fixed, and my available frequency bandwidth is fixed, and I want to support an upper limit of N users, should I use a code length of N, or some value greater than N? Through what process would one work to determine the appropriate code length? $\endgroup$
    – Jordan
    Aug 16, 2023 at 15:34
  • $\begingroup$ Similarly, if I know I have 4 users, and their transmit power is fixed (e.g. T dB), is there any functional difference between using a code length of 4 and giving them 1 code each to transmit at T dB on, vs. using a code length of 8 and giving them 2 codes each, to split their payload across and transmit at T/2 dB with each code, simultaneously? $\endgroup$
    – Jordan
    Aug 16, 2023 at 15:36
  • $\begingroup$ in practice, as you might guess, things get a bit complicated. The code length you choose not only depends on the number of users you want to serve, but also on your channel, and especially on the channel statistics, as different users will see different attenuation and different frequency-selective channels that require different amounts of power and equalization. There's no "easy" here – schemes with codes of different lengths exist, and in general, codes are dynamically assigned to users, so that, for example in a TDMA/CDMA system, you might use a set of shorter codes for close users, and $\endgroup$ Aug 16, 2023 at 15:59
  • $\begingroup$ more time and longer codes for the further-away users; and you could re-use codes between different phases, it's not like you "burn" a code into a transmitter forever. This really becomes a "systemds design" problem more of a simple "yeah, we trade of data rate for robustness". $\endgroup$ Aug 16, 2023 at 16:00
  • $\begingroup$ Regarding your "is there a functional difference": yes. First of all, dB of what? decibel is a relative measurement. Also, what sense does taking the square root of whatever you mean make (T/2 dB is a square root in linear terms; refresh your decibel understanding!!!). Are you normalizing (with the help of a control backchannel) the received power (to reduce the near/far problem)? Then, going for the longer sequence might make sense for further away stations, as a transmitter might not have enough transmit power otherwise. $\endgroup$ Aug 16, 2023 at 16:03

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.