mounzer saleh email: [email protected] tel: +961 1 …arabia.ni.com/sites/default/files/usrp...

77
ni.com Mounzer saleh Applications engineer Email: [email protected] Tel: +961 1 33 28 28

Upload: buikien

Post on 20-Apr-2018

223 views

Category:

Documents


1 download

TRANSCRIPT

ni.com

Mounzer saleh – Applications engineer

Email: [email protected]

Tel: +961 1 33 28 28

ni.com

An Introduction to Software Defined Radio With

LabVIEW and NI USRP

ni.com

Hands-on Course Objectives

Exercise 1

• Acquire an RF signal using USRP

• Introduction to the LabVIEW environment

• Configuring the USRP software defined radio

• Acquiring an RF signal using NI USRP

Exercise 2

• Demodulate & listen to live FM radio

• LabVIEW programming fundamentals

• Integrating digital signal processing functions

Exercise 3

• Using Mathscript code and pre-built IP

ni.com

• LabVIEW is a graphical programming environment used

by millions of engineers and scientists to develop

sophisticated measurement, test, and control systems

• LabVIEW can integrate with wide variety of hardware

devices, including the NI USRP

What is LabVIEW?

ni.com

VSAs & VSGs Switching Amplifiers & Attenuators

Power Meters

FPGA I/O & Co-processing

Multicore Processing

Optimized APIs

Cellular, Wireless, & GPS Test Toolkits

(802.11 a/b/g/n , GSM, EDGE, WCDMA, RFID, WiMAX, GPS, etc.)

Reference Architectures

Soft Front Panels

NI RF Test Platform

ni.com

The Next 30 Years: Expanding LabVIEW into System Design

Research/Modeling

Design/Simulation

Verification/Validation

Manufacturing

Product Verification Design Verification

ni.com

Introduction to SDR

Acquire a spectrum using NI-USRP API

Introduction to the LabVIEW environment

Configuring the USRP software defined radio

Acquiring an RF signal using NI-USRP

ni.com

From Concept to Prototype … Rapidly!

Design Simulate Prototype

Graphical System Design Platform

• LabVIEW Graphical System Design offers one tool, integrated flow • Shorter learning curve • Easier system integration • Reduce the time to hardware … rapid prototyping!

ni.com

Getting Started in LabVIEW

ni.com

LabVIEW Programs are Called Virtual Instruments (VIs)

LabVIEW VIs contain three main components:

1. Front Panel 2. Block Diagram 3. Icon/Connector Pane

ni.com

Controls Palette - contains the controls and indicators you use to create the front panel

Front Panel & Controls Palette

Numeric

Control

ni.com

Front panel objects appear as

terminals on the block diagram

Block Diagram & Functions Palette

Contains the VIs, functions, and constants you use to create the block diagram

Math

Function

ni.com

• Block diagram execution

– Dependent on the flow of data

– Block diagram does NOT execute left to right

• Node executes when data is available to ALL input terminals

• Nodes supply data to all output terminals when done

Dataflow Programming

ni.com

Hover over function blocks for just-in-time help

• Help»Show Context Help

• Shortcut Keys: <Ctrl-H>

LabVIEW Help Utilities – Context Help

ni.com

• Select Help»LabVIEW Help

• Use the Detailed help link or

button in the Context Help

window

• Right-click an object and select

Help from the shortcut menu

LabVIEW Help Utilities – LabVIEW Help

ni.com

Software-Defined Radio (SDR) refers to the

technology wherein software modules running on

a generic hardware platform are used to

implement radio functions …..

What is a Software Defined Radio?

ni.com

NI USRP – Software Defined Radio

1 Gigabit Ethernet to PC Plug-and-play capability

Up to 25 MS/s baseband IQ

streaming

Tunable RF Transceiver

Front Ends Frequency Range

50 MHz – 2.2 GHz (NI-2920)

2.4 GHz & 5.5 GHz (NI-2921)

400 MHz – 4.4 GHz (NI-2922)

Applications

FM Radio

TV

GPS

GSM

ZigBee

Safety Radio

OFDM

Passive Radar

Dynamic Spectrum Access

Signal Processing

and Synthesis NI LabVIEW to develop

and explore algorithms

NI Modulation Toolkit and

LabVIEW add-ons to

simulate or process live

signals

ni.com

NI USRP Software Defined Radio

RF Transceiver

Software Processing

Baseband IQ

ni.com

SDR Components

Tx • Digital to Analog

• RF Upconversion • Modulation

• RF Downconversion

• Analog to Digital RX

• Demodulation

• Signal Processing

ni.com

NI-USRP Driver Software | RX Settings

ni.com

Receiver Path Software Radio Example

BUS

Sig

nal P

rocessin

g (

PC

)

SMA

TX

SMA

RX ?

ni.com

Receiver Path Software Radio Example

AD

C

DA

C

Amp

Amp

BUS

Sig

nal P

rocessin

g (

PC

)

SMA

TX

SMA

RX

How fast?

How many bits?

5GS/s for Wifi!?

ni.com

Example: Sampling at 5 GS/s

2.4 GHz

50 MHz

0 Hz

2.5 GHz

•Signal of interest has 50 MHz bandwidth

•When we sample at 5 GS/s, we get all the data

between 0-2.5 GHz

•Only interested in 2.4 GHz +/- 25 MHz

•At this sampling rate, we collect much more data

than we need

•How do we get around this?

ni.com

Mixing

ni.com

Signal After Mixing

• After mixing, signal of interest has 50 MHz bandwidth,

but now it is a much lower frequency

• At this lower frequency, an ADC can capture the signal

50 MHz

0 Hz

ni.com

Introduction to I and Q

)2sin()sin()2cos()cos()2cos( tfAtfAtfA ccc

)cos(AI )sin(AQ

)2sin()2cos()2cos( tfQtfItfA ccc

Note: I and Q capture Amplitude and Phase information

ni.com

IQ Modulator

• By summing two orthogonal

data streams and a carrier,

we get a phase modulator

(any angle in the phase

plane).

• If we add amplitude control,

we get a vector modulator

(any point in the phase

plane).

An IQ modulator multiplies I and Q by the carrier and carrier -

90 degrees,

respectively.

LO

ni.com

Software Radio | Receiver

AD

C

AD

C

0o

90o

Tunable

Oscillator

Amp

BUS

Sig

nal P

rocessin

g (

PC

)

Mixe

r

Mixe

r

SMA

RX

)2sin()()2cos()( tftQtftI cc

fc

I(t)

Q(t)

fc = center frequency of interest

RF Signal IQ Mixing Baseband

100

MS/s

ADC

ni.com

Receiver Path Software Radio Example

AD

C

AD

C

LPF

LPF

0o

90o

Tunable

Oscillator

Amp

Switc

h BUS

Sig

nal P

rocessin

g (

PC

)

Mixe

r

Mixe

r

SMA

RX

2

SMA

RX

1

20

MHz

LPF

• Low pass filters chosen to be below 50MHz Nyquist criteria

•Act as anti-aliasing filters

•Switch added to handle multiple different antennas

•2 sampling chains effectively samples the signal twice

100

MS/s

ADC

RF Signal IQ Mixing Baseband

2

Sampling

chains

ni.com

Receiver Path USRP Example

AD

C

AD

C

LPF

LPF

0o

90o

Tunable

Oscillator

Amp

Switc

h BUS

Sig

nal P

rocessin

g (

PC

)

Mixe

r

Mixe

r

SMA

RX

2

SMA

RX

1

20

MHz

LPF

100

MS/s

ADC

Data Rate Calculation: 100 Million Samples/sec x 16 bits/Sample x 2 = 3.2

Gigibits/second

BUS = 1 Gb Ethernet … down-conversion is needed to ~ 25 MS/s or less.

1 Gb

Etherne

t

900

MHz

3.2 Gb/s

RF Signal IQ Mixing Baseband

ni.com

FPGA

Receiver Path: USRP Example

AD

C

AD

C

LPF

LPF

0o

90o

Tunable

Oscillator

Amp

Switc

h BUS

Sig

nal P

rocessin

g (

PC

)

Mixe

r

Mixe

r

SMA

RX

2

SMA

RX

1

900

MHz 20

MHz

LPF

100

MS/s

ADC

Data Rate Calculation: 100 Million Samples/sec x 16 bits/Sample x 2 = 3.2

Gigibits/second

BUS = 1 Gb Ethernet … down-conversion is needed to ~ 25 MS/s or less.

1 Gb

Etherne

t

Onboard

Signal

Processing

Onboard

Signal

Processing

RX

Co

ntr

ol

RF Signal IQ Mixing Baseband

ni.com

Radio | NI USRP System Diagram

FPGA

AD

C

AD

C

DA

C

DA

C LPF

LPF

LPF

LPF

0o

90o

0o

90o

Tunable

Oscillator

Tunable

Oscillator

Amp

Amp

Mixe

r

Mixe

r

Switc

h BUS

Sig

nal P

rocessin

g (

PC

)

Onboard

Signal

Processing

Onboard

Signal

Processing

Onboard

Signal

Processing

Onboard

Signal

Processing

Mixe

r

Mixe

r

RX

Co

ntr

ol

TX

Co

ntr

ol

SMA

RX

2

SMA

RX

1

TX

1

NI USRP-2920 System Diagram

ni.com

NI USRP-2920 Hardware Diagram

Analog RF Transceiver Fixed Function

FPGA

PC

4. Antenna

5. Gain

2. IQ Rate

6. # Samples/

Buffer

3. Carrier

Frequenc

y

1. Device

Name

ni.com

1. Device Name – IP address of one or multiple USRP

2. IQ Rate – Quadrature sampling rate, equivalent to bandwidth

3. Carrier Frequency – Frequency of interest

4. Antenna – Select which antenna port to receive from

5. Gain – Amplification of signal before digitizing the signal

6. Fetch size – how many samples to acquire each fetch

USRP Configuring in 6 Parameters

ni.com

NI USRP RF Receive Parameters

Frequency

Pow

er

(dB

)

94.7 MHz

1 MHz

50 MHz

IQ Rate ~ Bandwidth ~

ni.com

NI USRP RF Receive Parameters

Frequency

Pow

er

(dB

)

94.7 MHz

1 MHz

50 MHz

Carrier Frequency

ni.com

NI USRP RF Receive Parameters

Frequency

Pow

er

(dB

)

94.7 MHz

1 MHz

50 MHz

Gain

ni.com

NI USRP RF Receive Parameters

number of samples

timefetchsamplesnumberrateIQ

__*_

1

Time Domain

ni.com

NI-USRP Driver Software

Initialize Configur

e Start Read IQ Stop Close

ni.com

Exercise 1 buffered finite Acquisition

ni.com

Demodulating Live FM

Demodulate & listen to live FM radio

LabVIEW programming fundamentals

Integrating digital signal processing functions

Using .m file script inside LabVIEW

ni.com

Common Data Types Found in LabVIEW

ni.com

Reviewing the Block Diagram

Wire:

Waveform

Datatype

Wire:

Error Cluster

ni.com

• The waveform data type is used by LabVIEW to

display and store periodic signal measurements.

Waveform Data Type

t0 – Initial time of waveform

dt – Sample period

Y – Array of data samples

Baseband IQ : Y is an array of complex numbers representing I and Q samples

ni.com

• An array consists of elements and dimensions

• Elements: data that make up the array

• Dimension: the length, height, or depth of an array

• Consider using arrays when you work with

a collection of similar data and when you

perform repetitive computations

Arrays

49

ni.com

• Data structure that groups data together

• Data may be of different types

• Analogous to struct in ANSI C

• Elements must be either all controls or all indicators

• Thought of as wires bundled into a cable

• Uses:

• Grouping variables

• Error handling

• Modulation toolkit

Introduction to Clusters

ni.com

Loops

• While Loop

• Terminal counts iterations

• Always runs at least once

• Runs until stop condition is

met

• For Loop

– Terminal counts iterations

– Runs according to input N of

count terminal

While Loop

For Loop

ni.com

FM radio can be demodulated in 3 steps:

1. Detect carrier phase

2. Unwrap the phase (remove discontinuities)

3. Compute the derivative (change in phase ≈ frequency)

Demodulating Broadcast FM Radio

Baseband IQ

Detect phase

Unwrap phase

Differentiate phase

Demodulated FM

ni.com

• Polar numbers consist of magnitude and phase

• Phase values from -180º to 180º

• Discontinuities exist as phase wraps back around

• Unwrap phase to eliminate discontinuities

Unwrapping Phase

180°

-180°

ni.com

Exercise 2A Demodulate and Listen to FM Radio

ni.com

Demodulated Broadcast FM

30

Hz

15

kHz

23

kHz

38

kHz

53

kHz

58.35

kHz

67.65

kHz

76.65

kHz

92

kHz

99

kHz

57 kHz 0

19 kHz

Stereo

Pilot

Stereo Audio

Left - Right

Direct Band

RBDS

Mono

Audio

Left + Right

Audos Subcarrier

ni.com

LabVIEW Models of Computation

Personal Computers PXI Systems CompactRIO Single-Board RIO

Dataflow C | HDL Code Textual Math Simulation Statechart

Custom Design

Multi-Rate DSP

LabVIEW

Real-Time

LabVIEW

Desktop

LabVIEW

FPGA

LabVIEW

MPU/MCU

ni.com

• Implement equations and algorithms textually

• Input and output variables created at the border

• Generally compatible with popular .m file script language

• Terminate statements with a semicolon to disable

immediate output

Math with the LabVIEW MathScript Node

Prototype your equations in the interactive LabVIEW MathScript Window.

(Functions»Programming»

Structures»MathScript)

ni.com

Detect phase

Unwrap phase

Differentiate phase

Frequency Demodulation Algorithm

ni.com

Exercise 3A Use a MathScript RT node

ni.com

• Analog and Digital modulation formats • AM, FM, PM

• ASK, FSK, MSK, GMSK, PAM, PSK, QAM

• Custom

• Visualization • 2D and 3D Eye, Trellis, Constellation

• Modulation Analysis • BER, MER, EVM, burst timing,

frequency deviation, ρ (rho)

• Impairments • Additive White Gaussian Noise (AWGN)

• DC offset, Quadrature skew, IQ gain imbalance, phase noise

• Equalization, Channel Coding, Channel Models

Communications Design in LabVIEW Modulation Toolkit

ni.com

Exercise 3B Use Use Prebuilt IP

ni.com

Digital Communications

Explore a digital communications system

Open and run a digital communications reference design

Identify the part of a more advanced LabVIEW block diagram

Overview of the modulation & demodulation process

ni.com

Digital Communication System

So

urc

e C

od

ing

Ch

an

ne

l C

od

ing

Mo

du

lati

on

Up

co

nvers

ion

Do

wn

co

nvers

ion

Dem

od

ula

tio

n

Ch

an

nel D

eco

din

g

So

urc

e D

eco

din

g

Communications Channel

ni.com

NI Modulation Toolkit

NI Modulation Toolkit

Digital Communication System

ni.com

NI Modulation Toolkit

NI Modulation Toolkit

NI USRP

NI USRP

Digital Communication System

ni.com

• Analog and Digital modulation formats • AM, FM, PM

• ASK, FSK, MSK, GMSK, PAM, PSK, QAM

• Custom

• Visualization • 2D and 3D Eye, Trellis, Constellation

• Modulation Analysis • BER, MER, EVM, burst timing,

frequency deviation, ρ (rho)

• Impairments • Additive White Gaussian Noise (AWGN)

• DC offset, Quadrature skew, IQ gain imbalance, phase noise

• Equalization, Channel Coding, Channel Models

Communications Design in LabVIEW Modulation Toolkit

ni.com

Advanced Digital Communications Topics

ni.com

Packet-based Communication Link System

Setup

• USRP control (Tx & Rx)

• Modulate Tx signal

• Demodulate Rx signal

• Reconstruct message

NI USRP-2920

Receiver

NI USRP-2920

Transmitter

RF Signal

Center Frequency: 915MHz

Modulation Format: PSK packets

Bit Rate: 400kbps

ni.com

Packet-based Communication with LabVIEW

ni.com

Packet Structure

GUARD

BAND SYNC

SEQ PCKT

NUM PAD DATA

Field Length

[bits]

Description

Guard Band 30 Allow initialization of Rx PLL, filters, etc

Sync Sequence 20 Frame and Symbol Synchronization

Packet Number 8 Range: 0-255 Used for reordering of

packets and detection of missing packets

Data 64 - 256 Variable length data field. Length

detected dynamically at Rx end

Pad 20 Allows for filter edge effects.

ni.com

Transmitter Block Diagram

ni.com

The Received Signal

ni.com

Receiver Block Diagram

ni.com

Demonstration : Packet Based Transceiver

ni.com

Digital Communications Bundle

Key Benefits

• Affordable

• Accessible

• NI Supported

• TX & RX Real RF Signals

• Scales to Research

Target Courses

• Communication Systems

• Digital & Wireless Communications

• Software Defined Radio (SDR)

Bundle Contents

• Two NI USRP-2920 + Toolkits

• MIMO Cable

• Digital Comm Lab Manual

ni.com

NI USRP Research Case Study:

Cognitive Radio & Whitespace

Large Scale Cognitive Radio Testbed • Prototyping cognitive radio in LabVIEW

• Spectral sensing with blind detection

• Database driven geo-location with GPS

• Deployed in Munich, Germany

“LabVIEW software and the NI USRP hardware are key

components of this research project, allowing the team

to rapidly prototype and successfully deploy the first

cognitive radio test bed of this kind.” Dr. Paulo Marques, COGEU

Aveiro, Portugal

ni.com

NI USRP Research Case Study:

Physical Layer Prototyping

• Continuously monitoring multiple wifi channels

• Demodulation and descrambling of 802.11b beacon signals

• Identification of hotspots, tracking relative power levels

Carrier Detection

Frequency Offset

Estimation & Correction

Demodulation &

Descrambling

Interpret the frame for

SSID

Demodulate Descramble

Dr. Murat Torlak

802.11b SSID Decoding

ni.com

Summary

• LabVIEW offers a graphical approach, shortening the

design process, and tight hardware/software integration

that allows for seamless transition from design to test

• NI provides a full spectrum of RF / Communications

solutions: RF Test, Research and Education

• LabVIEW and NI USRP is an accessible, easy-to-use

software defined radio platform

ni.com

• Learn more about NI SDR and RF platforms

• Visit ni.com/sdr

• Download references from the Code sharing community”

• Learn more about LabVIEW

Next Steps

ni.com

NI LabVIEW Certifications

Certified

LabVIEW

Architect

Certified

LabVIEW

Developer

Certified LabVIEW

Associate Developer

Certified

LabVIEW

Architect

Certified

LabVIEW

Developer

Certified LabVIEW

Associate Developer

On May 16th, FREE

Certified LabVIEW

Associate Developer!!

ni.com

Thank you

Questions