Download as pdf or txt
Download as pdf or txt
You are on page 1of 91

GNU Radio Tutorials

Labs 1 5
Balint Seeber
Ettus Research
Version 1.0 (1
th
!"ril #01$%
&o''ents ( su))etions *elco'e+
balint,ettus.co'
,s"enchdotnet

Lab 1

-"en GNU Radio &o'"anion+

-"en a Ter'inal.&onsole.&o''and /ro'"t

Run 0)nuradio1co'"anion0

Lab 1
Lo) *indo* 2ee" an e3e on this4 as *ell as 3our ter'inal5
Bloc2 list
/ress
&TRL67 to
search 8or a
na'e
&an9as (the 8lo*)ra"h
construction area%
:ra) bloc2s 8ro'
the Bloc2 list
onto the can9as.
&onnect "orts b3 clic2in) on the chosen "ort o8 one
bloc24 and then clic2 on the "ort o8 the other bloc2.
;ou can delete connections b3 clic2in) on the
connection0s line and "ressin) the :elete 2e3.

Lab 1
&reate a sine *a9e ( ins"ect the )enerated
sa'"les *ith a (ti'e1do'ain% Sco"e Sin2

Lab 1
0-"tions0 bloc2 is used
to set )lobal "ara'eters
(double clic2%

Lab 1
Na'e o8 )enerated /3thon 8ile
Title o8 'ain GU< *indo*4 or na'e o8 Hierarchical bloc2
GR& can9as si=e
T3"e o8 code to )enerate (see ne>t%
?o* to start ( sto" the 8lo*)ra"h
<8 code is run as 0root0 (e.). *ith 0sudo0%
as2 -S 2ernel to "rioritise this "rocess
!d9anced+ li'it the nu'ber o8 sa'"les out"ut
8ro' each iteration o8 e9er3 bloc20s *or2 8unction

Lab 1
GU< a"" usin) @A tool2it
(use @A GU< bloc2s%
GU< a"" usin) Bt tool2it
(use Bt GU< bloc2s%
&o''and1line a"" *ithout GU<
(te>t1based4 run in a console%
&reate a Hierarchical bloc2
that *ill a""ear in the bloc2 list
(a reusable co'"onent4 not an a""
use /ad Source.Sin2 bloc2s to
e>"ose "orts4 and /ara'eter bloc2s
to e>"ose con8i)uration 9ariables%

Lab 1
!uto'aticall3 start 8lo*)ra"h
:o not auto'aticall3 start 8lo*)ra"h

Lab 1
@ill auto'aticall3 e>it i8.*hen done
/ressin) ENTER *ill e>it

Lab 1
Variable+ a bloc2 that contains an arbitrar3 /3thon
e>"ression.
;ou can re8er to it in another bloc2 b3 its ID.
0sa'"Crate0 is al*a3s added
b3 de8ault in a ne* 8lo*)ra"h

Lab 1
(double clic2%
ID+ (/3thon% 9ariable na'e
Value+ arbitrar3 /3thon e>"ression4 e.).
D#000 (the de8ault%+ an inte)er
D#eE+ D#000.0 (8loatin)1"oint nu'ber%
int(D#eE%+ D#000 (inte)er cast o8 8loatin)1
"oint nu'ber%

Lab 1
(double clic2%
!nother e>a'"le o8 a si'"le arbitrar3
/3thon e>"ression.
?o9er the cursor o9er an3 "ara'eter
8ield and the toolti" *ill sho* 3ou the
e>"ression0s evaluated result
(here 5 6 E F 11%
Note: arbitrar3 e>"ressions can only be
*ritten into 8ields that ha9e a *hite
bac2)round (0ra*0 8ields%.
0'3C9ar0 is Gust 8or sho* here
(it doesn0t actuall3 do an3thin)
use8ul in this 8lo*)ra"h%.

Lab 1
GU< *id)et to control
the )enerated 8reHuenc3
GU< *id)et to "lot sa'"les
in the ti'e1do'ain
@ill throttle the rate at *hich
sa'"les "ass throu)h this bloc2
(thus settin) the rate at *hich
sa'"les "ass throu)h the *hole
8lo* )ra"h%.
S3nthesises a sine *a9e

Lab 1
T3"e o8 sa'"le (sets "ort colour%
!n3 processing bloc20s
0Sa'"le Rate0 "ara'eter is
used 8or :S/ calculation4 not
8or controllin) the rate at *hich
sa'"les are "roduced.
This is distinct 8ro' a hardware
(or Throttle% bloc2 *here it is
used to control sa'"le 8lo*.
T3"e o8 si)nal
7reHuenc3 (here it0s lin2ed to the slider
/hase o88set
!n underline indicates chan)in)
the "ara'eter 9ia an3
de"endent 9ariable *ill cause
the bloc2 to tri))er an internal
callbac2 and u"date its state
(i.e. "er8or' a real1ti'e
"ara'eter chan)e%

Sa'"le Rate (:S/%

<8 calculatin) a sine *a9e *here a )i9en


8reHuenc3 in Hertz is desired4 3ou actuall3 need
to 2no* the sa'"le rate too. This is because
the 'athe'atical re"resentation reHuires both
9alues to calculate the indi9idual sa'"le
a'"litude at an3 s"eci8ic "oint in ti'e.

The actual sa'"le rate 9alue used can be


an3thin). <t Gust so ha""ens 3ou0ll usuall3 use
the sa'e 9alue as in the rest o8 3our 8lo*)ra"h
so that e9er3thin) *ill be consistent (o"erate in
the sa'e sa'"le rate do'ain%.

Sa'"le Rate (:S/%

Thin2 o8 it as bein) used to calculate the


discrete ste" si=e 8ro' one sa'"le to the ne>t
*ithin a :S/ o"eration (e.). the ti'e ste" *hen
calculatin) the a'"litude o8 the ne>t sa'"le in
the sine *a9e )enerator%

Sa'"le Rate (?ard*are%

:istinct 8ro' 'athe'atical (:S/% calculation4


sa'"le rate also re8ers to the rate at *hich
sa'"les "ass throu)h the 8lo*)ra"h.

<8 there is no rate control4 hard*are cloc2 or


throttlin) 'echanis'4 the sa'"les *ill be
)enerated4 "ass throu)h the 8lo*)ra"h and be
consu'ed as 8ast as "ossible (i.e. the 8lo*)ra"h
*ill be &/U bound%.

This is desirable i8 3ou *ant to "er8or' so'e


8i>ed :S/ on stored data as Huic2l3 as "ossible
(e.). read 8ro' a 8ile4 resa'"le and *rite it bac2%.

Sa'"le Rate (?ard*are%

-nl3 a bloc2 that re"resents so'e underl3in)


hard*are *ith its o*n cloc2 (e.). USR/4 sound
card%4 or the Throttle Bloc24 *ill use 0Sa'"le
Rate0 to set that hard*are cloc24 and there8ore
ha9e the e88ect o8 a""l3in) rate control to the
sa'"les in the 8lo*)ra"h.

! Throttle Bloc2 *ill si'"l3 a""l3 host1based


ti'in) (a)ainst the 0*all cloc20% to control the
rate o8 the sa'"les it "roduces (i.e. sa'"les
that it 'a2es a9ailable on its out"uts to
do*nstrea' bloc2s%.

Sa'"le Rate (?ard*are%

! hard*are Sin2 bloc2 *ill consu'e sa'"les at


a 8i>ed rate (relati9e to the *all cloc2%

The Throttle Bloc24 or a hard*are Sin2 bloc24


*ill a""l3 0bac2 "ressure0 to the u"strea'
bloc2s (the rate o8 *or2 o8 the u"strea' bloc2s
*ill be li'ited b3 the throttlin) e88ect o8 this rate1
controllin) bloc2%

! hard*are Source bloc2 *ill "roduce sa'"les


at a 8i>ed rate (relati9e to the *all cloc2%

Sa'"le Rate (?ard*are%

<n )eneral4 there should onl3 e9er be one bloc2


in a 8lo*)ra"h that has the abilit3 to throttle
sa'"le 8lo*.

-ther*ise 3ou need to be 9er3 care8ul *ith


'ulti"le4 uns3nchronised cloc2 sources+ the3
*ill e9entuall3 )o out o8 s3nc and cause
o9er8lo*s.underruns as their
"roduction.consu'"tion rates *ill di88er.

This is the 0t*o cloc20 "roble' (discussed later%

@or2 arounds+ allo* non1bloc2in) <.-4 and.or t*ea2


resa'"lin) rates to account 8or the cloc2 o88sets

Lab 1
! "ort0s colour indicates the t3"e o8 sa'"les 8lo*in) throu)h
the "ort. The colours also a""l3 to bloc2 "ara'eter 8ields.
Tip:
!8ter sin)le1clic2in) on bloc24
"ress the u".do*n arro* 2e3s
to chan)e the t3"e
(this actuall3 ste"s throu)h
o"tions in the bloc20s
8irst a9ailable "ara'eter%.
Real sin)le1"recision
8loatin)1"oint 9alues

Lab 1
!'"litude is 8i>ed
7reHuenc3 is 9ariable
The slider0s <: is 08reH04 *hich is also the /3thon
9ariable na'e. This is used to set the
07reHuenc30 "ara'eter o8 the Si)nal Source.
Since 07reHuenc30 is underlined4 'o9in) the slider
(and there8ore chan)in) the 9alue o8 08reH0% *ill
tri))er the callbac2 in the Si)nal Source4 *hich
*ill 'a2e it u"date its internal :S/ calculations.

Lab 1
@hether 08reH0 should be a
8loatin)1"oint nu'ber4 or an inte)er
1000.0 in scienti8ic notation
Label ne>t to *id)et in the GU<

Lab 1
Rate at *hich to throttle sa'"les
throu)h this bloc2. Iust ha""ens to be
the sa'e as the sa'"le rate *e use
8or :S/.dis"la3 in the other bloc2s5
Vectors ( ta)s
*ill be co9ered
another ti'e.

Lab 1
These *ill be co9ered later4 but 8or
no* ha9e a loo2 at the
:ocu'entation tab *here the3 are
discussed.
/lot 'ulti"le si)nals (the3 'a3 not be s3nchronised *hen dra*nJ5%
This is "urel3 8or )eneratin) the correct ste" si=es on the dra*n A1a>is5
J /lot t*o 7loat strea's in s3nc b3
chan)in) Sco"e0s T3"e to &o'"le>4 and
use 7loat to &o'"le> bloc2 be8orehand.
0 *ill cause the "lot to auto1scale to the
inco'in) si)nal. Enterin) an3 other 9alue *ill
set it to a 8i>ed scale.o88set in that di'ension.

Lab 1
Generate /3thon code
Generate /3thon code
and e>ecute the code

Lab 1 /3thon code )enerated b3 GR&

Lab 1
Sine *a9e o8 a'"litude 1
To))le auto1scalin)
?ori=ontal o88set
;1a>is control (a9ailable *hen
auto1scalin) is disabled%
A1a>is scale
To))le :& re'o9al
:ra* st3le (line4 "oints4 none%
&ontrol 8reHuenc3 o8 sine *a9e
b3 dra))in) slider4 or enterin) a
9alue in the te>t bo>

Lab 1
Scienti8ic notation *or2s here too4 but 3ou can also a""end S< units.
The de8ault 08reH0 is 10004 so *e see 0120. ;ou could enter 01eD04
*hich *ould result in the sa'e 9alue. Si'ilarl3 0#D$00 is eHui9alent to
0#.D$20 and 0#.D$eD04 but @A *id)ets *ill al*a3s sho* the S< 9ersion.
Note: 3ou cannot enter S< units into the "ara'eter 8ields in GR&5

Lab 1+ T&/ &lient ("roducer%
&reate a sine *a9e ( trans'it )enerated sa'"les
o9er a T&/ connection

Lab 1+ T&/ &lient ("roducer%
Enable.disable
selected bloc2

Lab 1+ T&/ &lient ("roducer%
Tip:
Ka2e note o8 the
2e3board shortcuts
in the bloc2
conte>t 'enu.

Lab 1+ T&/ &lient ("roducer%
J The current T&/ Source.Sin2
i'"le'entation does not *or2 on @indo*s
Tip:
The 8lo*)ra"h *ill not start unless a T&/ connection is established.
<8 the T&/ connection 8ails4 a /3thon e>ce"tion *ill be thro*n and
"ro)ra' *ill not start.

Lab 1+ T&/ Ser9er (consu'er%
Recei9e sa'"les 8ro' an inco'in) T&/
connection and "lot on a Sco"e Sin2

Lab 1+ T&/ Ser9er (consu'er%
Tip:
The 8lo*)ra"h *ill not start until a T&/ connection is acce"ted.
<n this case the GU< *ill not a""ear until the client has connected.
;ou don0t need to 2no*
the ser9er0s </ address.
0.0.0.0 *ill 'a2e it listen
on all net*or2
inter8aces.

Lab 1+ T&/ Ser9er ( &lient
&lient ("roducer%
Ser9er (consu'er%
Tip: 3ou can run each a""lication se"aratel3 on t*o net*or21connected 'achines.
Iust chan)e the client0s destination </ address to the 'achine on *hich the ser9er is runnin).

Lab #
Generate a sine *a9e ( so'e noise4 add both4 and
"lot the resultin) si)nal in the 8reHuenc3 do'ain.

Lab #
Noise source si'ulates noise 8loor
(a'"litude controlled b3 slider%
!dd a nu'ber o8
strea's to)ether
GU< *id)et to
dra* an 77T "lot

Lab #

Lab #
0noiseCa'"0 is the slider 9alue4 *hich (here% *e inter"ret in dB4 as o""osed to a linear sa'"le
a'"ltitude 9alue (e.). 01.00%.
There8ore *e need to con9ert the 9alue in dB to an actual linear a'"ltiude 9alue (09olts0% 8or
use b3 the bloc2 (i.e. re9erse the 0lo)100 8unction%. The deci'al "oints are added to 8orce
/3thon to co'"ute *ith 8loatin)1"oint 9alues (other*ise it *ould round and "roduce inte)ers%.

Lab #
Nu'ber o8 in"ut strea's

Lab #
Sets the ran)e on the ;1a>is
Value added to rendered ;1a>is 9alues
Used to control ho* the
co'"uted 77T is scaled
and 08it0 to the a9ailable
"lot area.
Na'e o8 an existing GR& Variable that *ill be set to the
8reHuenc3 3ou clic2 on i8 clic2in) in the 77T "lot area.
Ti'e relati9e to Sa'"le Rate5

Lab #
Tip:
<8 3our 77T Sin2 *ill sho* 3our baseband si)nal4 3ou
can use 07reH Set Varna'e0 to ha9e 3our 8lo*)ra"h
"rocess a s"eci8ic si)nal1o81interest at the 8reHuenc3
3ou clic2 on (e.). *ith the 7reH Alatin) 7<R 8ilter%.
Kore on this later...

Lab #
Scale adGust'ent
-88set adGust'ent
/ea2
corres"ondin) to
1 2?= tone
Si'ulated noise
8loor is belo* *hat
is currentl3 sho*n
on the "lot

Lab #
/ea2 'o9ed as
07reHuenc30 has
been adGusted
Noise a'"litude
has been
increased

Lab #
!9era)in) enabled4 *hich has the e88ect
o8 s'oothin).8lattenin) the noise 8loor

Lab #
Tip: ?o9erin) 3our 'ouse o9er the "lot area *ill sho*
this toolti" (ri)ht1clic2 to enable.disable it%.
Frequency is calculated 8ro' the 'ouse cursor0s
hori=ontal co'"onent (and is a""ro>i'ate%.
Amplitude is calculated 8ro' the 'ouse cursor0s
9ertical co'"onent.
FFT is calculated 8ro' the a'"litude o8 the 77T bin that
corres"onds to Frequency.

Lab #+ A; Kode
Use a Sco"e Sin2 in A; Kode so *e can obser9e
the characteristics o8 an <B (Huadrature% si)nal
!dded slider 8or
si)nal a'"ltitude

Lab #+ A; Kode
Since *e use the sa'e sa'"le rate consistentl3 across bloc2s4
07reHuenc30 *ill also be the rate at *hich the <B sa'"le (co'"le>
"hasor% *ill rotate around the A; "lot (e.). here it0ll be once a second%.
The "lot *ill collect a )rou" o8
sa'"les and dis"la3 the' usin)
the sa'"le0s < 9alue 8or the A
coordinate4 and B 9alue 8or the ;
coordinate.
The )rou" *ill a""ear to rotate
counter1cloc2*ise in a circle *ith a
8i>ed distance o8 1 8ro' the ori)in
(the 0Si)nal !'"0%.

Lab #+ A; Kode
To return to nor'al sco"e 'ode4 clic2 on an3 o8
the other 0&hannel -"tions0 tabs.
?ere *e recall *hat a Huadrature sine *a9e
loo2s li2e (;1a>is scale has been adGusted%.

Lab #+ A; Kode
Loo'in) in on the sine *a9e alon) the ;1a>is4 *e
see the indi9idual < and B 9alues that 'a2e u"
each <B sa'"le. Each o8 these "airs (ta2en
to)ether alon) the 9ertical% beco'es a "oint on
the A; "lot. The < and B 9alues here deter'ine
the instantaneous an)le (argu'ent% o8 the "hasor.
To sho* the indi9idual sa'"les4 the
0Kar2er0 dra* st3le has been chan)ed

Lab #+ A; Kode
Since the 8reHuenc3 has been
increased4 but the nu'ber o8
sa'"les collected b3 the "lot
re'ains constant4 the sa'"les
*ill s"an a )reater an)ular (ar)%
ran)e.

Lab #+ A; Kode
No* the 8reHuenc3 has been
increased si)ni8icantl3 and the
discrete sa'"les can be
seen. <n 8act the3 are
o9erla""in) in the "lot.
Tip: ;ou can 'anual enter 9alues that are
outside the slider0s "reset ran)e 9ia the te>t bo>.
E.). 3ou could enter 1# and obser9e the sa'"le
)rou" rotate in the o""osite (cloc2*ise% direction.
This is *hat ha""ens *hen 3ou ha9e a 0ne)ati9e
8reHuenc30 (ha9e a loo2 at the 77T "lot%.

Lab #+ A; Kode
To Goin the discrete sa'"le "oints on
the "lot4 0Line Lin20 can be selected.

Lab #+ A; Kode
<ncreasin) 0Noise !'"0 adds noise to
each sa'"le4 *hich can be seen in
the sli)ht o88set o8 each sa'"le "oint
in the nois3 circle.

Lab #
! Noteboo2 can be used to
or)anise GU< *id)ets in tabs.
The Noteboo2 "ara'eter s3nta> is+
Mnoteboo2 <:N4 M=ero1based tab inde>N
This is our )enerated GU<

Lab D+ !udio
-ut"ut a sin)le tone 8ro' the co'"uter0s soundcard

Lab D+ !udio
The sa'"le rate has
been chan)ed to
$ 2?=4 *hich
)enerall3 su""orted
on all audio hard*are.
<nstead o8 )eneratin)
a tone4 3ou can also
)enerate noise.
7loatin)1"oint sa'"le 9alues should be
nor'alised to be bet*een 11.0 and 1.0.
The !udio Sin2 *ill scale inco'in) sa'"les
a""ro"riatel3 8or the hard*are.
There8ore *e should choose an a'"litude (0.O%
that is a little less than 08ull scale0 (i.e. M 1.0%.
This is )enerall3 )ood "ractice (8or USR/s too%.

Lab D+ !udio
<denti8ier that is "lat8or'1s"eci8ic.
Blan2 i'"lies the de8ault.
E.). on !LS! *ith "ulse audio
installed4 3ou could *rite 0"ulse0.
Run Pa"la3 1LQ in a Linu> ter'inal
to see "ossible !LS! o"tions.
Set to the nu'ber o8 channels
3ou *ish to strea' to on 3our
audio hard*are (e.). # 8or stereo%
:e"endin) on the underl3in) i'"le'entation4 this *ill instruct the
hard*are0s user'ode !/< to return i''ediatel3 a8ter bein) "assed
a bu88er o8 audio sa'"les (non1bloc2in) 'ode%4 or *ait until the3
are consu'ed (bloc2in) 'ode%.
See ne>t "a)e 8or details.

Lab D+ !udio

Bloc2in) 'ode (0-R to Bloc20% *ill a""l3


u"strea' bac2"ressure4 *hich is )ood *hen
the !udio Sin2 is the onl3 hard*are de9ice in
the 8lo*)ra"h.

This can be "roble'atic i8 the 8lo*)ra"h source


is4 8or e>a'"le4 a USR/. The source is then
also hard*are that has its o*n internal cloc2
and *ill be throttlin) the sa'"le "roduction rate
*hile the !udio Sin2 is throttlin) consu'"tion
*ith its o*n uns3nchronised cloc2. This is
called the 0two clock0 "roble'.

Lab D+ !udio

To *or2around this t*o cloc2 "roble'4 set the


!udio Sin2 to non1bloc2in) 'ode (not 0-R to
Bloc20% so that it *ill ne9er hold u" the 8lo*)ra"h
(i.e. not a""l3 bac2"ressure%. <t *ill consu'e
sa'"les as nor'al4 but i8 there is e9er an e>cess
(e.). the USR/ is "roducin) sa'"les a little
8aster than the !udio Sin2 can consu'e% it *ill
dro" the sa'"les ('i)ht cause audio )litches%.

This does not sol9e the case *here sa'"les are


bein) "roduced slower than the !udio Sin20s
consu'"tion rate (this *ill "roduce an underrun+
audio *ill sound cho""3 and 0aU0 *ill be "rinted%.

Lab D+ !udio
Sa'e sine *a9e as be8ore4 but no* *e hear it e'anatin) 8ro' the co'"uter0s s"ea2ers.

Lab D+ !udio
Visualise the audio sa'"led b3 a soundcard on a
ti'e1based scrollin) 77T (*ater8all.s"ectro)ra'%.

Lab D+ !udio
/ara'eters are identical to the !udio Sin2

Lab D+ !udio
/ara'eters are identical to the 77T Sin2

Lab D+ !udio
Runnin) the sine *a9e )enerator "ro)ra' at the sa'e ti'e4 and chan)in) the 8reHuenc3.
This is a rou)h 0loo"bac20 test *here the co'"uter0s 'icro"hone listens to its s"ea2ers.


Lab $+ 7K RA
Recei9e a baseband si)nal usin) a USR/ and listen
to it usin) a narro*1 or *ide1band 7K de'odulator


Lab $+ 7K RA
0sa'"Crate0 has
been a Variable
bloc24 but no* is a
Te>t Bo> *hose
9alue can be
chan)ed at runti'e
The USR/ Source
bloc2 *ill "roduce
baseband sa'"les
b3 sa'"lin) R7 on a
selected antenna at
a "articular
8reHuenc34 sa'"le
rate and )ain
! Rational Resa'"ler *ill ada"t
the notional rate o8 a strea' b3
inter"olatin).deci'atin) o9erall4
as needed.
This is necessar3 here because
USR/ rates are not inte)er
'ulti"les o8 !udio Sin2 rates.
The t*o 7K recei9er bloc2s
acce"t co'"le> baseband
sa'"les and out"ut
de'odulated audio. The3 di88er
'ainl3 in ter's o8 their internal
8ilter band*idths.
:isable 0-R
to Bloc20 to
*or2 around
0t*o cloc20
"roble'


Lab $+ 7K RA
Usuall3 0TA.RA0 or 0RA#0
Tip: To be certain about an3 o8 the
"ossble "ara'eter 9alues4 consult
the online docu'entation 8or 3our
de9ice and.or dau)hterboard.
;ou can also run 0uhdCusr"C"robe0
in a ter'inal 8or hard*are s"ecs.
@atch 3our console durin) runti'e
8or an3 *arnin) 'essa)es 8ro'
U?: re)ardin) in9alid settin)s5 Usuall3 0
Valid ran)e de"ends on hard*are
Valid ran)e de"ends on hard*are
Valid ran)e de"ends on hard*are
Sa'"le t3"e on out"ut "ort
Sa'"le t3"e 8ro' USR/
Sa'e as U?: de9ice ar)s
RA strea'er o"tions
Ka""in) 8ro' "h3sical (USR/%
channel inde> to lo)ical (GR&
"ort% channel inde> (=ero1based%.
Lea9e as the e'"t3 list 0ST0 8or the
de8ault linear 'a""in).
Tip: usuall3 all "ara'eters
can be le8t as the3 are
(e>ce"t 8or sa'"le rate4
8reHuenc34 )ain and antenna%.
These *ill be co9ered later
Selects a 0side04 e.). !+! or !+B
Sets the nu'ber o8 out"ut "orts
and du"licates the channel1
s"eci8ic "ara'eters accordin)l3.

Lab $+ 7K RA

This e>a'"le uses the USR/ B#00

Valid ran)es+

!ntenna+ TA.RA4 RA#

7reHuenc3+ O0 K?= E G?=

RA Gain+ 0 OD (de8ault o8 U#5 is a )ood startin) "oint%

Sa'"le Rate+ E#.5 2s"s 5E Ks"s (E#.5eD 1 5EeE%

:e8ault Master loc2 !ate F D#eE ('a>+ E1.$$eE%

(K&R . sa'"le rate% must be an inte)er4 and s"ould be di9isible b3 $


8or the best R7 "er8or'ance (8lat s"ectru'%

K&R can be chan)ed *ith P'asterCcloc2CrateFAQ in :e9ice !ddr4


*here A is ne* K&R in ?= (e.). $0eE%

! 0-0 on the console indicates an o9errun4 and occurs


*hen the host is not able to consu'e sa'"les Huic2l3
enou)h.


Lab $+ 7K RA
:eter'ine the in"ut ( out"ut sa'"le
8or'at4 and *hat 8or'at (real or
co'"le>% the 8ilter ta"s *ill be
<8 Ta"s is le8t blan24 the ta"s are
auto'aticall3 co'"uted
7ractional B@ a88ects the sha"e o8
the lo*1"ass 8ilter that is )enerated
*hen no 8ilter ta"s are su""lied.
S"eci8icall3 it deter'ines ho* stee"
the lo*1"ass rollo88 is. Lea9in) the
de8ault 0 tells the code to select a
reasonable de8ault (currentl3 0.$%
@e need to ada"t the USR/ rate to so'ethin) suitable 8or the
!udio Sin2. The de8ault 0sa'"Crate0 9alue is #50eD4 *hich sets the
rate at *hich the USR/ "roduces sa'"les. The !udio Sin2 is
con8i)ured 8or a sa'"le (consu'"tion% rate o8 $eD4 but (#50000 .
$000% is not an inte)er. @e can cheat here and set :eci'ation to
be the inco'in) notional sa'"le rate (#50000%4 and the
<nter"olation to be a di88erent (non1di9isible% out)oin) notional
sa'"le rate (1V#000J%. The code *ill calculate the G&:. Since the
"ara'eters 'ust be inte)ers4 and 0sa'"Crate0 is a 8loatin)1"oint
nu'ber4 *e use the /3thon 8unction 0int0 to con9ert it to an inte)er.
J 0audioCrate0 is 'ulti"lied b3 $ (0audioCinter"0% because the
de'odulator bloc2s *ill "er8or' additional deci'ation (b3 $%.
S"eci8icall3 the @B7K bloc2 should be )i9en a hi)h rate (i.e. hi)h
band*idth si)nal since 7K broadcast channels are #00 2?= *ide%.


Lab $+ 7K RA
T"e $ide %and FM bloc2 'a2es
it eas3 to listen to stations in the
nor'al Broadcast 7K band.
<nco'in) notional sa'"le rate (1V#eD%
:eci'ation 8actor+ out)oin) rate is (inco'in) . deci'ation% F $000

Lab $+ 7K RA
T"e Narro& %and FM bloc2
'a2es it eas3 to listen to narro*
analo) and di)ital channels that
use 7K or 7SR.
<nco'in) notional sa'"le rate ('(000)%
-ut)oin) notional sa'"le rate ($000%
To s*itch bet*een
'odulators in this e>a'"le4
si'"l3 enable one bloc2 and
disable the other.
7K de1e'"hasis 8actor ('ore on @i2i"edia%
Ka>i'u' a'ount si)nal *ill de9iate 8ro' center (0 ?=%. This deter'ines
out"ut 9alue scalin) (e.). here 65 2?= *ill be 1.04 15 2?= *ill be 11.0%.
J 0audioCinter"0 is
chan)ed to 1 here as
NB7K doesn0t need such
a hi)h band*idth si)nal

Lab $+ 7K RA
The baseband s"ectru' (a local radio station% in sho*n on the 77T "lot4 and the si)nal at the
center o8 the s"ectru' is de'odulated "roducin) audio co'in) out o8 the host0s soundcard.

Lab $+ Kanual 7K RA
Re"eat the Narro* Band 7K rece"tion e>a'"le4 but
"er8or' the indi9idual de'odulation ste"s.

Lab $+ Kanual 7K RA
/o*er SHuelch *ill sHuelch
(or 'ute% the baseband si)nal
*hen its a'"litude is belo*
the threshold. This 'eans *e
can a9oid listenin) to noise.
The Buadrature :e'odulator
is the 2e3 "art o8 de'odulatin)
an 7K si)nal. The 0de9iation0 is
the 'a>i'u' 8reHuenc3 shi8t
*e e>"ect.
The un8iltered (ra*% 7K1de'odulated
si)nal *ill "ass throu)h the Lo* /ass
7ilter4 *hich *ill 2ee" the 9oice
8reHuenc3 ran)e *e0d li2e to hear4 and
attenuate an3thin) hi)her.
The Sco"e Sin2
*ill "lot both the
un8iltered and
8iltered si)nal.

Lab $+ Kanual 7K RA
Threshold abo9e *hich the si)nal should be allo*ed to "ass throu)h
!9era)in) 8actor a""lied to the 'easured si)nal a'"litude used 8or detection
No+ )enerate =ero sa'"les *hile sHuelched.
;es+ don0t "roduce an3 sa'"les *hile sHuelched.
!ctuall3 the
0al"ha0 o8 a
sin)le1"ole
<<R 8ilter
Len)th (in nu'ber o8 sa'"les% o8 attac2 and deca3 *indo*s (see ne>t%

Lab $+ Kanual 7K RA
!l"ha 'ust be bet*een =ero and one. -ne
'eans no a9era)in) *ill be a""lied4 and =ero
'eans the si)nal *ill ne9er chan)e (al*a3s sta3
at =ero%. The s'aller the 9alue4 the lon)er it *ill
ta2e 8or the sHuelch to o"en *hen a si)nal o8 a
"articular a'"litude is "resent. ;ou should
e>"eri'ent until 3ou 8ind a suitable 9alue that
*or2s *ell 8or 3our a""lication (e.). 'ini'al
nu'ber o8 8alse 0un'utin)s0%.
Note: !l"ha onl3 a""lies to the si)nal detection
"rocess4 not to the si)nal that is out"ut *hen the
bloc2 is in the un'uted state.
?a9in) a non1=ero Ra'" *ill also i'"ro9e the
"er8or'ance o8 this bloc2. @hen Ra'" is 04 the
si)nal *ill be un'uted i''ediatel3 once its
a9era)ed a'"litude e>ceeds the threshold.
@hen non1=ero4 the bloc2 *ill transition throu)h
an attac2 "hase *hen un'uted4 and a deca3
"hase *hen 'utin) once 'ore. The Ra'" 9alue
is the nu'ber o8 sa'"les the attac2 and deca3
"hases should last. :urin) these "hases4 the
in"ut si)nal *ill be 'ulti"lied b3 a s'ooth ra'"
8unction (actuall3 the "art o8 a sine *a9e%4 *hich
has the e88ect o8 8adin) in.out the ori)inal si)nal.

Lab $+ Kanual 7K RA
This bloc2 e88ecti9el3 out"uts the
instantaneous 8reHuenc3 chan)e in the
inco'in) Huadrature baseband si)nal as
a real 8loatin)1"oint out"ut (in essence
"ure FreHuenc3 de1Modulation%.
Gain is a scalin) 8actor a""lied to this
calculation. The eHuation calculates the
)ain such our out"ut *ill ideall3 9ar3
bet*een 11.0 and 1.04 *here each e>tent
re"resents the 'a>i'u' 8reHuenc3
de9iation *e e>"ect in our si)nal. Usuall3
this de9iation is set b3 the trans'itter.

Lab $+ Kanual 7K RA
:eter'ine the sa'"le 8or'at4 and *hether the 8ilter
*ill deci'ate (reduce the notional sa'"le rate% or
inter"olate (increase the notional sa'"le rate%
The deci'ation or inter"olation rate (de"endin) on the 7<R T3"e%
Gain a""lied b3 the 7<R 8ilter itsel8
Notional inco'in) sa'"le rate ($000%
7reHuenc3 o8 the end o8 the "assband (D.5 2?=%
@idth 8ro' the end o8 the "assband to the be)innin) o8 the sto" band
Select the a""ro"riate @indo* 8unction *hen )eneratin) 8ilter ta"s
!dditional 9alue used b3 the Raiser *indo*

Lab $+ Kanual 7K RA
The 7ilter :esi)n Tool (run 0)rC8ilterCdesi)n0% is a GU< that allo*s 3ou to interacti9el3 desi)n
di88erent t3"es o8 8ilters. -nce 3ou0re ha""3 *ith 3our desi)n4 3ou can "lace an
<nter"olatin).:eci'atin) 7<R 7ilter bloc2 into 3our GR& 8lo*)ra"h and set its ta"s usin) the
8ilter coe88icients out"ut b3 the desi)ner.

Lab $+ Kanual 7K RA
The baseband si)nal *ill be de'odulated as be8ore4 ho*e9er audio *ill onl3 be heard i8
there is a stron)1enou)h si)nal "resent at the center o8 the s"ectru' to o"en the sHuelch.
The Sco"e Sin2 sho*s the ra* de'odulated si)nal (a *histle% in blue4 and the lo*1"ass
8iltered (and there8ore sli)htl3 dela3ed% si)nal in )reen4 *hich is out"ut to the !udio Sin2.

Lab 5+ 7K TA
Sa'"le audio 8ro' 3our soundcard and trans'it it
8ro' a USR/ usin) a Narro* %and FM carrier.
;ou need to ha9e a 9alid a'ateur radio (?!K% license
to actuall3 trans'it on the 8reHuenc3 in this e>a'"le5

Lab 5+ 7K TA
;ou need to ha9e a 9alid a'ateur radio (?!K% license
to actuall3 trans'it on the 8reHuenc3 in this e>a'"le5
@e a""l3 an additional inter"olation 8actor so the NB7K Trans'it bloc2 out"uts a
hi)her notional sa'"le rate (1V#000%4 and then *e resa'"le 8or the USR/ (to
#50000%.
<n trans'it chain4 3ou *ill usuall3 be able to control the 'odulated si)nal0s
notional baseband rate (here it is 1V#0004 i.e. "rior to resa'"lin) 8or the USR/%.
This 'a2es 8or a tradeo88 bet*een a hi)her1rate4 "otentiall3 hi)her1Hualit3
s3nthesised baseband si)nal (at the e>"ense o8 "rocessin) "o*er%4 or sa9in)
&/U c3cles 8or lo*er1Hualit3. This choice is usuall3 a""lication1.si)nal1s"eci8ic.
0-R to Bloc20 has no e88ect *ith
!LS!. <n non1bloc2in) 'ode (to
*or2 around the t*o cloc2
"roble'%4 "ortaudio (8or
e>a'"le% *ill =ero18ill i8 no audio
sa'"les are a9ailable.
The USR/
Sin2 *ill
trans'it the
baseband
si)nal.

Lab 5+ 7K TA
<nco'in) notional sa'"le rate ($000%
-ut)oin) notional sa'"le rate
(1V#000%
Sa'e as recei9er
;ou need to ha9e a 9alid a'ateur radio (?!K% license
to actuall3 trans'it on the 8reHuenc3 in this e>a'"le5

Lab 5+ 7K TA
;ou need to ha9e a 9alid a'ateur radio (?!K% license
to actuall3 trans'it on the 8reHuenc3 in this e>a'"le5
-ut)oin) notional sa'"le rate (#50000%
<nco'in) notional sa'"le rate (1V#000%

Lab 5+ 7K TA
;ou need to ha9e a 9alid a'ateur radio (?!K% license
to actuall3 trans'it on the 8reHuenc3 in this e>a'"le5
/ara'eters are identical to the USR/ Source
Tip: &ertain 9alid
ran)es 'i)ht be
di88erent bet*een RA
and TA 8or the sa'e
de9ice. E.). B#00 TA
)ain ran)e is 0 V.5.
Tip: ! 0U0 on the console
indicates the USR/ ran
out o8 sa'"les to
trans'it4 so the host
isn0t "roducin) the'
Huic2l3 enou)h.

Lab 5+ 7K TA
The audio (a *histle% "ic2ed u" b3 the sound card *ill be sho*n in the sco"e "lot4 and
trans'itted b3 the USR/ at the selected 8reHuenc3.
;ou need to ha9e a 9alid a'ateur radio (?!K% license
to actuall3 trans'it on the 8reHuenc3 in this e>a'"le5

Lab 5+ 7K TA

<8 3ou see lots o8 the letter 0U0 in the console4 the
trans'it chain o8 the USR/ is e>"eriencin)
underruns+ sa'"les cannot be "roduced Huic2l3
enou)h b3 the host.

<n this e>a'"le (under Linu>.!LS!% it *ill occur


because o8 the 0t*o cloc20 "roble'4 but cannot
be 8i>ed b3 chan)in) 0-R to Bloc20 since the
!udio Source is "roducin) sa'"les that are all
bein) consu'ed *ithout issue4 but it ha""ens
to be doin) this a little too slo*l3.

Lab 5+ 7K TA

<t is "ossible to cheat b3 addin) a 08ud)e04 or 0t*iddle04


8actor to the <nter"olation rate at the Rational Resa'"ler.

<n the e>a'"le it *as+

int(sa'"Crate J 1.0%

@e can as2 the resa'"ler to "roduce more sa'"les 8or


the sa'e nu'ber o8 in"ut sa'"les so that the USR/ *ill
al*a3s ha9e enou)h sa'"les to trans'it

The <nter"olation rate *ould beco'e+

int(sa'"Crate J 1.01%

The notional out"ut rate *as increased b3 1W (1.0 6 0.01%4


*hich eHuals F #5#500.
The USR/ U?: Sin2 *ill still consu'e at #50000.

GNU Radio+
htt"+..)nuradio.or).
&GR!N+
htt"+..c)ran.or).
Ettus Research+
htt"+..ettus.co'.
U?: :ocs+
htt"+..8iles.ettus.co'.uhdCdocs.do>3'anual.ht'l.

You might also like