I am having problems when demodulating the signal: If I demodulate the sequence chip by chip and then operate only with binary information the "integrate and dump" (correlator) sometimes will provide an incorrect decision about the bit. I will need analog information (a.k.a the amplitude of signal) to properly integrate the chips over the bit period.

My question will be better understood after an example.


  1. Assume two users with orthogonal codes: (1 1) and (1 -1) in bipolar notation
  2. I will use the codes for Direct Sequence Spread Spectrum, I apply the sequence after BPSK modulation.
  3. BPSK maps "1" to 1 and "0" to -1.
  4. Carrier: Ideal square wave or sin/cos, I think the issue is independent of the carrier.
  5. Senders and receivers perfectly synchronized, no noise, no delays, etc.

Now Sharing the channel:

Assume both users send a digital "0" at the same time. After BPSK (0 --> -1) and spreading with appropiate codes for each user:

s1 = (-1  -1)
s2 = (-1   1)

Now over the channel this is what travels:

s1+s2 = (-2 0)

[So amplitude -2 for the signal on the first chip, and no signal (? amplitude zero) for the second chip]

Now the important part Now assume we are user 2, and we want to decode our signal, we will receive an analog (-2 0) signal.

I have a Simulink model, and what I was doing was:

  1. BPSK_demodulator block, to go from analog to digital, for every 'chip'.
  2. Multiply the information in bipolar by the DSSS code in bipolar.
  3. Integrate and Dump for a period of the bit (2 chips -or samples-).
  4. Then decode the original bit according to the sign of the integral results. (go to unipolar, so negative value translate to 0)

Comments suggest to first de-speard (dsss code) then BPSK. We can invert step 1 and 2 (first multiply the analog signal by the DSSS code). I will modify my original quesiton accordingly

In any case the integral ("integrate and dump") will be over either 1 or -1 for every chip-sample, because I am doing it after bpsk-demod (maybe that is the error?). I am losing analog information before doing the integral, and I think that is VERY important for CDMA systems. In a perfect channel my integral should always be either +2 or -2, no matter what the other user is sending (because he is using an orthogonal code).

See what happens for User 2:

received signal is (-2 0) We apply the DSSS sequence of User_2 (1 -1) (the despreading operation I represent it with a '*' but its not mathematically correct):

(-2 0) * (1 -1) = (-2 0)

We apply BPSK demod for every sample, then bipolar notation, and the result is

(-1 ?)

Actually the second chip, that has amplitude zero for this case, should not be taken in account for the integral result. But the BPSK demodulator operation has to take a decision. He decides its a 1. We can even overcome this singularity on this example if we assume user_1 sends with much more power than user_2 (Ive been reading about the near far problem, but if codes are perfectly orthogonal this does not affect):

s1 = (-101 , -101)
s2 = (-1 1)
s1+s2= (-102 -100)

User2_after_despread :

(-102 -100) * (1 -1) = (-102 100)

after BPSK demod --> bipolar this is without a doubt a:

 (-1 +1)

So the integrate and dump will do -1 +1 = 0. Actually we can't decide if this is positive or negative.. But should be a -2 for user_2, so it will decode into a "0"

In the analog world the first chip should have a "weight" of -2 (or -102 in the extreme example), and the second chip a weight of 0 (or +100 in the extreme example). The integral should be -2. If for every sample/chip I multiply for the amplitude this works: (-2 0) * (1 -1) = -2 + 0 = -2.. negative : this is a digital 0.

Other 'extreme' cases: user_1 has signal with 100dB more power than user_2 lets try 4 possible combinations of both users sending one bit at the same time:

u1 sends a 1: s1=(100 , 100)
u2 sends a 1: s2=(1 , -1)
s1+s2 = (101, 99)

u2 sends a 0: (-100 , -100)
u2 sends a 1: s2=(1 , -1)
s1+s2 = (-99, -101)

The analog integral for user_2 should always be +2.

u1 sends a 1: s1=(100 , 100)
u2 sends a 0: s2=(-1 , 1)
s1+s2 = (99, 101)

u2 sends a 0: (-100 , -100)
u2 sends a 0: s2=(-1 , 1)
s1+s2 = (-101, -99)

The analog integral for user_2 should always be -2.

As you see signals (101, 99) and (99, 101) are very similar but one decodes into a "1" and the other into a "0" for user_2. The same applies for the other pair (-99 -101) and (-101 -99)

I've been thinking about this a lot. The user_1 signal effect, after despreading for user_2, should be zero. But this is only true if we do an 'analog' integral; If we do integrate and dump over either +1 or -1 values/samples, all this is broken, because we are losing information. I think the orthogonality properties of dsss-codes holds for BPSK modulation (How does the PSK demodulator differentiates one carrier from the other in CDMA ), but if we use other digital modulation we will probably lose the orthogonality properties for most of them (DBPSK, 256-QAM...): that is another problem I think (also interesting).

To overcome this issue I've come up with this: I multiply every demodulated chip with the absolute value of the analog signal, so I recover this information, and then the 'integrate and dump' (correlator?) gives the expected result over the bit period. Here it is:

enter image description here

But maybe that |abs| multiplication has undesired effects when I start to having more realistic systems..

I guess my question is:

How to properly implement a digital demodulator* for CDMA-BPSK?

I have to mix the BPSK bitstream with analog data from the original signal? I have to do an integrate and dump operation even before I run a BPSK_demod decision?

*(+correlator/matched filter? I had no Idea of those concepts until this week) ps: I am newbie on signals an processing :)

edit: I will probably try to reduce the length of this question.

  • $\begingroup$ I didn't read through your whole question yet, but premise #1 of your hypothesis is incorrect. $[1, 1]$ and $[1, 0]$ are not orthogonal to one another (their inner product is $1$). $\endgroup$
    – Jason R
    Jan 30, 2019 at 14:11
  • $\begingroup$ You are right, they become orthogonal in bipolar notation. I think the problem still holds. I will rewrite everything on bipolar then. $\endgroup$
    – renzoe
    Jan 30, 2019 at 15:04
  • $\begingroup$ Ok, that makes sense. Very brief answer: yes, you can build a CDMA receiver using a bank of matched filters, one for each spreading code. Carrier synchronization can be an issue, however, or you can have significant scalloping loss. $\endgroup$
    – Jason R
    Jan 30, 2019 at 15:13
  • $\begingroup$ What you shouldn't do is do the BPSK decision prior to despreading. That's a great way to loose your orthogonality, as the first comment demonstrates. So, the algorithm is despread -> de-BPSK; not de-BPSK->despread, since the BPSK decision is not a linear operation. $\endgroup$ Jan 30, 2019 at 15:23
  • $\begingroup$ HI Markus, thanks for the comments. Yes I see your point. I will rewrite the question with despreading before BPSK demod (and spreading after BPSK mod). I guess the question is when and how I do the "integrate and dump" operation? If I do after the BPSK_demod simulink block I still have the problem. I will integrate over +1 or -1 samples/chips. $\endgroup$
    – renzoe
    Jan 30, 2019 at 15:34


Your Answer

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

Browse other questions tagged or ask your own question.