44
OFDM Packet Receivers in GNU Radio Martin Braun (Ettus Research / GNU Radio) FOSDEM 2014

OFDM Packet Receivers in GNU Radio - archive.fosdem.org · Part I – OFDM PHY Development 1 What is OFDM? 2 Tagged Stream Blocks 3 GNU Radio OFDM Codes 4 The OFDM Transmitter 5 The

  • Upload
    others

  • View
    14

  • Download
    0

Embed Size (px)

Citation preview

Page 1: OFDM Packet Receivers in GNU Radio - archive.fosdem.org · Part I – OFDM PHY Development 1 What is OFDM? 2 Tagged Stream Blocks 3 GNU Radio OFDM Codes 4 The OFDM Transmitter 5 The

OFDM Packet Receivers in GNU Radio

Martin Braun (Ettus Research / GNU Radio)

FOSDEM 2014

Page 2: OFDM Packet Receivers in GNU Radio - archive.fosdem.org · Part I – OFDM PHY Development 1 What is OFDM? 2 Tagged Stream Blocks 3 GNU Radio OFDM Codes 4 The OFDM Transmitter 5 The

Introduction

I Who is this guy:I mbr0wnI GNU Radio contributor since 2008I KIT graduateI Now full-time SDR developer for Ettus Resarch LLC

Page 3: OFDM Packet Receivers in GNU Radio - archive.fosdem.org · Part I – OFDM PHY Development 1 What is OFDM? 2 Tagged Stream Blocks 3 GNU Radio OFDM Codes 4 The OFDM Transmitter 5 The

Part I – OFDM PHY Development

1 What is OFDM?

2 Tagged Stream Blocks

3 GNU Radio OFDM Codes

4 The OFDM Transmitter

5 The OFDM Receiver

6 Going over the air

Page 4: OFDM Packet Receivers in GNU Radio - archive.fosdem.org · Part I – OFDM PHY Development 1 What is OFDM? 2 Tagged Stream Blocks 3 GNU Radio OFDM Codes 4 The OFDM Transmitter 5 The

Part I – OFDM PHYs

I What is OFDM?I How can we build OFDM-based PHY layers in GNU

Radio?

Page 5: OFDM Packet Receivers in GNU Radio - archive.fosdem.org · Part I – OFDM PHY Development 1 What is OFDM? 2 Tagged Stream Blocks 3 GNU Radio OFDM Codes 4 The OFDM Transmitter 5 The

Outline

1 What is OFDM?

2 Tagged Stream Blocks

3 GNU Radio OFDM Codes

4 The OFDM Transmitter

5 The OFDM Receiver

6 Going over the air

Page 6: OFDM Packet Receivers in GNU Radio - archive.fosdem.org · Part I – OFDM PHY Development 1 What is OFDM? 2 Tagged Stream Blocks 3 GNU Radio OFDM Codes 4 The OFDM Transmitter 5 The

What is OFDM?

I Orthogonal Frequency DivisionMultiplexing: Transmit many narrow-bandsignals in parallel on orthogonalfrequencies

I “Good way to transport lots of digital dataover the air”

I Used in many standards (LTE, Wifi, DVB,DAB, . . . )

Page 7: OFDM Packet Receivers in GNU Radio - archive.fosdem.org · Part I – OFDM PHY Development 1 What is OFDM? 2 Tagged Stream Blocks 3 GNU Radio OFDM Codes 4 The OFDM Transmitter 5 The

Anatomy of an OFDM signal

I Complex modulations symbols(BPSK, QPSK, . . . )

I OFDM symbols: Set ofcomplex modulation symbolstransmitted at once

I Subcarriers: Discretefrequencies on which data aretransmitted

I Frame: Set of OFDM symbolsI Header: Carries info on frame,

helps synchronization. . .I Pilot symbols: Special

symbols, known a-priori...

...

...

...

...

...

...

t

f

cN −1,0 cN −1,M −1

c1,M −1

c0,0

c0,1

c0,1 c0,M −1

fN −1

∆f f1

f0

T TG

TO

Page 8: OFDM Packet Receivers in GNU Radio - archive.fosdem.org · Part I – OFDM PHY Development 1 What is OFDM? 2 Tagged Stream Blocks 3 GNU Radio OFDM Codes 4 The OFDM Transmitter 5 The

An OFDM transmitter

Discrete-time

domain

Analogdomain

Complexsymbols D/A

Converter

Lowpassfilter

Cyclicprefixadder...

0

00

IFFT

Centre frequency

I Efficient sub-carrier modulation via IFFT (createsbaseband signal)

I Cyclic prefix: Creates space between OFDM symbolsI . . . so how do we make on of these in GNU Radio?I No states!

Page 9: OFDM Packet Receivers in GNU Radio - archive.fosdem.org · Part I – OFDM PHY Development 1 What is OFDM? 2 Tagged Stream Blocks 3 GNU Radio OFDM Codes 4 The OFDM Transmitter 5 The

Outline

1 What is OFDM?

2 Tagged Stream Blocks

3 GNU Radio OFDM Codes

4 The OFDM Transmitter

5 The OFDM Receiver

6 Going over the air

Page 10: OFDM Packet Receivers in GNU Radio - archive.fosdem.org · Part I – OFDM PHY Development 1 What is OFDM? 2 Tagged Stream Blocks 3 GNU Radio OFDM Codes 4 The OFDM Transmitter 5 The

gr tagged stream blocks

I Handle stream boundariesI Input-drivenI Uses tagsI Not really the same category

as sync, decimator,interpolator

I Tag on the first item definespacket length

I Examples:I CRC32I OFDM-Frame operationsI More to follow

Page 11: OFDM Packet Receivers in GNU Radio - archive.fosdem.org · Part I – OFDM PHY Development 1 What is OFDM? 2 Tagged Stream Blocks 3 GNU Radio OFDM Codes 4 The OFDM Transmitter 5 The

Outline

1 What is OFDM?

2 Tagged Stream Blocks

3 GNU Radio OFDM Codes

4 The OFDM Transmitter

5 The OFDM Receiver

6 Going over the air

Page 12: OFDM Packet Receivers in GNU Radio - archive.fosdem.org · Part I – OFDM PHY Development 1 What is OFDM? 2 Tagged Stream Blocks 3 GNU Radio OFDM Codes 4 The OFDM Transmitter 5 The

GNU Radio OFDM Codes

I Disclaimer: There are two versions of OFDM codes inGNU Radio

I All of this depends on the new codes!I Where to start:

I gr-digital/examples/ofdm/*.grcI “OFDM Transmitter” and “OFDM Receiver” hierarchical

blocksI In Python: digital.ofdm rx and digital.ofdm tx

I Many recent developments have gone into this (tags,message passing, tagged stream blocks. . . )

Page 13: OFDM Packet Receivers in GNU Radio - archive.fosdem.org · Part I – OFDM PHY Development 1 What is OFDM? 2 Tagged Stream Blocks 3 GNU Radio OFDM Codes 4 The OFDM Transmitter 5 The

OFDM – Wishlist

I Fully configurable frame configuration (pilot tones,occupied carriers. . . )

I Can we reconfigure the whole thing to do 802.11a andDAB?

I Any part of the flow graph should be exchangeableI . . . and individually useful

Page 14: OFDM Packet Receivers in GNU Radio - archive.fosdem.org · Part I – OFDM PHY Development 1 What is OFDM? 2 Tagged Stream Blocks 3 GNU Radio OFDM Codes 4 The OFDM Transmitter 5 The

Outline

1 What is OFDM?

2 Tagged Stream Blocks

3 GNU Radio OFDM Codes

4 The OFDM Transmitter

5 The OFDM Receiver

6 Going over the air

Page 15: OFDM Packet Receivers in GNU Radio - archive.fosdem.org · Part I – OFDM PHY Development 1 What is OFDM? 2 Tagged Stream Blocks 3 GNU Radio OFDM Codes 4 The OFDM Transmitter 5 The

The OFDM Transmitter

I CRC block: Output is always 4 bytes longer than input

I Packet header generator: Evaluates payload and metadatato generate custom payload

I Bit repacker: Prepare for modulation, handles oddnumbers of bits

Page 16: OFDM Packet Receivers in GNU Radio - archive.fosdem.org · Part I – OFDM PHY Development 1 What is OFDM? 2 Tagged Stream Blocks 3 GNU Radio OFDM Codes 4 The OFDM Transmitter 5 The

The OFDM Transmitter

I CRC block: Output is always 4 bytes longer than inputI Packet header generator: Evaluates payload and metadata

to generate custom payload

I Bit repacker: Prepare for modulation, handles oddnumbers of bits

Page 17: OFDM Packet Receivers in GNU Radio - archive.fosdem.org · Part I – OFDM PHY Development 1 What is OFDM? 2 Tagged Stream Blocks 3 GNU Radio OFDM Codes 4 The OFDM Transmitter 5 The

The OFDM Transmitter

I CRC block: Output is always 4 bytes longer than inputI Packet header generator: Evaluates payload and metadata

to generate custom payloadI Bit repacker: Prepare for modulation, handles odd

numbers of bits

Page 18: OFDM Packet Receivers in GNU Radio - archive.fosdem.org · Part I – OFDM PHY Development 1 What is OFDM? 2 Tagged Stream Blocks 3 GNU Radio OFDM Codes 4 The OFDM Transmitter 5 The

The OFDM Transmitter

I Symbol mappers: Regular blocksI None of the code after the mappers cares about the actual

complex values (enforce boundaries!)

I Multiplexer: Respects tag positions and boundaries

Page 19: OFDM Packet Receivers in GNU Radio - archive.fosdem.org · Part I – OFDM PHY Development 1 What is OFDM? 2 Tagged Stream Blocks 3 GNU Radio OFDM Codes 4 The OFDM Transmitter 5 The

The OFDM Transmitter

I Symbol mappers: Regular blocksI None of the code after the mappers cares about the actual

complex values (enforce boundaries!)I Multiplexer: Respects tag positions and boundaries

Page 20: OFDM Packet Receivers in GNU Radio - archive.fosdem.org · Part I – OFDM PHY Development 1 What is OFDM? 2 Tagged Stream Blocks 3 GNU Radio OFDM Codes 4 The OFDM Transmitter 5 The

The OFDM Transmitter

I Carrier allocator: Distributes symbols in time andfrequency, adds pilot symbols and headers

I Cyclic prefixer: Includes rolloff

Page 21: OFDM Packet Receivers in GNU Radio - archive.fosdem.org · Part I – OFDM PHY Development 1 What is OFDM? 2 Tagged Stream Blocks 3 GNU Radio OFDM Codes 4 The OFDM Transmitter 5 The

The OFDM Transmitter

I Carrier allocator: Distributes symbols in time andfrequency, adds pilot symbols and headers

I Cyclic prefixer: Includes rolloff

Page 22: OFDM Packet Receivers in GNU Radio - archive.fosdem.org · Part I – OFDM PHY Development 1 What is OFDM? 2 Tagged Stream Blocks 3 GNU Radio OFDM Codes 4 The OFDM Transmitter 5 The

Pilot allocation

I Pilot symbols: Known symbols to aid the receiver

I Pilot symbols can be allocated in any mannerI “Wifi-style:” ( (1, 5), )

I “DRM-style:” ( (1, 5), (), (2, 6), (), ...)

I Constant header can be injected

Page 23: OFDM Packet Receivers in GNU Radio - archive.fosdem.org · Part I – OFDM PHY Development 1 What is OFDM? 2 Tagged Stream Blocks 3 GNU Radio OFDM Codes 4 The OFDM Transmitter 5 The

Outline

1 What is OFDM?

2 Tagged Stream Blocks

3 GNU Radio OFDM Codes

4 The OFDM Transmitter

5 The OFDM Receiver

6 Going over the air

Page 24: OFDM Packet Receivers in GNU Radio - archive.fosdem.org · Part I – OFDM PHY Development 1 What is OFDM? 2 Tagged Stream Blocks 3 GNU Radio OFDM Codes 4 The OFDM Transmitter 5 The

The OFDM Receiver

I How can we find a packet, decode its header and then actdepending on the configuration?

I Waits for packet detectionI “High” signal at the trigger input denotes start of packetI Tags can also denote start of packet

I Pipe header to first sub-flow graphI Wait for decoding, use header info to determine length of

payloadI Pipe payload to second sub-flowgraph

Page 25: OFDM Packet Receivers in GNU Radio - archive.fosdem.org · Part I – OFDM PHY Development 1 What is OFDM? 2 Tagged Stream Blocks 3 GNU Radio OFDM Codes 4 The OFDM Transmitter 5 The

The OFDM Receiver

I Channel estimator / equalizer: Reverse the effects of theradio channel

I Header parser: Uses the same object as the headergenerator

I Passes information to the HPD as an asynchronousmessage (“feedback”)

Page 26: OFDM Packet Receivers in GNU Radio - archive.fosdem.org · Part I – OFDM PHY Development 1 What is OFDM? 2 Tagged Stream Blocks 3 GNU Radio OFDM Codes 4 The OFDM Transmitter 5 The

The OFDM Receiver

I Channel estimator / equalizer: Reverse the effects of theradio channel

I Header parser: Uses the same object as the headergenerator

I Passes information to the HPD as an asynchronousmessage (“feedback”)

Page 27: OFDM Packet Receivers in GNU Radio - archive.fosdem.org · Part I – OFDM PHY Development 1 What is OFDM? 2 Tagged Stream Blocks 3 GNU Radio OFDM Codes 4 The OFDM Transmitter 5 The

The OFDM Receiver

I Waits for packet detectionI “High” signal at the trigger input denotes start of packetI Tags can also denote start of packet

I Pipe header to first sub-flow graphI Wait for decoding, use header info to determine length of

payloadI Pipe payload to second sub-flowgraph

Page 28: OFDM Packet Receivers in GNU Radio - archive.fosdem.org · Part I – OFDM PHY Development 1 What is OFDM? 2 Tagged Stream Blocks 3 GNU Radio OFDM Codes 4 The OFDM Transmitter 5 The

Outline

1 What is OFDM?

2 Tagged Stream Blocks

3 GNU Radio OFDM Codes

4 The OFDM Transmitter

5 The OFDM Receiver

6 Going over the air

Page 29: OFDM Packet Receivers in GNU Radio - archive.fosdem.org · Part I – OFDM PHY Development 1 What is OFDM? 2 Tagged Stream Blocks 3 GNU Radio OFDM Codes 4 The OFDM Transmitter 5 The

Over the air

I My setup:I RTLSDR Dongle (gr-osmocom)I USRP B210I GNU Radio (current version)I gr-osmosdr + dependenciesI That’s it – no magic extra libraries

Page 30: OFDM Packet Receivers in GNU Radio - archive.fosdem.org · Part I – OFDM PHY Development 1 What is OFDM? 2 Tagged Stream Blocks 3 GNU Radio OFDM Codes 4 The OFDM Transmitter 5 The

Getting it running

I Use hierarchical blocks (“OFDM Transmitter”, “OFDMReceiver” in GRC)

I Let’s try that!

I Make sure signal amplitude is in valid range (PAPR!)I Play around with gainsI Add rolloffI Avoid DC spursI This is what you want at the receiver:

Page 31: OFDM Packet Receivers in GNU Radio - archive.fosdem.org · Part I – OFDM PHY Development 1 What is OFDM? 2 Tagged Stream Blocks 3 GNU Radio OFDM Codes 4 The OFDM Transmitter 5 The

Getting it running

I Use hierarchical blocks (“OFDM Transmitter”, “OFDMReceiver” in GRC)

I Let’s try that!I Make sure signal amplitude is in valid range (PAPR!)I Play around with gainsI Add rolloffI Avoid DC spurs

I This is what you want at the receiver:

Page 32: OFDM Packet Receivers in GNU Radio - archive.fosdem.org · Part I – OFDM PHY Development 1 What is OFDM? 2 Tagged Stream Blocks 3 GNU Radio OFDM Codes 4 The OFDM Transmitter 5 The

Getting it running

I Use hierarchical blocks (“OFDM Transmitter”, “OFDMReceiver” in GRC)

I Let’s try that!I Make sure signal amplitude is in valid range (PAPR!)I Play around with gainsI Add rolloffI Avoid DC spursI This is what you want at the receiver:

Page 33: OFDM Packet Receivers in GNU Radio - archive.fosdem.org · Part I – OFDM PHY Development 1 What is OFDM? 2 Tagged Stream Blocks 3 GNU Radio OFDM Codes 4 The OFDM Transmitter 5 The

Demo

I 250 kHz bandwidthI QPSKI max. 375 kbpsI Downsides:

I Heavy CPU usageI No FEC

Page 34: OFDM Packet Receivers in GNU Radio - archive.fosdem.org · Part I – OFDM PHY Development 1 What is OFDM? 2 Tagged Stream Blocks 3 GNU Radio OFDM Codes 4 The OFDM Transmitter 5 The

How do I build my own OFDM transceivers?

I Fastest dev path: Change as little as possibleI Critical components:

I Synchronization / DetectionI Find begin of packetsI Correct fine frequency offset

I Header formatterI Generate and parse headers (let’s have a look at them. . . )

I (Equalizer)I Stock equalizers might be enough

I See also Bastian’s talk!

Page 35: OFDM Packet Receivers in GNU Radio - archive.fosdem.org · Part I – OFDM PHY Development 1 What is OFDM? 2 Tagged Stream Blocks 3 GNU Radio OFDM Codes 4 The OFDM Transmitter 5 The

Packet Header Object

gr-digital/include/gnuradio/digital/packet header default.h

Page 36: OFDM Packet Receivers in GNU Radio - archive.fosdem.org · Part I – OFDM PHY Development 1 What is OFDM? 2 Tagged Stream Blocks 3 GNU Radio OFDM Codes 4 The OFDM Transmitter 5 The

Part II – MAC Development

7 Asynchronous operation: Messages

Page 37: OFDM Packet Receivers in GNU Radio - archive.fosdem.org · Part I – OFDM PHY Development 1 What is OFDM? 2 Tagged Stream Blocks 3 GNU Radio OFDM Codes 4 The OFDM Transmitter 5 The

Synchronous vs. asynchronous operation

I PHY layer: streaming-oriented (samples)I MAC layer: packet-oriented, timing constraintsI How do we traverse this boundary?

Page 38: OFDM Packet Receivers in GNU Radio - archive.fosdem.org · Part I – OFDM PHY Development 1 What is OFDM? 2 Tagged Stream Blocks 3 GNU Radio OFDM Codes 4 The OFDM Transmitter 5 The

Outline

7 Asynchronous operation: Messages

Page 39: OFDM Packet Receivers in GNU Radio - archive.fosdem.org · Part I – OFDM PHY Development 1 What is OFDM? 2 Tagged Stream Blocks 3 GNU Radio OFDM Codes 4 The OFDM Transmitter 5 The

Message passing interface

I Remember the header/payload demultiplexer?I Dotted lines mean asynchronous data passingI We can switch between domains!I Both domains support metadata transport (tags)

Page 40: OFDM Packet Receivers in GNU Radio - archive.fosdem.org · Part I – OFDM PHY Development 1 What is OFDM? 2 Tagged Stream Blocks 3 GNU Radio OFDM Codes 4 The OFDM Transmitter 5 The

What metadata are understood?

I Looking at gr-uhd documentation:I rx freq, rx time, tx time

I Header/payload demuxer can be told about these items!I Seems like it’s all there to start implementing!

Page 41: OFDM Packet Receivers in GNU Radio - archive.fosdem.org · Part I – OFDM PHY Development 1 What is OFDM? 2 Tagged Stream Blocks 3 GNU Radio OFDM Codes 4 The OFDM Transmitter 5 The

Transceivers

I If you have a device that supports it, you can set uphalf-duplex transceivers without any additional efforts

Page 42: OFDM Packet Receivers in GNU Radio - archive.fosdem.org · Part I – OFDM PHY Development 1 What is OFDM? 2 Tagged Stream Blocks 3 GNU Radio OFDM Codes 4 The OFDM Transmitter 5 The

Simplest Possible MAC

Page 43: OFDM Packet Receivers in GNU Radio - archive.fosdem.org · Part I – OFDM PHY Development 1 What is OFDM? 2 Tagged Stream Blocks 3 GNU Radio OFDM Codes 4 The OFDM Transmitter 5 The

That’s all, folks!

I Check us out on www.gnuradio.org!

Page 44: OFDM Packet Receivers in GNU Radio - archive.fosdem.org · Part I – OFDM PHY Development 1 What is OFDM? 2 Tagged Stream Blocks 3 GNU Radio OFDM Codes 4 The OFDM Transmitter 5 The