Hi

I am new to gnu radio and am trying to understand how a packet

I am looking at benchmark_tx.py and benchmark_rx.py.I understood that
this is the top block which uses transmit_py and receive_py as the
underlying blocks.
I am using DQPSK for modulation.I went through dbpsk.py to understand
how the modulation is done.What i couldnt find out is where is the bit
stream modulated with the carrier frequency.From the theory of QPSK i
know that the phase of the carrier is changed depending if the bit that
modulates it is ‘1’ or ‘0’.
I cant figure out where this happens in the code.

My eventual aim is to put a block for BPSK in place.Any pointers on how
to do it will use greatly appreciated

Manav

I may not be the best to explain this, but I’ll give it my best shot.

With simple PSK it is modulating with a 1 or a 0 based on two
constellation points, and depending on the variation of PSK you will
have more than 1 constellation point and these will map to more than 1
bit. You can see this with QPSK, for example:

So QPSK isn’t exactly demodulating to 0 or 1, that’s PSK. With QPSK
it’s demodulating to bit sequences of length 2.

So, what you end up doing is finding out where this phase shift places
your symbol around the unit circle. Whichever constellation it is
closest to, it will produce the bits relative to the constellation.

As you are looking at dbpsk.py as an example of how the demodulation is
done (generating bits from your samples and symbols), start here:

You will see that it uses the diff_phase_cc() block to use the phase
shifting of symbols. You can look at the code for this block to further
understand whats going on.

Then, if you look a little further down in the python code you will find
the code which attempts to map the given symbols to a constellation
point, which then produces your bits.

The actual constellation mapping is specified within the psk.py module:

You will find that the number of constellations is dependent on the
modulation (PSK=2, QPSK=4, 8PSK=8) and that make_constellation actually
places them around the unit circle for use with the symbol mapper.

Remember, the python does the block setup and connections, then the
actual mapping is actually happening within the C++ code of the blocks.
So, if you want to see how the actual symbol mapping to constellations
is done, you look at the C++ code for gr.map_bb, which would be in
gr_map_bb.cc:

This is a general overview… if you have more specific questions,
seemed rather open

• George

And if you don’t understand how the python code interacts with the C++
code, I strongly recommend reading the following document:

• George

yup…got it…thanks…

i understood in QPSK how the bits get mapped to constellation space.

One doubt still persists.QPSK modulation theory tells us that we need to
change the phase of the carrier depending upon the incoming data
bits…i.e what we see mapped to the constellation space is the modulated
data.
I cannot see a carrier frequency specified anywhere in bqpsk.y…Where do
i specify the carrier frequency for my transmission…this part is still
a bit hazy…
I can see the incoming bits getting mapped to constellation space not
the modulated data…M i missing something here?

Thanks
Manav

On 3/4/08, Manav R. [email protected] wrote:

I cannot see a carrier frequency specified anywhere in bqpsk.y…Where do
i specify the carrier frequency for my transmission…this part is still
a bit hazy…

The USRP acts as a direct conversion transmitter. The QPSK modulated
baseband waveform (constellation) is generated on the host and sent to
the USRP via USB, where it is turned into an analog I and Q baseband
signal with digital to analog converters. The transmitter
daughterboard generates a local oscillator at the desired carrier
frequency, and a complex mixer modulates this carrier with the I and Q
signals to form your passband transmitted waveform.

Johnathan C.
Corgan Enterprises LLC
http://corganenterprises.com/

Manav R. wrote am 2008-03-04 17:37:

I cannot see a carrier frequency specified anywhere in bqpsk.y…Where do
i specify the carrier frequency for my transmission…this part is still
a bit hazy…

All modulation is done in basis band, and then the signal is shifted to
the carrier frequency.

It’s funny to listen to and think of, but it is definitely correct to do
phase or frequency modulation with a carrier of 0 and shift it to the
target freuency afterwards. Mathematically it’s the same as modulating
the carrier.

## Patrick

Engineers motto: cheap, good, fast: choose any two
Patrick S.
Student of Telematik, Techn. University Graz, Austria

If you are using the USRP, it handles all the conversion to and from
carrier frequency. The data going across the USB bus is generally
complex baseband.
You instruct the USRP what the carrier frequency should be:

``````    #Set freq
if not(usrp.tune(self.usrp_out, 0, self.out_dcard, tx_freq)):
print "Failed to set initial frequency"
self._set_status_msg("Failed to set initial frequency")``````

thanks for the replies…
So that means if i dont have a USRP, i cannot simulate a packet
transmission/reception entirely in software since the data will never be
modulated to the carrier frequency.

What is the alternative…Write a mixer block(using gr.multiply_cc) in
software and feed the data bits and a local oscillator to this?The
output of the mixer will then be the modulated signal at the carrier
frequency i want…And then I demodulate it using costas’s receiver…

Is this the right way…

Manav

On Tue, Mar 4, 2008 at 1:27 PM, Manav R. [email protected]
wrote:

thanks for the replies…
So that means if i dont have a USRP, i cannot simulate a packet
transmission/reception entirely in software since the data will never be
modulated to the carrier frequency.

No need for a USRP … just simulation!

What is the alternative…Write a mixer block(using gr.multiply_cc) in
software and feed the data bits and a local oscillator to this?The
output of the mixer will then be the modulated signal at the carrier
frequency i want…And then I demodulate it using costas’s receiver…

It depends on what you’re trying to simulate. The RF hardware with
I/Q phase/DC imbalances? Just baseband distortions? Fading? Doppler

I recommend the book:

``````"Simulation of Communication Systems" ISBN 0-306-46267-2
``````

It’s heavy on the math, and it’s really for advanced readers - but it
covers everything.

I believe there may be some channels implemented within GNU Radio
right now, but there hasn’t been much discussion of using GNU Radio
strictly for simulation.

Hope this helps.

Brian

Brian P. wrote:

output of the mixer will then be the modulated signal at the carrier
It’s heavy on the math, and it’s really for advanced readers - but it
covers everything.

I believe there may be some channels implemented within GNU Radio
right now, but there hasn’t been much discussion of using GNU Radio
strictly for simulation.

Hope this helps.

There is a basic channel model added in the benchmark_loop.py case:

• George

No USRP, no problem. Here is an example of what you want (taken from
http://noether.uoregon.edu/~jl/gmsk/gmsk-test.py)

``````# Mix to IF
lo = gr.sig_source_c(sample_rate, gr.GR_SIN_WAVE, lo_freq,
1.0, 0)
mixer = gr.multiply_cc()
fg.connect(lo, (mixer, 1))

# Take real part as transmit
ctof = gr.complex_to_float()

# Simulate noise in the channel
noise = gr.noise_source_f(gr.GR_GAUSSIAN, noise_mag)
fg.connect(noise, (air_noise, 1))

# Mix to baseband
chan_taps = gr.firdes.low_pass(1.0, sample_rate, lp_cutoff,
lp_tw, gr.firdes.WIN_HAMMING)
chan_filter = gr.freq_xlating_fir_filter_fcf(1, chan_taps,
-lo_freq, sample_rate)
``````

Hope that helps.
-Steven

I too am a new user of the USRP and continuing on this topic, id like to
be able to display the symbol mapping done by the benchmark codes. Some
starting guidance would extremely helpful. I have been informed of the
matlib package which is available to produce matlab like plots, is this
a way to go?

If you are looking to do plots, I would suggest saving them to a file
and using the matlab/octave scripts available here

If you want to do something in real time look at the various scripts
in the ‘examples’ folder for how to use the scope sink. It has an x/y
mode that can be effectively used as an IQ plot to show your 2D symbol
space.

Jason

Michael Matrakis wrote:

Michael

It’s still a work-in-progress, but I’ve been working on the gr-qtgui
is a qt-based version of the benchmark_rx digital code. When you run it
with the -G option, it will show you two plots; one of the received
signal, and the other is of the output of the mpsk_receiver. If you
click on the Constellation tab, you will see the symbol mapping.

There is also a version of benchmark_loopback with a Qt interface that
will also show you this.

Tom

Hi guys,

I too am a new user of the USRP and continuing on this topic, id like to
be able to display the symbol mapping done by the benchmark codes. Some
starting guidance would extremely helpful. I have been informed of the
matlib package which is available to produce matlab like plots, is this
a way to go?

Cheers,

Michael

Jason U. wrote:

I too am a new user of the USRP and continuing on this topic, id like to
be able to display the symbol mapping done by the benchmark codes. Some
starting guidance would extremely helpful. I have been informed of the
matlib package which is available to produce matlab like plots, is this
a way to go?

If you are looking to do plots, I would suggest saving them to a file
and using the matlab/octave scripts available here

If you want to do something in real time look at the various scripts
in the ‘examples’ folder for how to use the scope sink. It has an x/y
mode that can be effectively used as an IQ plot to show your 2D symbol
space.

Jason

Thanks Jason,

Another question though is im slightly confused on how to use the
gr.file_sink command which the octave page says to use as the file sink.
I’m just a little unsure on how to link this to a variable to output
useful data into the produced file.

Cheers,

Michael