CS434/534: GNU Radio - PowerPoint PPT Presentation

1 / 32
About This Presentation
Title:

CS434/534: GNU Radio

Description:

Title: CS434/534: GNU Radio Author: Yang Richard Yang Last modified by: Richard Yang Created Date: 2/16/1997 2:02:43 PM Document presentation format – PowerPoint PPT presentation

Number of Views:138
Avg rating:3.0/5.0
Slides: 33
Provided by: YangRich8
Category:

less

Transcript and Presenter's Notes

Title: CS434/534: GNU Radio


1
GNU Radio
2
Outline
  • What is GNU Radio?
  • Basic Concepts
  • Developing Applications

2
3
What is GNU Radio?
  • Software toolkit for signalprocessing
  • Software radio construction
  • Rapid development
  • USRP (Universal Software Radio Peripheral)
  • Hardware frontend for sendingand receiving
    waveforms

4
GNU Radio Components
Hardware Frontend
Host Computer
RF Frontend (Daugtherboard)
ADC/DAC and Digital Frontend (USRP)
GNU Radio Software
http//mobiledevices.kom.aau.dk/fileadmin/mobilede
vices/teaching/software_testing/Gnu_radio_lecture.
pdf
5
GNU Radio Software
  • Opensource software (GPL)
  • Don't know how something works? Take a look!
  • Existing examples 802.11b(Wi-Fi), ATSC (HDTV),
    OFDM, DBPSK, DQPSK
  • Features
  • Extensive library of signal processing
    blocks(C/ and assembly)
  • Python environment for composing blocks (flow
    graph)

6
GNU Radio Hardware
  • Sends/receives waveforms
  • USRP Features
  • USB 2.0 interface (480Mbps)
  • FPGA (customizable)
  • 64Msps Digital to Analog converters
  • 128Msps Analog to Digital converteres
  • Daughterboards for different frequency ranges
  • Available Daughterboard
  • 400-500Mhz, 800-1000Mhz, 1150-1450Mhz,
    1.5-2.1Ghz, 2.3-2.9Ghz

7
GNU Radio Hardware Schematic
Host Computer
RX/TXDaughterboard
ADC/DAC
FPGA
USB Interface
http//mobiledevices.kom.aau.dk/fileadmin/mobilede
vices/teaching/software_testing/Gnu_radio_lecture.
pdf
8
Outline
  • What is GNU Radio?
  • Basic Concepts
  • Developing Applications

8
9
Basics Blocks
  • Signal Processing Block
  • Accepts 0 or more input streams
  • Produces 0 or more output streams
  • Source No input
  • noise_source,signal_source,usrp_source
  • Sink No outputs
  • audio_alsa_sink,usrp_sink

10
Basics Data Streams
  • Blocks operate on streams of data

1
5
3
4
12
12
3
7
9
11
Basics Data Types
  • Blocks operate on certain data types
  • char, short, int, float, complex
  • Vectors
  • Input Signature
  • Data types for input streams
  • Output Signature
  • Data types for output streams

Two streamsof float
One streamof complex
12
Basics Flow Graph
  • Blocks composed as a flow graph
  • Data stream flowing from sources to sinks

13
Example OFDM Synchronizer
http//gnuradio.org/trac/raw-attachment/wiki/Wirel
ess/gr_ofdm.pdf
14
GNU Radio Companion
15
GNU Radio Companion (Cont'd)
  • GNU Radio Companion
  • Design flow graphsgraphically
  • Generate runnable code
  • Demonstration

16
Outline
  • What is GNU Radio?
  • Basic Concepts
  • Developing Applications

16
17
Development Architecture
PythonApplication developmentFlow graph
construction
  • Python
  • Application management (e.g., GUI)
  • Flow graph construction
  • Non-streaming code (e.g., MAC-layer)
  • C
  • Signal processing blocks
  • Certain routines also coded in assembly
  • Why is the hybrid structure?

CSignal processing blocks
http//mobiledevices.kom.aau.dk/fileadmin/mobilede
vices/teaching/software_testing/Gnu_radio_lecture.
pdf
18
Dial Tone Example
!/usr/bin/env python from gnuradio import
gr from gnuradio import audio from
gnuradio.eng_option import eng_option from
optparse import OptionParser class
my_top_block(gr.top_block) def
__init__(self) gr.top_block.__init__(self
) parser OptionParser(option_classeng_
option) parser.add_option("-O",
"--audio-output", type"string", default"",
help"pcm output device
name. E.g., hw0,0") parser.add_option("-
r", "--sample-rate", type"eng_float",
default48000,
help"set sample rate to RATE (48000)")
(options, args) parser.parse_args () if
len(args) ! 0 parser.print_help()
raise SystemExit, 1
sample_rate int(options.sample_rate)
ampl 0.1 src0 gr.sig_source_f
(sample_rate, gr.GR_SIN_WAVE, 350, ampl)
src1 gr.sig_source_f (sample_rate,
gr.GR_SIN_WAVE, 440, ampl) dst
audio.sink (sample_rate, options.audio_output)
self.connect (src0, (dst, 0))
self.connect (src1, (dst, 1)) if __name__
'__main__' try my_top_block().run()
except KeyboardInterrupt pass
19
Dial Tone Example (1)
from gnuradio import gr from gnuradio import
audio from gnuradio.eng_option import
eng_option from optparse import OptionParser
Import modules from GNU Radio library
20
Dial Tone Example (2)
class my_top_block(gr.top_block) def
__init__(self) gr.top_block.__init__(self
)
Define container for Flow Graph gr.top_block
class maintains thegraph
21
Dial Tone Example (3)
Define and parse command-line options
parser OptionParser(option_classeng_op
tion) parser.add_option("-O",
"--audio-output", type"string", default"",
help"pcm output device
name. E.g., hw0,0") parser.add_option("-
r", "--sample-rate", type"eng_float",
default48000,
help"set sample rate to RATE (48000)")
(options, args) parser.parse_args () if
len(args) ! 0 parser.print_help()
raise SystemExit, 1
22
Dial Tone Example (4)
Create and connect signal processing blocks
sample_rate int(options.sample_rate)
ampl 0.1 src0 gr.sig_source_f
(sample_rate, gr.GR_SIN_WAVE, 350, ampl)
src1 gr.sig_source_f (sample_rate,
gr.GR_SIN_WAVE, 440, ampl) dst
audio.sink (sample_rate, options.audio_output)
self.connect (src0, (dst, 0))
self.connect (src1, (dst, 1))
23
Dial Tone Example (5)
Run the flow graph when the program is executed
if __name__ '__main__' try
my_top_block().run() except
KeyboardInterrupt pass
24
Useful Links
  • Homepage (download, more links, etc)
  • http//gnuradio.org/trac/
  • More comprehensive tutorial
  • http//gnuradio.org/trac/wiki/Tutorials/WritePytho
    nApplications
  • Available Signal Processing Blocks
  • http//gnuradio.org/doc/doxygen/hierarchy.html
  • GNU Radio Mailing List Archives
  • http//www.gnu.org/software/gnuradio/mailinglists.
    html
  • CGRAN 3rd Party GNU Radio Apps
  • https//www.cgran.org/
  • OFDM Implementation Presentation
  • http//gnuradio.org/trac/wiki/Wireless

25
Backup
26
Creating Your Own Block
  • Basics
  • A block is a C class
  • Typically derived from gr_block or gr_sync_block
    class
  • Three components
  • my_block_xx.h Block definition
  • my_block_xx.cc Block implementation
  • my_block_xx.i Python bindings (SWIG interface)

27
Block Definition
include ltgr_sync_block.hgt class
my_block_cc typedef boostshared_ptrltcs434_my_b
lock_ccgt cs434_my_block_cc_sptr cs434_my_block_c
c_sptr cs434_make_my_block_cc() class
my_block_cc public gr_sync_block private uns
igned int d_count friend cs434_my_block_cc_sptr
cs434_make_my_block_cc() cs434_my_block_cc()
public int work(int noutput_items,
gr_vector_const_void_star input_items,
gr_vector_void_star output_items)
Create instances of block
Method for processing input streams andproducing
output streams
28
Block Implementation (1)
ifdef HAVE_CONFIG_H include "config.h" endif
include ltmy_block_cc.hgt include
ltgr_io_signature.hgt cs434_my_block_cc_sptr
cs434_make_my_block_cc() return
cs434_my_block_cc_sptr(new cs434_my_block_cc())
cs434_my_block_cccs434_my_block_cc()
gr_sync_block("my_block_cc", gr_make_io_signatu
re(1, 1, sizeof(gr_complex)), gr_make_io_signat
ure(1, 1, sizeof(gr_complex))), d_count(0)
Helper method to create block
Define input and output signatures
29
Block Implementation (2)
int cs434_my_block_ccwork(int
noutput_items, gr_vector_const_void_star
input_items, gr_vector_void_star
output_items) const gr_complex in (const
gr_complex)input_items0 gr_complex out
(gr_complex)output_items0 memcpy(out, in,
sizeof(out) noutput_items) for (int i 0
i lt noutput_items i) fprintf(stderr,
"u\tlt.6f, .6fgt\n", d_count, ini.real(),
ini.imag()) return noutput_items
Copy input stream to output stream
Echo samples stderr
Return number of items processed
30
SWIG Interface
Condensed copy of block definition (in header
file)
GR_SWIG_BLOCK_MAGIC(cs434, my_block_cc) cs434_my
_block_cc_sptr cs434_make_my_block_cc() class
cs434_my_block_cc public gr_sync_block private
cs434_my_block_cc()
31
Outline
  • What is GNU Radio?
  • Basic Concepts
  • Developing Applications
  • HW2 Introduction

31
32
HW2 Overview
  • Implement MAC layer for a wireless device
  • Link-layer header
  • Carrier-sensing and backoff
  • Link-layer acknowledgments
  • Template code at
  • https//www-net.cs.yale.edu/svn/courses/cs434/spri
    ng09/hw4/gr-cs434-hw4/
Write a Comment
User Comments (0)
About PowerShow.com