CS434/534: GNU Radio - Yale Universityzoo.cs.yale.edu/.../assignments/ps2/gnuradio-jh.pdf · GNU...
Transcript of CS434/534: GNU Radio - Yale Universityzoo.cs.yale.edu/.../assignments/ps2/gnuradio-jh.pdf · GNU...
![Page 1: CS434/534: GNU Radio - Yale Universityzoo.cs.yale.edu/.../assignments/ps2/gnuradio-jh.pdf · GNU Radio Software Opensource software (GPL) Don't know how something works?Take a look!](https://reader030.fdocuments.in/reader030/viewer/2022040514/5e6bacfa2d3a5537ac0e464c/html5/thumbnails/1.jpg)
GNU Radio
![Page 2: CS434/534: GNU Radio - Yale Universityzoo.cs.yale.edu/.../assignments/ps2/gnuradio-jh.pdf · GNU Radio Software Opensource software (GPL) Don't know how something works?Take a look!](https://reader030.fdocuments.in/reader030/viewer/2022040514/5e6bacfa2d3a5537ac0e464c/html5/thumbnails/2.jpg)
2
Outline
What is GNU Radio?
Basic Concepts
Developing Applications
![Page 3: CS434/534: GNU Radio - Yale Universityzoo.cs.yale.edu/.../assignments/ps2/gnuradio-jh.pdf · GNU Radio Software Opensource software (GPL) Don't know how something works?Take a look!](https://reader030.fdocuments.in/reader030/viewer/2022040514/5e6bacfa2d3a5537ac0e464c/html5/thumbnails/3.jpg)
What is GNU Radio?
Software toolkit for signal
processing
Software radio construction
Rapid development
USRP (Universal Software Radio Peripheral)
Hardware frontend for sending
and receiving waveforms
![Page 4: CS434/534: GNU Radio - Yale Universityzoo.cs.yale.edu/.../assignments/ps2/gnuradio-jh.pdf · GNU Radio Software Opensource software (GPL) Don't know how something works?Take a look!](https://reader030.fdocuments.in/reader030/viewer/2022040514/5e6bacfa2d3a5537ac0e464c/html5/thumbnails/4.jpg)
GNU Radio Components
Hardware Frontend Host Computer
RF Frontend(Daugtherboard)
ADC/DAC andDigital Frontend
(USRP)
http://mobiledevices.kom.aau.dk/fileadmin/mobiledevices/teaching/software_testing/Gnu_radio_lecture.pdf
GNU RadioSoftware
![Page 5: CS434/534: GNU Radio - Yale Universityzoo.cs.yale.edu/.../assignments/ps2/gnuradio-jh.pdf · GNU Radio Software Opensource software (GPL) Don't know how something works?Take a look!](https://reader030.fdocuments.in/reader030/viewer/2022040514/5e6bacfa2d3a5537ac0e464c/html5/thumbnails/5.jpg)
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)
![Page 6: CS434/534: GNU Radio - Yale Universityzoo.cs.yale.edu/.../assignments/ps2/gnuradio-jh.pdf · GNU Radio Software Opensource software (GPL) Don't know how something works?Take a look!](https://reader030.fdocuments.in/reader030/viewer/2022040514/5e6bacfa2d3a5537ac0e464c/html5/thumbnails/6.jpg)
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
![Page 7: CS434/534: GNU Radio - Yale Universityzoo.cs.yale.edu/.../assignments/ps2/gnuradio-jh.pdf · GNU Radio Software Opensource software (GPL) Don't know how something works?Take a look!](https://reader030.fdocuments.in/reader030/viewer/2022040514/5e6bacfa2d3a5537ac0e464c/html5/thumbnails/7.jpg)
GNU Radio Hardware Schematic
RX/TXDaughterboar
dADC/DAC
http://mobiledevices.kom.aau.dk/fileadmin/mobiledevices/teaching/software_testing/Gnu_radio_lecture.pdf
Host Computer
FPGAUSB
Interface
![Page 8: CS434/534: GNU Radio - Yale Universityzoo.cs.yale.edu/.../assignments/ps2/gnuradio-jh.pdf · GNU Radio Software Opensource software (GPL) Don't know how something works?Take a look!](https://reader030.fdocuments.in/reader030/viewer/2022040514/5e6bacfa2d3a5537ac0e464c/html5/thumbnails/8.jpg)
8
Outline
What is GNU Radio?
Basic Concepts
Developing Applications
![Page 9: CS434/534: GNU Radio - Yale Universityzoo.cs.yale.edu/.../assignments/ps2/gnuradio-jh.pdf · GNU Radio Software Opensource software (GPL) Don't know how something works?Take a look!](https://reader030.fdocuments.in/reader030/viewer/2022040514/5e6bacfa2d3a5537ac0e464c/html5/thumbnails/9.jpg)
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
![Page 10: CS434/534: GNU Radio - Yale Universityzoo.cs.yale.edu/.../assignments/ps2/gnuradio-jh.pdf · GNU Radio Software Opensource software (GPL) Don't know how something works?Take a look!](https://reader030.fdocuments.in/reader030/viewer/2022040514/5e6bacfa2d3a5537ac0e464c/html5/thumbnails/10.jpg)
Basics: Data Streams
Blocks operate on streams of data
1 5 3
3 7 9
4 12 12
![Page 11: CS434/534: GNU Radio - Yale Universityzoo.cs.yale.edu/.../assignments/ps2/gnuradio-jh.pdf · GNU Radio Software Opensource software (GPL) Don't know how something works?Take a look!](https://reader030.fdocuments.in/reader030/viewer/2022040514/5e6bacfa2d3a5537ac0e464c/html5/thumbnails/11.jpg)
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
![Page 12: CS434/534: GNU Radio - Yale Universityzoo.cs.yale.edu/.../assignments/ps2/gnuradio-jh.pdf · GNU Radio Software Opensource software (GPL) Don't know how something works?Take a look!](https://reader030.fdocuments.in/reader030/viewer/2022040514/5e6bacfa2d3a5537ac0e464c/html5/thumbnails/12.jpg)
Basics: Flow Graph
Blocks composed as a flow graph
Data stream flowing from sources to sinks
![Page 13: CS434/534: GNU Radio - Yale Universityzoo.cs.yale.edu/.../assignments/ps2/gnuradio-jh.pdf · GNU Radio Software Opensource software (GPL) Don't know how something works?Take a look!](https://reader030.fdocuments.in/reader030/viewer/2022040514/5e6bacfa2d3a5537ac0e464c/html5/thumbnails/13.jpg)
Example: OFDM Synchronizer
http://gnuradio.org/trac/raw-attachment/wiki/Wireless/gr_ofdm.pdf
![Page 14: CS434/534: GNU Radio - Yale Universityzoo.cs.yale.edu/.../assignments/ps2/gnuradio-jh.pdf · GNU Radio Software Opensource software (GPL) Don't know how something works?Take a look!](https://reader030.fdocuments.in/reader030/viewer/2022040514/5e6bacfa2d3a5537ac0e464c/html5/thumbnails/14.jpg)
GNU Radio Companion
![Page 15: CS434/534: GNU Radio - Yale Universityzoo.cs.yale.edu/.../assignments/ps2/gnuradio-jh.pdf · GNU Radio Software Opensource software (GPL) Don't know how something works?Take a look!](https://reader030.fdocuments.in/reader030/viewer/2022040514/5e6bacfa2d3a5537ac0e464c/html5/thumbnails/15.jpg)
GNU Radio Companion (Cont'd)
GNU Radio Companion
Design flow graphs
graphically
Generate runnable code
Demonstration
![Page 16: CS434/534: GNU Radio - Yale Universityzoo.cs.yale.edu/.../assignments/ps2/gnuradio-jh.pdf · GNU Radio Software Opensource software (GPL) Don't know how something works?Take a look!](https://reader030.fdocuments.in/reader030/viewer/2022040514/5e6bacfa2d3a5537ac0e464c/html5/thumbnails/16.jpg)
16
Outline
What is GNU Radio?
Basic Concepts
Developing Applications
![Page 17: CS434/534: GNU Radio - Yale Universityzoo.cs.yale.edu/.../assignments/ps2/gnuradio-jh.pdf · GNU Radio Software Opensource software (GPL) Don't know how something works?Take a look!](https://reader030.fdocuments.in/reader030/viewer/2022040514/5e6bacfa2d3a5537ac0e464c/html5/thumbnails/17.jpg)
Development Architecture
http://mobiledevices.kom.aau.dk/fileadmin/mobiledevices/teaching/software_testing/Gnu_radio_lecture.pdf
Python
Application development
Flow graph construction
C++
Signal processing blocks
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?
![Page 18: CS434/534: GNU Radio - Yale Universityzoo.cs.yale.edu/.../assignments/ps2/gnuradio-jh.pdf · GNU Radio Software Opensource software (GPL) Don't know how something works?Take a look!](https://reader030.fdocuments.in/reader030/viewer/2022040514/5e6bacfa2d3a5537ac0e464c/html5/thumbnails/18.jpg)
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_class=eng_option)
parser.add_option("-O", "--audio-output", type="string", default="",
help="pcm output device name. E.g., hw:0,0")
parser.add_option("-r", "--sample-rate", type="eng_float", default=48000,
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
![Page 19: CS434/534: GNU Radio - Yale Universityzoo.cs.yale.edu/.../assignments/ps2/gnuradio-jh.pdf · GNU Radio Software Opensource software (GPL) Don't know how something works?Take a look!](https://reader030.fdocuments.in/reader030/viewer/2022040514/5e6bacfa2d3a5537ac0e464c/html5/thumbnails/19.jpg)
Dial Tone Example (1)
from gnuradio import gr
from gnuradio import audio
from gnuradio.eng_option import eng_option
from optparse import OptionParserImport modules from GNU Radio library
![Page 20: CS434/534: GNU Radio - Yale Universityzoo.cs.yale.edu/.../assignments/ps2/gnuradio-jh.pdf · GNU Radio Software Opensource software (GPL) Don't know how something works?Take a look!](https://reader030.fdocuments.in/reader030/viewer/2022040514/5e6bacfa2d3a5537ac0e464c/html5/thumbnails/20.jpg)
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 the
graph
![Page 21: CS434/534: GNU Radio - Yale Universityzoo.cs.yale.edu/.../assignments/ps2/gnuradio-jh.pdf · GNU Radio Software Opensource software (GPL) Don't know how something works?Take a look!](https://reader030.fdocuments.in/reader030/viewer/2022040514/5e6bacfa2d3a5537ac0e464c/html5/thumbnails/21.jpg)
Dial Tone Example (3)
parser = OptionParser(option_class=eng_option)
parser.add_option("-O", "--audio-output", type="string", default="",
help="pcm output device name. E.g., hw:0,0")
parser.add_option("-r", "--sample-rate", type="eng_float", default=48000,
help="set sample rate to RATE (48000)")
(options, args) = parser.parse_args ()
if len(args) != 0:
parser.print_help()
raise SystemExit, 1
Define and parse command-line options
![Page 22: CS434/534: GNU Radio - Yale Universityzoo.cs.yale.edu/.../assignments/ps2/gnuradio-jh.pdf · GNU Radio Software Opensource software (GPL) Don't know how something works?Take a look!](https://reader030.fdocuments.in/reader030/viewer/2022040514/5e6bacfa2d3a5537ac0e464c/html5/thumbnails/22.jpg)
Dial Tone Example (4)
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))
Create and connect signal processing blocks
![Page 23: CS434/534: GNU Radio - Yale Universityzoo.cs.yale.edu/.../assignments/ps2/gnuradio-jh.pdf · GNU Radio Software Opensource software (GPL) Don't know how something works?Take a look!](https://reader030.fdocuments.in/reader030/viewer/2022040514/5e6bacfa2d3a5537ac0e464c/html5/thumbnails/23.jpg)
Dial Tone Example (5)
if __name__ == '__main__':
try:
my_top_block().run()
except KeyboardInterrupt:
pass
Run the flow graph when the program is executed
![Page 24: CS434/534: GNU Radio - Yale Universityzoo.cs.yale.edu/.../assignments/ps2/gnuradio-jh.pdf · GNU Radio Software Opensource software (GPL) Don't know how something works?Take a look!](https://reader030.fdocuments.in/reader030/viewer/2022040514/5e6bacfa2d3a5537ac0e464c/html5/thumbnails/24.jpg)
Useful Links
Homepage (download, more links, etc) http://gnuradio.org/trac/
More comprehensive tutorial http://gnuradio.org/trac/wiki/Tutorials/WritePythonApplications
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