Forum: GNU Radio Direct Sequence Spread Spectrum Question.

Posted by Ahmed Zaheer (Guest)
on 2012-11-29 16:21
(Received via mailing list)
I was trying to implement Direct Sequence Spread Spectrum in gnuradio. 
In the transmitting flowgraph I am using GLFSR source to multiply it 
with the file which I am transmitting. At the receiver end I am able to 
receive it by multiplying it with same GLFSR source with the same 
values. But there is no acquisition being done. I am seeing a block 
named PN Correlator. But I don't know what this block does and where 
should I use this block in the flowgraph. My question is does anybody 
know what the PN Correlator block does and is it performing the 
acquisition or not.

Any help/comments would be greatly appreciated.

Regards.
Posted by Albert Chun-Chieh Huang (Guest)
on 2012-12-01 16:47
(Received via mailing list)
Ahmed Zaheer <ghumman1988@yahoo.com> writes:

> I was trying to implement Direct Sequence Spread Spectrum in gnuradio. In the 
transmitting flowgraph I am using GLFSR source to multiply it with the file which 
I am transmitting. At the receiver end I am able to receive it by multiplying it 
with same GLFSR source with the same values. But there is no acquisition being 
done. I am seeing a block named PN Correlator. But I don't know what this block 
does and where should I use this block in the flowgraph. My question is does 
anybody know what the PN Correlator block does and is it performing the 
acquisition or not. 
>
> Any help/comments would be greatly appreciated. 
>
> Regards.

Ahmed,

After taking a look at digital_pn_correlator_cc.cc, I think it's a
serial code acquisition block as described in its header. The output
will be cross-correlation of PN sequence and input samples. Input sample
pointer is advanced by noutput_items samples for each call, and the
output value is derived from multiplying input samples by PN sequence,
both are length of whole PN sequence. If you think noutput_items to be
one, then it will be easier to understand this code. So, yes, it's
serial search code acquisition to my understanding. If you monitor the
output of digital_pn_correlator, you should see a spike when the
acquisition is achieved, and the interval between two spikes will be
roughly the length of PN sequence due to noise effect. I think its input
is time domain samples from your front-end.

This is my understanding of this block. Hope it helps.

Best Regards,

Albert

--
Albert Chun-Chieh Huang(黃俊傑)
Blog: Random Notes, http://alberthuang314.blogspot.com/
Posted by Ahmed Zaheer (Guest)
on 2012-12-03 02:59
(Received via mailing list)
Thanks a lot Albert:

I am multiplying my file source with GLFSR source and then giving the 
product to modulation blocks in transmitting flowgraph. In the receiving 
flowgraph after demodulating the signal I am passing the demodulated 
signal through PN Correlator block having same values of degree, mask 
and seed parameters and then save the file into sink source. I am not 
able to receive the same data(it only works when I use degree=1, mask 
and seed =0 for both GLFSR and PN Correlator i.e. making GLFSR a 
constant source of magnitude 1). Do I have to use the PN Correlator 
block in some other manner? Or I should use some other blocks after PN 
Correlator block to retrieve the original data? 

Regards.
Ahmed. 


________________________________
 From: Albert Chun-Chieh Huang <alberthuang314@gmail.com>
To: Ahmed Zaheer <ghumman1988@yahoo.com>
Cc: "discuss-gnuradio@gnu.org" <discuss-gnuradio@gnu.org>
Sent: Saturday, December 1, 2012 7:46 AM
Subject: Re: [Discuss-gnuradio] Direct Sequence Spread Spectrum 
Question.

Ahmed Zaheer <ghumman1988@yahoo.com> writes:

> I was trying to implement Direct Sequence Spread Spectrum in gnuradio. In the 
transmitting flowgraph I am using GLFSR source to multiply it with the file which 
I am transmitting. At the receiver end I am able to receive it by multiplying it 
with same GLFSR source with the same values. But there is no acquisition being 
done. I am seeing a block named PN Correlator. But I don't know what this block 
does and where should I use this block in the flowgraph. My question is does 
anybody know what the PN Correlator block does and is it performing the 
acquisition or not. 
>
> Any help/comments would be greatly appreciated. 
>
> Regards.

Ahmed,

After taking a look at digital_pn_correlator_cc.cc, I think it's a
serial code acquisition block as described in its header. The output
will be cross-correlation of PN sequence and input samples. Input sample
pointer is advanced by noutput_items samples for each call, and the
output value is derived from multiplying input samples by PN sequence,
both are length of whole PN sequence. If you think noutput_items to be
one, then it will be easier to understand this code. So, yes, it's
serial search code acquisition to my understanding. If you monitor the
output of digital_pn_correlator, you should see a spike when the
acquisition is achieved, and the interval between two spikes will be
roughly the length of PN sequence due to noise effect. I think its input
is time domain samples from your front-end.

This is my understanding of this block. Hope it helps.

Best Regards,

Albert
Posted by Gerald Baier (Guest)
on 2012-12-03 21:12
(Received via mailing list)
On 03.12.2012 02:58, Ahmed Zaheer wrote:
> I am multiplying my file source with GLFSR source and then giving the
> product to modulation blocks in transmitting flowgraph. In the
> receiving flowgraph after demodulating the signal I am passing the
> demodulated signal through PN Correlator block having same values of
> degree, mask and seed parameters and then save the file into sink
> source. I am not able to receive the same data(it only works when I
> use degree=1, mask and seed =0 for both GLFSR and PN Correlator i.e.
> making GLFSR a constant source of magnitude 1).
You have to make sure that the chip-rate of your PN sequence is higher
than the symbol-rate of your modulation block. Try setting the sample
per symbol option of the modulation block to the length of the PN
sequence. This way the period of the PN sequence is equal to one symbol
duration.
> Do I have to use the PN Correlator block in some other manner? Or I
> should use some other blocks after PN Correlator block to retrieve the
> original data?
I think your next problem are the following lines in the PN correlator,
where d_pn is the current chip of the PN sequence and d_len the
sequence's period:

  67   for (int i = 0; i < noutput_items; i++) {
  68     sum = 0.0;
  69
  70     for (int j = 0; j < d_len; j++) {
  71       if (j != 0)                           // retard PN generator
one sample per period
  72         d_pn = 2.0*d_reference->next_bit()-1.0; // no conditionals
  73       sum += *in++ * d_pn;
  74     }
  75
  76     *out++ = sum*gr_complex(1.0/d_len, 0.0);
  77   }

Basically after one complete period (line 70), the correlator keeps the
old state of the PN generator's shift register, hereby
retarding/changing the phase of the PN sequence (line 71). What you want
do to, is to always correlate with the same phase, so removing line 71
should do the trick.

Keep in mind that the PN correlator is a decimator block, so for N
samples, with N being the length of the PN sequence, it only outputs one
sample. Therefore you can't demodulate with the same samples per symbol
option as in the modulator.

I hope that helps,

Gerald
Posted by Gonzalo Flores de la Parra (gflopa)
on 2012-12-06 23:24
what kind of digital modulation are you using? im working on a DS with 
802.11b Barker sequence but my receiver isn't working yet. What version 
of GNU-radio are you working with? and in what SDR  are you implementing 
your DS?
Posted by Albert Chun-Chieh Huang (Guest)
on 2012-12-07 05:14
(Received via mailing list)
Gerald Baier <gerald.baier@student.kit.edu> writes:

> On 03.12.2012 02:58, Ahmed Zaheer wrote:
[stuff deleted]
>  70     for (int j = 0; j < d_len; j++) {
> the old state of the PN generator's shift register, hereby
>
> Gerald

Hi, Gerald,

Thank you for clarifying this block! I think I misunderstood the code in
pn_correlator.

If I read it correctly, pn_correlator acts like one finger in a RAKE
receiver in that it correlates input samples by PN sequence and
transforms chips to symbols. I don't see "sequential search" part as
described in its comment. As far as I know, sequential search means to
correlate input samples by PN sequence and advance one sample after each
correlation. If that's the case, may I suggest GNU Radio developers
modify its comment in pn_correlator_cc.h from "PN code sequential search
correlator" to "PN code correlator" without using "sequential search"?

--
Albert Chun-Chieh Huang(T)
Blog: Random Notes, http://alberthuang314.blogspot.com/
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.