Two Questions regarding the very beginning steps of implementing DSSS!

Dear Gnuradio,
I had two questions…I did spend some time searching for my answers in
the
mailing list and couldn’t find “if already discussed” solutions. Please
forgive if so.

Q.1. TX side: I simply want to take a packet and XOR each bit of the
packet
with a PN-code (hint: final goal will be to implement a DSSS). Could you
please hint me some pointers as to where catch the packet before it gets
modulated so that I can XOR it with my code? I read and re-read
benchmark_tx.py code and tried to trace the function send_pkt(). But I
couldn’t do a good job at it. Please give me some pointers. PS: My
modulation choice will be DBPSK.

Q.2. RX side: I want to use usrp_rx_cfile.py to capture my sent data,
then
change it into matlab readable data format using “read_binary_complex.m”
and
finally will do XOR with my code in MATLAB. I have one small question
and
possibly a stupid one…that I am about to ask it hesistantly… the
binary
file I get as an output of usrp_rx_cfile.py, say binary.dat, do I need
to
demodulate it at all (with dbpsk_demod) as the usrp_rx_cfile.py has no
options for allowing me to select my demod_type.

-Thanks in Advance,
-Novice-GnuRadioer and Novice-DSPer

On Sun, Feb 8, 2009 at 3:19 AM, Bishal T. [email protected]
wrote:

Q.1. TX side: I simply want to take a packet and XOR each bit of the packet
with a PN-code (hint: final goal will be to implement a DSSS). Could you
please hint me some pointers as to where catch the packet before it gets
modulated so that I can XOR it with my code? I read and re-read
benchmark_tx.py code and tried to trace the function send_pkt(). But I
couldn’t do a good job at it. Please give me some pointers. PS: My
modulation choice will be DBPSK.

You will find the call to create the packet contents prior to modulation
here:

http://gnuradio.org/trac/browser/gnuradio/trunk/gnuradio-core/src/python/gnuradio/blks2impl/pkt.py#L86

After this function returns, the ‘pkt’ variable will contain an array
of bytes representing the full packet (header, payload, CRC). You can
manipulate its contents from Python here.

If you only want to modify a portion of the packet, you can instead
add your code to the called function:

http://gnuradio.org/trac/browser/gnuradio/trunk/gnuradio-core/src/python/gnuradio/packet_utils.py#L104

Q.2. RX side: I want to use usrp_rx_cfile.py to capture my sent data, then
change it into matlab readable data format using “read_binary_complex.m” and
finally will do XOR with my code in MATLAB. I have one small question and
possibly a stupid one…that I am about to ask it hesistantly… the binary
file I get as an output of usrp_rx_cfile.py, say binary.dat, do I need to
demodulate it at all (with dbpsk_demod) as the usrp_rx_cfile.py has no
options for allowing me to select my demod_type.

Yes, you will need to demodulate the data. The usrp_rx_cfile.py
program records complex, downconverted baseband samples directly from
the USRP.

Johnathan

Bishal T. wrote:

Q.1. TX side: I simply want to take a packet and XOR each bit of the
packet with a PN-code (hint: final goal will be to implement a DSSS).
Could you please hint me some pointers as to where catch the packet
before it gets modulated so that I can XOR it with my code? I read and
re-read benchmark_tx.py code and tried to trace the function send_pkt().
But I couldn?t do a good job at it. Please give me some pointers. PS: My
modulation choice will be DBPSK.

If your packets have an outside source, one of the easiest ways to get
them in to a GnuRadio stream is by using the tun/tap device. Tun/tap
is a pseudo ethernet device driver. On side of it talks to the OS’s
network stack, while the other side connects to an application program
instead of to actual ethernet hardware. This gives you direct access to
packet data at one of two levels. The Tap device gives you the entire
raw ethernet frame, while the Tun device simply gives you the ethernet
frame’s payload. I used a Tun device in the GMSK Spacecraft
Groundstation code that is in CGRAN. Look at the hdlc router block
code.

Once you have the packets read into a GnuRadio stream, it’s easiest
(though maybe not most efficient) to handle the bit-level processing
in an unpacked stream of bytes with one bit per byte. There’s a
standard block to do the unpacking.

As far as DSSS goes, I’ve done some GnuRadio work with that as well,
but it’s not complete. As you note, the basic operation centers
around XORing the bitstream with a pseudorandom sequence. Typically
this sequence runs at many times the clock rate of of the data.
This is called the “chip” rate. So, the data must be upsampled to
the chip rate before it can be XORed.

In the world of streams of digitized analog data, this upsampling
is typically done by inserting extra 0’s into the bitstream and
following with a low-pass filter to remove the introduced high
frequency components. But since we’re working with digital
data directly, it’s much more computationally efficient to
simply replicate the input bit the appropriate number of times
onto the output. The code for a block that does this also
appears in the GMSK Spacacraft Groundstation project, although
it is being used for other purposes than DSSS. It’s called
digital_upsampler.

@(^.^)@ Ed