1 PDF
1 PDF
DAB
Software Receiver Implementation
Andreas M
uller
Wireless standards are subject to rapid development and frequent changes, making old hardware
obsolete at a high rate. On the other hand, the constantly increasing computational power of
general purpose computers allows developers to move functionality away from hardware and
specialized processors, to high-level software running on arbitrary general purpose processors.
This leads to the idea of software defined radios, where as much of the signal processing as
possible is done in software. While this idea is not new, CPUs have only recently become fast
enough for practical implementations of wireless standards in software.
This semester thesis investigates the possibility of implementing a receiver for the Digital
Audio Broadcasting (DAB) standard [1] in software, by using the GNU Radio toolkit a free
open-source framework for the creation of software defined radios.
Outline
The report is split into the following chapters:
Chapter GNU Radio and the USRP introduces the GNU Radio toolkit and the Universal
Software Radio Peripheral (USRP).
Chapter Implementation describes the implementation of DAB in GNU Radio.
Chapter Conclusions and Outlook reviews the project and draws some conclusions.
ii
Acknowledgements
I would like to thank my supervisor, Michael Lerjen, for his continuous support with helpful
comments and ideas throughout the project. I would also like to thank the Communication
Technology Laboratory (CTL) for allowing me to pursue this project, despite the fact that the
CTL does currently not make any use of GNU Radio.
I would further like to thank Jens Elsner for helpful tips and for allowing me to gain from
his experience from his own experiments with DAB and GNU Radio. This helped in avoiding
some pitfalls, such as the problems with signals from the TVRX daughterboard. Jens also
provided the contact to Nicolas Alt, who allowed me to take a look at his complete DAB receiver
implementation in Matlab. This was very helpful, both from a design perspective, and because
the comparison with my own implementation allowed me to verify each step.
Furthermore, I would like to thank the ISG, and especially David Schneider, for providing
GNU Radio on the Tardis machines and for hosting the Subversion (SVN) repository used for
this project.
Last but not least, I would like to thank the GNU Radio developers, for providing a very
interesting toolkit, that allowed me to learn about software radios in a very practical manner
and experiment with real-time DAB.
Contents
1 Task Description 1
2 Introduction 6
2.1 Project Idea . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2 Software Framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.3 Contributions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.4 Some Words on Notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3 DAB 8
3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.2 DAB Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.3 Fast Information Channel (FIC) . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.3.1 FIB Assembler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.3.2 Energy Dispersal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.3.3 Convolutional Coding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.4 Main Service Channel (MSC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.5 Frame Assembly and OFDM Modulation . . . . . . . . . . . . . . . . . . . . . . 11
3.5.1 Frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.5.2 OFDM Modulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.5.3 Complete Signal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.6 Practical Considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
3.6.1 Availability of DAB in Switzerland . . . . . . . . . . . . . . . . . . . . . . 14
3.6.2 Audio Quality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
6 Implementation 26
6.1 Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
6.2 Physical Layer (OFDM) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
6.2.1 Input Filtering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
6.2.2 Time Synchronisation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
6.2.3 Fine Carrier Frequency Synchronisation . . . . . . . . . . . . . . . . . . . 30
6.2.4 OFDM Sampler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
6.2.5 FFT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
6.2.6 Coarse Carrier Frequency Synchronisation . . . . . . . . . . . . . . . . . . 34
6.2.7 Phase Differentiation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
6.2.8 Removal of the Phase Reference Symbol . . . . . . . . . . . . . . . . . . . 35
6.2.9 Sampling Frequency Offset Estimation and Resampling . . . . . . . . . . 35
6.2.10 Magnitude Equalization . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
6.2.11 Frequency Interleaving . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
6.2.12 Symbol Demapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
6.3 Evaluation of the Physical Layer . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
6.3.1 The Test Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
6.3.2 BER in AWGN Channel . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
6.3.3 Effects of Coarse Carrier Frequency Offsets . . . . . . . . . . . . . . . . . 39
6.3.4 Effects of Fine Carrier Frequency Offsets . . . . . . . . . . . . . . . . . . 41
6.3.5 Effects of Sampling Frequency Offsets . . . . . . . . . . . . . . . . . . . . 42
6.3.6 Effects of Multipath Propagation . . . . . . . . . . . . . . . . . . . . . . . 43
6.3.7 Evaluation of the Processing Speed . . . . . . . . . . . . . . . . . . . . . . 43
6.3.8 Receiving a Live Signal . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
6.4 Fast Information Channel (FIC) . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
6.4.1 FIC Symbol Selection and Repartitioning . . . . . . . . . . . . . . . . . . 45
6.4.2 Convolutional Coding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
6.4.3 Energy Dispersal Scrambling . . . . . . . . . . . . . . . . . . . . . . . . . 47
6.4.4 FIB Sink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
C Additional Tools 57
C.1 OProfile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
C.2 Python, IPython and SciPy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
C.3 Doxygen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
C.4 Swig . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
C.5 Graphviz, dot and dump2dot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
C.6 Subversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
D Code Overview 59
D.1 Python Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
D.1.1 Quality Assurance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
D.1.2 Channel Tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
D.2 C++ Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
D.3 Patches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
CONTENTS v
E Installation 62
E.1 Operating System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
E.2 Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
E.3 External Dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
E.4 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
F Presentation 64
H Acronyms 73
Bibliography 76
List of Figures
A.4 Complete receiver with USRP as signal source, OFDM demodulation and FIC
decoding. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Task Description
The following pages reflect the task description, as provided by Michael Lerjen.
2
1 Introduction
1.1 DAB
Since many years, analog systems are more and more replaced by their digital successors.
This trend also embraces the electronic mass media. As a new digital radio standard, Dig-
ital Audio Broadcasting (DAB) has been developed in the EU project Eureka-147 between
1987 and 2000. It was standardized by the European Telecommunications Standards In-
stitute (ETSI) [1] and the broadcast infrastructure is now more and more implemented
mainly in Europe but also in Canada and China. A total of 500 mio customers worldwide
can already receive DAB signals at their homes.
DAB is based on state-of-the-art techniques like OFDM, convolutional coding, data com-
pression and also offers extra services like program information, traffic information, mul-
timedia object transmission and conditional access.
The GNU Radio project [3] develops free hardware and software for a software defined
radio (SDR) system. The hardware and the software of this project is based on flexible
building blocks and software libraries, which can be configured to implement receivers
and transmitters for different radio standards.
2 Project Goals
Based on the DAB standard [1] and further literature, a concept shall be worked
out how the GNU Radio hardware and software together with MATLAB can be em-
ployed to build a real-time DAB receiver.
Identify possible problems and system bottlenecks and analyze possible solutions.
3 Project Tasks
The tasks given represent work items and questions we see at the start of the project.
This tentative list is mainly to serve as an orientation and can be modified and extended,
depending on the project progress.
2
4
Analyze the performance and complexity of different algorithms for the sub-blocks
of the system.
Implement blocks in Matlab or C++ and compare their perfomance and processing
complexity. Always optimize the system for real-time usability.
4 Project organization
Organize weekly meetings with your thesis supervisors. The meetings will be held
to evaluate the status of the project and to discuss potential problems.
Document your work in a thesis report. We recommend to use LATEXand to start the
documentation at the beginning of the project.
5 End of Project
Two copies of the thesis report need to be handed in, containing also a CD/DVD with all
relevant files in a clean and documented directory structure. The copies remain property
of the IKT.
At the end of the thesis, there will be a short presentation of the project and its results
(15 min presentation and 5 min Q&A) to a wider audience.
Please note that the thesis will only be accepted when the keys for the ETZ building are
properly returned.
Z
urich, April 3, 2008 Prof. Dr. H. B
olcskei
3
5
References
[1] ETSI Standard,ETSI EN 300 401 V1.4.1, European Standard (Telecommunications se-
ries)
4
Chapter 2
Introduction
2.3 Contributions
An inquiry on the GNU Radio mailing list7 about Orthogonal Frequency Division Multiplexing
(OFDM) and DAB revealed, that Jens Elsner had already created an implementation of the DAB
physical layer (OFDM) some time ago. Unfortunately, his implementation is not compatible
with some of the newer developments in GNU Radio. Additionally, one goal for the presented
implementation was to use independent modular signal processing blocks (which results in simpler
blocks with better reusability), whereas Jens receiver is mainly implemented as one big block
(which tends to result in faster code and allows the use of feedback loops). For this reasons, none
of the code written by Jens is reused in this thesis. The code was however still interesting as a
reference. Jens also provided some DAB samples and shared his experience from experiments
with the USRP. Especially his warnings about problems with the Television Receiver (TVRX)8
saved me from wasting a lot of time and energy. Additionally, Jens student thesis [6] provided
a lot of interesting and relevant information.
GNU Radio itself also includes some code for OFDM. Although this code is not DAB spe-
cific, part of this code was used as a basis for the DAB implementation, namely the code for
fine carrier frequency synchronisation and part of the code for coarse carrier frequency synchro-
nisation. Additionally, one OFDM block, the cyclic prefixer, could be used directly without any
adjustments. As DAB uses an OFDM scheme that is fundamentally different from the one used
by the GNU Radio OFDM code, most of the existing OFDM blocks could however not be reused.
On the other hand, many non OFDM-specific blocks from GNU Radio were very useful, such as
the Fast Fourier Transform (FFT) block, Finite Impulse Response (FIR) filter blocks, the Trellis
module, various blocks for mathematical operations and numerous low-level blocks.
Finally, Jens Elsner also provided a contact to Nicolas Alt, who has implemented a complete
DAB receiver in Matlab, which he kindly shared with Jens and me. Although his implementation
is designed as an off line DAB receiver, having a working software model and known to work
samples was highly useful to verify each step of the GNU Radio implementation, especially for
the Fast Information Channel (FIC) decoder. Additionally, the idea to use the distance between
two Null symbols to get an estimate for the sampling frequency was adopted from Nicolas code.
Function names, class names, file names and executable commands are printed in a monospace
font
Functions are additionally designated by brackets, e.g. foo xy()
7 http://lists.gnu.org/mailman/listinfo/discuss-gnuradio
8 The TVRX is a daughterboard for the USRP; more on this will be explained in Chapter 5.2.
Chapter 3
DAB
3.1 Introduction
DAB is a digital radio technology, which was developed between 1981 and 1993 and standardized
by ETSI in 1997. DAB makes use of various advanced technologies, such as OFDM, convolutional
coding and audio coding. Besides an audio signal, DAB can also be used to transmit additional
data, such as program information, traffic information, paging services or even complete HTML
pages [3].
This chapter aims to be a basic introduction into the technical details of DAB. The full DAB
specification is available for free on the ETSI website [1]. Please note that this introduction
describes the transmit path, as does the specification. The chapter Implementation (Chapter 6)
on the other hand is written from a receiver perspective.
Figure 3.1, which is a simplified version of the block diagram shown in Section 4 on Page 22
of the DAB specification [1], shows the general design of a DAB transmitter.
FIDC
FIB FIBs Energy Convolutional
MCI
SI assembler Dispersal Encoder
Conditional
MP2 Transmission
Audio Access Energy Convolutional Time CIFs
audio Frame
stream Scrambler Dispersal Encoder Interleaver
encoder Multiplexer
(optional)
Conditional
Main Synch.
(other Access Energy Convolutional Time FIC and MSC
Service Channel
data) Scrambler Dispersal Encoder Interleaver Symbol
Multiplexer Symbol
(optional) Generator
Generator
(other
data)
OFDM Signal Generator
Convolutional Code
As specified in Section 11.1.1 of the DAB standard, the encoder consists of a Finite State Machine
(FSM) with 64 states (the code has constraint length 7, i.e. the current bit and 6 past bits are
used). The FSM produces four output bits from one input bit. The bits are created with the
following modulo 2 addition of input bits:
Puncturing
Puncturing is applied to adjust the code rate. The process here is rather simple: Some predefined
bits are deleted from the codeword, according to puncturing vectors. For different protection
levels, resp. code rates, 24 different puncturing vectors are specified.
Conditional
MP2
Audio Access Energy Convolutional Time
audio
stream Scrambler Dispersal Encoder Interleaver
encoder (optional)
Conditional
Main
(other Access Energy Convolutional Time
Scrambler Service
data) Dispersal Encoder Interleaver
(optional) Multiplexer
(other
data)
In case of an audio stream, the data is first encoded with the MPEG-1 Audio Layer II (MP2)
codec. The data may then be scrambled, to prevent access by unauthorized users. Energy
dispersal and convolutional encoding is then applied in the same way as in the FIC (though with
different parameters).
Differently from the FIC, the information is then interleaved in time. Mixing up the infor-
mation in time serves to protect the data against short-time interferers across all frequencies.
Finally, the different information blocks from the MSC are multiplexed according to the
information specified in the FIC.
3.5. FRAME ASSEMBLY AND OFDM MODULATION 11
Null Symbol
For the duration of the Null Symbol, no signal is transmitted. This is done to indicate the
separation of the frames.
Data Symbols
The other symbols in the frame contain either FIC or MSC data. Please note that there is no
one-to-one association between symbols and FIBs or CIFs.
QPSK Mapping
Two different Quadrature Phase-Shift Keying (QPSK) constellations are used.
The constellation shown in Figure 3.5 is used for the first symbol only, the PRS. For the
other symbols, the constellation shown in Figure 3.6 is used.
Differential Modulation
To achieve differential modulation, each symbol is is multiplied to the previous symbol before
transmission.This means, that the phase of the current symbol is always added to the phase of
the previous symbol, which results in output symbols with constellations alternating between
1 For better readability, this section always refers to DAB mode I. Parameters for all modes are collected in
found in [7].
3.5. FRAME ASSEMBLY AND OFDM MODULATION 12
10 00
11 01
the constellation shown in Figure 3.6 and the one from 3.5. Since each constellation is shifted
by 4 relative to the previous one, this is called 4 D-QPSK.
Frequency Interleaving
The individual OFDM subcarriers are mixed according to a static sequence defined in the DAB
standard. Frequency interleaving prevents that too much information of the same codeword is
lost if there is a small-bandwidth interferer.
with (
0 for l = 0
gk,l (t) =
e2k(t)/TU Rect(t/TS ) for l = 1, 2, . . . , L
and TS = TU + .
The parameters and variables, as defined in [1], are listed in Table 3.1.
Please note that zm,l,k = 0 for k = 0. This means that the central subcarrier is not used.
The value gk,l (t) = 0 for l = 0 on the other hand, represents the Null symbol.
The values for the parameters, which depend on the transmission mode, are given in Table
38 in the DAB specification [1]. For reference, the values are listed in Table 3.2. The elementary
time period is T = 1/2048000 second.
The variables defined in Table 3.1 will be used throughout this text; as they depend on the
used DAB mode, please refer to Table 3.2 for specific values.
3.5. FRAME ASSEMBLY AND OFDM MODULATION 13
Variable Description
L Number of OFDM symbols per frame, exclusive Null symbol
K Number of subcarriers
TF Length of the frame without the Null symbol
TN ull Length of the Null symbol
TS Length of an OFDM symbol different than the Null symbol
TU Inverse of the subcarrier spacing
Length of the guard interval
zm,l,k Complex D-QPSK symbol of carrier k of OFDM symbol l in transmission frame m
fc Central frequency of the OFDM signal
Parameter DAB Mode I DAB Mode II DAB Mode III DAB Mode IV
L 76 76 153 76
K 1536 384 192 768
TF 196608T 49152T 49152T 98304T
= 96ms = 24ms = 24ms = 48ms
TN ull 2656T 664T 345T 1328T
1.297ms 324s 168s 648s
TS 2552T 638T 319T 1276T
1.246ms 312s 156s 623s
TU 2048T 512T 256T 1024T
= 1ms = 250s = 125s = 500s
504T 126T 63T 252T
246s 62s 31s 123s
The different modes are specified to accommodate different frequency ranges and operating
conditions. In Section 15.1 of the DAB specification [1], suitable conditions are described as
follows (quote):
Transmission mode I is intended to be used for terrestrial Single Frequency Networks (SFN)
and local-area broadcasting in Bands I, II and III.
Transmission modes II and IV are intended to be used for terrestrial local broadcasting in
Bands I, II, III, IV, V and in the 1452 MHz to 1492 MHz frequency band (i.e. L-Band). It
can also be used for satellite-only and hybrid satellite- terrestrial broadcasting in L-Band.
Transmission mode III is intended to be used for terrestrial, satellite and hybrid satellite-
terrestrial broadcasting below 3000 MHz.
One notable feature is the possibility to use Single Frequency Networks (SFNs) in mode I.
This means, that multiple geographically separated transmitters broadcast at exactly the same
frequency. This requires that the transmitters are accurately synchronised both in time and
frequency to avoid interference at the receiver. Even with synchronized transmitters, there
may however still be a delay between two signals from different transmitters arriving at the
receiver, because of different path lengths. The effects of this are the same as from multipath
propagation. The solution in the standard is to require that the maximum distance between
3.6. PRACTICAL CONSIDERATIONS 14
each pair of transmitters in an SFN, divided by the propagation speed, must be smaller than
the length of the cyclic prefix. Like this, no signal arriving from any secondary transmitter will
have a delay longer than the cyclic prefix, and the signal quality is not affected, as long as the
magnitude of the delayed signal is not too large (a simulation of these effects is presented in
Section 6.3.6).
3 Many recording studios and broadcast radio stations artificially increase the loudness of their music for
marketing reasons. This has led to the so called loudness war [8].
4 A list of DAB ensembles in Switzerland with the broadcast channels and the transmitted quality can be found
under http://digiradio.ch/dab/programme/ch/index.html.
Chapter 4
A Software Defined Radio (SDR) or just Software Radio (SR)1 is a radio that is built entirely or
in large parts in software, which runs on a general purpose computer. A more extensive definition
is given by Joseph Mitola, who coined the term Software Radio:
A software radio is a radio whose channel modulation waveforms are defined in soft-
ware. That is, waveforms are generated as sampled digital signals, converted from
digital to analog via a wideband DAC and then possibly upconverted from IF to RF.
The receiver, similarly, employs a wideband Analog to Digital Converter (ADC) that
captures all of the channels of the software radio node. The receiver then extracts,
downconverts and demodulates the channel waveform using software on a general
purpose processor. Software radios employ a combination of techniques that in-
clude multi-band antennas and RF conversion; wideband ADC and Digital to Analog
conversion (DAC); and the implementation of IF, baseband and bitstream process-
ing functions in general purpose programmable processors. The resulting software-
defined radio (or software radio) in part extends the evolution of programmable
hardware, increasing flexibility via increased programmability. [10]
This means, that instead of using analog circuits or a specialized Digital Signal Processor
(DSP) to process a radio signal, the digitized signal is processed by architecture independent
high level software running on a general purpose processor. The term radio designates any
device, that transmits and/or receives radio waves.
While most modern radios contain firmware that is written in some kind of programming
language, the important distinction in a software radio is that it is not tailored to a specific chip
or platform, and it is therefore possible to reuse its code across different underlying architectures.
A
D
PC
D
A
range of the ADC; as the signal of interest would be attenuated as well, this would however mean that it would
no longer be possible to use the whole dynamic range of the ADC for the signal of interest.
4.3. REVIEW AND OUTLOOK 17
4.2.4 Latency
Since general purpose computers are not designed for real-time applications, a rather high latency
can occur in practical SDRs.
While latency is not much of an issue in transmit-only or receive-only applications, many
wireless standards, such as Global System for Mobile communications (GSM) or Digital Enhanced
Cordless Telecommunications (DECT) require precise timing, and are therefore very difficult to
implement in an SDR.
This chapter introduces the GNU Radio software toolkit and the associated hardware device,
the USRP.
Apart from signal processing blocks, GNU Radio also provides support for various signal
sources and sinks, such as:
Signal generators
1 A more detailed explanation and the complete license can be found under http://www.gnu.org/licenses/
gpl.html.
5.1. GNU RADIO 19
Noise generators
User Datagram Protocol (UDP) source and sink (to transport samples over a network)
The GNU Radio project was founded by Eric Blossom and is now supported by numerous
enthusiasts around the world. While GNU Radio was started on a Linux platform, it now
supports various Unixes, and partially even Windows.
More information about GNU Radio can be found on the GNU Radio website [14]. An
introduction to GNU Radio and its background can also be found in the wired magazine [15].
Data Format
The most common data format used to represent samples in GNU Radio blocks are complex
floats interleaved floats, of which the first is treated as real, and the second as imaginary part.
This means, that each sample occupies 8 bytes. Other data formats are float (4 byte float values),
short (2 byte integer values) and char (1 byte integer values).
These data types also exist as vector types, which is useful for blocks that operate on a fixed
number of samples at once, e.g. FFT blocks.
The data format can often be recognized from the name of the block. If a block is named
foo vXY, the block operates on vectors (as v is present), has the input type X and the output
type Y. The types can be
f floats (4 bytes)
For instance, the block fft vcc is an FFT block that operates on vectors with complex
interleaved floats.
5.1. GNU RADIO 20
Implementation
GNU Radio is implemented in C++ and Python, and uses SWIG2 to create an interface between
the two. While C++ is used for low-level programming, mainly for the core of the framework, to
create low-level signal processing blocks and for hardware support, Python is used on a higher
level, to connect signal processing blocks into an application, or the wrap multiple low level
blocks into a higher level block. This approach allows the combination of the high speed of C++
and the ease of use of Python.
To create an application, a programmer derives her own class from either the class top block
of the module gr in the package gnuradio for a console application, or from the class std top -
block of the module stdgui2 in the package gnuradio.wxgui3 for a GUI based application.
Currently, this can only be done in Python; support for pure C++ applications, which may
sometimes be preferable (e.g. for embedded systems), is under development.
Signal processing blocks can be either synchronous, which means that there is an integer
relationship between the sample rate at input and output ports, or asynchronous. Synchronous
blocks are classes that are usually derived from gr sync block (blocks with an 1:1 sample rate
ratio), gr sync interpolator (1:N) or gr sync decimator (N:1). Asynchronous blocks are
commonly directly derived from gr block. Blocks are usually written in C++; there is however
the possibility to wrap up several blocks into a higher level block. This can be done in Python
by deriving a class from gr.hier block2.
Once the desired blocks have been instantiated, they can be connected with the connect
method of the main class in Python (i.e. the class which is derived from top block or std top -
block, that represents the flow graph). This is the analog of drawing edges in the graph. To
get a runnable graph, all ports of each block must be connected. Signal processing can then be
started with the start method of the flow graph.
In a running GNU Radio application, the scheduler of the GNU Radio framework manages
the blocks and the flow of samples between them, assisted by the forecast() methods of the
blocks, which can be used by the programmer, to tell the scheduler, how many input samples a
block requires to produce a given number of output samples.
The actual signal processing is done in the function general work() (in the case of a general
block), resp. work() (in the case of a synchronous block). These functions are called by the
scheduler and are given a certain number of input samples (which is not fixed, but can be
influenced by the programmer to a certain degree). The work function then does its signal
processing and reports back, how many input samples were processed and how many output
samples produced.
GNU Radio also takes care of buffering the data. While signal processing blocks usually
process samples as fast as they come in (or as fast as the CPU allows, depending on which is
lower)4 , some signal sources and sinks provide, respectively require a constant sample rate (e.g.
the audio sink). In this case, it is the programmers responsibility to make sure, that data is
processed fast enough. If a source delivers more samples than the application can process, then
some buffer will eventually overflow, and samples are lost (this is called an overrun). If the
sample rate at the input of a sink is too low on the other hand, the buffer will eventually be
empty and a glitch in the signal results (an underrun).
Such problems can also occur, if some interface (e.g. the Universal Serial Bus (USB) interface
between an USRP and the PC) is too slow, or if data streams with different fixed sample rates
are connected without appropriate interpolation or decimation. Obviously, it is crucial to avoid
such problems as much as possible for a real-time radio application (this can never be completely
guaranteed however, as a PC usually does not run a real-time OS).
2 SWIG is an acronym for Simplified Wrapper and Interface Generator. Information about SWIG can be
mation.
4 It is however possible to limit the processing rate by using the block gr.throttle.
5.1. GNU RADIO 21
While the principle of connecting blocks with continuous data streams is quite general, it has
its limitations, for example when dealing with packet based data. Currently, several extensions
to GNU Radio, such as message blocks, which are better suited for handling packet-based data5
are under development.
Further information on the GNU Radio architecture and on writing signal processing blocks
can be found in the tutorial How To Write a Block by Eric Blossom [16].
An illustrative example
The following listing shows a simple and illustrative example of a GNU Radio application:
#! / u s r / b i n / env python
from g n u r a d i o import g r
from g n u r a d i o import a u d i o
from g n u r a d i o . wxgui import s t d g u i 2 , f f t s i n k 2
if name == m a i n :
app = s t d g u i 2 . stdapp ( a u d i o f f t g r a p h , Real Time Audio Spectrum )
app . MainLoop ( )
In this example, the PCs microphone is taken as signal source. The signal is amplified by
the factor 1000 and the spectrum of the resulting signal is displayed on the screen.
Contrary to the explanations above, the flow graph is never started with its start() method.
In this example, this is done automatically, when the stdapp is initialised.6
Figure 5.1 shows a screenshot of the resulting application.
GPL. The USRP is developed and sold by Ettus Research9 , in collaboration with the GNU
Radio developers.
In Figure 5.3, a photography of an USRP with four daughterboards can be seen.
USRP
RX Motherboard
Dboard
AD9862
TX ADC/DAC
USB 2.0
Dboard
Altera FX2
Cyclone USB
PC
RX FPGA
Dboard
AD9862
TX ADC/DAC
Dboard
DA converters AD converters
Speed 128 MSPS 64 MSPS
Resolution 14 Bit 12 Bit
Table 5.1: Parameters of the D/A and A/D converters in the USRP.
As it is not possible to transmit the data stream at the full sample rate via USB, up- and
down-conversion needs to be done in the USRP. Figure 5.5 shows a more detailed block diagram
of the USRP motherboard.
Figure 5.5: USRP transmit and receive paths (Source: GNU Radio Wiki12 ).
On the upper half, the receive chain can be seen. The signals are first converted into digital
samples; in the FPGA, the channels are then routed to the Digital Down-Converter (DDC)
12 http://gnuradio.org/trac/wiki/UsrpRfxDiagrams
5.3. WRAP UP 25
blocks by a configurable multiplexer. In the DDCs, they are converted to baseband at the desired
frequency and decimated. The interior of the DDCs (which is not shown) consists of a CORDIC13 ,
which converts the signal to baseband, followed by a Cascaded Integrator Comb (CIC) filter with
a programmable decimation and a halfband filter with a fixed decimation of 2. Finally, all data
streams are interleaved sample wise, buffered and sent over the USB interface to the PC.
The transmit path is similar, with the exception that the up-conversion is done in the DAC
instead of the FPGA. More information can be found in the GNU Radio Wiki [18].
Latency
The whole system, consisting of an application on a general purpose PC, the USB interface and
the USRP, has together a latency of several hundred milliseconds. Because PCs are not designed
for real-time applications, it is difficult to reduce the latency. This makes the use of the USRP
for TDMA systems difficult (i.e. application dependent reconfiguration on FPGA level would be
needed). Extensions to overcome such limitations are currently under development.
5.3 Wrap Up
Together, GNU Radio and the USRP provide a powerful tool for creating software defined radios.
GNU Radio carefully abstracts lower level details from its users, to allow them to focus on their
application. With the growing number of available low-level signal processing blocks, GNU Radio
becomes more and more versatile. The USRP is kept as generic as possible. This makes it usable
for a wide range of applications; in most cases without the need to write any new Verilog code.
13 A CORDIC is an efficient way to compute trigonometric functions. CORDIC stands for COordinate Rotation
DIgital Computer. More information is available in [17]. The CORDIC implementation for the USRP can be
found under http://gnuradio.org/trac/browser/gnuradio/trunk/usrp/fpga/sdr_lib/cordic.v
14 http://gnuradio.org/trac/browser/gnuradio/trunk/gr-usrp
Chapter 6
Implementation
In this chapter, the implementation of the DAB receiver is presented. After a short explanation
of the general experimentation setup, the implementation of the OFDM demodulation will be
explained (Section 6.2). The OFDM part represents the major part of the work for this thesis, and
it was also extensively tested. For this purpose, an OFDM modulation block was implemented.
The results of these tests are discussed in Section 6.3. Finally, in Section 6.4, the implementation
of the FIC decoder, which was significantly facilitated by the availability of a generic trellis
module, gr-trellis, is discussed.
6.1 Setup
While it is possible to use GNU Radio to work on a signal that is received live over the air, it is
more convenient to record some samples to a file and use this file for experiments. From a file,
samples can easily be loaded into GNU Radio or Matlab. Using a file for development also has
the advantage that results are reproducible. Once the application is finished, it is easy to switch
to a signal received live.
The USRP with the TVRX daughterboard was therefore used to record about half a minute
worth of DAB Mode I samples from the Swiss DAB Ensemble at 227.36 MHz1 . However, during
their experiments, Jens Elsner and Nicolas Alt had discovered, that the TVRX disturbs the phase
of the received signal strongly, making it very hard to decode the content.2 Nicolas was kind
enough to provide some of his samples, recorded with a Lyrtech SDR platform, which provided
a much cleaner signal. The Lyrtech samples on the other hand had a noticeable offset in the
sampling rate. This required some additional work to correct the sampling frequency, but did
not pose any problems otherwise.
For reference, Jens additionally provided some samples from a mode II DAB ensemble,
recorded with the USRP and the Direct Broadcast Satellite Receiver (DBSRX) daughterboard (in
Switzerland, there are unfortunately no DAB ensembles in the frequency range of the DBSRX).
Towards the end of this thesis, samples were additionally recorded with a setup consisting
of a spectrum analyzer to receive and filter the signal and an external mixer to move the signal
from the IF output of the spectrum analyzer (310.7 MHz) to a carrier frequency of 20 MHz,
which is in the range of the BasicRX. The samples were then recorded with the USRP and the
BasicRX daughterboard. With this setup, the FIC of a Swiss DAB signal could successfully be
decoded.
1 A list of the available ensembles in Switzerland can be found under http://digiradio.ch/dab/programme/
ch/index.html.
2 Jens noticed, that each symbol had a random phase offset, possibly due to phase noise in the oscillator of the
TVRX (the TVRX is the only daughterboard, which does not use the same clock source as the USRP mainboard).
Ettus Research is currently developing a new daughterboard for the frequency range of the TVRX, which will
hopefully solve these problems.
6.2. PHYSICAL LAYER (OFDM) 27
Table 6.1 gives an overview over the used samples and lists some challenges that were en-
countered (Actually, multiple streams of each type of samples were used, to see the effects of
different Signal to Noise Ratios (SNRs), etc. The parameters listed in Table 6.1 are valid for all
used streams of each type, however.).
All used samples are complex floats. Although floats may be processed slower than integers
on certain architectures, they are much easier to work with, as the programmer needs to worry
much less about ranges and precision. The use of complex float samples is in fact rather common
in GNU Radio.
Sampling
Rate
Estimation
FFT Filter
(Bandpass) Energy Fine
Resampling Based Frequency OFDM
(optional) Null Symbol Correction Sampler
(optional) Detection
Energy Phase
Based Diff Remove Frequency Symbol
FFT Coarse Pilot Deinter- Demapper
Frequency y[n]=x[n]* Symbol leaving
Correction conj(x[n-1)
The following sections explain the individual blocks. Please note that the description of the
blocks is written in the order, in which they were developed. This is not always the same order
as the order of blocks in the flow graph.
6.2. PHYSICAL LAYER (OFDM) 28
Peak
Moving Detect
Sum
-1
Time synchronisation is required to find the start of the frames. As many of the other blocks
rely on the frame start to process the signal, it is very important that the Null symbol detection
is accurate.
Since DAB frames are separated by Null symbols, during which the signal is zero (except for a
possible Transmitter Identification Information (TII) signal, which can be ignored, as its energy
is comparatively small), time synchronisation can easily and accurately be done by observing the
signal energy.
To find the Null symbol, a moving sum of the length of the Null symbol is first calculated,
which can be done with an FIR-filter with taps set to one:
ull 1
TNX
y[n] = x[n k]
k=0
with TN ull as specified in Table 3.2. The signal is then inverted and a peak detector from GNU
Radio, gr.peak detector fb is used, which is basically a finite state machine with two states.
Whenever a given threshold is exceeded, the peak detector starts looking for a maximum, until
the signal goes below the threshold again. Null symbol detection is shown in Figure 6.2.
Because the FIR filter is rather inefficient, it has been replaced by an equivalent IIR filter,
While this replacement is mathematically simple, a practical implementation must take care that
no error accumulates, because of the limited precision of the calculations, and that there are no
3 Technically, even three FFTs, but the transformation of the taps only has to be done once.
6.2. PHYSICAL LAYER (OFDM) 29
problems with new values being rounded away, if the sum is already large in comparison4 . Exper-
iments showed that this was indeed a problem, and the moving sum was therefore implemented
as a new block in C++, with a double precision data type for the sum.
Figure 6.3 shows a part of the received signal (top), the output of the moving sum block
(bottom) and the detected start of the DAB frame (red).
Null symbol detection is implemented in the class detect null in the file detect null.py
(directory gr-dab/src/python/).
Complexity Analysis
While the implementation with an FIR filter has a complexity of O(n m) (with m being the
length of the Null symbol), the rewrite with a delay block and an IIR filter only has blocks with
O(n) complexity, and it can therefore be expected to run quite fast.
Although tests with Gaussian noise at a sample rate of 2.048 MSPS first seemed to imply that
time synchronisation alone still already uses most of the available processing power (on a laptop
with a Pentium Mobile CPU, clocked at 1.6 GHZ), OProfile5 later showed that actually, about
80% of the resources were spent on generating the noise. Analysis also shows, that with the FIR
implementation, most processing time is spent on calculating the moving sum (the two loops
belong to a Streaming SIMD Extensions (SSE) optimized assembler function that calculates the
complex dot product, which is used by the FIR filter):
CPU: CPU with timer interrupt, speed 0 MHz (estimated)
Profiling through timer interrupt
samples % image name symbol name
7768 96.3533 libgnuradio-core.so.0.0.0 .loop2
59 0.7318 libgnuradio-core.so.0.0.0 gr_fir_fff_simd::filter()
54 0.6698 libgnuradio-core.so.0.0.0 .loop1
41 0.5086 libgnuradio-core.so.0.0.0 gr_peak_detector_fb::work()
37 0.4589 libgnuradio-core.so.0.0.0 .cleanup
31 0.3845 libgnuradio-core.so.0.0.0 gr_vector_source_c::work()
19 0.2357 libgnuradio-core.so.0.0.0 float_dotprod_sse
16 0.1985 libgnuradio-core.so.0.0.0 gr_fir_fff_generic::filterN()
15 0.1861 libgnuradio-core.so.0.0.0 gr_complex_to_mag_squared::work()
10 0.1240 libgnuradio-core.so.0.0.0 gr_single_threaded_scheduler::main_loop()
8 0.0992 libgnuradio-core.so.0.0.0 gr_multiply_const_ff::work()
[...]
4 For illustration: In Matlab, 1e20+1-1e20 evaluates to zero.
5 For a brief description of OProfile, please see Appendix C.1.
6.2. PHYSICAL LAYER (OFDM) 30
In the delay block implementation on the other hand, CPU time is much more evenly dis-
tributed among the blocks, and the CPU usage is drastically reduced (this is not reflected in the
number of samples in the OProfile report, as a different amount of data was processed):
CPU: CPU with timer interrupt, speed 0 MHz (estimated)
Profiling through timer interrupt
samples % image name symbol name
2929 45.7871 libgnuradio-core.so.0.0.0 gri_iir::filter()
761 11.8962 libgnuradio-core.so.0.0.0 gr_peak_detector_fb::work()
646 10.0985 libgnuradio-core.so.0.0.0 gr_vector_source_c::work()
549 8.5821 libgnuradio-core.so.0.0.0 gr_sub_ff::work()
508 7.9412 libgnuradio-core.so.0.0.0 gri_iir::filter_n()
261 4.0800 libgnuradio-core.so.0.0.0 gr_complex_to_mag_squared::work()
215 3.3610 libgnuradio-core.so.0.0.0 gr_single_threaded_scheduler::main_loop()
123 1.9228 libgnuradio-core.so.0.0.0 gr_add_const_ff::work()
117 1.8290 libgnuradio-core.so.0.0.0 gr_multiply_const_ff::work()
[...]
The implementation of the moving sum block in C++ actually reduces the runtime even a
bit more.
the amplitude of each symbol is reduced and the phase is shifted (i.e. the constellation is
rotated)
Inter Carrier Interference (ICI) is introduced
Accurate fine frequency correction is therefore rather important; especially in a signal with
a small subcarrier spacing and possibly low SNR.
GNU Radio already implements several carrier frequency synchronisation blocks for OFDM.
One of them is a preamble correlator, as suggested by Timothy M. Schmidl and Donald C.
Cox in [20]. Schmidl and Cox make use of the fact, that if a pilot symbol is used, where all odd
subcarriers are zero, the first half of the training symbol is equal to the second half, up to a phase
difference, which depends only on the fine carrier frequency error f (as the coarse frequency
error introduces phase differences only in multiples of a complete period):
= TU f
where TU is again the inverse of the subcarrier spacing, as defined in Table 3.2. Schmidl and
Cox show, that the fine carrier frequency error can therefore be estimated as
f
c = /(TU)
with
M
X 1
= (P (d)) =
rd+m rd+m+M ,
m=0
where M is the number of complex samples in the first half of the training symbol and ri denotes
a complex baseband sample. Once the frequency error has been calculated, it can be corrected
U ).
by multiplying the signal with exp(2t/T
6.2. PHYSICAL LAYER (OFDM) 31
This method is robust and has linear complexity. Unfortunately, the pilot symbols used in
DAB do not have the property that all odd carriers are zero.
Another synchronisation method implemented by GNU Radio is the cyclic prefix correlator,
as suggested by Jan-Jaap van de Beek, Magnus Sandell and Per Ola Borjesson in [21]. Instead
of comparing the first and the second half of a pilot symbol, this method compares the cyclic
prefix of any symbol to the last part of that symbol, whose phase should be identical, unless
there is a fine carrier frequency error. The method therefore uses the redundancy introduced by
the cyclic prefix, assuming that the channel is Additive White Gaussian Noise (AWGN). In their
paper however, they show that this method also works in a time-dispersive channel (although
with decreased performance). The existing code using this method was adapted for DAB. The
moving sum was implemented in the same way as presented in Section 6.2.2, and the block
therefore has linear complexity.
After calculating the fine carrier frequency offset, correction is straightforward: The original
signal is multiplied with a signal from a numerically controlled oscillator, whose frequency is as
high as the negated offset.
The implementation is in the file ofdm sync dab.py. Figure 6.4 shows the corresponding
block diagram.
Frame Start
-Tu Complex
z Conjugate
z-Ts
Complex Sample
to and Numerically
Moving
Angle Hold Controlled
Sum Oscillator
z-Ts
In Figure 6.5, the result can be seen. The plot shows DAB data (blue), the start of the
symbols (red), the output of the moving sum over the phase difference (green) and the value
after the sample and hold block (magenta).
The result was verified by writing the synchronised signal into a file and feeding it through
synchronisation again. In Figure 6.6 it can be seen, that the fine frequency error is indeed
corrected. Beginning at the start of the first symbol, the phase difference goes close to zero
(the result can be seen at the end of the first symbol, because of the delay introduced by the
moving sum and the correlator itself). Please note that the first symbol is corrected with the fine
frequency error found by evaluating the phase difference of the cyclic prefix in the first symbol.
This can be done by simply delaying the signal by one symbol length, before doing the correction.
phase offsets in the DAB symbols, as shown in Figure 6.7 (for this plot, the DBSRX samples
were used).
One possible way to improve the fine carrier frequency offset estimation is to evaluate more
than one symbol per DAB frame and use the average value. The trade-off about this is, that
an additional delay is introduced. Additionally, if there is a sampling frequency offset, symbols
towards the end of the DAB frame tend to have larger timing offsets, since the timing is always
synchronised at the start of the frame. This means that in the presence of a sampling frequency
offset, the symbols at the start of the frame are more reliable for fine carrier frequency offset
estimation. For later symbols, the possibility that the sampling is not done exactly at the end
of the symbol is increased.
Another possibility is to adjust the value only gradually to changes, e.g. by using the correc-
tion value
fc [n] = ff [n] + (1 )fc [n 1] 0 1
based on estimates ff [n] of the fine carrier frequency offset.
6.2. PHYSICAL LAYER (OFDM) 33
These two methods are implemented in the block ofdm sync dab, which makes use of the
C++ block ofdm ffs sample. The plot in Figure 6.8 shows, that the phase indeed doesnt jump
any longer.
6.2.5 FFT
Once the stream is split into vectors, they can be transformed into the frequency domain, by
applying the FFT. This is done with the block gr.fft vcc provided by GNU Radio. This block
uses the external Fastest Fourier Transform in the West (FFTW) library6 to perform fast Fourier
transformation.
where X[i] is the i-th entry in the FFT vector, K is the number of used subcarriers and
LF = TU /T the FFT length (please refer to Table 3.2 for specific values).
While this correlation has quadratic complexity, the same trick as for the moving sum only
calculating the energy of the first offset and just adding the difference for the other offsets can
be used to get linear complexity. This also makes it unnecessary to restrict the search range for
the frequency offset.
The implementation is in the C++ block dab ofdm coarse frequency correct, which also
removes the unused carriers and outputs vectors with K (the number of used subcarriers, as
specified in Table 3.2) symbols per vector.
More plots with different parameters led to the assumption, that there might be a frequency
dependent phase offset introduced by an inaccurate sampling rate. The plot displayed in Figure
6.10, which shows the phase of symbols from different subcarriers, confirmed this assumption.
This problem is also described in [19], where it is shown that an offset in the sampling
frequency has the following effects:
reduction of the amplitude of the symbols
a phase shift for each symbol, depending on the distance to the central carrier
i = 2(s i + c )
where c = f f is the relative carrier frequency offset (with fc the actual frequency offset and
c
f the subcarrier spacing) and s = fs /fs is the relative sampling frequency offset. In our
case, the sampling frequency is 2.048 MSPS with an offset of approximately 75 ppm. The phase
offset difference between the lowest and the highest subcarrier should therefore be
4 , the symbol is associated to another phase region and the offset estimation gets wrong. In
Figure 6.11, this effect can be seen for the carriers form 0 to about 300.
Figure 6.11: Estimated phase offset per carrier after 10, 50, 100 and 500 symbols, with = 0.01.
6.2. PHYSICAL LAYER (OFDM) 37
The approach used by Nicolas Alt in his implementation is to estimate the sample rate by
looking at the length of a frame. Since the start of each frame needs to be detected anyways (by
looking at the Null symbols), this can be implemented easily.
Once the actual sample rate is known, it can be used to estimate the individual phase offset
of each subcarrier, or to resample the signal (another very efficient and beautiful method is
described by Maja Sliskovic in [19] the author basically suggests to adjust the twiddle factors
in the FFT to make up for the sampling frequency offset; as this only needs to be done once, it
is a very efficient method).
The method of choice for this implementation was to resample the signal. This is done by
fractional interpolator from GNU Radio and a separately running thread, which estimates the
sampling rate and updates the interpolation factor. As the interpolation ratio is a parameter
of the fractional interpolator rather than an input signal, the estimates are read from Python
and the parameter is updated accordingly. This approach however leads to the problem that the
exact moment, when the interpolation factor is updated, can not be controlled, and this might
therefore happen in the middle of a frame. To avoid this, the fractional interpolation from GNU
Radio has been extended, such that it ignores a newly set interpolation factor, until a new frame
starts.
As the drift of the sampling rate is usually small, even a static interpolation factor will in
practice usually suffice in the case of the USRP, resampling is in fact usually not needed at all.
Dynamic resampling is therefore optional and not enabled by default.
that bit.
6.3. EVALUATION OF THE PHYSICAL LAYER 38
While the imperfections are modeled in the channel, they may in practice also be introduced
by the receiver or the transmitter.
The complete test bench is shown in Figure A.3 in the Appendix.
The energy of the signal is scaled by the FFT block. To solve this problem, the energy
is measured in a first run without noise, and an appropriate scale factor is consequently
applied. This also has the effect, that the energy that is specified for the signal is the
average energy of the signal including the Null symbols (without rescaling, the average
energy would be slightly lower).
The energy of the signal is rescaled by its spectrum occupancy ratio (about 0.75), as the
signal does not occupy the same bandwidth as the noise.
If too many frames are lost, the BER is reported as 0.5, as this is the equivalent to not
getting any information.
6.3. EVALUATION OF THE PHYSICAL LAYER 39
Figure 6.12: BER in a noisy channel (tested with 1MB data per transmission).
The very first frame can not be detected, as there is no reference signal before the first Null
symbol, which makes detection of the frame start impossible. The first frame is therefore
ignored (this is no problem for a live receiver; loosing the first frame only implicates that
the user has to wait 50-100 ms longer before hearing something after turning on the radio).
A small number of bytes is usually lost at the end. This happens, because the scheduler
does not move the last samples through the flow graph, when there is no more input. The
lost bytes are ignored for BER calculation (in a live receiver, there is no such problem, as
there is an endless stream of input samples).
where s is the phase difference per sample, lcp is the length of the cyclic prefix, f is the
carrier frequency offset and fs is the sampling frequency. If we express the carrier frequency
offset as fn = ff sub
in multiples of the subcarrier spacing fsub , which is related to the FFT
length lf f t by fs = fsub lf f t , we get
lcp
= 2 fn
lf f t
While it would be easy to correct the carrier frequency offset before cutting away the cyclic
prefix, by multiplying it with a complex phasor, this would waste precious CPU cycles. Addi-
tionally, if the same energy based coarse frequency offset detection was to be used, two FFTs
would be required instead of one. The preferred solution to correct the phase offset is therefore
to calculate it from the frequency offset and the length of the cyclic prefix and correct it after
the FFT.
Figure 6.14: BER with coarse carrier frequency offsets (100kB data blocks).
With this problem fixed, a plot of the BER with coarse carrier frequency offsets from -300kHz
to +300kHz now looks as depicted in Figure 6.14.
6.3. EVALUATION OF THE PHYSICAL LAYER 41
Two different effects are visible here. Firstly, at an offset of about 110 kHz in either direction,
the BER starts to increase. This is due to the input bandpass, which in this experiment has a
bandwidth of 100 kHz more than the signal bandwidth and a transition width of 50 kHz. With
the filter removed, this effect vanishes. Secondly, at about 250 kHz offset in either direction,
the BER goes to 0.5, i.e. all information is lost. This happens, because the signal, which has
a bandwidth of 1.537 MHz is moved out of the received spectrum area, which has a bandwidth
of 2.048 MHz. At an offset of more than 256 kHz, it is therefore no longer possible to perform
accurate coarse frequency correction. Such large offsets are however rather unlikely in a practical
receiver.
Figure 6.15: Fine carrier frequency offset without correction (simulated with 10MB data blocks).
To illustrate the importance of fine carrier frequency synchronisation, Figure 6.15 shows the
6.3. EVALUATION OF THE PHYSICAL LAYER 42
BER of a Mode I DAB signal in a channel with an SNR of 15 dB and a fine carrier frequency
offset between 0 and 100 Hz (1/10 of the subcarrier spacing), with correction turned off.
Figure 6.16 shows the effect of a sampling frequency offset without any correction (this test
was done with additional noise; the SNR is 15 dB).
Without correction, even small offsets in the area of 50 ppm have a dramatic effect. Since
crystal oscillators are often specified to an accuracy of around 50 ppm, this is critical.
With dynamic sampling rate correction enabled, the BER stays below 102 , for offsets up to
10000 ppm Figure 6.17 shows the plot (again with SNR 15 dB).
Figure 6.17: Sampling frequency offset with correction (1MB data packets).
6.3. EVALUATION OF THE PHYSICAL LAYER 43
The first five frames were ignored here, as the receiver needs some time to adjust to the
sample rate offset, which disturbs the result for the first few frames.
Figure 6.18: Effect of multipath propagation (simulation runs with 500kB data packets).
This plot is particularly interesting, when the lengths of the cyclic prefix for each mode is
kept in mind. As a reminder, the lengths are listed in Table 6.2.
DAB Mode 1 2 3 4
Length of the cyclic prefix 504 126 63 252
Comparing these numbers with the plot confirms, that as soon as the delay is longer than
the cyclic prefix, the effect of an echo increases drastically. For Mode 1, no errors occurred at all
(since zero can not be plotted on a log scale, this is not visible in the plot).
Figure 6.19 shows the effect of taps with magnitudes of 0.3 to 1 (relative to the signal power)
for DAB mode 1.
Echoes with magnitudes smaller than 0.2 have little effect, even when the delay is long
(magnitude 0.2 is not shown in the plot, as the BER is always zero).
Figure 6.19: Effect of taps with different magnitudes (500kB data packets).
sample with 2.048 MSPS directly, and the rational resampler block is obviously too slow, the
solution was therefore to adapt the code to work with a sample rate of 2 MSPS. The drawback
about this is mostly, that the FFT length is in that case also 2000. The speed penalty is however
acceptable (please refer to Appendix B for an evaluation of the speed of different FFT lengths).
The adaptation of the code for arbitrary sample rates only requires the update of a few
OFDM parameters. In the source code, this results in the following code fragment:
if self.sample_rate != self.default_sample_rate:
self.T = 1./self.sample_rate
self.ns_length = int(round(self.ns_length*float(self.sample_rate)/float(self.default_sample_rate)))
self.cp_length = int(round(self.cp_length*float(self.sample_rate)/float(self.default_sample_rate)))
self.fft_length = int(round(self.fft_length*float(self.sample_rate)/float(self.default_sample_rate)))
self.symbol_length = self.cp_length + self.fft_length
self.frame_length = self.symbols_per_frame * self.symbol_length + self.ns_length
With the resampler removed, the block wasting the most CPU cycles was the block that
calculates the phase for the fine carrier frequency synchronisation algorithm (block 16 in Figure
A.1). The atan2 operation employed by this block requires about 35% of the total CPU time
inside libgnuradio. As there is a sample and hold block right after the complex to arg block,
this is a huge waste of CPU cycles, which can however be fixed easily, by moving the phase
calculation after the sample and hold block.
With this update, real-time processing was possible again, however only with sampling fre-
quency correction (which uses another interpolation block) turned off. The OProfile report looked
as follows:
15118 17.9274 python2.4
TIMER:0|
samples| %|
------------------
5484 36.2746 libgnuradio-core.so.0.0.0
3100 20.5054 _dab_swig.so
2804 18.5474 libm-2.6.1.so
1286 8.5064 libc-2.6.1.so
1210 8.0037 libfftw3f.so.3.1.2
817 5.4042 kernel-2.6.24
[...]
6.4. FAST INFORMATION CHANNEL (FIC) 45
Obviously, most of the time is still spent inside libgnuradio. The FFTW library uses surpris-
ingly few CPU time, even with the new FFT length 2000. Inside libgnuradio, the statistics look
as follows:
CPU: CPU with timer interrupt, speed 0 MHz (estimated)
Profiling through timer interrupt
samples % image name symbol name
542 20.7583 libgnuradio-core.so.0.0.0 gr_multiply_cc::work()
325 12.4473 libgnuradio-core.so.0.0.0 gr_single_threaded_scheduler::main_loop()
290 11.1069 libgnuradio-core.so.0.0.0 gr_frequency_modulator_fc::work()
215 8.2344 libgnuradio-core.so.0.0.0 gr_sincosf
184 7.0471 libgnuradio-core.so.0.0.0 gr_kludge_copy::work()
183 7.0088 libgnuradio-core.so.0.0.0 gr_peak_detector_fb::work()
142 5.4385 libgnuradio-core.so.0.0.0 gr_fft_vcc_fftw::work()
80 3.0640 libgnuradio-core.so.0.0.0 gr_conjugate_cc::work()
72 2.7576 libgnuradio-core.so.0.0.0 gr_complex_to_mag_squared::work()
72 2.7576 libgnuradio-core.so.0.0.0 min_available_space()
71 2.7193 libgnuradio-core.so.0.0.0 gr_multiply_const_ff::work()
65 2.4895 libgnuradio-core.so.0.0.0 gr_block_detail::input()
[...]
One block that uses up a lot of CPU time is the frequency modulator (block 20 in Figure
A.1), which is used to correct the fine frequency offset. A simple idea to avoid its use is to simply
ask the USRP to retune the frequency instead. The implementation of this idea showed, that
the resource usage is indeed reduced drastically. It should be noted however, that this is a step
away from SDR. Also, whenever the frequency is retuned, the signal is disturbed.
Another block that uses up many CPU cycles is the complex multiplication block. One place
where a complex multiplication is done at the full data rate, is the fine frequency estimation
(block 14 in Figure A.1). This is especially awkward, because most of these multiplications are
unnecessary, as the fine frequency offset is estimated from the first eight (in the case of DAB
mode I) symbols only, and the values for the other symbols are not needed. To avoid this, a
signal would needed, which tells every block, when it needs to calculate outputs (by default,
every block in the flow graph processes all samples). This would require, that every block is
extended to be able to use such a control signal. A simpler method is to implement the whole
fine frequency estimation (blocks 12-17 in Figure A.1) in one block. Although this approach has
the disadvantage that modularity is lost, it is the preferable solution, because it generates the
least overhead for control signals and it is easily realizable. This idea is implemented in the C++
block ofdm ffe all in one (block 20 in Figure A.2).
Figure A.2 shows the OFDM demodulation with all the code improvements.
Figure 6.20: DAB constellation sink with samples from the Swiss DAB ensemble at 227.36 MHz.
DAB mode. The block responsible for this task is called select vectors (its implementation
is generic, i.e. it can be used to select any number of vectors at the start of the frame or after
skipping a given number of vectors).
The next task is to repartition the vectors, such that each vector contains one codeword. In
the case of DAB mode I for instance, three OFDM symbols with 3072 bits each contain four
convolutional codewords with 2034 bits each, and therefore three vectors need to be repartitioned
into four vectors. This task is done in the block repartition vectors.
Viterbi Decoder
The module gr-trellis, which was written by Achilleas Anastasopoulos, implements a generic
FSM class and a generic Viterbi decoder. This module makes the decoding process rather simple.
First, an object with the FSM described in Section 11.1.1 of the DAB specification is in-
stantiated. This can easily be done by calling the appropriate constructor with the generator
polynomials and the input and output bit width.
Secondly, a combined block, which first calculates the metrics for the input symbols and then
does the decoding is instantiated. This is a bit more complicated. As the metrics calculator
considers each four bits generated by one input bit to the FSM as one of 16 possible symbols,
a constellation table with 64 entries is needed, specifying the 4 constellation points for each of
the 16 symbols. The metrics calculator uses the distance from the constellation point to get an
estimate for the certainty of correct detection.
6.4. FAST INFORMATION CHANNEL (FIC) 47
With the metrics, the Viterbi decoder then selects the most likely path in the trellis and
outputs the corresponding bit sequence.
7.1 Conclusions
One of the major challenges when implementing a software defined radio is the limited amount of
available processing time. The majority of papers about signal processing algorithms is written
from a primarily mathematical perspective, and many of these algorithms are not suitable for a
software implementation. Therefore, the choice often has to be made in favor of the faster algo-
rithm, rather than the one with the best receiving performance. On the other hand, computers
are getting faster and faster. Even though the project of this thesis was developed and tested on
a laptop with a single core CPU, CPUs with four and more cores are available today.
With all features (input filtering, frequency correction, magnitude equalisation, ..) except
dynamic resampling1 turned on, the presented implementation of DAB in GNU Radio requires
about 95% of the available CPU time to demodulate the complete OFDM signal and decode the
FIC in real-time (using a five years old ThinkPad laptop with an 1.6 GHz CPU). Without the
FFT filter at the input, even only about 80% of the available processing power is required. Since
most of the processing power is spent for OFDM demodulation, a complete real-time software
DAB receiver is certainly feasible on current hardware.
A big advantage for implementing an algorithm in software, is the open availability of existing
code for a similar problem. Often, only minor adjustments of existing code are needed to reuse
it for a new problem. While making such adjustments still requires a complete understanding
of the used algorithm, the availability of open code for a similar problem facilitates both the
process of learning and implementing the algorithm.
In the case of GNU Radio, all source code, including the Verilog code for the FPGA, is
available for inspection and reuse, which was very helpful.
7.2 Outlook
To finally be able to hear an audio signal, the implementation of the MSC is needed. As many
blocks required for this have already been implemented for the FIC, this should not be too much
work.
Once the receiver is complete, a comparison to hardware receivers would be interesting, to
evaluate the receiving performance practically, rather than only with simulations as described
in Section 6.3. On the other hand, the existing test bench and simulation code could easily be
adapted to do other interesting simulations. For instance, the performance of SFNs could be
evaluated by using an appropriate FIR tap for each transmitter.
1 The current fractional resampler is too slow to run in real-time together with the rest of the code; the USRP
To save some of the required processing power, it would also be interesting to see, whether
the receiver can be extended, such that it adapts itself dynamically to the receiving conditions.
For instance, if the conditions are good and the channel changes only slowly, an update of the
magnitude equalisation factors for each new frame may not be necessary, and it may be done
less often. The ultimate idea behind software defined radio is to have a cognitive radio, which is
completely aware of its RF environment, and adapts all its parameters whenever needed.
Finally, it would also be interesting to implement a DAB transmitter. Since a transmitter
does not require such things as frequency synchronisation, its implementation is often much easier
than the implementation of the corresponding receiver. As the physical layer has already been
implemented and most blocks for the upper layers are already available, the implementation of
a DAB transmitter in GNU Radio should be comparatively easy. With a complete transmitter
and receiver implementation, DAB could also be used to transport other data, for instance to
build a wireless data network between two computers equipped with USRPs operating in the 2.4
GHz ISM band.
Appendix A
The following pages contain flow graphs from various parts of the DAB code. The content of
these blocks and the underlying algorithms are explained in Chapter 6.
51
file_source (1)
kludge_copy (3)
0
0
kludge_copy (6)
0 0 0
0
1 0
Synchronisation
Fine Frequency
Frame Start
Detection
0
1
multiply_cc (21)
1
0
ofdm_sampler (22)
0 1
fft_vcc_fftw (23)
0 1
ofdm_coarse_frequency_correct (24)
0 1
diff_phasor_vcc (25)
0 1
ofdm_remove_first_symbol_vcc (26)
0
1
qpsk_demapper_vcb (28)
file_sink (30)
file_source (1)
0
1
multiply_cc (24)
1 0
ofdm_sampler (25)
0 1
fft_vcc_fftw (26)
0 1
ofdm_coarse_frequency_correct (27)
0 1
diff_phasor_vcc (28)
0 1
ofdm_remove_first_symbol_vcc (29)
0 1
0 1
magnitude_equalizer_vcc (30)
0 1
qpsk_demapper_vcb (32)
file_sink (34)
Figure A.2: Revised version of OFDM demodulation: With resampling, magnitude equalization
and a single block for fine frequency estimation.
53
vector_source_b fft_filter_ccc
stream_to_vector kludge_copy
0 0 0
0
0 1 0
1
ofdm_insert_pilot_vcc complex_to_mag_squared multiply_cc
0 1
Modulation
0 1
0
1
stream_to_vector multiply_cc
0 1 0
1
insert_null_symbol ofdm_sampler
0 1
Demodulation
multiply_const_cc fft_vcc_fftw
0 1
multiply_const_cc ofdm_coarse_frequency_correct
0 0 0 1
0 1
1
0
Channel add_cc qpsk_demapper_vcb
0
0
vector_sink_b
Figure A.3: DAB OFDM test bench: Modulation, channel model and demodulation.
54
usrp1_source_c
kludge_copy
0 0
fft_filter_ccc measure_processing_rate
kludge_copy
0 1
0
0 0
select_vectors
complex_to_mag_squared 0 1
0 1
repartition_vectors
0
moving_sum_ff delay 1
unpuncture_vff
multiply_const_ff
vector_to_stream
peak_detector_fb
0 0
1 0 viterbi_combined_fb
ofdm_ffe_all_in_one
stream_to_vector
delay frequency_modulator_fc
0
1
prune_vectors FIC
OFDM
multiply_cc
1 0 vector_to_stream vector_source_b
ofdm_sampler
0 1
0 1
xor_bb
fft_vcc_fftw
0 1 stream_to_vector
ofdm_coarse_frequency_correct
0 1
0 1
repartition_vectors
1 0
diff_phasor_vcc
0 1 null_sink vector_to_stream
ofdm_remove_first_symbol_vcc
0 1
0 1 unpacked_to_packed_bb
magnitude_equalizer_vcc
0
1
stream_to_vector
frequency_interleaver_vcc
fib_sink_b
complex_to_interleaved_float_vcf
0
Figure A.4: Complete receiver with USRP as signal source, OFDM demodulation and FIC
decoding.
Appendix B
As the USRP can not be used to sample directly at 2.048 MSPS (which is the inverse of the
fundamental time unit specified in the DAB standard), the nearest possible sample rate, 2 MSPS,
is used instead. Therefore, the signal must either be resampled, or the code must be able to use
any sample rate. The latter option would also require an FFT of length 2000 instead of 2048.
To answer the question, which option is more computationally intensive, the speed of the FFT
library, FFTW, has to be evaluated. According to the FFTW website, FFTW has a complexity
of O(n log n) for any length, even for primes. This does however not mean, that the runtime is
completely independent of the FFT length, but rather that the speed difference is only a constant
factor and not some function of the number of processed samples.
To evaluate the speed for the lengths between 1950 and 2050, a small test program in Python
was created. The result can be seen in Figure B.1.
It should be noted that the relative speed between different FFT sizes is also influenced
heavily by the architecture of the computer used (e.g. by the cache block size).
Table B.1 lists some of the run times from a simulation with 100000000 samples on two
56
different PCs,
a) a ThinkPad with an Intel Pentium M processor clocked at 1.6 GHz (with real-time schedul-
ing enabled and an SSE optimized FFTW library).
b) a Tardis (a student PC with a Dual Core Intel Pentium 4 CPU clocked at 3.2 GHz, from
which only one core was used)
The fastest result is in both cases the one with an FFT of length 2048.
Although this shows up to a factor of 10 between the ideal case and the worst case, an FFT
of length 2000 is reasonably fast to justify its use. In total, the FFT block still uses less than
10% of the available CPU time, whereas resampling alone would need about 80% (and an FFT
of length 2048 would still be required in that case).
Appendix C
Additional Tools
This chapter briefly introduces some of the additional tools used for development and testing. As
good information on all of these tools is available online and they are not subject of this thesis,
the description is deliberately kept short. This should hopefully still suffice to understand, how
each tool fits into the development process.
All software presented in this chapter is open source software, which is freely available.
C.1 OProfile
OProfile is a statistical profiler for Linux, which can be used for performance analysis. OProfile
allows the profiling of programs by collecting statistical data with the aid of a kernel module.
Based on events, such as timer events, cache misses or memory references, samples (i.e. infor-
mation about the code which is currently being executed) are recorded.
Once all code has been executed, these samples can be retrieved from the OProfile daemon for
further processing. This allows a programmer to quantitatively analyze, how much computing
power is spent in some area of her code, relative to other parts. Besides analyzing single program
runs, it is possible to get differential information about multiple program runs, e.g. to find out,
whether a change in the code resulted in a performance increase.
Because OProfile uses a kernel module and hardware performance counters of the CPU,
profiling a program or a library requires no recompilations 1 or alike, which makes profiling very
convenient. This is especially useful for a toolkit like GNU Radio, where the mix of Python and
C++ code would otherwise complicate performance analysis.
Besides OProfile, standard Unix tools, such as time or top were used to evaluate the efficiency
of the code.
Further information on performance analysis can be found in [22]. Information about OProfile
can be found on the OProfile website [23], as well as in [24].
annotation, however.
C.3. DOXYGEN 58
SciPy is a library, which provides many mathematical functions. Together with IPython, this
library can be used as an interactive Computer Algebra System (CAS), similar to Matlab, but
with Python as its underlying programming language.
More information about Python, IPython and SciPy can be found under http://python.
org/, http://ipython.scipy.org/ and http://scipy.org respectively.
C.3 Doxygen
Doxygen is a tool, which can be employed to extract comments from the source code of various
programming languages and create a code manual in Hypertext Markup Language (HTML),
LATEX, or a number of other output formats.
As a good documentation of the source code is important, it is preferable to document the
source code and let Doxygen create a code manual, rather than to write a separate manual.
More information on Doxygen is available on http://www.doxygen.org/.
C.4 Swig
Simplified Wrapper and Interface Generator (SWIG) is a tool which can automatically create
interfaces between two different programming languages. In the case of GNU Radio, SWIG is
used to create bindings between Python and C++ blocks.
Information about SWIG can be found at http://www.swig.org/.
C.6 Subversion
Subversion is a version control system, i.e. it can be used to keep track of changes made in source
code or other documents. Whenever the code is checked in, its current state is stored on the
Subversion server. This is very helpful if some change in the code breaks the functionality, and
it also has the benefit, that a backup is always available.
Subversion is available from http://subversion.tigris.org/.
Appendix D
Code Overview
This section gives an overview of the program code. It does however not intend to describe the
purpose of the individual blocks and their functions, as this information is available in the HTML
documentation generated by Doxygen.
dab estimate samplerate.py estimates the exact sample rate of samples from a file
usrp dab rx.py receive live FIC information with the USRP
test ofdm sync dab.py test the synchronisation code with samples from a file
All executables have built-in help pages, which can be displayed by calling the program with
the parameter -h, e.g. for dab rx constellation.py:
$ ./dab_rx_constellation.py -h
usage: dab_rx_constellation.py: [options] <filename>
options:
-h, --help show this help message and exit
-m DAB_MODE, --dab-mode=DAB_MODE
DAB mode [default=1]
-F, --filter-input enable FFT filter at input
-c, --correct-ffe do fine frequency correction
-u, --correct-ffe-usrp
do fine frequency correction by retuning the USRP
D.1. PYTHON CODE 60
instead of in software
-e, --equalize-magnitude
do magnitude equalization
-s RESAMPLE_FIXED, --resample-fixed=RESAMPLE_FIXED
resample by a fixed factor (fractional interpolation)
-S, --autocorrect-sample-rate
estimate sample rate offset and resample (dynamic
fractional interpolation)
-R RX_SUBDEV_SPEC, --rx-subdev-spec=RX_SUBDEV_SPEC
select USRP Rx side A or B [default=A]
-f FREQ, --freq=FREQ set frequency to FREQ [default=227360000.0]
-r SAMPLE_RATE, --sample-rate=SAMPLE_RATE
set sample rate to SAMPLE_RATE [default=2000000]
-d DECIM, --decim=DECIM
set decimation rate to DECIM [default=32]
-g RX_GAIN, --rx-gain=RX_GAIN
set receive gain in dB (default is midpoint)
-v, --verbose verbose output
Another important file is parameters.py. This file contains two classes, dab parameters,
which contains all parameters from the DAB standard, and receiver parameters, which con-
tains all parameters of the receiver. dab parameters also has many built-in self checks to verify
the DAB parameters.
plot sampling rate offset ber.py evaluates the effect of an offset in the sampling
frequency
All four scripts use the DAB test bench from the file dab tb.py, which is depicted in Figure
A.3.
D.2. C++ CODE 61
D.3 Patches
The directory gr-dab/patches contains some patches for blocks in the GNU Radio framework.
Appendix E
Installation
This chapter gives an overview of how GNU Radio and the code developed in this thesis can be
installed. As GNU Radio is a rather complex toolkit, the first installation of GNU Radio and
associated code can be cumbersome. The GNU Radio community has however written some
good documents on how to install GNU Radio. Rather than reproducing them, they shall be
linked here:
Readme: http://gnuradio.org/trac/browser/gnuradio/trunk/README
E.2 Packages
Some distributions provide packages for GNU Radio. As the DAB module relies on some of the
newer code found in the trunk, an installation from the code in the SVN repository is required.
The packages may however be useful to pull in the required dependencies.
E.4 Installation
Once all external dependencies are satisfied, the build and install process is in the ideal case
as easy as
E.4. INSTALLATION 63
$ ./bootstrap
$ ./configure
$ make
$ make check
Presentation
On the following pages, the presentation slides are included, which were used for the presentation
on June 13th, 2008.
DAB
Software Receiver Implementation
Andreas Muller
Supervisor: Michael Lerjen
1 Introduction
Task
Software Defined Radio
DAB
GNU Radio and USRP
2 Implementation
OFDM Synchronisation
OFDM Demodulation
3 Evaluation
Test Setup
Results
4 Conclusions
5 Questions
Task
SDR
Software Defined Radio (almost) all signal
processing in software
DAB
Digital Audio Broadcasting digital radio
technology standardized by ETSI
Real-time
Process data as fast as it arrives 2 MSPS or 16
MB/s
66
Idea
Digitize the signal and do all the signal processing in (high level,
architecture independent) software.
Strengths
Flexibility
Reusable code, fast development cycle
Cognitive radio: Adapts itself dynamically to RF environment
better spectral and power efficiency
Weaknesses
Limited sample rate and dynamic range of ADCs and DACs
analog front end needed for filtering
Resource usage, energy consumption, cost
Upper Layers
Punctured convolutional coding
Energy dispersal, Time interleaving
MPEG 2 audio coding
67
GNU Radio
Overview
Open source framework for real-time software radios
Provides many common building blocks: FFT, FIR & IIR filters,
mathematical operations, AGC, modulation & demodulation, . . .
Hardware
Interface between computer and antenna is needed
Most commonly used with GNU Radio: USRP
USRP
Two AD9862 Mixed Signal Front-End Processors
4 DACs with sampling rate 128 MSPS 2 I/Q TX channels
4 ADCs with sampling rate 64 MSPS 2 I/Q RX channels
Altera Cyclone FPGA for conversion to/from baseband,
decimation/interpolation, multiplexing and buffering
Cypress FX2 USB 2.0 interface
Daughterboards according to selected frequency range
68
(Source: http://ettus.com)
OFDM I Synchronisation
Time Synchronisation
Frame start detection must be accurate, as the other blocks
depend on it
Can easily be done by looking at the energy of the signal (Null
symbols)
Implemented with moving sum, inverter and peak detector
Frequency Synchronisation
Small subcarrier bandwidth accurate synchronisation needed
Fine frequency synchronisation (offsets < subcarrier bandwidth)
compare cyclic prefix to end of the symbol fine frequency offset
can be estimated from the phase offset
Coarse frequency synchronisation (offsets > subcarrier bw)
done after fine frequency synchronisation and after FFT
simply shift signal in the frequency domain very efficient
69
OFDM II Demodulation
Demodulation
Besides time and frequency synchronisation, demodulation is
rather straightforward
Sampler: Remove cyclic prefix, pack each OFDM symbol in a
vector
FFT
Calculate phase difference (undo the D in D-QPSK)
Magnitude equalization (only needed for soft bits, as the
information is only in the phase)
Undo frequency interleaving: Mix symbols according to
sequence specified in DAB standard
I and Q components contain independent bits simply check if
<(x) > 0 and =(x) > 0
Test Setup
Simulation Cycle
Generate random bytes
Modulation
Channel-model distorts OFDM signal
Demodulation
Calculate BER from original and received bytes
Channel Model
Sampling frequency offset modeled by fractional interpolator
Multipath propagation modeled with FIR filter
Frequency offset (signal source + multiplication block)
AWGN (noise source + adder block)
70
Results SNR
DAB Mode 1 2 3 4
Cyclic Prefix Length 504 126 63 252
71
Conclusions
Conclusions
Real-time processing is possible
FIBs successfully decoded
No audio yet
Challenges
Very efficient algorithms and programming needed
Many signal processing papers are written from a primarily
mathematical perspective
Advantages
Same code for simulation and actual receiver
Open source code of existing blocks helps understand algorithms
Existing code can sometimes be adapted for new purposes
GNU Radio: Large and enthusiastic community
Questions?
This semester thesis is accompanied by a CD-ROM, which has the following content:
/
gr-dab ...................... Python and C++ code for the DAB GNU Radio module
doc/index.html ................. Source code documentation (generated by Doxygen)
Acronyms
The following list provides an overview of the acronyms used throughout this thesis.
CA Conditional Access
CU Capacity Unit
FM Frequency Modulation
GR GNU Radio
IF Intermediate Frequency
QA Quality Assertion
RF Radio Frequency
SC Service Component
SR Software Radio
SI Service Information
SVN Subversion
[1] ETSI, ETSI EN 300 401 V1.4.1: Radio Broadcasting Systems; Digital Audio Broadcasting
to mobile, portable and fixed receivers, 2006. [Online]. Available: http://www.etsi.org
[2] , ETSI ES 201 980 V2.3.1: Digital Radio Mondiale (DRM); System Specification,
2008. [Online]. Available: http://www.etsi.org
[5] V. Fischer, Software Implementation of a Digital Radio Mondiale (DRM) Receiver, Part
I (Framework), Institute for Communication Technology, Darmstadt University of Tech-
[6] J. P. Elsner, Implementation of the DAB physical layer in software using the GNU Radio
framework. Universit
at Karlsruhe, 2007.
[8] Wikipedia, Loudness war Wikipedia, The Free Encyclopedia, 2008. [Online].
Available: http://en.wikipedia.org/w/index.php?title=Loudness war
bitrates and audio quality; Dynamic range compression and loudness, Department
of Electronic Systems Engineering, University of Essex, 2002. [Online]. Available:
http://www.david.robinson.org/commsbill/
BIBLIOGRAPHY 78
[11] V. Bose, M. Ismert, M. Welborn, and J. Guttag, Virtual Radios. Massachusetts Institute
of Technology, 1998.
[13] E. Blossom, GNU Radio: Tools for Exploring the Radio Frequency Spectrum, Linux
Journal, 2004. [Online]. Available: http://www.linuxjournal.com/article/7319
[15] Q. Norton, GNU Radio Opens an Unseen World, Wired Magazine, 2006. [Online].
Available: http://www.wired.com/science/discoveries/news/2006/06/70933
[17] Wikipedia, CORDIC Wikipedia, The Free Encyclopedia, 2008. [Online]. Available:
http://en.wikipedia.org/w/index.php?title=CORDIC&oldid=201345871
[19] M. Sliskovic, Carrier and Sampling Frequency Offset Estimation and Correction in Multi-
carrier Systems, 2001.
[20] T. M. Schmidl and D. C. Cox, Robust Frequency and Timing Synchronization for OFDM,
Signal Processing, IEEE Transactions on Communications, vol. 45, no. 12, pp. 16131621,
Dec 1997.
[21] J. van de Beek, M. Sandell, and P. Borjesson, ML estimation of time and frequency offset
in OFDM systems, Signal Processing, IEEE Transactions on [see also Acoustics, Speech,
and Signal Processing, IEEE Transactions on], vol. 45, no. 7, pp. 18001805, Jul 1997.
[Online]. Available: http://epubl.luth.se/avslutade/0347-0881/96-09/bsb96r.pdf
BIBLIOGRAPHY 79
[22] Wikipedia, Performance Analysis Wikipedia, The Free Encyclopedia, 2008. [On-
line]. Available: http://en.wikipedia.org/w/index.php?title=Performance analysis&oldid=
201033250
[23] J. Levon, OProfile A System Profiler for Linux. [Online]. Available: http:
//oprofile.sourceforge.net/
[24] W. E. Cohen, Tuning Programs with OProfile, Wide Open Magazine, 2008. [Online].
Available: http://people.redhat.com/wcohen/Oprofile.pdf