0% found this document useful (0 votes)
7 views

lab2

The document provides an overview of a lab course on wireless system design using Software Defined Radio (SDR) and GNU Radio. It covers the fundamentals of digital signal processing, the use of GNU Radio Companion for creating flowgraphs, and the implementation of a transmitter that generates a pseudo-random bit sequence (PRBS). Additionally, it outlines the procedure for configuring the flowgraph, running experiments, and capturing results for analysis.

Uploaded by

Peter Jack
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

lab2

The document provides an overview of a lab course on wireless system design using Software Defined Radio (SDR) and GNU Radio. It covers the fundamentals of digital signal processing, the use of GNU Radio Companion for creating flowgraphs, and the implementation of a transmitter that generates a pseudo-random bit sequence (PRBS). Additionally, it outlines the procedure for configuring the flowgraph, running experiments, and capturing results for analysis.

Uploaded by

Peter Jack
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

ELEX 7860 : Wireless System Design

2019 Winter Term

Introduction to SDR and GNU Radio

Introduction used to optimize designs and to generate test vectors


for verification of DSP hardware.
Modern wireless communication systems process A GNU Radio flowgraph can send/receive samples
signals as sampled digitized signals rather than as to/from radio hardware, files, network connections
analog signals. This is known as “Digital Signal Pro- and other GNU Radio flowgraphs1 .
cessing” (DSP) and is used because of the lower cost An example of a flowgraph created by GRC is
and lower power consumption of digital compared to shown in Figure 1.
analog electronics.
Exceptions include the Analog Front End (AFE) Dataflow Flowgraphs
that converts between digital baseband signals and
the passband RF signal, RF power amplifiers and DC It may appear from the flowgraph that the blocks op-
power supplies, all of which are necessarily analog. erate in parallel (simultaneously). However, since
Most DSP basebands are implemented using the blocks are implemented in software they must
application-specific digital circuits to minimize costs execute sequentially. This “dataflow” architecture
and power consumption. However, a sufficiently-fast means that blocks execute only when they have data
computer can also implement the baseband signal to process. The order in which blocks are executed is
processing. This is known as “Software Defined Ra- determined by a scheduler that examines the amount
dio” (SDR): of data available on the input ports of each block.
For efficiency reasons there are buffers between
baseband blocks that allow blocks to process multiple sam-
I/Q
samples
RF up/down
antenna ples each time the block is executed. However, this
user computer
converter buffering increases latency and can prevent proper
operation of certain delay-sensitive applications such
GNU Radio is an open-source project that develops as those using feedback control (e.g. PLLs). Many
software for SDR systems. GNU Radio Companion blocks allow the maximum buffer sizes to be adjusted
(GRC) is a graphical design tool that lets a user create to minimize latency.
GNU Radio software without having to write code.
Blocks representing signal processing functions are Complex Baseband Representation
added to a diagram, configured, and interconnected
using a graphical user interface. This “flowgraph” is It is possible to down-convert a real bandpass signal
then turned into an executable script that executes centered around a carrier frequency into a complex
the processing blocks in the required order to process baseband signal centered about zero (DC). The com-
the samples. In this lab we will use GRC to configure plex baseband signal is centered on zero and, unlike
and run SDR software. real signals, the frequency components are not con-
The advantages of GNU Radio and similar tools strained to have even (or odd) symmetry.
such as MathWorks’s Simulink and National Instru- The complex baseband architecture reduces im-
ment’s LabView are that they don’t require pro- plementation costs because receivers and transmit-
gramming and that the flowgraphs can be self- ters can be implemented using only low-pass filters
documenting. However, many users prefer program- that can be integrated into ICs. This reduces costs by
ming languages such as Matlab (e.g. using the Com- reducing parts count and board space.
munications Toolbox), because they are more flexi- The baseband interface of the SDR hardware
ble. uses sampled complex baseband signals in I/Q
GNU Radio and similar tools are also used to simu- 1
Including those written in programming languages such as
late communication systems. The simulations can be Python, C++ and Matlab.

lab2.tex 1 2019-01-31 01:53


Figure 1: GNU Radio Companion flowgraph for PRBS-modulated BPSK (2-QAM).

(real/imaginary) format and most of the signal pro- band power that might interfere with users of other
cessing operates on these complex signals. channels and receivers use them to reject signals
As an example, in this lab we will translate the fre- present on other channels.
quency of signal by multiplying it by a complex sinu- Low-pass filters are also used when changing the
soid. GNU Radio also includes blocks that convert sampling rate of digitized signals. Increasing (“inter-
between signal of different types (e.g. byte, float and polation”) or decreasing (“decimation”) the sampling
complex). rate requires post- or pre-low-pass filtering the signal
to avoid aliasing.
ML PRBS There are many digital filter types (IIR, FIR), archi-
tectures (parallel, cascade, FFT) and design methods
In evaluating, testing and implementing communi-
(window, mini-max). In this lab we will use a simple
cation systems we often need a signal that has statis-
window-based design of an FIR filter to interpolate
tics similar to that of a random binary source but
a low-bandwidth baseband signal’s sampling rate to
which is deterministic. This is called a pseudo-
the higher rate required by the SDR transmitter.
random bit sequence (PRBS).
The most common type of PRBS is the Maximal-
Length PRBS (ML-PRBS) which has certain desirable Variables and GUI Widgets
properties, including having the maximum possible
period for a given generator complexity. A GNU Radio flowgraph is actually a Python script.
An ML-PRBS can be generated using flip-flops and This allows us to embed variables (using the “Vari-
xor gates to compute feedback in a circuit called a able” block) and arbitrary Python code into a flow-
linear-feedback shift register (LFSR). graph.
It’s also possible to include blocks that create
Filters user interface components (“widgets”) that are active
while the block is running. These can be used to dis-
The radio spectrum is divided into bands which are play waveforms or frequency spectra and to change
allocated to different uses (broadcasting, cellular, values of variables 2 . These variables can be used
radio-navigation, etc.). Each band is typically divided in expressions that configure the operation of blocks.
into smaller ranges, called channels with each chan- You saw examples of this in the UI presented by the
nel allocated to a different set of users.
Filtering is a important part of most communica- 2
Parameters whose names are underlined in a block’s prop-
tion systems. Transmitters use them to limit out-of- erties dialog box can be updated during flowgraph execution.

2
previous lab which was implemented using GNU Ra- Configure the Flowgraph
dio.
Use the File ▶ Open menu item to start a new QT
GUI flowgraph. Then add, configure and connect the
Procedure
following blocks:
In this lab you will practice using GNU radio by
building a transmitter that incorporates some typical Variable Add a second variable with ID interp.
blocks. The flowgraph generates a ML-PRBS, mul- This will be used to set the interpolation ratio
tiplies it by a complex exponential to shift the fre- between baseband samples and RF samples.
quency and then interpolates to increase the sam-
pling rate. Add a third variable with ID bb_rate that has
The diagram in figure 1 shows the flowgraph. the value samp_rate/interp. Note that the
value of a variable can be set to an arbitrary
Using GRC
Python expression. The code generated for each
block is shown in the “Generated Code” tab.
Start GRC. Under the View menu enable the Block
Tree Panel, Console Panel and Variable Editor. Make GLFSR Source This block (Galois LFSR) generates
sure ‘Hide Variables’ is not checked. a PRBS. Configure this block as follows:
The easiest way to add a block is to search for it by
name. Click on the magnifying glass icon ( ) on the
menu bar or type Control-F. Type part of the block
name and double-click on the desired block name.
This adds it to the flowgraph. You can them move the
block by dragging it (any connections will follow).
To connect block outputs to inputs click on the out-
put port and then click on the input port you want to
connect it to.
As in any diagram, the blocks should be arranged
Degree, 𝑁, is the number of bits in the shift reg-
so that the logical flow is left-to-right and top-to-
ister. The PRBS period is 2 − 1 bits. Configure
bottom whenever possible.
𝑁 = 3 which will generate a PRBS with a pe-
Samples flowing between blocks can be of differ-
riod 7 bits. Mask defines the LFSR taps. If speci-
ent types. Bits are typically transferred in the least-
fied as 0 a suitable generator polynomial for the
significant bit of a Byte type and signal samples are
specified degree will be chosen. Note that float
typically Float or Complex types. In GRC the color
outputs have values ±1 while byte outputs have
of the input and output connectors reflects the signal
values 0 or 1.
type (e.g. orange for floats, blue for complex).
If there is a mismatch between the signal types the
connector will be drawn in red. Type Conversions Type conversions are some-
You can double-click on a block to open up its times required. For example, the GLFSR
properties dialog box. This allows you to configure Source above is configured to output floats but
the input and output types and other aspects of the these need to be converted to Complex values.
block’s operation. The block’s title and some of the Add a Float To Complex block that sets the
block’s properties are displayed inside the block in imaginary component to zero by connecting a
the flowgraph. Constant Source with value 0.
Some blocks define data structures rather than
process samples. An example is Variable blocks that Signal Source Add a [Co-]Sinusoidal signal source
set the value of a variable. This variable can be used with a Complex output whose amplitude is
when configuring other blocks. By default a variable, 1 and whose frequency is set by the variable
samp_rate, is included in a new flowgraph. f_offset. It is configured as follows:

3
that is created when the flowgraph executes. In
addition to input types, ranges, labels, etc, the
GUI Hint provides some control over the posi-
tioning of the GUI elements (and use of tabs).
For example, a hint of [1,2] means to place that
GUI element on the first row, second column.

osmocom Sink This block represents the interface


Rational Resampler Add an interpolator block to the transmit portion of the SDR hardware. It
configured as follows: is configured as follows:

This interpolates by a factor interp and the


low-pass anti-aliasing filter is set to the follow-
ing expression:

filter.firdes.low_pass_2(1,samp_rate,
0.5*samp_rate/interp,0.02*samp_rate,60)

This Python expression computes the FIR filter


taps for a low-pass filter. The function parame-
ters specify the gain, sampling frequency, -6 dB
cutoff frequency, width of transition band and The Device Arguments drive=lime,soapy=0
required stopband attenuation (in dB). selects a driver, a Sample Rate of samp_rate
sets the DAC sample rate, the Ch0 Frequency
Multiplier This block does a complex multiplica- sets the RF center frequency3 , the Gain values
tion of two inputs. set the gains of the digital and analog portions
of the transmitter, Ch0 Antenna selects one of
QT GUI Frequency Sink This block is similar to a RF matching networks on the PCB, Ch0 Band-
spectrum analyzer and shows the power spec- width selects the (two-sided) baseband band-
trum when the flowgraph is running. width. Note that in this case we’ve set the band-
QT GUI Time Sink This block is similar to an oscil- width and the sampling rate to be the same
loscope and shows the real and imaginary com- (5 MHz) which is appropriate for complex base-
ponents versus time when the flowgraph is run- band signals.
ning.
Measurements
QT GUI Range This block defines a GUI interface
item that allows run-time changes to variables Connect the LimeSDR Mini SDR board to the lab PC’s
when the flowgraph is run. Set ID to f_offset USB 3.0 ports (on the front of the case) using the sup-
to allow run-time control of the frequency of plied USB 3.0 cable. Connect the SDR boards’s TX
the complex [co]sinusoidal signal source block output to the spectrum analyzer’s RF In input using
added above. the supplied SMA-to-BNC cable:
The GUI blocks have configuration options for 3
This covers an amateur radio band although we will not be
how they should be displayed in the window transmitting “over the air” in this lab.

4
Select Run ▶ Execute, press F6, or press on the
run ( ) icon. This will convert the flowgraph to a
Python script and run it.
To capture the GNU Radio Companion GUI you
can use the Windows Snipping Tool. To capture the
spectrum analyzer display plug a USB flash drive into
the connector on the analyzers front panel4 . Select
View the RF Spectrum File (Shift-7) ▶ Directory Management and select USB
as the Current Location. Select Back and Save ▶ Save
Screen as JPEG to save an image file showing the spec-
Configure the spectrum analyzer for a center fre- trum analyzer display.
quency of 222.5 MHz, a span of 5 MHz, reference
level of 10 dBm and resolution/video bandwidths of
10 kHz and 3 kHz respectively. Additional Test Cases

Capture the baseband spectrum shown on the Make the following changes and capture the result-
GNU Radio Companion run-time window (“Top ing baseband signal and RF spectrum:
Block”) and the RF spectrum as displayed on the
spectrum analyzer: • shift the signal up in frequency by 1 MHz using
the GUI slider

• change the PRBS period from 7 to 255 bits

• change the filter Taps to [1] to disable the inter-


polator’s anti-aliasing filter

Lab Report

Submit a report in PDF format to the appropriate


dropbox on the course web site.
Your report should include the four GUI and spec-
trum analyzer captures and answers to the following
questions:

4
Spectrum analyzers with older (version 1.x) firmware may
show errors when trying to save to USB drives lager than 2 GB.
The instructor may be able to lend you a small USB drive or
(worst-case) you can crop a photo of the screen taken with your
phone.

5
• What is the result of multiplying 𝑒
by 𝑒 ? What is/are the resulting fre-
quency(ies)? How does this differ from
multiplying two real sinusoids?

• How does the baseband spectrum shown in the


frequency sink GUI differ from the one shown
by the spectrum analyzer?

• What is the period of the PRBS sequence for 𝑁 =


3? What is the spacing of the frequency compo-
nents? What are the period and frequency spac-
ing for 𝑁 = 8?

• What happens when you disable the interpola-


tor’s low-pass filtering? What is the name of this
effect?

You might also like