Reply by johnlovestohate September 19, 20102010-09-19
I am sorry about that code. Let me explain it here.

The received data signal I have is a complex baseband signal sampled at
twice the chip rate.

Data = {d0,d1,d2,d3........}, BPSK modulated complex baseband signal at
receiver.

The original PN sequence can be assumed as shown below,
PN = {1 -1 1 -1 ....... 1 -1} which is of length 1023

I divide the signal into bins of 2046 as the length of PN is 1023 and the
signal is sampled at twice the chip rate.

PN_2046 = {1 1 -1 -1 1 1 -1 -1 ...... 1 1 -1 -1} represents the
interpolated PN sequence which is interpolated by a factor of 2. I am just
repeating the PN chip by one.

Now, I multiply the arrays, Data and PN_2046 sample by sample and add them
together resulting in one complex value and then I find the magnitude of
the resultant sum. The following is the matlab code

result = Data.*PN_2046
result_sum = abs(sum(result))

The result_sum is high when the data array and PN_2046 array are aligned in
code phase.

But this is a slow process so I want to do sth similar using FFTs. Complex
cross correlation doesn't seem to work here.

Thanks,
John

> > >johnlovestohate wrote: >> I am sorry I wasn't particularly clear. >> >> I am trying to find the starting point of the PN sequence in the
received
>> signal so that I can use this value in achieving a code phase lock in
the
>> code tracking loop and also to despread the signal before passing it to
the
>> carrier tracking loop. >> >> something like this link shows. >> http://img19.imageshack.us/img19/826/dsssrxr.jpg >> This is the flow graph of my DSSS transmitter in software. > >In this loop, the carrier sync depends on the PN sequence sync, and the >PN sequence sync depends on the carrier sync. This arrangement works for >tracking, but it generally won't work for the acquisition of the signal. > >> [data bits]-->[spreading by XOR with PN Seq]--->[convert to symbols
{-1+0j
>> or 1+0j}]--->[RRC interpolation FIR, interp=4]--->[channel model] >> >> The data bits are spread using 1023 length Gold codes(each bit is
converted
>> to 20*1023 bit sequence). After this each chip coming out of spreading >> block is converted to BPSK symbols and then RRC interpolated with >> interpolation factor equal to 4. I pass this into a channel block with >> frequency offset equal to '0' therefore, there is no frequency offset
but
>> only signal degradation due to noise. >> >> I am then saving the signal in the DSSS Receiver flow graph this way >> >> signal--->[channel filter]--->[RRC FIR filter, interp=1]--->[saved
file]
>> >> I use two methods to determine the signal peak.One works while the
other
>> doesn't. It means the algorithm has a problem. >> >> Assuming, the PN_Sequence looks like this {1,-1,1,-1} the up-sampled pn >> sequence looks like {1,1,1,1,-1,-1,-1,-1,1,1,1,1-1,-1,-1,-1} where we >> up-sample by the interpolation factor 4. >> >> 1. I do a sample by sample multiply and integrate which gives a good >> correlation. >> pnlen=1023; >> sps=4 % samples per symbol >> >> >> for n=1:1:pnlen*sps >> integ_r = integ_r + real(rxdata(n))*pn(n); % pn is upsampled
pn_sequence
>> integ_i = integ_i + imag(cordata(n))*pn(n); >> end >> corr_result=(integ_r*integ_r + integ_i*integ_i)^0.5 % magnitude >> >> This gives good results but is very slow. >> >> Then I decided to use FFT to speed things up >> >> 2. When using FFT I do this. >> PN_FFT = fft(pn) % pn is of length pnlen*sps. >> data_FFT = fft(data) % using pnlen*sps data points. >> COR_FFT = ifft(PN_FFT.*conjugate(data_FFT)); > >I have no idea what this script supposed to mean. >You have to take a piece of a signal of the length of 2xPN sequence, add > the same amount of zeroes so to compute a linear convolution, and take >a PN sequence of 1 x length as the reference. > >> The correlation results that i get using this is bad. >> What is wrong with this algorithm? > >For starters, can you compute just plain old simple convolution via FFT ? > >Vladimir Vassilevsky >DSP and Mixed Signal Design Consultant >http://www.abvolt.com >
Reply by Vladimir Vassilevsky September 19, 20102010-09-19

johnlovestohate wrote:
> I am sorry I wasn't particularly clear. > > I am trying to find the starting point of the PN sequence in the received > signal so that I can use this value in achieving a code phase lock in the > code tracking loop and also to despread the signal before passing it to the > carrier tracking loop. > > something like this link shows. > http://img19.imageshack.us/img19/826/dsssrxr.jpg > This is the flow graph of my DSSS transmitter in software.
In this loop, the carrier sync depends on the PN sequence sync, and the PN sequence sync depends on the carrier sync. This arrangement works for tracking, but it generally won't work for the acquisition of the signal.
> [data bits]-->[spreading by XOR with PN Seq]--->[convert to symbols {-1+0j > or 1+0j}]--->[RRC interpolation FIR, interp=4]--->[channel model] > > The data bits are spread using 1023 length Gold codes(each bit is converted > to 20*1023 bit sequence). After this each chip coming out of spreading > block is converted to BPSK symbols and then RRC interpolated with > interpolation factor equal to 4. I pass this into a channel block with > frequency offset equal to '0' therefore, there is no frequency offset but > only signal degradation due to noise. > > I am then saving the signal in the DSSS Receiver flow graph this way > > signal--->[channel filter]--->[RRC FIR filter, interp=1]--->[saved file] > > I use two methods to determine the signal peak.One works while the other > doesn't. It means the algorithm has a problem. > > Assuming, the PN_Sequence looks like this {1,-1,1,-1} the up-sampled pn > sequence looks like {1,1,1,1,-1,-1,-1,-1,1,1,1,1-1,-1,-1,-1} where we > up-sample by the interpolation factor 4. > > 1. I do a sample by sample multiply and integrate which gives a good > correlation. > pnlen=1023; > sps=4 % samples per symbol > > > for n=1:1:pnlen*sps > integ_r = integ_r + real(rxdata(n))*pn(n); % pn is upsampled pn_sequence > integ_i = integ_i + imag(cordata(n))*pn(n); > end > corr_result=(integ_r*integ_r + integ_i*integ_i)^0.5 % magnitude > > This gives good results but is very slow. > > Then I decided to use FFT to speed things up > > 2. When using FFT I do this. > PN_FFT = fft(pn) % pn is of length pnlen*sps. > data_FFT = fft(data) % using pnlen*sps data points. > COR_FFT = ifft(PN_FFT.*conjugate(data_FFT));
I have no idea what this script supposed to mean. You have to take a piece of a signal of the length of 2xPN sequence, add the same amount of zeroes so to compute a linear convolution, and take a PN sequence of 1 x length as the reference.
> The correlation results that i get using this is bad. > What is wrong with this algorithm?
For starters, can you compute just plain old simple convolution via FFT ? Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com
Reply by johnlovestohate September 18, 20102010-09-18
I am sorry I wasn't particularly clear.

I am trying to find the starting point of the PN sequence in the received
signal so that I can use this value in achieving a code phase lock in the
code tracking loop and also to despread the signal before passing it to the
carrier tracking loop.

something like this link shows.
http://img19.imageshack.us/img19/826/dsssrxr.jpg


This is the flow graph of my DSSS transmitter in software.

[data bits]-->[spreading by XOR with PN Seq]--->[convert to symbols {-1+0j
or 1+0j}]--->[RRC interpolation FIR, interp=4]--->[channel model]

The data bits are spread using 1023 length Gold codes(each bit is converted
to 20*1023 bit sequence). After this each chip coming out of spreading
block is converted to BPSK symbols and then RRC interpolated with
interpolation factor equal to 4. I pass this into a channel block with
frequency offset equal to '0' therefore, there is no frequency offset but
only signal degradation due to noise.

I am then saving the signal in the DSSS Receiver flow graph this way

signal--->[channel filter]--->[RRC FIR filter, interp=1]--->[saved file]

I use two methods to determine the signal peak.One works while the other
doesn't. It means the algorithm has a problem.

Assuming, the PN_Sequence looks like this {1,-1,1,-1} the up-sampled pn
sequence looks like {1,1,1,1,-1,-1,-1,-1,1,1,1,1-1,-1,-1,-1} where we
up-sample by the interpolation factor 4.

1. I do a sample by sample multiply and integrate which gives a good
correlation.
pnlen=1023;
sps=4 % samples per symbol


for n=1:1:pnlen*sps
  integ_r = integ_r + real(rxdata(n))*pn(n); % pn is upsampled pn_sequence
  integ_i = integ_i + imag(cordata(n))*pn(n);
end
corr_result=(integ_r*integ_r + integ_i*integ_i)^0.5 % magnitude

This gives good results but is very slow.

Then I decided to use FFT to speed things up

2. When using FFT I do this.
PN_FFT = fft(pn) % pn is of length pnlen*sps.
data_FFT = fft(data) % using pnlen*sps data points.
COR_FFT = ifft(PN_FFT.*conjugate(data_FFT));

The correlation results that i get using this is bad. 

What is wrong with this algorithm?

Thanks for the patience you all showed.
John






Reply by Tim Wescott September 17, 20102010-09-17
On 09/17/2010 05:08 AM, johnlovestohate wrote:
> Hi all, > Where can I find a practical block diagram of a Direct Sequence Spread > Spectrum (DSSS) system? I looked for it everywhere but couldn't find any. I > am aware of the general block diagrams but I am specifically interested in > something that shows how the system looks in the real world. Currently, I > am trying to implement a DSSS system on Gnuradio.
What bits are missing, in your view? Have you googled?
> In another question if I am using RRC shaping in a BPSK based DSSS system > how can I do a cross correlation between the received signal and the PN > Sequence. I am using a real valued PN sequence whereas the received signal > is a RRC filtered (to complete the raised cosine system) complex signal at > baseband. The cross correlation using real valued pn sequence and the > complex signal at baseband doesn't give me good results. I am using FFTs to > do this. The fact that the transmitted signal is RRC shaped might be a > reason but I am not sure though. > > Can someone who has experience in DSSS offer me a little help please?
I'm pretty sure that if you're RRC filtering the RF you can just multiply by the PN sequence. I've had good results doing things that way with CDMA phone signals. You may be down a few dB of signal to noise doing that -- but I'm not sure, I haven't had my coffee yet. A bit extra noise or no, that's what I've done, and the correlation peak came through loud and clear. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" was written for you. See details at http://www.wescottdesign.com/actfes/actfes.html
Reply by brent September 17, 20102010-09-17
On Sep 17, 8:34&#4294967295;am, Richard Owlett <rowl...@pcnetinc.com> wrote:
> johnlovestohate wrote - again after waiting for a whole 6 hours: > > > Hi all, > > Where can I find a practical block diagram of a Direct Sequence Spread > > Spectrum (DSSS) system? I looked for it everywhere but couldn't find any. > > &#4294967295; try Google?????? > > E.G.www.google.com/search?q="block+diagram"+"Direct+Sequence+Spread+Spectrum"+OR+DSSS
Ed Gruberman (substitute DSP for Tae Kwon Leap) http://www.youtube.com/watch?v=KF6zILkOOc0&feature=related
Reply by Richard Owlett September 17, 20102010-09-17
johnlovestohate wrote - again after waiting for a whole 6 hours:
> Hi all, > Where can I find a practical block diagram of a Direct Sequence Spread > Spectrum (DSSS) system? I looked for it everywhere but couldn't find any.
try Google?????? E.G. www.google.com/search?q="block+diagram"+"Direct+Sequence+Spread+Spectrum"+OR+DSSS
Reply by johnlovestohate September 17, 20102010-09-17
Hi all,
Where can I find a practical block diagram of a Direct Sequence Spread
Spectrum (DSSS) system? I looked for it everywhere but couldn't find any. I
am aware of the general block diagrams but I am specifically interested in
something that shows how the system looks in the real world. Currently, I
am trying to implement a DSSS system on Gnuradio.

In another question if I am using RRC shaping in a BPSK based DSSS system
how can I do a cross correlation between the received signal and the PN
Sequence. I am using a real valued PN sequence whereas the received signal
is a RRC filtered (to complete the raised cosine system) complex signal at
baseband. The cross correlation using real valued pn sequence and the
complex signal at baseband doesn't give me good results. I am using FFTs to
do this. The fact that the transmitted signal is RRC shaped might be a
reason but I am not sure though.

Can someone who has experience in DSSS offer me a little help please? 

Thanks,
John