Sunteți pe pagina 1din 90

The USRP under 1.5X Magnifying Lens!

By:
Firas Abbas Ha!a
Rev 1.0
Last updated: 12-Jun-2008
This d"#uen$ is dedi#a$ed $" %&URA'( )"uni$y *es+e#ia,,y $he de-e,"+ing $ea. and
is #"nsidered as +ar$ "f %&U Radi" +r"/e#$.

GNU Radio is free software; you can redistriute it and!or "odify it under t#e ter"s of t#e GNU
Genera$ %u$ic License as pu$is#ed y t#e &ree 'oftware &oundation; eit#er version () or *at
your option+ any $ater version.

GNU Radio is distriuted in t#e #ope t#at it wi$$ e usefu$) ut ,-./0U. 1N2 ,1RR1N.2;
wit#out even t#e i"p$ied warranty of 34R5/1N.16-L-.2 or &-.N4'' &0R 1
%1R.-5UL1R %UR%0'4. 'ee t#e GNU Genera$ %u$ic License for "ore detai$s.
2ou s#ou$d #ave received a copy of t#e GNU Genera$ %u$ic License a$on7 wit# GNU Radio. -f
not) write to t#e &ree 'oftware &oundation) -nc.) 81 &ran9$in 'treet) 6oston) 31 02110-1(01)
U'1.

Tab,e "f )"n$en$s
References ......................................................................................................................................... (
,ords 3ust 6e 'aid .......................................................................................................................... (
'tartin7 Notes .................................................................................................................................... :
U'R% ................................................................................................................................................. 8
1;5 'ection ................................................................................................................................. <
;15 'ection ................................................................................................................................. <
1u=i$iary -nput!0utput 1na$o7 5#anne$s: .................................................................................... >
1u=i$iary ;i7ita$ -!0 %orts: ........................................................................................................... >
&%G1 ............................................................................................................................................ >
;au7#teroards ........................................................................................................................... 11
6asic .?!R? ;au7#teroards ................................................................................................. 11
Low &re@uency .?!R? ;au7#teroards ................................................................................ 11
.AR? ;au7#teroards ........................................................................................................... 12
;6'R? ;au7#teroards ......................................................................................................... 12
R&? ;au7#teroards .............................................................................................................. 12
.rou$es#ootin7 .......................................................................................................................... 12
%ower .......................................................................................................................................... 12
Genera$ Buestions ........................................................................................................................... 1(
&%G1 Aeri$o7 Buestions ................................................................................................................. 20
1;C8<2 5odec Buestions ............................................................................................................... 2<
5ontro$$in7 &%G1 Re7isters Buestions .......................................................................................... 28
;i7ita$ ;own 5onverter Buestions ................................................................................................. (0
;i7ita$ U% 5onverter Buestions ...................................................................................................... (8
;i7ita$ -!0 %ins 5ontro$ Buestions ................................................................................................. (C
;au7#teroards Buestions .............................................................................................................. ::
5DD -nterfacin7 Buestions .............................................................................................................. 82
R''- 3easure"ent Buestions ........................................................................................................ <8
3ot#eroard Re-5$oc9in7 Buestions ............................................................................................. >0
Loadin7 &%G1 6it 'trea" Buestions ............................................................................................. >(
.i"in7 Latency Buestions .............................................................................................................. >8
U'6 5ontro$$er &?2 Buestions ...................................................................................................... >>
%a7e 2 of C0
Referen#es
.#e fo$$owin7 references #ave ein7 used to write t#is docu"ent.
- Gnuradio 3ai$in7 arc#ives.
- Gnuradio wi9i wesite.
- www.ettus.co"
- ;awei '#en tutoria$s.
- U'R% User and ;eve$operEs Guide docu"ent.
- 3'c .#esis F;esi7n of a #ardware p$atfor" for narrow-and 'oftware ;efined Radio
app$icationsG y Ha$en ,ater"eyer
- www.7ps-sdr.co"
- U'R% used -nte7rated 5ircuits ;atas#eets.
0"rds Mus$ Be Said
- .#e Gnuradio "ai$in7 $ist is a treasure and so"e "ai$in7 $ist answers s#ou$d e 7o$d wei7#ted.
- %$ease send feedac9 corrections for any tec#nica$ "ista9es especia$$y t#ose $ae$ed y
I&-?34I
- Gnuradio is 7reat and i"pressive proJect and t#e U'R% is an a"aKin7 device. - a$ways as9 "y
se$f) #ow t#ey ui$d t#is 7reat proJectL ,eE$$ never 9now t#e answer.
%a7e ( of C0
S$ar$ing &"$es
1. .#e "ateria$ of t#is docu"ent was "ain$y *not a$$+ were ta9en fro" t#e "ai$in7 arc#ive posts
of *Gnuradio ;eve$opers tea"+:
- 4ric 6$osso"
- 3att 4ttus
- Jo#nat#an 5or7an
- 6rian %ada$ino
2+ 'o"e ti"es) - invent t#e @uestions w#en - see i"portant infor"ation f$ippin7 in t#e discussion
wit#out ein7 as9ed.
(+ .o find t#e ori7ina$ posts in t#e "ai$in7 arc#ive Just pic9 *copy+ so"e ordered words and start
searc#in7 *paste it+ in:
#ttp:!!$ists.7nu.or7!arc#ive!#t"$!discuss-7nuradio!
.#en you wi$$ 9now w#o said *or "ay e as9ed+ t#ese tec#nica$ infor"ation.
:+ .#e answers and tec#nica$ infor"ation in t#is docu"ent are not necessari$y 100M correct and
error free. 5orrections and feedac9 are #i7#$y we$co"ed and appreciated.
8+ - t#in9 it is wron7 to say t#at so"e @uestions are si$$y; a i7 tree was on$y a s"a$$ seed in so"e
day.
<+ No docu"entation for inand-si7na$in7 and no "-$oc9 in t#is docu"ent revision. 3ay e in
t#e future *- #ope+ it wi$$ e inc$uded y "e or so"eone e$se.
>+ - #ope t#at; t#is docu"ent is usefu$.
%a7e : of C0
USRP
.#e Universa$ 'oftware Radio %erip#era$) or U'R% *pronounced NusurpN+ is desi7ned to a$$ow
7enera$ purpose co"puters to function as #i7# andwidt# software radios. -n essence) it serves as
a di7ita$ aseand and -& section of a radio co""unication syste".
.#e asic desi7n p#i$osop#y e#ind t#e U'R% #as een to do a$$ of t#e wavefor"-specific
processin7) $i9e "odu$ation and de"odu$ation) on t#e #ost 5%U. 1$$ of t#e #i7#-speed 7enera$
purpose operations $i9e di7ita$ up and down conversion) deci"ation and interpo$ation are done on
t#e &%G1.
.#e true va$ue of t#e U'R% is in w#at it ena$es en7ineers and desi7ners to create on a $ow
ud7et and wit# a "ini"u" of effort. 1 $ar7e co""unity of deve$opers and users #ave
contriuted to a sustantia$ code ase and provided "any practica$ app$ications for t#e #ardware
and software. .#e powerfu$ co"ination of f$e=i$e #ardware) open-source software and a
co""unity of e=perienced users "a9e it t#e idea$ p$atfor" for your software radio deve$op"ent.
U'R% 3ot#eroard
%a7e 8 of C0
.#e U'R% #as : #i7#-speed ana$o7 to di7ita$ converters *1;5s+) eac# at 12 its per sa"p$e)
<:3'a"p$es!sec. .#ere are a$so : #i7#-speed di7ita$ to ana$o7 converters *;15s+) eac# at 1: its
per sa"p$e) 1283'a"p$es!sec. .#ese : input and : output c#anne$s are connected to an 1$tera
5yc$one 4%1512 &%G1. .#e &%G1) in turn) connects to a U'62 interface c#ip) t#e 5ypress
&?2) and on to t#e co"puter. .#e U'R% connects to t#e co"puter via a #i7# speed U'62
interface on$y) and wi$$ not wor9 wit# U'61.1.
'o in princip$e) we #ave : input and : output c#anne$s if we use rea$ sa"p$in7. /owever) we can
#ave "ore f$e=ii$ity *and andwidt#+ if we use co"p$e= *-B+ sa"p$in7. .#en we #ave to pair
t#e" up) so we 7et 2 co"p$e= inputs and 2 co"p$e= outputs.
A') Se#$i"n
.#ere are : #i7#-speed 12-it 1; converters. .#e sa"p$in7 rate is <:3 sa"p$es per second. -n
princip$e) it cou$d di7itiKe a and as wide as (23/K. .#e 1; converters can andpass-sa"p$e
si7na$s of up to aout 2003/K. -f severa$ decie$s of $oss is to$era$e) t#en) -& fre@uency as #i7#
as 800 3/K can e di7itiKed. /owever) if we sa"p$e a si7na$ wit# t#e -& $ar7er t#an (23/K) we
wi$$ introduce a$iasin7 and actua$$y t#e and of t#e si7na$ of interest is "apped to so"e p$aces
etween -(23/K and (23/K. 'o"eti"es t#is can e usefu$) for e=a"p$e) we cou$d $isten to t#e
&3 stations wit#out any R& front end. .#e #i7#er t#e fre@uency of t#e sa"p$ed si7na$) t#e "ore
t#e 'NR wi$$ e de7raded y Jitter. 1003/K is t#e reco""ended upper $i"it.
.#e fu$$ ran7e of t#e 1;5s is 2A pea9 to pea9) and t#e input is 80 o#"s differentia$. .#is is
:0",) or 1<d6". .#ere is a pro7ra""a$e 7ain a"p$ifier *%G1+ efore t#e 1;5s to a"p$ify t#e
input si7na$ to uti$iKe t#e entire input ran7e of t#e 1;5s) in case t#e si7na$ is wea9. .#e %G1 is
up to 20d6. ,it# 7ain set to Kero) fu$$ sca$e inputs are 2 Ao$ts pea9-to-pea9 differentia$. ,#en set
to 20 d6) on$y .2 A p-p differentia$ input si7na$ is needed to reac# fu$$ sca$e. .#is %G1 is software
pro7ra""a$e.
-f si7na$s are 15-coup$ed) t#ere is no need to provide ;5 ias as $on7 as t#e interna$ uffer is
turned on. -t wi$$ provide an appro=i"ate$y 2A ias. -f si7na$s are ;5-coup$e) a ;5 ias of
A55!2 *1.<8A+ s#ou$d e provided to ot# t#e positive and ne7ative inputs) and t#e interna$
uffer s#ou$d e turned off. .#e 1;5 AR4& provides a c$ean 1 A reference
'A) Se#$i"n
1t t#e trans"ittin7 pat#) t#ere are a$so : #i7#-speed 1:-it ;1 converters. .#e ;15 c$oc9
fre@uency is 128 3'!s) so Ny@uist fre@uency is <:3/K. /owever) we wi$$ proa$y want to stay
e$ow it to "a9e fi$terin7 easier. 1 usefu$ output fre@uency ran7e is fro" ;5 to aout ::3/K.
.#e ;15s can supp$y 1A pea9 to a 80 o#" differentia$ $oad) or 10", *10d6"+. .#ere is a$so
%G1 used after t#e ;15) providin7 up to 20d6 7ain. .#is %G1 is software pro7ra""a$e. .#e
;15 si7na$s *-0U.%O1!-0U.NO1 and -0U.%O6!-0U.NO6+ are current-output) eac# varyin7
etween 0 and 20 "1. .#ey can e converted into differentia$ vo$ta7es wit# a resistor.
%a7e < of C0
Au1i,iary 2n+u$3(u$+u$ Ana,"g )hanne,s:
.#ere are 8 1u=i$iary ana$o7 input c#anne$s connected to $ow speed 10 it 1;5 inputs *$ae$ed
1U?O1;5O11O1) 1U?O1;5O61O1) 1U?O1;5O12O1) 1U?O1;5O62O1)
1U?O1;5O11O6) 1U?O1;5O61O6) 1U?O1;5O12O6) and 1U?O1;5O62O6+ w#ic# can
e read fro" software. .#ese 1;5s can convert up to 1.283'%' and #ave a andwidt# of around
200 H/K. .#ese ana$o7 c#anne$s are usefu$ for sensin7 t#e R''- si7na$ $eve$s) te"peratures) ias
$eve$s)..etc.
1dditiona$$y) t#ere are 8 ana$o7 output c#anne$s connected $ow-speed 8it ;15 outputs. .#ese
are 1U?O;15O1O1) 1U?O;15O6O1) 1U?O;15O5O1) 1U?O;15O1O6) 1U?O;15O6O6
and 1U?O;15O5O6. .#ese ;15s can e used for supp$yin7 various contro$ vo$ta7es suc# as
e=terna$ varia$e 7ain a"p$ifiers contro$. -n addition) t#ere are two additiona$ ;15s *$ae$ed
1U?O;15O;O1 and 1U?O;15O;O6+ w#ic# are constructed usin7 12 it si7"a-de$ta
"odu$ator wit# e=terna$ si"p$e $ow pass fi$ter.
.#e U'R% "ot#eroard connectors *R?1 and .?1+ s#are one set of t#e : ana$o7 output
c#anne$s *1U?O;15O1O1 to 1U?O;15O;O1 for R?1 and .?1+ and eac# #ave 2
independent ana$o7 input c#anne$s *1U?O1;5O11O1 and 1U?O1;5O61O1 for R?1 and
1U?O1;5O12O1 and 1U?O1;5O62O1 for .?1+. .#e R?6 and .?6 s#are t#eir ot#er own
independent set. .#ere is a$so 1U?O1;5OR4& w#ic# can provides a reference $eve$ for 7ain
settin7 if it is necessary.
Au1i,iary 'igi$a, 23( P"r$s:
.#e U'R% "ot#eroard #as #i7# speed <: it di7ita$ -!0 ports. .#ese are divided in two 7roups
*(2 it for -0OR? and (2 it for -0O.?+. .#ese di7ita$ -!0 pins are connected to t#e
dau7#teroards interface connecters *R=1) .=1) R=6 and .=6+. 4ac# of t#ese connectors #as 1<
it di7ita$ -!0 its. .#ese si7na$s can e contro$$ed fro" software y readin7!writin7 to specia$
&%G1 re7isters and eac# can e independent$y confi7ured eit#er as di7ita$ input or di7ita$ output.
'o"e of t#ese pins are used to contro$ specific operations on t#e insta$$ed dau7#teroards suc# as
contro$$in7 t#e se$ection of receivin7 R& input port) in auto"atic trans"it!receive "ode)
contro$$in7 power supp$y feedin7 for different .? and R? parts) synt#esiKer $oc9 detection)Petc.
-t can e a$so used to i"p$e"ent 1G5 processin7 and can e very #e$pfu$ in deu77in7 &%G1
i"p$e"entations w#en connected to a $o7ic ana$yKer.
FP%A
%roa$y understandin7 w#at 7oes on t#e U'R% &%G1 is t#e "ost i"portant part for t#e GNU
Radio users. 1s s#own in t#e fi7ure e$ow) a$$ t#e 1;5s and ;15s are connected to t#e &%G1.
.#is piece of &%G1 p$ays a 9ey ro$e in t#e U'R% syste". 6asica$$y w#at it does is to perfor"
#i7# andwidt# "at#) and to reduce t#e data rates to so"et#in7 you can s@uirt over U'62.0. .#e
%a7e > of C0
&%G1 connects to a U'62 interface c#ip) t#e 5ypress &?2. 4veryt#in7 *&%G1 circuitry and U'6
3icrocontro$$er+ is pro7ra""a$e over t#e U'62 us.
.#e standard &%G1 confi7uration inc$udes di7ita$ down converters *;;5+ i"p$e"ented wit# :
sta7es cascaded inte7rator-co" *5-5+ fi$ters. 5-5 fi$ters are very #i7#-perfor"ance fi$ters usin7
on$y adds and de$ays. &or spectra$ s#apin7 and out of and si7na$s reJection) t#ere is a$so (1 tap
#a$fand fi$ters cascaded wit# t#e 5-5 fi$ters to for" co"p$ete ;;5 sta7e. .#e standard &%G1
confi7uration i"p$e"ents 2 co"p$ete di7ita$ down converters *;;5+. 1$so t#ere is an i"a7e wit#
: ;;5s ut wit#out #a$fand fi$ters. .#is a$$ows 1) 2 or : separate R? c#anne$s.
-n t#e : ;;5 i"p$e"entation) in t#e R? pat# we #ave : 1;5s) and : ;;5s. 4ac# ;;5 #as two
inputs - and B. 4ac# of t#e : 1;5s can e routed to eit#er of - or t#e B input of any of t#e :
;;5s. .#is a$$ows for #avin7 "u$tip$e c#anne$s se$ected out of t#e sa"e 1;5 sa"p$e strea".
.#e fi7ure e$ow s#ows t#e $oc9 dia7ra" of t#e U'R% di7ita$ down converter.
%a7e 8 of C0
Now $etQs see t#e di7ita$ down converter *;;5+. ,#at does it doL &irst) it down converts t#e
si7na$ fro" t#e -& and to t#e ase and. 'econd) it deci"ates t#e si7na$ so t#at t#e data rate can
e adapted y t#e U'6 2.0 and is reasona$e for t#e co"putersQ co"putin7 capai$ity. .#e
co"p$e= input si7na$ *-&+ is "u$tip$ied y t#e constant fre@uency *usua$$y a$so t#e -&+ e=ponentia$
si7na$. .#e resu$tin7 si7na$ is a$so co"p$e= and centered at 0. .#en we deci"ate t#e si7na$ wit# a
factor N.
.#e deci"ator can e treated as a $ow pass fi$ter fo$$owed y a down sa"p$er. 'uppose t#e
deci"ation factor is N. -f we $oo9 at t#e di7ita$ spectru") t#e $ow pass fi$ter se$ects out t#e and
R-&s!N) &s!NS) and t#en t#e down sa"p$er de-spread t#e spectru" fro" R-&s) &sS to R-&s!N) &s!NS.
'o in fact) we #ave narrowed t#e andwidt# of t#e di7ita$ si7na$ of interest y a factor of N.
Re7ardin7 t#e andwidt#) we can sustain (236!sec across t#e U'6. 1$$ sa"p$es sent over t#e
U'6 interface are in 1<-it si7ned inte7ers in -B for"at) i.e. 1<-it - and 1<-it B data *co"p$e=+
w#ic# "eans : ytes per co"p$e= sa"p$e. .#is resu$tin7 in a *(236yte per sec!:6yte+ 83e7a
co"p$e= sa"p$es!sec across t#e U'6. 'ince co"p$e= processin7 was used) t#is provides a
"a=i"u" effective tota$ spectra$ andwidt# of aout 83/K y Ny@uist criteria. 0f course we can
se$ect "uc# narrower ran7es y c#an7in7 t#e deci"ation rate. &or e=a"p$e) suppose we want to
desi7n an &3 receiver. .#e andwidt# of a &3 station is 7enera$$y 200 9/K. 'o we can se$ect t#e
deci"ation factor to e 280. .#en t#e data rate across t#e U'6 is <:3/K ! 280 T 28< 9/K) w#ic#
is we$$ suited for t#e 200 9/K andwidt# wit#out $osin7 any spectra$
infor"ation. .#e deci"ation rate "ust e in R8) 28<S. &ina$$y t#e co"p$e= -!B si7na$ enters t#e
co"puter via t#e U'6. .#atQs t#e software wor$dU
Note t#at w#en t#ere are "u$tip$e c#anne$s *up to :+) t#e c#anne$s are inter$eaved. &or e=a"p$e)
wit# : c#anne$s) t#e se@uence sent over t#e U'6 wou$d e -0 B0 -1 B1 -2 B2 -( B( -0 B0 -1 B1)
%a7e C of C0
Petc. -n "u$tip$e R? c#anne$s *1)2) or :+ ) a$$ input c#anne$s "ust e t#e sa"e data rate *i.e.
sa"e deci"ation ratio+.
1t t#e .? pat#) t#e story is pretty "uc# t#e sa"e) e=cept t#at it #appens reverse$y. ,e need to
send a aseand -!B co"p$e= si7na$ to t#e U'R% oard. .#e di7ita$ up converter *;U5+ wi$$
interpo$ate t#e si7na$) up convert it to t#e -& and and fina$$y send it t#rou7# t#e ;15.
.#e di7ita$ up converters *;U5+ on t#e trans"it side are actua$$y contained in t#e 1;C8<2
50;45 c#ips) not in t#e &%G1 *as s#own in t#e fi7ure e$ow+. .#e on$y trans"it si7na$
processin7 $oc9s in t#e &%G1 are t#e 5-5 interpo$ators. .#e interpo$ator outputs can e routed
to any of t#e : 50;45 inputs.
-n "u$tip$e .? c#anne$s *1 or 2+ a$$ output c#anne$s "ust e t#e sa"e data rate *i.e. sa"e
interpo$ation ratio+. Note t#at .= rate "ay e different fro" t#e R? rate.
.#e U'R% can operate in fu$$ dup$e= "ode. -n t#is "ode) trans"it and receive sides are
co"p$ete$y independent of one anot#er. .#e on$y consideration is t#at t#e co"ined data rate over
t#e us "ust e (2 3e7aytes per second or $ess.
%a7e 10 of C0
'augh$erb"ards
0n t#e "ot#er oard t#ere are four s$ots) w#ere you can p$u7 in up to 2 R? asic dau7#ter oards
and 2 .? asic dau7#ter oards or 2 R&? oards. .#e dau7#ter oards are used to #o$d t#e R&
receiver interface or tuner and t#e R& trans"itter. .#ere are s$ots for 2 .? dau7#ter oards)
$ae$ed .?1 and .?6) and 2 correspondin7 R? dau7#ter oards) R?1 and R?6. 4ac# dau7#ter
oard s$ot #as access to 2 of t#e : #i7#-speed 1; ! ;1 converters *;15 outputs for .?) 1;5
inputs for R?+.
.#is a$$ows eac# dau7#ter oard w#ic# uses rea$ *not -B+ sa"p$in7 to #ave 2 independent R&
sections) and 2 antennas *: tota$ for t#e syste"+. -f co"p$e= -B sa"p$in7 is used) eac# oard can
support a sin7$e R& section) for a tota$ of 2 for t#e w#o$e syste". Nor"a$$y) we can see t#at t#ere
are two '31 connectors on eac# dau7#ter oard. ,e usua$$y use t#e" to connect t#e input or
output si7na$s. No anti-a$ias or reconstruction fi$terin7 is provided on t#e U'R% "ot#eroard.
.#is a$$ows for "a=i"u" f$e=ii$ity in fre@uency p$annin7 for t#e dau7#teroards.
4very dau7#teroard #as an -25 44%R03 *2:L502: or 2:L5028+ onoard w#ic# identifies t#e
oard to t#e syste". .#is a$$ows t#e #ost software to auto"atica$$y set up t#e syste" proper$y
ased on t#e insta$$ed dau7#teroard. .#e 44%R03 "ay a$so store ca$iration va$ues $i9e ;5
offsets or -B i"a$ances. -f t#is 44%R03 is not pro7ra""ed) a warnin7 "essa7e is printed
every ti"e U'R% software is run.
4ac# .? dau7#teroard #as a pair of differentia$ ana$o7 outputs w#ic# are updated at 128 3'!s.
.#e si7na$s *-0U.%O1!-0U.NO1 and -0U.%O6!-0U.NO6+ are current-output. 1$so 4ac# R?
dau7#teroard #as 2 differentia$ ana$o7 inputs *A-N%O1!A-NNO1 and A-N%O6!A-NNO6+ w#ic#
are sa"p$ed at a rate of <: 3'!s.
.#ere are severa$ 9inds of dau7#ter oards avai$a$e now:
Basi# TX3RX 'augh$erb"ards
4ac# #as two '31 connectors t#at can e used to connect e=terna$ up!down tuners or si7na$
7enerators. ,e can treat it as an entrance or an e=it for t#e si7na$ wit#out affectin7 it. 'o"e for"
of e=terna$ R& front end is re@uired. .#e 1;5 inputs and ;15 outputs are direct$y transfor"er-
coup$ed to '31 connectors *80V i"pedance+ wit# no "i=ers) fi$ters) or a"p$ifiers. .#e 6asic.?
and 6asicR? 7ive direct access to a$$ of t#e si7na$s on t#e dau7#teroard interface *inc$udin7 1<
its of #i7#-speed di7ita$ -!0) '%- and -25 uses) and t#e $ow-speed 1;5s and ;15s+. 4ac# of
t#e 6asic .?!R? oards #as $o7ic ana$yKer connecters for t#e 1< 7enera$ purpose -0s. .#ese pins
can e used to #e$p deu77in7 your &%G1 desi7n y providin7 access to interna$ si7na$s.
L"4 Fre5uen#y TX3RX 'augh$erb"ards
.#e L&.? and L&R? are very si"i$ar to t#e 6asic.? and 6asicR?) respective$y) wit# 2 "ain
differences. 6ecause t#e L&.? and L&R? use differentia$ a"p$ifiers instead of transfor"ers)
t#eir fre@uency response e=tends down to ;5. .#e L&.? and L&R? a$so #ave (0 3/K $ow pass
fi$ters for anti-a$iasin7.
%a7e 11 of C0
T6RX 'augh$erb"ards
.#is is a receive-on$y dau7#ter oard. -t is a co"p$ete A/& and U/& receiver syste" ased on a
.A tuner "odu$e. .#e R& fre@uency ran7es fro" 803/K to 8<03/K) wit# an -& andwidt# of
<3/K.
1$$ tunin7 and 1G5 functions can e contro$$ed fro" software. .ypica$ noise fi7ure is 8 d6. .#is
oard is t#e on$y U'R% dau7#teroard w#ic# is N0. 3-30 capa$e.
'BSRX 'augh$erb"ards
'i"i$ar to t#e .AR? oard) t#is is a$so a receive-on$y. -t is a co"p$ete receiver syste" for 800
3/K to 2.: G/K wit# a ( -8 d6 noise fi7ure. .#e ;6'R? features a software contro$$a$e
c#anne$ fi$ter w#ic# can e "ade as narrow as 1 3/K) or as wide as <0 3/K. .#e ;6'R? is
3-30 capa$e) and can power an active antenna via t#e '31.
RFX 'augh$erb"ards
.#e R&? fa"i$y of dau7#teroards is a co"p$ete R& transceiver syste". .#ey #ave -ndependent
$oca$ osci$$ators *R& synt#esiKers+ for ot# .? and R? w#ic# ena$es a sp$it-fre@uency operation.
1$so) it #as a ui$t-in .!R switc#in7 and si7na$ .? and R? can e on sa"e R& port *connector+ or
in case of R? on$y) we can use au=i$iary R? port. 3ost oards #ave ui$t-in ana$o7 R''-
"easure"ent. 1$$ oards are fu$$y sync#ronous desi7n and 3-30 capa$e. &or R&?
dau7#teroards R& fre@uency ran7e) c#ec9:
www.ettus.co"
Tr"ub,esh""$ing
,#en first powered up) a L4; on t#e U'R% s#ou$d e f$as#in7 at aout (-: ti"es per second.
.#is indicates t#at t#e processor is runnin7) and #as put t#e device in a $ow power "ode. 0nce
fir"ware #as een down$oaded to t#e U'R%) t#e L4; wi$$ $in9 at a s$ower rate.
P"4er
.#e U'R% is powered y a <A :1 15!;5 power converter. .#e converter is capa$e of C0-
2<0A15) 80!<0 /K operation) and so s#ou$d wor9 in any country. -f t#ere is a need to use anot#er
power supp$y) t#e connector is a standard 2.1""!8.8"" ;5 power connector. .#e U'R%
"ot#eroard itse$f on$y needs 8A) ut a <A supp$y is needed to supp$y its dau7#teroards. -t
draws aout 1.<1 wit# 2 dau7#teroards fi=ed on it. .#e power can e c#ec9ed to e connected to
t#e U'R% y seein7 a $in9in7 L4; on it. -f t#ere is no $in9in7 L4;) c#ec9 a$$ power
connections) and c#ec9 for continuity in t#e power fuse *&801) near t#e power connector+. -f t#e
fuse needs rep$ace"ent) it is siKe 0<0() ratin7 ( a"ps.
%a7e 12 of C0
%enera, 7ues$i"ns
B+ ,#en t#e U'R% is p$u77ed in) t#e L4; to t#e ri7#t of t#e U'6 contro$$er $in9s at a fast rate
of aout ( ti"es per second. 0nce a U'R% app$ication starts) t#at rate s$ows down to aout 1 ti"e
per second. ,#at contro$s t#e $in9in7 of t#e L4;sL
1+ .#e L4;s are contro$$ed y t#e onoard &?2 U'6 contro$$er. ,#en you first power t#e usrp
up) a very s"a$$ pro7ra" is $oaded out of t#e 28< yte 44%R03. .#at code puts t#e 1;C8<2Qs
into a $ow-power state and runs a ti7#t $oop t#at $in9s t#e $ed aout ( ti"es per second. 'ee
usrp!fir"ware!src!usrp2!eepro"Oinit.c. 0nce t#e Nre7u$arN fir"ware is $oaded) t#e s$ow $in9in7
is done in t#e ti"er interrupt service routine) isrOtic9. 'ee usrp!fir"ware!src!usrp2!usrpO"ain.c
B+ - see N0N NUN NuN NaN c#aracters appear on t#e screen w#en - run "y 7nuradio pro7ra". -
understand t#ey appear w#en data f$ow fro" U'R% to %5 is stopped or so"et#in7. - a" curious
w#at is t#e "eanin7 of t#ese c#aracters isL ;oes faster %5 #e$p reducin7 suc# data f$ow trou$esL
1+ NuN T U'R%
NaN T audio *sound card+
N0N T overrun *%5 not 9eepin7 up wit# received data fro" usrp or audio card+
NUN T underrun *%5 not providin7 data @uic9$y enou7#+
aUaU TT audio underrun *not enou7# sa"p$es ready to send to sound card sin9+
uUuU TT U'R% underrun *not enou7# sa"p$e ready to send to U'R% sin9+
u0u0 TT U'R% overrun *U'R% sa"p$es dropped ecause t#ey werenQt read in ti"e.
2es) a faster "ac#ine wi$$ 7enera$$y cure t#is pro$e". .#is assu"es t#at youQre not as9in7 t#e
U'6 to do so"et#in7 t#at it canQt. -n our est case) we sustain (236!s across t#e U'6. - su77est
avoidin7 -nte$ 5e$eron or ot#er Ncac#e cripp$edN parts.
B+ ;oes t#e nu"er of Qu0Qs correspond to t#e nu"er of sa"p$es droppedL
1+ No. 0verrun detection is current$y i"p$e"ented y po$$in7 at appro=i"ate$y 10/K. -f youQre
tryin7 to receive constant$y strea"in7 data) you s#ou$dnQt see any u0Qs.
B+ /ow t#e U'R% oots *w#at is t#e ootin7 se@uence+L
1+ .#e U'R% itse$f contains no R03-ased fir"ware) "ere$y a few ytes t#at specify t#e vendor
-; *A-;+) product -; *%-;+ and revision. ,#en t#e U'R% is p$u77ed in to t#e U'6 for t#e first
ti"e) t#e #ost-side $irary sees an un-confi7ured U'R%. -t can te$$ itQs un-confi7ured y readin7
t#e A-;) %-; and revision. .#e first t#in7 t#e $irary code does is down$oad t#e 8081 code t#at
%a7e 1( of C0
defines t#e e#avior of t#e U'6 perip#era$ contro$$er. ,#en t#is code oots) t#e U'R% si"u$ates
a U'6 disconnect and reconnect. ,#en it reconnects) t#e #ost sees a different device: t#e A-;)
%-; and revision are different. .#e fir"ware now runnin7 defines t#e U'6 endpoints) interfaces
and co""and #and$ers. 0ne of t#e co""ands t#e U'6 contro$$er now understands is $oad t#e
&%G1. .#e $irary code) after seein7 t#e U'R% reconnect as t#e new device) 7oes to t#e ne=t
sta7e of t#e oot process and down$oads t#e &%G1 confi7uration it strea". 0nce t#e
fir"ware #as een down$oaded to t#e &?2) it sets an interna$ re7ister and reoots itse$f) t#is ti"e
presentin7 custo" product and vendor -;Es) w#ic# t#e #ost detects as t#e &?2 disconnectin7
fo$$owed y t#e connection of a custo" U'6 device.
B+ ,#at too$s are you usin7 to do t#e &%G1 pro7ra""in7L 1nd w#ic# too$s did you use to
$ayout t#e U'R% "ot#eroardL
1+ .#e &%G1 is pro7ra""ed in Aeri$o7) and co"pi$ed wit# Buartus fro" 1$tera. .#e
"ot#eroard $ayout was done in %1;') ut t#e $ayout fi$es are not distriuted. .#e sc#e"atics
are done in 74;1.
B+ 5an we use ;5-;5 converter wit# outputs 8A to power U'R%L
1+ .#e U'R% "ot#eroard can operate fro" 8A) ut "ost of t#e dau7#teroards re7u$ate t#e <A
down to 8A) so we rea$$y need aout 8.8 to 8.>8 A to operate correct$y.
B+ ,#at is t#e "a=i"u" ;5 supp$y vo$ta7e for t#e U'R%L 5an we use 1(.8AL
1+ No) it isnQt. .#e U'R% itse$f uses a $inear re7u$ator) so puttin7 1(.8 A in wi$$ resu$t in "ore
t#an 10 additiona$ watts ein7 dissipated. 1$so) "any of t#e capacitors on t#e dau7#teroards are
siKed for <A input) and "i7#t $ow wit# "ore t#an 10 A.
B+ ,#at is U'R% "ot#eroard fuse ratin7L
1+ .#e fuse siKe is 0<0(. Ratin7 is (1"ps.
B+ - t#in9 t#e 4%1512B2:058 &%G1 runs at "uc# #i7#er c$oc9 speeds t#an <:3/K.
1+ ,#en t#e &%G1 is routed) t#ere isnQt "uc# "ore s$ac9 aove t#e <:3/K for &"a= *or so -
t#ou7#t+.
%a7e 1: of C0
B+ /ow contro$ si7na$in7 is doneL ,#at is t#e protoco$ for itL ,#en - use t#ese $ines:
src T usrp.sourceOc *0) deci"+
src.setOr=Ofre@ *0) -&Ofre@+
src.setOp7a*0)20+
/ow actua$$y it 7ets trans$ated and conveyed to t#e &%G1 "asterOcontro$ "odu$e on &%G1 to do
t#e needfu$L
1+ %$ease ta9e a $oo9 at t#e code in usrpOstandard.W#)ccX) usrpOasic.W#)ccX) and usrpOpri"s.
W#)ccX. .#ey a$$ 7o over t#e U'6 as contro$ "essa7es to endpoint 0. .#e contro$ "essa7es are
parsed in t#e &?2 and acted upon. Genera$$y spea9in7 t#ey end up issuin7 transactions on t#e
-25 us or '%- us.
.#e &%G1 re7isters) 1;C8<2 re7isters and dau7#teroards appear on t#e '%- us. .#e
confi7uration 44%R03Es and dau7#teroards appear on t#e -25 us. 'ee t#e U'R% sc#e"atics
for detai$s.
.#e usrp!fir"ware!inc$ude!usrpOspiOdefs.# contains t#e definition for t#e '%- us. .#e
usrp!fir"ware!inc$ude!usrpOi2cOaddr.# contains t#e standard -25 addresses. 'o"e dau7#teroards
use ot#ers t#at are a function of w#ic# s$ot t#e dau7#teroard is p$u77ed into.
B+ /ow i7 are t#e U'R% uffersL
1+ .#e U'R% #as uffers at t#ree points in t#e pat#:
0n t#e #ost: current$y 836 .?) 836 R=. * I&-?34I +
0n t#e 5ypress &?2 U'6 perip#era$: 2H6 .? and 2H6 R=. * I&-?34I +
0n t#e &%G1: :H6 .? and :H6 R?.
B+ ,#en - #ave two R? 5#anne$s) t#en #ow e=act$y is t#e r=Ouffer used to store and 9eep t#e
data co"in7 fro" 2 R? pat#s separatedL
1+ .#e different pat#s a$ternate in t#e &-&0. .#e data is in t#is order:
5/1--
5/1-B
5/2--
5/2-B
etc.
B+ - wis# to ui$d Just one R? wit# #a$fand fi$ter and one .?. .#e present usrpOstd.v# #as 2r=)
1t= or :r=. ,#at do - need to do toL
1+ 4dit t#e fi$e confi7.v# ) t#en unco""ented t#e $ine:
!!Yinc$ude N..!inc$ude!co""onOconfi7O1r=#O1t=.v#N
%a7e 18 of C0
1nd co""ent t#e $ine:
Yinc$ude N..!inc$ude!co""onOconfi7O2r=#O2t=.v#N
6y usin7 F!!G) t#is wi$$ now inc$udes 1 .? and 1 R? wit# #a$fand fi$ter.
B+ .#in7s w#ic# cou$d e contro$$ed fro" %yt#on on &%G1 and 1;!;1 converters are:
Gains and ;eci"ation Rate. 5an its!sa"p$e of 1;!;1 converters e contro$$ed fro" pyt#onL
,#at e$se is contro$$a$e fro" %yt#onL
1+ .#e 1;5s a$ways sa"p$e at 12 its. .#e ;15s are a$ways 1: its. .#e data processed in t#e
U'R% is a$ways 1< its. &ro" pyt#on you can switc# to 8-it sa"p$es over t#e U'6. .#is a$$ows
you to dou$e your sa"p$e rate "a9e it *1<3'%'+.
B+ -Qve een p$ayin7 wit# t#e usrper app$ication. - a" a$e to read and write to t#e C8<2 c#ips
o9ay ut a$$ atte"pts at usin7 i2cOread fai$L ,#at is t#e "e"ory "apL
1+ - usua$$y prefer to do t#is 9ind of e=peri"entation fro" %yt#on) ut in any event youQre
proa$y usin7 an inva$id -25 address. 'ee usrp!fir"ware!inc$ude!usrpOi2cOaddr.#
Note a$so) t#at if w#at youQre rea$$y tryin7 to do is read t#e contents of one of t#e 44%R03Qs)
youQre "uc# etter off usin7 readOeepro".
Z&ro" pyt#on:
u T usrp.sin9Oc*0+ I or u T usrp.sourceOc*0+
I returns a strin7
s T u.readOeepro"*i2cOaddr) eepro"Ooffset) nytes+
print s
I returns a strin7
s T u.readOi2c*i2cOaddr) nytes+
print s
B+ /ow we contro$ auto trans"it!receive switc# de$ayL
1+ .#is a$$ows so"eone *fro" %yt#on+ to "anua$$y adJust t#e ti"in7 offset of t#e auto-
trans"it!receive switc#in7 to etter a$i7n wit# t#e trans"itted data w#en usin7 an e=terna$
trans"it!receive switc#.
-n a previous code) t#e auto trans"it!receive function wou$d switc# ased on w#et#er or not t#ere
was data in t#e trans"it &-&0 of t#e &%G1. Unfortunate$y) t#is wou$d not ta9e into account t#e
pipe$ine de$ay of t#e &%G1 interpo$ator and 1;C8<2 ;15 up converter. ;ependin7 on t#e
interpo$ation ratio used in t#e trans"it side) t#is cou$d resu$t in t#e 1.R switc#in7 si7na$ 7oin7
#i7# up to 28 us ear$y) and 7oin7 $ow up to (8 us efore t#e data was co"p$ete$y trans"itted. -f
%a7e 1< of C0
so"eone were usin7 a fast e=terna$ R=!.= switc#) t#is cou$d resu$t in s$icin7 off t#e end of a
trans"ission.
.#e new capai$ity adds an independent) confi7ura$e de$ay to t#e risin7 and fa$$in7 ed7es of t#e
1.R si7na$) "easured in c$oc9 tic9s. .o use) once one #as a$ready confi7ured 1.R operation as
needed) one needs to ca$$ two new dau7#teroard functions:
sudev.atrOsetOt=Ode$ay*c$oc9Otic9sOtoOde$ayOt=+ I Risin7 ed7e
sudev.atrOsetOr=Ode$ay*c$oc9Otic9sOtoOde$ayOr=+ I &a$$in7 ed7e
t#at wou$d e QsetOatrOt=Ode$ayQ and QsetOatrOr=Ode$ayQ.
...w#ere QsudevQ is t#e oJect created for t#e dau7#teroard in use.

Unfortunate$y) t#e est way *ri7#t now+ is to fi7ure out w#at va$ues to po9e in #ere are to "easure
t#e offset on an osci$$oscope etween t#e onset of t#e 1.R si7na$ and t#e power output fro" t#e
dau7#teroard.
,eQre wor9in7 on a way to as9 t#e &%G1 itse$f w#at va$ues s#ou$d e set *or even set t#ese y
defau$t+) ut #avenQt wor9ed out yet t#e est way to do t#is. ;ifferent e=terna$ R=!.= switc#es
#ave different needs so t#ere isnQt a one siKe fits a$$.
4"pirica$$y "easured) t#ou7#) t#e pipe$ine de$ay t#rou7# t#e U'R% trans"it pat# is aout 80
tic9s D ( tic9s [ interpo$ation rate. -t see"s t#e fa$$in7 ed7e needs so"ew#at $on7er t#an t#is to
co"p$ete$y drop to Kero ener7y and t#is "ay e data dependent) so a7ain) t#e est course is to
"easure wit# your particu$ar app$ication.
B+ ,#at is t#e U'R% 5$oc9 reference instai$ityL
1+ .#e c$oc9 #as a 20 pp" specification) ut at roo" te"perature) -t is typica$$y wit#in 8 pp".
B+ /ow t#e e=pected in-and .? ti"esta"ps "ay wor9L
1+ /ere is t#e order - was t#in9in7:
- &?2 receives pac9et to e sent to &%G1
- &?2 sends entire 812 yte pac9et to t#e &%G1
- &%G1 #as state "ac#ine to process t#e pac9et w#ic# does t#e fo$$owin7
- 5#ec9 to e sure it can fi7ure out w#ere t#e pac9et #as to 7o
- 5#ec9 to e sure t#e &-&0 is not fu$$
- Read t#e $en7t# of t#e pac9et
- &i$$ up t#e receivin7 &-&0 unti$ it is fu$$ or tota$ $en7t# of pac9et #as een reac#ed
- -f t#e pac9et $en7t# was reac#ed *w#ic# "i7#t e $ess t#an 812+) s9ip t#e rest since itQs
paddin7
- 4$se if t#e &-&0 is fu$$) $oop and fi$$ t#e &-&0 unti$ t#e pac9et $en7t# #as een reac#ed
- &%G1 #as co""and and c#anne$ state "ac#ines w#ic# do t#e fo$$owin7
wit# t#e t=Oc"d and t=Oc#anne$ &-&0s
- Read out ti"esta"p and $en7t# fro" pac9et
- 4nsure ti"esta"p is in t#e future
%a7e 1> of C0
- -f ti"esta"p is in t#e past) s9ip t#e rest of t#e pac9et and set
appropriate f$a7
- 4$se wait unti$ t#e current ti"e is reac#ed
- -f current ti"e is reac#ed) send out t#e siKe of t#e pac9et
B+ - was Just wonderin7 w#et#er t#e U'R% #as 7ot so"e te"perature specs t#at - s#ou$d ta9e into
account.
1+ 1$$ of t#e c#ips in t#e U'R% are specified over at $east t#e 0->05 ran7e. 1t roo" te"perature
t#e U'R% can run a$$-out continuous$y for days at a ti"e. 1ny enc$osure s#ou$d ta9e t#e power
consu"ption of t#e syste" into account. .#is can e as #i7# as 18-18 ,atts dependin7 on w#at
dau7#teroards you use.
B+ -s t#e $oopac9 interface wor9in7 on t#e U'R%) and #ow to ena$e itL
1+ .#ere is a $oopac9 interface in t#e current &%G1 code. -tQs ena$ed y writin7 to t#e
&RO30;4 re7ister. Grep t#e veri$o7 for N$oopac9N) and $oo9 at fp7aOre7sOco""on.W#)vX
B+ - was wonderin7 w#y can t#e U'R% Non$yN ac#ieve (2 36ytes!sec) i.e. 28< 3its!sec
w#ereas t#e U'6 2.0 specifications are :80 36its!secL
1+ .#e U'R% easi$y does 28< "e7aits per second *(2 "e7aytes!s+. .#e U'6 2.0 raw si7na$in7
rate is :80 "e7aits per second) or <0 "e7aytes per second. 2ou canQt 7et t#e fu$$ :80 ecause
t#ere is over#ead fro" pac9et #eaders) ti"e etween pac9ets) etc. ,e cou$d proa$y s@ueeKe a
$itt$e "ore andwidt# out of t#e us) ut it isnQt a priority for now. .#e U'R% needs data to 7o
ot# ways) so t#ere are so"e fir"ware de$ays in t#e 8-it processor t#at runs in t#e interface c#ip.
-f so"eone cared) it is proa$y possi$e to repro7ra" t#e fir"ware so t#at w#en no data is ein7
trans"itted) t#e auto"atic #ardware "ode is used. .#e fir"ware wou$d #ave to 9now) or e to$d)
w#en to switc# in and out of t#is "ode. 6ut t#is wou$d 7ain 28M "ore andwidt#U
B+ .#e U'R% R&? oards #ave aout 20 3/K andwidt# on ot# .? and R? sides) and can
operate fu$$ dup$e= as $on7 as you separate t#e .? and R? fre@uencies *.? and R? #ave separate
%LL synt#esiKers+. -s t#ere a way to "ove 203/K-wide si7na$s etween t#e #ost "ac#ine and t#e
R&?L
1+ 20 3/K andwidt# indicates t#e widt# of t#e aseand fi$ters. .#us) you can tune di7ita$$y
anyw#ere D!- 10 3/K fro" t#e L0. -f you use 1< it sa"p$es) you canQt 7et t#at "uc# over t#e
U'6 us at once.
'o w#y is 20 3/K usefu$L /ere are ( e=a"p$e scenarios:
%a7e 18 of C0
- 2ou cou$d si"u$taneous$y receive or trans"it 2 separate si7na$s w#ic# are : 3/K wide eac#)
w#ic# are separated y 12 3/K.

- 2ou can use 8 it sa"p$es) and 7et 1< 3/K of andwidt#. -f you were a radio astrono"er) you
cou$d use :-it sa"p$es and 7et (2 3/K of andwidt#.
- 2ou cou$d do a wideand "odu$ation and de"odu$ation in t#e &%G1. 2ou wou$d e a$e to
dea$ wit# "uc# wider si7na$s) and send a $ower it rate over t#e us.
B+ .#e ;5 offset is auto"atica$$y re"oved in #ardware) ut we can turn t#is feature off. -s t#ere
a software f$a7 in t#e code - can switc# it offL
1+ 'ee:
#ttp:!!7nuradio.or7!trac!wi9i!Usrp&%G1
Under N5o""on Re7istersN:
18 &RO;5O0&&'4.O5LO4N ;5 offset contro$ $oop ena$e
%a7e 1C of C0
FP%A 6eri,"g 7ues$i"ns
B+ ,ou$d e it possi$e to "odify t#e U'R% &%G1 Aeri$o7 codeL
1+ 2es. -t is possi$e. .#e top $eve$ of t#e veri$o7 source for t#e &%G1 can e found #ere:
usrp!fp7a!top$eve$!usrpOstd!usrpOstd.v
t#e u$9 of t#e code is #ere:
usrp!fp7a!sdrO$i![.v
B+ - wou$d $i9e to reco"pi$e a$$ t#e veri$o7 fi$es for t#e &%G1 in order to #ave a etter
understandin7 of t#e ro$e of eac# "odu$e. - e$ieve t#e pro7ra" used to co"pi$e t#e fi$es was
Buartus --. -s t#at correctL
1+ -f you want to ui$d t#e &%G1 .rf fi$e fro" source *not re@uired; we provide pre-co"pi$ed
.rf fi$es in usrp!fp7a!rf directory+) youQ$$ need 1$teraQs no cost Buartus -- deve$op"ent too$s.
,eQre current$y ui$din7 wit# Buartus -- ,e 4dition.
.#e proJect fi$e is usrp!fp7a!top$eve$!usrpOstd!usrpOstd.@pf. .#e top-$eve$ veri$o7 fi$e is
usrp!fp7a!top$eve$!usrpOstd!usrpOstd.v. .#e u$9 of t#e veri$o7 "odu$es are contained in
usrp!fp7a!sdrO$i![.v
B+ /ow t#e data co"in7!7oin7 to t#e 1;C8<2 is #and$ed in t#e &%G1L
1+ -n t#e &%G1 R? 'ide) in t#e ;5 offset re"ova$ process) t#ey are assi7ned on input. /ere is
w#ere it #appens:
#ttp:!!7nuradio.or7!trac!rowser!7nuradio!trun9!usrp!fp7a!sdrO$i!adcOinterface.vIL(:
we can see t#at t#e input of t#e r=Odcoffset "odu$e is assi7ned:
.adcOin*Wadc0R11S)adc0)(Q0X+
,#ic# is a 1 it si7n e=tension) t#e 12 ori7ina$ its) t#en ( its of 0Qs.
,#i$e in t#e &%G1 .? 'ide *as can e seen e$$ow+:
#ttp:!!7nuradio.or7!trac!rowser!7nuradio!trun9!usrp!fp7a!top$eve$!usrpOstd!usrpOstd.vIL1>C
w#atever 1<-its are co"in7 fro" t#e t=Oc#ain "odu$e is truncated y 2-its and sent out to t#e
;15s.
B+ .#e t=Oc#ain.v "odu$e uses a "odu$e ca$$ed p#aseOacc. -t ta9es as inputs *a"on7 ot#ers+ a
>it seria$ address and (2 it seria$ data and outputs t#e (2it p#ase.
;oes anyone #ave any idea w#at t#at "odu$e does and w#at its purpose is in t#e t=Oc#ainL
%a7e 20 of C0
1+ -t is not ena$ed. -f ena$ed) t#is code wou$d i"p$e"ent di7ita$ up conversion in t#e
&%G1) instead of usin7 t#e ;U5 in t#e 1;C8<2. N.6.) t#is code #asnQt een tested in so"et#in7
$i9e a coup$e of years and "ay #ave suffered it rot.
B+ - was $oo9in7 at t#e seria$Oio.v "odu$e ut - a" not sure w#at its purpose is or w#at it doesL

1+ .#e seria$Oio.v is on$y used for writin7 and readin7 t#e &%G1 re7isters.
B+ .#e data arrives as a seria$ input *fro" U'6 us+ to t#e &?2 c#ip. .#en) it 7ets to t#e &%G1 as
a 1<it para$$e$ input fro" t#e G%-& us. .#at input is ca$$ed usOdata in t#e &%G1. /owever)
upon readin7 t#e veri$o7 code of t#e seria$Oio.v "odu$e) it see"s t#at t#is "odu$e does a seria$ to
para$$e$ conversion of t#e ';- input and puts it into t#e (2 it seria$Odata output re7ister. - a"
confused as to w#et#er t#e seria$ data fro" t#e U'6 is converted to para$$e$ in t#e &?2 c#ip or
w#et#er t#e data sent to t#e &%G1 is seria$ ut a veri$o7 "odu$e inside t#e &%G1 converts it to
para$$e$. 'o - a" not sure w#et#er t#e data co"in7 fro" t#e U'6 to t#e usrpOstd.v "odu$e is t#e
1<it input usOdata or t#e ';- input.
1+ .#e actua$ data to!fro" t#e ;15s!1;5s *;U5s!;;5s+ 7oes across t#e 1<-it G%-& us.
*I&-?34I not a$$ t#e as9ed @uestion is answered+
B+ - a" $oo9in7 at t#e top$eve$ "odu$e ustpOstd.v -t is "y understandin7 t#at t#e data to e sent
co"in7 fro" t#e %5 or t#e data received 7oin7 to t#e %5 is t#e NusdataN inout.
.#e ot#er inouts ioOt=Oa) ioOt=O) ioOr=Oa and ioOr=O are t#e si7na$ 7oin7 to!co"in7 fro" t#e
dau7#teroards. - a" sti$$ confused on w#at is t#e purpose of t#e fo$$owin7 inputs: r=OaOa)
r=OOa) r=OaO) r=OO and t#e fo$$owin7 outputs: t=Oa) t=OL
1+ .a9e $oo9 at 1;C8<2 ;ata '#eetUUUUUUUUUUU
B+ - a" $oo9in7 at t#e trans"ission uffer *t=Ouffer.v+ veri$o7 code. 'o it see"s t#at it uses two
c$oc9 si7na$s. .#e t=c$9 si7na$ is used to read fro" t#e fifoO:9 w#i$e t#e usc$9 si7na$ is used to
write to t#e fifoO:9. ,#at are t#e c$oc9 speeds for t#ose c$oc9 si7na$sL*I&-?34I is t#e @uestion
correctL+

1+ .#e U'6 c$oc9 is :8 3/K) provided y t#e &?2.*I&-?34I is t#e answer enou7#L+
B+ 0ne of t#e inputs to t#e usrpOstd "odu$e is ';-. ,#at is t#e ori7in of t#is inputL
1+ .#e 8081 it-an7s t#e ';- data) c$oc9) and stroe $ines. .#ey are Ns$owN co"pared to ot#er
&%G1 actions. 'ee usrp-[!fir"ware!src!usrp1!spi.c
%a7e 21 of C0
B+ .#e "e"ory a$$ocated for eac# of t#e &-&0 in t=Ouffer and r=Ouffer is twice t#eir
capacity.....i.e <8H QitsQ*81C2 ytes+ as seen fro" t#e co"pi$ation report of Buartus. -s t#ere any
specific reasonL
1+ .#e &-&0s are :H $ines $on7) wit# eac# $ine 1< its.
B+ -n t#e cordic.v) 1< it vector =i) yi and Ki are passed as input. .#en cordic constants are pre-
defined. ,#at Nwire Ritwidt#D1:0S =iOe=t T WW2W=iRitwidt#-1SXX)=iX;N state"ent is doin7. -s it
Just nor"a$ concatenation and assi7n"entL
1+ 2es) we are si7n-e=tendin7 =i.
B+ .#e \posed7e c$oc9) if reset is set) t#en =0) y0) K0 is initia$iKed to Q0Q. Ne=t) w#en ena$e is
set) K0 is assi7ned a$$ its e=cept t#e first two. 1nd t#e first 2 its are used for t#e case state"ent.
-n t#is case state"ents) t#e first 2 its are used to deter"ine t#e @uadrants and accordin7$y adJust
t#e @uadrant *an7$e+ for =iOe=t and yiOe=t y C0 or 180 or 2>0 or (<0 de7ree. 6ut - a" not sure. -s
t#is correctL
1+ 2es
B+ 3any instances of cordicOsta7e are defined and t#ey are passed input va$ues =0) y0) K0 and
constants c00 etc. - a" not sure w#at NI*itwidt#D2)Kwidt#-1)0+N in t#is instance definition doesL
1+ .#e FI* +G is used to pass para"eters to t#e "odu$e ein7 instantiated.
B+ -n cordicOsta7e.v) if reset is set t#en =o) y0 and Ko are set to 0. 1nd w#en ena$e is
set) va$ue of K is c#ec9ed. 3y understandin7 of cordic $o7ic is t#at) if say t#at current an7$e is :8)
and desired is 20) t#en sutract fro" t#e current an7$e) and "a9e correspondin7 adJust"ents on =
a=is and y a=is varia$es. .#is state"ent c#ec9s if NKOisOposN and does ne=t operation
respective$y. - a" not sure w#at N=i - WWs#iftD1WyiRitwidt#-1SXX)yiRitwidt#-2:s#iftSXN is actua$$y
doin7. 3y understandin7 of cordic is t#at ased on an7$e adJust"ents) operations of "u$tip$es of
2 are carried out on =-a=is and y-a=is varia$e. 1nd WX state"ent are used for concatenation in
veri$o7.
1+ 'i7n e=tension
%a7e 22 of C0
B+ -n cordic.v) =o) yo and Ko are in continuous assi7n"ent "ode and are updated every ti"e a
=12) y12 or K12 va$ue c#an7es respective$y. Not e=act$y sure #ow t#e e=act desired an7$e is
otained in cordic.v. .#e a$7orit#" t#at - read "ade continuous adJust"ents on Qcurrent an7$eQ so
t#at it conver7ed to t#e desired an7$e. - donQt see t#at step #appenin7 in cordic.vL
1+ /ere #ow it 7oes. -f t#e an7$e is positive) it is reduced. -f t#e an7$e is ne7ative) it is increased.
-t a$ways 7ets c$oser to Kero.
B+ /ow we write a test enc# for t=Oc#ain.vL
1+ .o write a test enc#) you wou$d need to set t#e interpo$ation fre@uency proper$y and if you
wanted to use t#e 50R;-5) t#at wou$d #ave to e setup proper$y as we$$ for t#e p#ase
accu"u$ator. 2ou wou$d t#en stroe your sa"p$es in at a rate of &s w#ere &s is so"e fraction of
t#e tota$ c$oc9 speed and &s[interpOrate T t#e c$oc9 rate. 2ou t#en #ave to stroe every &s to
send your sa"p$es t#rou7# t#e c#ain.
2ou a$so need to assert t#e interpo$atorOstroe and sa"p$eOstroe on a consistent fre@uency asis
- e7: once every 18 c$oc9 cyc$es. 2ou canQt Just rando"$y assert and de-asserts t#e".
2ou #ave no fre@uency set. - e$ieve t#is fre@uency s#ou$d e t#e p#ase difference etween
sa"p$es of t#e 50R;-5 for eac# sa"p$e t#at 7oes in w#ere 2](1-1 is e@ua$ to 2[%-. 2ou
proa$y want to see a sine wave or so"e fi$tered si7na$ - try a pu$se train) W1) 0) 1) 0) ...X or you
can down$oad a "at#Orea$.v "odu$e - wrote fro" #ere:

#ttp:!!www.7nuradio.or7!trac!rowser!7nuradio!ranc#es!deve$opers!K#uoc#en!si"u$ations!urstO
test!"at#Orea$.v
- used it in t#e test enc# #ere to create so"e sines and cosines:

#ttp:!!7nuradio.or7!trac!rowser!7nuradio!ranc#es!deve$opers!K#uoc#en!si"u$ations!urstOtest!te
stOc#anOfifoOreader.v
B+ ;o peop$e Just urn t#eir Aeri$o7 code to t#e oard to test itL
1+ &or pre-synt#esis) R.L si"u$ation and testin7) - use -51RU' Aeri$o7 under Linu= and
G.H,ave. Note t#at if you p$an on usin7 it wit# -51RU' Aeri$o7) you wi$$ need one of t#e $atest
deve$oper snaps#ots as t#e code - wrote found so"e pro$e"s in t#eir rea$ va$ue #and$in7.
-t is definite$y N0. reco""ended you Just put it into an &%G1 and run wit# it as you rea$$y #ave
no idea w#atQs 7oin7 on inside t#ere. 1ccurate "ode$in7 can rea$$y #e$p wit# your deu77in7
ti"e.
B+ - went t#rou7# t#e "ai$in7 $ist and fi7ured out t#at t#e current Aeri$o7!A/;L code
i"p$e"entation occupies C8M of &%G1Qs resources. /owever) t#ere were so"e "ai$s t#at pointed
t#at reducin7 so"e receiver functiona$ities cou$d free so"e &%G1 resources. /owL
%a7e 2( of C0
1+ .#ereQs a #eader fi$e:
GNUORadio^usrp^fp7a^top$eve$^usrpOstd^confi7.v#
.#at #eader contro$s t#e ui$d confi7uration and is now functiona$. 3odify it to use t#e fi$e:
GNUORadio^usrp^fp7a^top$eve$^inc$ude^co""onOconfi7O1r=#O1t=.v#
.#is is #ow:
!! Unco""ent t#is for 1 R? c#anne$ *w! #a$fand+ _ 1 trans"it c#anne$
Yinc$ude N..!inc$ude!co""onOconfi7O1r=#O1t=.v#N
.#is wi$$ free up a $ot of space on t#e &%G1 for e=peri"entationU
B+ -n r=Oc#ain.v) w#at are t#e fo$$owin7 si7na$s forL
-sa"p$eOstroe.v
-deci"atorOstroe.v
-#Ostroe.v
-seria$Oaddr)seria$Odata)seria$Ostroe
-deu7data)deu7ctr$
1+ sa"p$eOstroe fo$$ows t#e fu$$ speed sa"p$es co"in7 fro" t#e 1;5 and feeds t#e input of t#e
deci"atin7 5-5 fi$ter.
deci"atorOstroe is 7enerated y t#e deci"atin7 5-5 fi$ter to feed t#e sa"p$es into t#e #a$fand
&-R fi$ter at t#e specified and deci"ated rate. ,#en t#e deci"ation y N ta9es p$ace) you 7et a
sa"p$e 1!N cyc$es. .#is ratio is preserved t#rou7#out t#at part of t#e c#ain.
.#e #Ostroe co"es out of t#e #a$fand deci"atin7 &-R fi$ter. .#is is a constant deci"ation y
2) ut is asserted w#en t#e &-R fi$ter #as an output to pass out of t#e R? c#ain.
seria$O[ is t#e interface used for re7ister writin7. -f you want to "odify any of t#e re7isters
wit#in t#e "odu$e) t#e si"p$e seria$ interface fro" t#e &?2 -Z &%G1 is w#at c#an7es t#e". -n
t#is case) t#ey are used to "odify t#e re7ister for p#ase accu"u$ation wit#in t#e &%G1 for t#e
cordic.
deu7[ is Just used for deu7 as t#e na"e su77ests. -n t#e current i"p$e"entation in t#e trun9) it
$oo9s $i9e t#e input to t#e #a$fand &-R fi$ter is w#at output on t#e deu7 us. *I&-?34I+
&or infor"ationa$ purposes) t#e interpo$ation stroes and fi$terin7 "odu$es are found #ere:
#ttp:!!7nuradio.or7!trac!rowser!7nuradio!trun9!usrp! f+ga !sdrO$i!"asterOcontro$.v
#ttp:!!7nuradio.or7!trac!rowser!7nuradio!trun9!usrp! f+ga !sdrO$i!cicOinterp.v
#ttp:!!7nuradio.or7!trac!rowser!7nuradio!trun9!usrp! f+ga !sdrO$i!stroeO7en.v
.#e re7ister is a si"p$e re7ister updated once t#e seria$ data is proper$y written *read: ato"ic
operation+. .#e stroeO7en is a down counter w#ic# resets to t#e input of w#atever t#at rate
re7ister is feedin7 t#e "odu$e w#en t#e counter 7ets down to 0.
B+ /ow "any c$oc9 cyc$es does it ta9e t#e cordic "odu$e to output va$id data and w#y is t#e
cordic a$7orit#" i"p$e"ented *in cordic.v+ fi=ed at 12 iterationsL
%a7e 2: of C0
1+ -t is a pipe$ined "odu$e w#ic# ta9es sa"p$es at t#e fu$$ rate and t#rou7# 12 pipe$ine sta7es
outputs t#e rotated vector. ,#y 12 was pic9ed is proa$y a siKe issue since you create re7isters
and f$ops for eac# sta7e. 2ou can "a9e t#e pipe$ine deeper and even varia$e if you want. .#ere
is a .0;0 in t#ere w#ic# su77ests "a9in7 it a varia$e $en7t# - not sure if t#e co""ent "eans at
runti"e or at ui$d ti"e) ut #ave a 7o at it.
B+ 5an we use 3e7a ce$$ 1$tera $oc9sL
1+ 2es. &or e=a"p$e) $i9e t#e t=OusOfifo and r=OusOfifo) you can Just te$$ Buartus to 7enerate
t#e appropriate dua$ c$oc9 &-&0 N"e7ace$$N for you. -n t#is way) 3att did t#at to 7enerate t#e
fifoO29 and fifoO:9 $oc9s t#at weQre current$y usin7. 'ee t#e Buartus "anua$ and t#e N5yc$one
;evice /andoo9N for supported confi7urations.
B+ .#e fo$$owin7 is t#e settin7Ore7 "odu$e
"odu$e settin7Ore7
* input c$oc9) input reset) input stroe) input wire R<:0S addr)
input wire R(1:0S in) output re7 R(1:0S out) output re7 c#an7ed+;
-n t#e :
..^7nuradio-(.0.2^usrp^fp7a^sdrO$i!"asterOcontro$.v "odu$e)
- see setttin7Ore7 "odu$e is ca$$ed as fo$$ow:
settin7Ore7 I*Y&RO31'.4RO5.RL+
srO"strOctr$*.c$oc9*"asterOc$9+).reset*1Q0+).stroe*seria$Ostroe+).addr*seria$Oaddr+).in*seria$Odat
a+).out*"asterOcontro$s++;
/owever) in:
..^7nuradio-(.0.2^usrp^fp7a^sdrO$i!settin7Ore7.v "odu$e) t#e settin7Ore7 "odu$e #as an output
si7na$ ca$$ed Nc#an7edN.5an anyone p$ease te$$ "e w#at wi$$ #appen to t#at Nc#an7edN si7na$L
1+ .#e Fc#an7edG si7na$ is not used in "ost p$aces) and is $eft out.
%a7e 28 of C0
A'89:; )"de# 7ues$i"ns
B+ - was $oo9in7 at t#e 1;C8<2 data s#eet) and it see"s t#at in t#e trans"it pat#) t#ere is on$y
one 1:it input ut t#e c#ip outputs 2 .? si7na$s. ;oes t#is "ean t#at if we want to output two
si7na$s) t#e data #as to e inter$eaved efore ein7 sent to t#e 1; c#ipL - a" not sure w#y t#ere
are 2 outputs ut on$y 1 inputL
1+ .#e data sent to t#e 1;C8<2 is inter$eaved) -B-B-B-B-B.
B+ - a" tryin7 to fi7ure out #ow t#e 1;C8<2 3=&4 is setup:
R? 'ide:
1. -s t#e interna$ ;LL used to sa"p$e faster t#an <:3'%'L -f so) w#at is t#e ;LL rateL -s it
possi$e t#is wou$d ever want to e usedL
2. -s t#e /i$ert &i$ter ever usedL
.? 'ide:
1. -s t#e /i$ert &i$ter ever usedL
2. -s t#e N50 ever usedL
(. -s t#e interpo$ation fi$ter ever usedL
:. -s t#e fi=ed R&s!:)&s!8S se$ecta$e "i=er ever usedL
8. -s t#e .? data ever sent as rea$-on$y instead of -!B fro" t#e &%G1 w#en it is actua$$y a
co"p$e= si7na$L
1u= 'ide:
1re any of t#e au=i$iary 1;5!;15s used for 1G5!A50 settin7L
1+ R? 'ide:
1- .#e ;LL is used to dou$e t#e sa"p$e rate so t#at t#e [;15s[ can sa"p$e at 1283/K. .#e
1;5s stay at <:3/K.
2- No
.? 'ide:
1- No
2- 2es) a$$ t#e ti"e *ot# coarse and fine+. -n t#e up converter *in t#e 1;C8<2) fro" fi7ure ( in
t#e C8<2 datas#eet+) t#ey sp$it t#e co"p$e= "u$tip$y into 2 parts -- coarse and fine. .#e fine part
*$oc9 ;+ runs at 1!: of t#e sa"p$e rate. .#is "eans t#at it can on$y "ove t#e fre@ency 1!:t# as
far. .#e $oc9 is t#en fo$$owed y t#e := interpo$ation *6$oc9 5+) and t#en t#e coarse
"odu$ation) 6$oc9 6. 6$oc9 6 on$y "oves t#e si7na$ D!- fs!: or fs!8.
(- 2es) a$ways.
:- 2es
8- No) we a$ways send -!B to t#e C8<2. .#ere are a coup$e of use cases) w#ere you "i7#t want to
send rea$ data) ut we donQt i"p$e"ent t#e".
1u=:
%a7e 2< of C0
2es) a$$ of t#e". ;etai$s depend on t#e specific dau7#teroard. .#e au= ;15!1;5Qs are a$$ run
to t#e dau7#teroards.
B+ /ow 1;C8<2 re7isters "aintainedL
1+ .#e 1;C8<2 is contro$$ed over '%-. .#e code t#at sets up t#e 1;C8<2Qs is contained in
usrpOasic.cc and usrpOstandard.cc. 3ost of it is in t#e constructors. 2ou "ay a$so want to ta9e a
$oo9 at t#e U'R% "ot#eroard sc#e"atic to see #ow everyt#in7 is wired to7et#er.
B+ - #ave two 6asicO.= dau7#teroards) so eac# one uses different 1;C8<2. 1re t#e 2 1;C8<2
ot# 7et t#ere c$oc9 in fro" t#e usrp "ot#eroard) and t#at is t#e sa"e c$oc9L
1+ .#e 1;C8<2s *w#ic# are on t#e "ot#eroard+ ot# 7et t#e sa"e c$oc9 fro" 1;C81( c$oc9
distriution -5. .#e on$y difference is t#at t#e c$oc9 si7na$ 7oes t#rou7# separate *ut identica$+
fi$ters on its way to eac# 1;C8<2.
B+ ,ou$d you p$ease iterate "ore on t#e concept of 1;C8<2 %G1L
1+ -tQs an ana$o7 a"p$ifier wit# a software contro$$a$e 7ain. 0n t#e R= pat# it #as steps of 1.0 d6
efore 1;5. 0n t#e .? pat#) t#e steps are 0.1 d6 after t#e ;15. 'ee t#e 1;C8<2 datas#eet for
detai$s. .#e %G1 is contro$$ed over t#e '%- seria$ us fro" t#e &?2 *as are a$$ t#e 1;C8<2
re7isters+.
B+ - need a way to update t#e 1U?O;15 port on t#e C8<2) ut apparent$y t#at is #and$ed y t#e
U'6 "icrocontro$$erU -s t#at correctL .o set up t#e 1U?O;15 do - #ave to waste U'6
andwidt#L
1+ .#e U'R% is wired suc# t#at on$y t#e &?2 can contro$ t#e 1;C8<2s and you cannot c#an7e it
fro" &%G1. /owever) you can c#an7e t#is #ardware wirin7 y addin7 R2001) R200:) and R2008
to t#e U'R%. 1$$ s#ou$d e `ero-o#" resistors. 6e carefu$) ecause you wi$$ now #ave "u$tip$e
drivers of t#ese nets. 2ouQ$$ need to #ave t#e &?2 '.0% drivin7 t#e" efore you "a9e t#e &%G1
drive t#e".
.#is wi$$ a$$ow t#e &%G1 to contro$ t#e 1;C8<2s. 2ou can a$so "a9e t#e &%G1 contro$ t#e
tunin7 of t#e R&?-series dau7#teroards.
%a7e 2> of C0
)"n$r",,ing FP%A Regis$ers 7ues$i"ns
B+ 5an anyone te$$ "e w#ere t#e re7isters are and #ow - can read!write to t#e"L
1+ 0nce you create a usrp.sourceOc*+ or usrp.sin9Oc*+ oJect) you can ca$$:

u T usrp.sourceOc*+
u.OwriteOfp7aOre7*re7no) va$+
.#e &%G1 re7isters are write-on$y. 2ou "ay ca$$:
u.OreadOfp7aOre7*re7no+
...ut t#e return va$ue wi$$ eit#er e Kero or a se"i-docu"ented set of deu77in7 va$ues unre$ated
to t#e re7ister nu"er you put.
.#e &%G1 re7ister definitions are in:
usrp!fir"ware!inc$ude!fp7aOre7sOco""on.#
usrp!fir"ware!inc$ude!fp7aOre7sOstandard.#
N0.4: -t is possi$e to da"a7e your #ardware y incorrect$y settin7 t#ese re7isters - e$ieve
settin7Ore7.v is instantiated w#erever t#ere is a re7ister w#ic# can e written to. 6ein7 a$e to
#ave access to every re7ister "a9es for a very #airy pro$e". .#e &%G1 re7isters are not set
usin7 -25) t#ey are set wit# '%-. .#ere is a$ready a "ec#anis" for readin7 ac9 va$ues over '%-)
ut it is on$y set up to read ac9 8 va$ues now) "ost$y for readin7 -!0 pins and R''- $eve$s) ut
not every re7ister. 'ee seria$Oio.v and settin7Ore7.v
B+ ,#at &%G1 re7isters are used for '%-) -25 contro$L 0r are t#ey Just a standard re7istersL
1+ 1$$ t#e -25 and '%- stuff is outside t#e &%G1. .#e '%- is a seria$ us w#ic# is used to set
re7isters on t#e dau7#teroards) t#e &%G1) and t#e 1;C8<2 are contro$$ed fro" t#e &?2 on$y.
B+ -Q" tryin7 to read and write t#e &%G1 re7isters usin7 Just t#e $iusrp. 3y write returns NtrueN)
ut t#e read returns 0) re7ard$ess of w#ic# &%G1 re7ister - read!write to. &or e=a"p$e:
if *ut=-ZOwriteOfp7aOre7*&RO1;5O0&&'4.O0)0=>>>>++
int readre7va$ue2 T *ut=-ZOreadOfp7aOre7*&RO1;5O0&&'4.O0++;
,#y is t#atL
1+ .#e &%G1 re7isters are write-on$y. ,#en readin7) instead of t#e re7ister contents) you 7et
Qreadac9Q re7ister contents w#ic# are actua$$y a nu"er of usefu$ si7na$s inside t#e &%G1. 'ee
$ine nu"ers (0: and (08 of usrpOstd.v to see w#at si7na$s are read ac9. .#e typica$ way of
%a7e 28 of C0
dea$in7 wit# write-on$y re7isters is to "aintain a s#adow copy in your code t#at you update every
ti"e you write to a re7ister) and t#en if you $ater want to NreadN t#e re7ister) Just $oo9 at t#e
s#adow copy. 2ou can a$so use t#is if you want to do a read-"odify-write.
B+ - e$ieve t#at t#e user-defined &%G1 re7isters donQt e=ist in t#e veri$o7 code. ;o - need to add
t#e" "anua$$yL - was 7oin7 to do t#at in usrpOstd.v.
1+ 5orrect. .#e actua$ re7isters are not instantiated *t#ey wou$d 7et pruned out anyway durin7
synt#esis if you did.+ -f you are writin7 custo" &%G1 code) you can instantiate any nu"er of:
settin7Ore7 I*&ROU'4RO??+ userOre7*...+;
...in w#atever veri$o7 "odu$e you create) and Just e sure to inc$ude:
usrp!fir"ware!inc$ude!fp7aOre7sOstandard.#.
.#e pat# in t#e inc$ude state"ent wi$$ vary dependin7 on w#ere your veri$o7 "odu$e is in t#e fi$e
syste". 1$so) if you are addin7 settin7 re7isters to e=istin7 "odu$es) t#en t#e Finc$udeG "ay
a$ready e done it for you.
&ina$$y) t#e constants &ROU'4RO0 t#rou7# &ROU'4RO18 are avai$a$e fro" 5DD y inc$udin7:
usrp!fir"ware!inc$ude!fp7aOre7sOstandard.#
*a7ain) pat# "ay vary.+
B+ -s t#ere a way to read fro" t#e &%G1 re7isters fro" usrperL
1+ No.
Z&ro" pyt#on:
I returns (2-it int
v T u.OreadOfp7aOre7*re7no+
Note t#at t#ere are on$y : reada$e re7isters) and - stron7$y su77est t#at you use
u.readOio*w#ic#Odoard+ instead of direct$y readin7 re7ister 1 or 2.
re7no resu$t
----- --------------------------
1 *ioOr=Oa aa 1<+ b ioOt=Oa I read dau7#teroard i!o pins
2 *ioOr=O aa 1<+ b ioOt=O I read dau7#teroard i!o pins
( returns const 0=aa88ff>> I donQt count on t#is
: returns const 0=f0f0C(1a I donQt count on t#is
&2-) t#e Nnor"a$N pyt#on interface to t#e usrp is defined in 7r-usrp!src!usrp1.i
%a7e 2C of C0
'igi$a, '"4n )"n-er$er 7ues$i"ns
B+ -n t#e &%G1 ;;5) are - and B sa"p$es ein7 7enerated fro" co"p$e= sa"p$esL .#e
adcOinterface "odu$e Just see"s to "u$tip$e= t#e sa"e co"p$e= sa"p$e to 2 $inesL
1+ .#e 1;5 interface "odu$e ta9es care of de"u=in7 t#e received si7na$ into - and B si7na$s.
.#en every pair of -B is routed to a ;;5.
B+ ,#at is t#e purpose of "u$tip$e=er in t#e &%G1 receive pat#L
1+ .#e 3U? is $i9e a router or a circuit switc#er. -t deter"ines w#ic# 1;5 *or constant Kero+ is
connected to eac# ;;5 input. .#ere are : ;;5s. 4ac# #as two inputs. ,e can contro$ t#e 3U?
usin7 usrp.set_mux() "et#od in %yt#on.
.#e 3u= va$ue is ca$cu$ated y:
3 2 1
1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+-------+-------+-------+-------+-------+-------+-------+-------+
| Q3 | I3 | Q2 | I2 | Q1 | I1 | Q0 | I0 |
+-------+-------+-------+-------+-------+-------+-------+-------+
4ac# :-it - fie$d is eit#er 1;5 0)1)2)(
4ac# :-it B fie$d is eit#er 1;5 0)1)2)( or 0=f *input is const Kero+
1$$ &%G1 ;;5 BQs "ust e 0=f or none of t#e" "ay e 0=f.
,e te$$ eac# input ;;5 input *-0) B0) -1 ... -() B(+ w#ic# 1;5 is connected to it y usin7 : its
*0) 1) 2) ( or 0=f+. 'o a (2-it inte7er wou$d e enou7# for a$$ 8 inputs to 9now w#ic# 1;5 is
connected. 0f course an inte7er in #e=adeci"a$ syste" wi$$ e "ore convenient if we want to use
t#e set_mux() "et#od. &or "ost rea$ sa"p$in7 app$ications) t#e B input of eac# ;;5 is constant
Kero. 'o @uite often we donQt need to "odify t#e standard confi7uration of t#e &%G1. 1ctua$$y it
is anticipated t#at t#e "aJority of U'R% users wi$$ never need to use anyt#in7 ot#er t#an t#e
standard &%G1 confi7uration.
B+ - want to insert a fi$ter &-R pass and after t#e output of 1;5 and efore t#e input of ;;5.
,#atQs t#e sa"p$in7 fre@uency for t#is fi$ter &-RL -s correct to insert t#is fi$terL
1+ .#e sa"p$e rate of t#e 1;5 is <:3sps. .#e sa"p$es t#en 7o t#rou7# t#e 50R;-5 to
7enerate co"p$e= pairs) t#en t#rou7# a 5-5 wit# "ini"u" deci"ation of :) and t#en t#rou7# a
#a$fand 2:1 deci"atin7 fi$ter. .#e $ac9 of #ardware "u$tip$iers inside t#e &%G1 re@uires you to
run a re$ative$y si"p$e fi$ter un$ess you are runnin7 at N$owN sa"p$e rates w#ic# a$$ow you to
seria$iKe t#e data 7oin7 t#rou7# one or two "u$tip$iers and accu"u$ate t#e output.
%a7e (0 of C0
B+ /ow t#e &%G1 #a$fand fi$ter i"p$e"ented) and w#y we cannot deci"ate y $ess t#an 8 in
standard &%G1 confi7urationL
1+ -t #as (1 taps. .#e current i"p$e"entation of t#e #a$fand fi$ter in t#e &%G1 re@uires 8 c$oc9s
to process t#e (1 taps. 'ee t#e co""ents aout ti"in7 in fp7a!sdrO$i!#!#a$fandOdeci".v
.#is wor9s fine wit# deci"ation 8 or #i7#er. .o run at deci"ation :) youQ$$ need to use a ui$d of
t#e &%G1 t#at does not contain t#e #a$fand fi$ter) or youQ$$ need to re-i"p$e"ent t#e #a$fand)
suc# t#at it uses two "u$tip$iers instead of one. -n addition to t#e standard 2 R= *wit# #a$fand+ 2
.= ui$d) t#e [current[ code contains an &%G1 i"a7e wit# : R? pat#s *wit#out t#e #a$fand+ and
wit# 0 trans"it pat#s. -tQs not insta$$ed y defau$t.

B+ 1;5 sa"p$es at <:3/K) and passes t#rou7# ot# - and B c#anne$s over t#e 2:-it R? us.
-nterna$ to t#e &%G1) t#e 5-5 auto"atica$$y deci"ates y a va$ue of at $east :. .#e #a$fand
deci"atin7 &-R fi$ter interna$ to t#e &%G1 deci"ates y a fi=ed va$ue of 2. .#is 7ives a "ini"u"
deci"ation rate of 8) $eavin7 83sps 7oin7 over t#e U'6 of t#e U'R%. -s t#is correctL
1+ 2es. Note t#at so"e &%G1 ui$ds donQt contain t#e #a$f-and.
,it# 1<-it - _ B deci" T 8 -Z 83'!sec -Z (236!sec.
,it# 8-it - _ B deci" T : -Z 1<3'!sec -Z (236!sec
B+ -s t#ere any ot#er way to decrease t#e sa"p$e rate eside t#e U'R% deci"OrateL
1+ .#e deci"Orate sets #ow "uc# deci"ation is done in t#e &%G1. 2ou can of course perfor"
additiona$ deci"ation in software. 2ouQd proa$y want to use 7r.firOfi$terOccf for t#at Jo. .#e
first ar7u"ent is t#e deci"ation rate.
Note:
.o use : c#anne$s) you "ust use t#e stdO:r=O0t=.rf &%G1 i"a7e. -f you use t#e stdO:r=O0t=.rf
i"a7e) t#e deci"ation rate "ust e aT 128. -f you need "ore deci"ation) you "ust do it in
software.
B+ 1re odd deci"ation nu"ers o9L 5an - use a deci"ation of 128L
1+ ,it# t#e stdO:r=O0t=.rf i"a7e) - e$ieve odd nu"ers wi$$ wor9. .#ey wi$$ not wor9 wit#
stdO2r=#O2t=.rf
B+ - wonder #ow to ca$cu$ate t#e fre@uency reso$ution of t#e U'R% 50R;-5 a$7orit#"L
1+ .#is paper is rea$$y 7ood for understandin7 t#e 50R;-5:
#ttp:!!we.nJit.edu!c#9J2!50R;-5.pdf
%a7e (1 of C0
-t is specifica$$y written to $oo9 at &%G1 i"p$e"entations) w#ic# is nice. 1s - understand it) t#e
U'R% uses t#e 50R;-5 as descried in section (.1 of t#at paper. 1 p#ase accu"u$ator is used to
spin t#e an7$e around) and t#e "odu$ated sin!cos or =i is t#e output on =o and yo after 12
iterations of t#e a$7orit#". .#e va$ue of Ko s#ou$d e Kero) and any error $eftover s#ou$d e
represented on t#at output. .#e reso$ution s#ou$d rea$$y e #ow s$ow$y you can spin t#e Ki
co"ponent w#i$e "aintainin7 accuracy out of t#e 50R;-5. -t "ay e t#at wit# 12 iterations and
1<-it inputs 0.01 /K is possi$e) w#ereas "ore iterations or $ar7er inputs "i7#t 7et etter
reso$ution) ut - suspect youQre rea$$y past t#e point of di"inis#in7 returns at t#at point.
.#e Np#ase 7eneratorN part of t#e 50R;-5 $oc9 wor9s y incre"entin7 a (2-it p#ase re7ister
y a fi=ed a"ount per c$oc9 cyc$e. .#e fu$$ siKe of t#e re7ister represents 2[%-*+ of p#ase) or one
cyc$e of t#e wavefor". .#e user pro7ra""ed p#ase incre"ent per c$oc9 cyc$e t#en represents
fre@uency.
-n t#e receive c#ain of t#e &%G1) t#e p#ase 7enerator is c$oc9ed at <: 3/K. .#us) t#e "ini"u"
de$ta-fre@uency *a one it c#an7e in t#e p#ase incre"ent re7ister+ is <: 3/K ! pow*2) (2+ T
0.01:C /K.
.#us) for ;5) t#e p#ase incre"ent va$ue is Kero) for 0.01:C /K) it is 1) for 0.02C8 /K) it is 2) a$$
t#e way up to (2 3/K) w#ere it is pow*2) (1+. 2ou can a$so tune ne7ative fre@uencies) w#ere -1
creates -0.01:C/K) etc.
.#e 50R;-5 $oc9 t#en uses t#e resu$tin7 Nsawtoot#N p#ase va$ue to rotate t#e inco"in7 si7na$
y t#at a"ount) resu$tin7 in co"p$e= fre@uency conversion. .#e &%G1 50R;-5 dea$s wit# p#ase
and not fre@uency) so t#ere is no concept of fre@uency reso$ution for it. .#e one ein7 used in t#e
U'R% #as 1: its of %/1'4 reso$ution. &re@uency reso$ution is contro$$ed y t#e N50) or p#ase
accu"u$ator. -n our case it #as (2 its of reso$ution. <: 3/K!2](2 is your fre@uency reso$ution
in /K.
B+ -f we want a deci"ation of <:) w#at is t#e response of t#e 5-5 fi$ter *deci"ation y (2+) /6&
*deci"ation y 2+ and t#e cascaded 5-5D/6& *tota$ deci"ation <:+ in t#e ;;5L
1+ &or deci"ation (2) t#e response of t#e 5-5 *: sta7es+ fre@uency response fro" 0 to 23/K is
s#own e$ow:
%a7e (2 of C0
.#e /6& fre@uency response is s#own e$ow *nor"a$iKed fre@uency+:
%a7e (( of C0
.#e cascaded response *5-5 D /6&+ is s#own e$ow *nor"a$iKed fre@uency+:

%a7e (: of C0
'igi$a, UP )"n-er$er 7ues$i"ns
B+ 'o fro" w#at - understand) in t#e trans"it side t#e di7ita$ up converters are i"p$e"ented in
t#e 1;C8<2 c#ip ut t#e interpo$ation is done in t#e &%G1. - e$ieve in t#e receive side t#e down
conversion is done in t#e &%G1. 'o w#y canQt we do t#e sa"e for t#e trans"it side and
i"p$e"ent t#e ;i7ita$ U% 5onverters in t#e &%G1L
1+ 0n t#e trans"it side we use our own 5-5 to interpo$ate fro" w#atever ratio co"es over t#e
U'6 to (2 3'!s. .#is is sent to t#e C8<2 w#ic# t#en interpo$ates a7ain y a factor of four to
rin7 us to 128 3'!s. .#e up converter is in t#e C8<2 as you say. -n t#e receive side) t#e down
conversion is done in t#e &%G1) ecause t#e C8<2 does not #ave a down converter in t#e R?
pat#. .#e us 7oin7 to t#e .? pat# on t#e C8<2 is "u$tip$e=ed *- t#en B sa"p$es+) and we run it at
our nor"a$ c$oc9 rate of <: 3/K. .#is "eans we can on$y 7et (2 3'!s co"p$e= across it. -f we
did t#e up conversion in t#e &%G1) we wou$d t#us e $i"ited to aout a 12 3/K carrier.
B+ .#e 1;C8<2 c#ip contains interpo$ation fi$ters as we$$. 5ou$d t#ose e used instead of t#e 5-5
interpo$ators on t#e &%G1L -n t#at way) ot# t#e up conversion and t#e interpo$ation wou$d e
done in t#e 1;C8<2 c#ip and "ore space wou$d e avai$a$e on t#e &%G1L
1+ ,e use t#ose interpo$ation fi$ters a$ready) ut t#ey on$y do a factor of :) so we sti$$ need a 5-5
in t#e &%G1.
B+ ,#at #appened to t#e cicOintOs#ifter.v fi$e in t#e U'R% sourceL - a" $oo9in7 at re-ena$in7
up conversion in t#e &%G1 ut cannot see" to $ocate t#is fi$e.

1+ -tQs sti$$ in: usrp!fp7a!sdrO$i!cicOintOs#ifter.v
B+ -s t#e data ein7 c$oc9ed out of t#e U'R% to ;15 is at <:3spsL
1+ 3ore precise$y) t#ere are two inter$eaved c#anne$s) eac# runnin7 at (23'!s. .#e 1;C8<2
interpo$ates eac# strea" y :) 7ivin7 two strea"s at 1283'!s.
B+ .#ere are two points t#at interpo$ation can #appen - inside t#e 1;C8<2 and interna$
to t#e &%G1. ,it#in t#e &%G1) t#e 5-5 fi$ter is t#e interpo$atin7 structure and #as a varia$e
rate) w#ereas t#e 1;C8<2 #as a fi=ed interpo$ation rate of 2= if a rea$-on$y si7na$ is ein7 used) or
%a7e (8 of C0
:= is possi$e if inter$eaved wit# -!B at <:3sps - 7ivin7 t#e sa"p$e rate of -!B (23sps.-s t#at
correctL
1+ 2es.
B+ - a" unsure w#at t#e "ini"u" interpo$atin7 rate of t#e 5-5 is) or t#e "a=i"u" for t#at
"atterL
1+ -tQs proa$y 1 or 2) t#ou7# - dout itQs een tested. .#e *wor9a$e+ "a=i"u" is deter"ined
y t#e widt# of t#e inter"ediate sta7es of t#e 5-5. - e$ieve weQre 7ood to 128 in t#e &%G1 5-5.
B+ ,#o sets t#e interpo$ation rate of t#e 5-5 interna$ to t#e &%G1 to 7et fro" t#e specified
nu"er of sa"p$es per sy"o$ fro" a "odu$ator $oc9 in GNU Radio to a nu"er t#at t#e 5-5
can interpo$ate into <:3spsL
1+ .#e code in usrpOstandard.cc contro$s t#e &%G1 interpo$ation rate. .#e rates do not #ave to e
powers of two. &ro" t#e user point of view t#e net interpo$ation rate "ust e in R:) 812S and a
"u$tip$e of :. .#is is a$$ contro$$ed in usrpOstandard.cc.
B+ .#ere are 2 co"p$e= interpo$ators i"p$e"ented in t#e &%G1 *say int0) and int1+. .#ere are :
rea$ *ie) 2 co"p$e=+ up converters i"p$e"ented in t#e ;15 c#ips *say ;150) ;151) ;152)
;15(+. .#e "u= routes - and B of int0 and int1 to t#e appropriate ;15s.
-s it true t#at ;150)1 are #ardwired to t#e .?1 side of t#e U'R% and dac2)( to t#e .?6L 1$so)
is t#e second co"p$e= interpo$ator used on$y if nc#anne$s T 2L
1+ 2es.
B+ - found out t#at t#e "a= .? fre@ is $i"ited in usrpOstandard.cc to ::3/K *since
U'4O&%G1O.?O50R;-5 is undefined+. Now) since a 1283'ps s#ou$d safe$y ensure <:3/K)
w#at is actua$$y i"posin7 t#at $i"itationL

1+ -ts set y t#e passand of t#e interpo$ator in t#e 1;C8<2. .#e di7ita$ up converters in t#e
1;C8<2 donQt a$$ow you to set t#e fre@uency to va$ues c$ose to t#e Ny@uist fre@uencies *fro"
::3/K to 8:3/K+. 'ince it sa"p$es at 128 3/K) t#e pro#iited ran7es are around "u$tip$es of
<: 3/K.
B+ -Q" #avin7 trou$e understandin7 e=act$y #ow to 7o aout sendin7 two independent) rea$-
va$ued si7na$s to different '31 connectors on t#e sa"e trans"it dau7#teroardsL
%a7e (< of C0
1+ 1s t#e software is current$y ui$t) you cannot send two independent) rea$-va$ued si7na$s to
different connectors on t#e sa"e trans"it dau7#teroard. .#e reason is t#at we are usin7 t#e
di7ita$ up-converters in t#e 1;C8<2) and #ave t#e 1;C8<2Qs confi7ured in
N;ua$ 5#anne$ 5o"p$e= ;15 ;ataN "ode. 'ee pa7es 20-21 of t#e 1;C8<2 datas#eet. -f you
on$y need two independent .? c#anne$s) t#e @uic9 fi= is to use two 6asic .= dau7#teroards.
.#is is supported. Just te$$ t#e U'R% t#at youQre usin7 two c#anne$s of data) and t#en provide a
strea" wit# two inter$eaved c#anne$s of - _ B data. 1n additiona$ t#ou7#t is t#at if you donQt
need di7ita$ up-conversion) - donQt t#in9 it wou$d ta9e "uc# to 7et two independent c#anne$s out.
2ou s#ou$d e a$e to use t#e e=istin7 &%G1 and #ost code) and Just "anua$$y Ja" t#e ri7#t
"a7ic va$ues into t#e 1;C8<2 re7isters 1C and 20. 3a9e sure t#at you continue to run t#e :=
interpo$ator on t#e 1;C8<2 so a$$ t#e data rates re"ain t#e sa"e. 2ou can write t#e 1;C8<2 re7s
fro" pyt#on usin7:
u T usrp.sin9Os*...+
u.OwriteOC8<2*w#ic#Ocodec) re7no) va$ue+ I note t#e $eadin7 O c#aracter
I w#ic#Ocodec is 0 or 1 for side 1 or 6
Loo9 in usrpOstandard.cc at usrpOstandardOt=::usrpOstandardOt= to see #ow we nor"a$$y setup
t#ese re7isters.
B+ 1t w#at rate s#ou$d - send t#e sa"p$es to t#e t=Oc#ainsL -s every : c$oc9 cyc$esL .#ey see" to
e contro$$ed y t=Ostroe) ut - fai$ed to understand w#at t#is si7na$ actua$$y "ean.
1+ .#e "ini"u" interpo$ation rate is : due to t#e 5-5 fi$ter $i"itations) so once every : wi$$
yie$d one side of t#e spectru". - e$ieve 128 is t#e ot#er end of t#e spectru") ut you s#ou$d set
a constant for t#e rate so we can test wit# different ones. .#e t=Ostroe #appens once every rate
c$oc9 cyc$es - wit# w#ic# it wi$$ send in a new sa"p$e. .#at stroe sends a new va$ue down t#e
.? strea" and reads a new one ready for t#e ne=t t=Ostroe.
B+ ,#at is t#e point of t#e usOreset and t#e c$earOstatus si7na$L .#ey are ot# input to current
t=Ouffer.
1+ - a" not sure of t#is - ut - a" assu"in7 to stop!reset t#e trans"it pat# and c$ear any status
"essa7es respective$y.
B+ ,e #ave "u$tip$e U'R%s c$oc9-sync#roniKed) ut we #avenQt found a way to set t#in7s up so
t#at t#e different sa"p$e strea"s #it t#e ;!1 converters at t#e sa"e c$oc9.
1+ ,e #ave 7otten "u$tip$e U'R%s sync#roniKed for receive. .#at &%G1 code and #ost code is in
t#e suversion. &or trans"it) t#e pro$e" cou$d e a it "ore difficu$t) dependin7 on w#et#er you
can dea$ wit# a constant p#ase difference etween t#e trans"ittin7 U'R%s or not *3-30 vs ea"
for"in7+. -f you need t#e p#ases to e identica$ etween t#e U'R%s t#en you wi$$ #ave to c#an7e
t#e veri$o7 suc# t#at you are no $on7er usin7 t#e di7ita$ up converters in t#e 1;C8<2 and instead
i"p$e"ent t#e ;U5 in t#e &%G1. .#is is ecause t#ereQs no way to direct$y contro$ t#e p#ase
%a7e (> of C0
accu"u$ator in t#e 1;C8<2. -f you can dea$ wit# a constant p#ase offset) t#en a strate7y si"i$ar to
w#at 3arin used for R= s#ou$d wor9 for .?.
B+ 3y @uestions are re7ardin7 t=Oc#ain.v. - a" a it confused as to #ow t#e f$ow of t#e code
wou$d proceed. .#ere is no Na$waysN state"ent in t#e code.
1+ .#is is Just wirin7 a coup$e t#in7s to7et#er to 7et t#e trans"ission c#ain to wor9 at t#e fu$$
c$oc9 rate. .#ere are ( "ain co"ponents #ere: a p#ase accu"u$ator) a 50R;-5 and an
interpo$atin7 5-5 fi$ter. .#e aseand si7na$s are fed into t#e 50R;-5 a$on7 wit# a p#ase fro"
t#e p#ase accu"u$ator. &or eac# sa"p$e t#at 7oes in) t#e p#ase accu"u$ator rotates. .#is
7enerates an -& t#at is "i=ed wit# your aseand si7na$. .#e interpo$atin7 5-5 fi$ter 7ets your
aseand si7na$ up to t#e proper sa"p$e rate to feed t#e ;15s.
%a7e (8 of C0
'igi$a, 23( Pins )"n$r", 7ues$i"ns
B+ - a" usin7 t#e dau7#teroardEs ;46UG -0 pins) and - a" connectin7 t#e" to "y $o7ic
ana$yKer. - #ave to enter t#e t#res#o$d va$ue in "y $o7ic ana$yKer. - can c#oose etween ..L
*1.:A+ 530' *2.8A+ 45L *- 1.(A+. - a" not sure w#ic# one to c#oose. Ri7#t now - #ave it set to
a user va$ue of (.(0A) is t#at t#e ri7#t c#oiceL
1+ 1$$ t#e si7na$s are LA530') 0 to (.(A. .#e correct t#res#o$d is 1.<8A *(.(A!2+
B+ - 7enerated a si7na$ usin7 t#e usrpOsi77en.py function and tried to use t#e -0 pins on t#e asic
.? oard to "onitor t#e di7ita$ output on a $o7ic ana$yKer ut it see"s t#at no si7na$ 7oes to
t#ose pins. -s t#ere so"et#in7 - need to c#an7e in t#e veri$o7 code to e a$e to use t#e deu7 -0
pinsL
1+ .#ere are two ways to contro$ t#e -!0 pins) eit#er fro" t#e #ost) or fro" wit#in t#e &%G1.
Me$h"d A:
.o contro$ t#e" fro" t#e #ost no c#an7es are re@uired in t#e veri$o7. &ro" pyt#on you need to
te$$ it to Noutput ena$eN t#e pins you are interested) and t#en write w#atever va$ues you $i9e to
t#e":
&ro" 7r-usrp!src!usrp1.i:
![U
[ ^rief ,rite direction re7ister *output ena$es+ for pins t#at 7o to dau7#teroard.
[
[ ^para" w#ic#Odoard R0)1S w#ic# dau7#teroard
[ ^para" va$ue va$ue to write into re7ister
[ ^para" "as9 w#ic# its of va$ue to write into re7
[
[ 4ac# dau7#teroard #as 1<-its of 7enera$ purpose i!o.
[ 'ettin7 t#e it "a9es it an output fro" t#e &%G1 to t#e dau7#teroard.
[
[ .#is re7ister is initia$iKed ased on a va$ue stored in t#e
[ dau7#teroard 44%R03. -n 7enera$) you s#ou$dnQt e usin7 t#is routine
[ wit#out a very 7ood reason. Usin7 t#is "et#od incorrect$y wi$$
[ 9i$$ your U'R% "ot#eroard and!or dau7#teroard.
[!
oo$ OwriteOoe *int w#ic#Odoard) int va$ue) int "as9+;
![U
[ ^rief ,rite dau7#teroard i!o pin va$ue
[
%a7e (C of C0
[ ^para" w#ic#Odoard R0)1S w#ic# dau7#teroard
[ ^para" va$ue va$ue to write into re7ister
[ ^para" "as9 w#ic# its of va$ue to write into re7
[!
oo$ writeOio *int w#ic#Odoard) int va$ue) int "as9+;
![U
[ ^rief Read dau7#teroard i!o pin va$ue
[
[ ^para" w#ic#Odoard R0)1S w#ic# dau7#teroard
[ ^returns re7ister va$ue if successfu$) e$se R41;O&1-L4;
[!
int readOio *int w#ic#Odoard+;
4.7.)
I 1ssu"es 6asicO.= in s$ot 1. ;o not do t#is $ind$yU 0utput ena$in7 a$$ t#e i!o pins
I on ot#er dau7#teroards wi$$ cause pro$e"s *urn up dau7#teroard and!or &%G1+
u T usrp.sin9Oc*0) <:+
side T 0 I side 1
u.OwriteOoe*side) 0=ffff) 0=ffff+ I set a$$ i!o pins as outputs
counter T 0
w#i$e 1:
u.writeOio*side) counter) 0=ffff+
counter T *counter D 1+ _ 0=ffff
Me$h"d B:
-f #owever) youQre tryin7 to contro$ t#e deu7 pins fro" t#e &%G1) youQ$$ need to output ena$e
t#e" fro" t#e #ost) and ena$e t#e" as deu7 outputs. 2ou do t#e $ast step y writin7 to t#e
&RO;46UGO4N16L4 &%G1 re7ister:
&ro" usrp!fir"ware!inc$ude!fp7aOre7sOco""on.#:
!! -f t#e correspondin7 it is set) interna$ &%G1 deu7 circuitry
!! contro$s t#e i!o pins for t#e associated an9 of dau7#teroard
!! i!o pins. .ypica$$y used for deu77in7 &%G1 desi7ns.
Idefine &RO;46UGO4N 1:
I define "&RO;46UGO4NO.?O1 *1 aa 0+ !! deu7 contro$s .?O1 i!o
I define "&RO;46UGO4NOR?O1 *1 aa 1+ !! deu7 contro$s R?O1 i!o
I define "&RO;46UGO4NO.?O6 *1 aa 2+ !! deu7 contro$s .?O6 i!o
I define "&RO;46UGO4NOR?O6 *1 aa (+ !! deu7 contro$s R?O6 i!o
.#ese defines are avai$a$e in pyt#on $i9e t#is:
%a7e :0 of C0
fro" usrpOfp7aOre7s i"port [
u T usrp.sin9Oc*0) <:+
u.OwriteOoe*0) 0=ffff) 0=ffff+
u.OwriteOfp7aOre7*&RO;46UGO4N) "&RO;46UGO4NO.?O1+
B+ - wou$d appreciate any su77estions on #ow to connect outputs fro" t#e &%G1 to t#e deu7
pins *suc# as t#e ioOt=Oa output+ in veri$o7L
1+ Loo9 at usrp!fp7a!top$eve$!usrpOstd!usrpOstd.v:
wire R18:0S re7O0)re7O1)re7O2)re7O(;
"asterOcontro$ "asterOcontro$
* ."asterOc$9*c$9<:+).usc$9*usc$9+)
.seria$Oaddr*seria$Oaddr+).seria$Odata*seria$Odata+).seria$Ostroe*seria$Ostroe+)
.t=OusOreset*t=OusOreset+).r=OusOreset*r=OusOreset+)
.t=OdspOreset*t=OdspOreset+).r=OdspOreset*r=OdspOreset+)
.ena$eOt=*ena$eOt=+).ena$eOr=*ena$eOr=+)
.interpOrate*interpOrate+).deci"Orate*deci"Orate+)
.t=Osa"p$eOstroe*t=Osa"p$eOstroe+).stroeOinterp*stroeOinterp+)
.r=Osa"p$eOstroe*r=Osa"p$eOstroe+).stroeOdeci"*stroeOdeci"+)
.t=Oe"pty*t=Oe"pty+)
!!.deu7O0*r=OaOa+).deu7O1*ddc0OinOi+)
.deu7O0*t=Odeu7usR18:0S+).deu7O1*t=Odeu7usR(1:1<S+)
.deu7O2*r=Odeu7usR18:0S+).deu7O(*r=Odeu7usR(1:1<S+)
.re7O0*re7O0+).re7O1*re7O1+).re7O2*re7O2+).re7O(*re7O(+ +;
.#e ar7u"ents .deu7O0*...+ t#rou7# .deu7O(*...+ are t#e si7na$s t#at 7et connected to t#e deu7
pins.
deu7O0 -Z .?O1
deu7O1 -Z R?O1
deu7O2 -Z .?O6
deu7O( -Z R?O6
B+ /ow do - assi7n t#e pins for t#e &%G1L - "ean t#e e=terna$ -0 pins.
1+ .#e e=terna$ -0 pins s#ou$d not #ave to e "apped if you use 3attQs Buartus -- proJect. -t wi$$
a$ready #ave t#e pins "apped to w#ere t#ey #ave to e "apped.
B+ - #ave t#e .AOR? oard in s$ot 6 and 6asic R? in s$ot 1 of t#e U'R%. - a" tryin7 to 7et t#e
raw 1!; data t#at co"es into t#e &%G1) out on t#e dau7#ter card connector. - wou$d $i9e to use
t#e 1<-it 7enera$ purpose deu7 pins fro" t#e &%G1 on t#e connector on 6asic R?. /owever)
-Ed $i9e to e carefu$ efore - write to t#e direction re7ister usin7 t#e OwriteOoe 7iven t#at an
%a7e :1 of C0
i"proper settin7 can cause da"a7e. 3y @uestion is w#et#er - can #ave ot# .AOR? and 6asic
R? oards p$u77ed in) w#i$e - use t#e OwriteOoeL -f yes) w#at is t#e precaution t#at - #ave to
fo$$owL
1+ 2ou are safe wit# ot# t#e asic oards and t#e .AR?) since t#ey donQt drive any of t#e pins.
B+ - #ave an app$ication w#ere - wi$$ need t#e U'R% 1U? di7ita$ -!0 to contro$ an antenna
switc#in7 networ9 at appro=i"ate$y 1 9/K fre@uencies. /ow far up t#e software c#ain does
support for t#e U'R% 1U? di7ita$ -!0 7oL -s t#ere "uc# support for t#e" at t#e pyt#on $eve$L
1+ .#ere are severa$ ways to do t#is. 1$$ of t#e dau7#teroard -0 pins can e contro$$ed fro"
software) a$$ t#e way up to t#e pyt#on app$ication $eve$. /owever) if you want t#e pins to c#an7e
@uic9$y) you need to do it in t#e &%G1. .#ere is a$ready a "ec#anis" for antenna switc#in7.
Loo9 in t#e autoOtr code in dOf$e=rf.py. 1$so you can use t#e 7rO7pio.
B+ ,#at is t#e 7rO7pioL
1+ gr<g+i" is an e=tension to t#e nor"a$ U'R% fir"ware) i"p$e"ented as an a$ternative &%G1
it strea") usin7 t#e e=istin7 U'R% #ost code. ,it# t#e gr<g+i" co"ponent you can trans"it and
receive a di7ita$ strea" to and fro" t#e U'R% w#ic# is a$i7ned wit# t#e e=istin7 ana$o7 strea".
;i7ita$ data is sent to or received fro" t#e dau7#teroard G%-0 pins and sacrifice one it eac#
fro" t#e - and t#e B ana$o7 strea"s to transport t#e di7ita$ its. 'ee 7nuradio-,i9i.
B+ - wou$d $i9e access to - and B output data *12 its eac#+ fro" 1;5 U<01 usin7 t#e deu7
#eaders fro" two R&?2:00 dau7#teroards. - Hnow t#at:
[ 4ac# dau7#teroard #as 1<-its of 7enera$ purpose i!o.
[ 'ettin7 t#e it "a9es it an output fro" t#e &%G1 to t#e dau7#teroard.
[ .#is re7ister is initia$iKed ased on a va$ue stored in t#e
[ dau7#teroard 44%R03. -n 7enera$) you s#ou$dnQt e usin7 t#is routine
[ wit#out a very 7ood reason. Usin7 t#is "et#od incorrect$y wi$$
[ 9i$$ your U'R% "ot#eroard and!or dau7#teroard.
[!
oo$ OwriteOoe *int w#ic#Odoard) int va$ue) int "as9+;
u T usrp.sin9Oc*0) <:+
side0 T 0 I side 1
u.OwriteOoe*side0) 0=ffff) 0=ffff+ I set a$$ i!o pins as outputs
side1T1 I side 6
u.OwriteOoe*side1) 0=ffff) 0=ffff+ I set a$$ i!o pins as outputs
1+ .#e dau7#teroard and t#e &%G1 are ot# drivin7 at $east pin 2. .#ou7# t#e pins are ca$$ed
N7enera$ purpose i!oN) t#at doesnQt "ean t#e user s#ou$d "ess wit# a$$ of t#e". 'o"e of t#e" are
used y t#e dau7#teroard code to contro$ or read status fro" parts on t#e dau7#teroards.
%a7e :2 of C0
,#ic# pins are safe for t#e user to "ess wit# depends on t#e desi7n of t#e 7iven dau7#teroard.
/ence our scary warnin7 on OwriteOoe.
'tep one:
Loo9 at t#e sc#e"atics for t#e R&?-2:00 oard and fi7ure out w#ic# of t#e 1< -!0 pins are
actua$$y used y t#e .? and R? #a$ves of t#e transceiver dau7#teroard) and w#ic# ones are
avai$a$e for your use. 'ee w#ic# of t#e -!0 pins actua$$y "a9es it to t#e #eader on t#e oard.
'tep two:
Loo9 a7ain and c#ec9 your wor9.
'tep t#ree:
Loo9 at t#e dau7#teroard code *dOf$e=rf.py+. 'ee w#at itQs doin7 to t#e various output ena$es
and -!0 pins. ;oes t#is "atc# your understandin7 of w#ic# pins are avai$a$e for your useL
'tep four:
5onfir" a7ain w#ic# pins are safe for you to e "essin7 wit#.
*- e$ieve t#at t#e #i7# >-its are avai$a$e for your use. -t "i7#t e 8) ut - #avenQt $oo9ed at t#e
sc#e"atics in a O$on7O ti"e. -Q" not 9iddin7 w#en - say OyouO s#ou$d c#ec9 t#e sc#e"atics.+
Now fi7ure out new va$ues for t#e ca$$s to u.OwriteOoe*...+) t#at on$y c#an7e t#e 04 va$ues of t#e
pins t#at "a9e it to t#e #eader and arenQt used for so"e ot#er purpose y t#e code t#atQs
contro$$in7 t#e dau7#teroard.
B+ Ne=t output ena$e t#e deu7 pins and ena$e t#e" as deu7 outputs.
u.OwriteOfp7aOre7*&RO;46UGO4N) LL+ - a" not sure #ow to safe$y output ena$e t#e deu7
outputs. ,ou$d 0=f do t#e JoL
1+ 1$$ t#e output ena$es are contro$$ed usin7 OwriteOoe. &RO;46UGO4N deter"ines w#et#er
t#e deu7 pins are routed to t#e i!o pins or w#et#er t#e nor"a$ writeOio and auto .!R va$ues "a9e
it to t#e #eader. 'ee t#e otto" of "asterOcontro$.v for t#e detai$s.
Given w#at youQ$$ find out after you $oo9 at t#e sc#e"atics) no va$ue of &RO;46UGO4N e=cept
for 0 is safe w#en youQre usin7 two R&?-2:00 oards. -f you can 7et y wit# a sin7$e R&?-2:00)
"y su77estion is t#at you put it on t#e 1-side) and t#en put a 6asic .= and a 6asic R= on t#e 6-
side. .#en youQve 7ot a tota$ of (2 unco""itted -!0 pins on t#e 6-side.

.#e &RO;46UGO4N re7ister wasnQt desi7ned to so$ve every possi$e pro$e". -t so$ved t#e one
we #ad) w#ic# was 7ettin7 deu7 info out to a 6asic R= and!or 6asic .=.
%a7e :( of C0
'augh$erb"ards 7ues$i"ns
B+ -f - want to app$y t#e output *80 o#"+ fro" a function 7enerator direct$y to t#e 6asicR?
inputs) w#at is t#e a$$owed vo$ta7e ran7e t#at can e app$iedL
1+ ,it#out da"a7in7 anyt#in7L
2+ ,it#out e=ceedin7 t#e ran7e of t#e 1;5L
(+ -s t#e input si7na$s need to e ;5 offset so as never to 7o e$ow 7roundL
1+ 1s fo$$ows:
1+ (A p-p s#ou$d e safe) since it wonQt e=ceed t#e (.(A supp$y vo$ta7e.
2+ .#e fu$$-sca$e ran7e of t#e 1;5 is 2A p-p.
(+ No) t#e transfor"er #and$es t#e iasin7. 2ou put in a si7na$ t#at is D!-1A.
B+ - #ave a radio wit# a 10.>3/K rea$ *not co"p$e=+ output t#at - wou$d $i9e to connect to t#e
asic R= dau7#ter oard direct$y.
1+ Just connect t#e rea$ input to t#e input connector) and use 0=f0f0f0f0 settin7 for t#e "u= va$ue
of t#e U'R% source. .#is feeds a Kero into eac# of t#e ;;5 B inputs and 1;50 into t#e ;;5 -
inputs. &or your receiver wit# t#e 10.> 3/K -&) set t#e ;;5 fre@uency to -10.>e< and youQ$$ 7et
co"p$e= aseand across t#e U'6. %ic9 t#e deci"ation va$ue to set t#e widt# of t#e t#e c#anne$
youQre interested in. .#e 1;5 sa"p$e rate is <:e< *adcOfre@*++. ;ivide t#at y t#e deci"ation
factor and t#at wi$$ 7ive you t#e sa"p$e rate across t#e U'6. .#e U'6 sa"p$es are 1<-it - and
1<-it B. i.e.) : ytes!sa"p$e. .#ereQs a fourt#-order 5-5 fi$ter in t#e &%G1) so t#ereQs so"e ro$$-
off across t#e and.
B+ -f we app$y "a=i"u" none distorted input si7na$ to t#e 6asicR? oard) w#at is t#e U'R%
;;5 output va$ueL
1+ Usin7 #i7# accuracy function 7enerator and U'R% wit# 6asic-R? at 0 d6 7ain wit#
deci"ation of 8+:
a+ ,it# 'ine wave si7na$ at fre@uency T280 H/K and =dB input power to 6asicR? we 7et:
.#eoretica$ ca$cu$ations:
,#en 0d6" si7na$ inJected into 80 0#" $oad) t#en we s#ou$d #ave si7na$ R3' T 0.228Ao$t and
'i7na$ vo$ta7e %-% T 0.<(<(C<10(Ao$t.
U'R% readin7s:
.#e "a=i"u" countin7 otained fro" U'R% for t#is si7na$ was >9>5.
+ ,it# 'ine wave si7na$ at fre@uency T280 H/K and 5dB input power to 6asicR? we 7et:
%a7e :: of C0
.#eoretica$ ca$cu$ations:
,#en D8d6" si7na$ inJected into 80 0#" $oad) t#en si7na$ R3' T 0.:Ao$t and 'i7na$ %-% T
1.1(1(>088Ao$t.
U'R% readin7s:
.#e "a=i"u" countin7 otained fro" U'R% for t#is si7na$ was 9??@.
c+ ,it# 'ine wave si7na$ at fre@uency T280 H/K and 8dB input power to 6asicR? we 7et:
.#eoretica$ ca$cu$ations :
,#en DCd6" si7na$ inJected into 80 0#" $oad) t#en si7na$ R3' T 0.<:Ao$t and 'i7na$ %-% T
1.8101C((<Ao$t.
U'R% readin7s:
.#e "a=i"u" countin7 otained fro" U'R% for t#is si7na$ was 1?=8:.
d+ ,it# 'ine wave si7na$ at fre@uency T280 H/K and 1=dB input power to 6asicR? we 7et:
.#eoretica$ ca$cu$ations:
,#en D10d6" si7na$ inJected into 80 0#" $oad) t#en si7na$ R3' T 0.>1Ao$t and 'i7na$ %-% T
2.00818(28CAo$t.
U'R% readin7s:
.#e "a=i"u" countin7 otained fro" U'R% for t#is si7na$ was 1?5@= *'aturated+.

&ro" t#e aove resu$ts we see t#at t#e 61'-5-R? is saturated w#en t#e input si7na$ power was
D10d6". .#is is $o7ica$) since t#e "a=i"u" input si7na$ to t#e U'R% 1;5 1;C8<2 is 2Ao$t %-%
*accordin7 to its data s#eets+. .#e va$ue otained fro" U'R% &%G1 for input si7na$ of 2A %-%
was aout 1(8>0.
B+ /ow R& tunin7 acco"p$is#ed in dau7#teroardsL
1+ ,e #ave to understand t#e co""ents aout tunin7 ein7 a Ntwo-step processNL &irst we as9
t#e front-end to tune as c$ose to t#e desired fre@uency as it can *&or e=a"p$e) on t#e R&? oards)
t#e %LL step siKe is : 3/K.+. .#en we use t#e resu$t of t#at operation and our tar7etOfre@uency
to deter"ine t#e va$ue for t#e di7ita$ down converter.
.#e return va$ue fro" tune software function is an instance of tuneOresu$t w#ic# can e e=a"ined
to see #ow everyt#in7 was setup:
1- .#e aseandOfre@ is t#e R& fre@uency t#at corresponds to ;5 in t#e R& front-end -&
output *t#e input to t#e 1!;Qs and fro" t#ere to t#e di7ita$ down-converter+. Note t#at t#is
isnQt necessari$y t#e $ocation of t#e si7na$ of interest. 'o"e dau7#teroards #ave t#e
si7na$ of interest at a non-Kero -& fre@uency.
2- .#e d=cOfre@ is t#e fre@uency va$ue used in t#e di7ita$ down or up converter.
(- .#e residua$Ofre@ is a very s"a$$ nu"er on t#e order of 1!100 of a /K. -t can e i7nored.
:- .#e -nverted is true if t#e spectru" is inverted) and we werenQt a$e to fi= it for you.
%a7e :8 of C0
0n t#e receive pat#) t#e end resu$t of tune is t#at t#e si7na$ at t#e 7iven tar7et R& fre@uency
ends up at ;5 in t#e co"p$e= aseand input fro" t#e U'R%.
Note:
1stract$y) .? and R? dau7#teroards can e sp$it into two 7enera$ cate7ories:
1- .#ose t#at use ot# converters as a pair *oards doin7 @uadrature up or down conversion+
and
2- .#ose t#at can use t#e converters independent$y.
6ecause weQre usin7 t#e di7ita$ up converter in t#e 1;C8<2 in N;ua$ 5#anne$ 5o"p$e= ;15
;ata 3odeN) ot# ;!1 outputs are re$ated *-_B+ and as a resu$t) a$$ .? dau7#teroards are
N@uadratureN oards.
0n t#e receive side weQve 7ot a it "ore variation. .#e .AOR? oard *for e=a"p$e+ is [not[ a
@uadrature oard) since it on$y uses a sin7$e 1!;.
0n t#e R&? transceiver oards *:00) C00) 1200 and 2:00+) ot# t#e .= side and R= side are
@uadrature.
B+ ,#at is a sudeviceL
1+ .#e .? or R? dau7#teroard consists of eit#er one or two sudevices. Buadrature oards
#ave a sin7$e sudevice. Non-@uadrature oards #ave one or two sudevices and it is dependin7
on t#e dau7#teroard desi7n.
.#e funda"enta$ capai$ities of a sudevice are t#e ai$ity to tune and set 7ain. 4ac# sudevice
#as a dau7#teroard specific c$ass t#at is derived fro" dOase.py *in 7r-usrp+.
.#e visi$e "et#ods are:
def did*se$f+:
NNN
Returns inte7er dau7#teroard -; fro" 44%R03
NNN
def na"e*se$f+:
NNN
Na"e of dau7#teroard. 4.7.) N.A R=N
NNN
def fre@Oran7e*se$f+:
NNN
Return ran7e of fre@uencies in /K t#at can e tuned y t#is dau7#teroard.
\returns *"inOfre@) "a=Ofre@) stepOsiKe+
\rtype tup$e
NNN
def setOfre@*se$f) tar7etOfre@+:
NNN
%a7e :< of C0
'et t#e fre@uency.
\para" fre@: tar7et R& fre@uency in /K
\type fre@: f$oat
\returns *o9) actua$OaseandOfre@+ w#ere:
o9 is .rue or &a$se and indicates success or fai$ure)
actua$OaseandOfre@ is t#e R& fre@uency t#at corresponds to ;5 in
t#e -&.
NNN
def 7ainOran7e*se$f+:
NNN
Return ran7e of 7ain t#at can e set y t#is dau7#teroard.
\returns *"inO7ain) "a=O7ain) stepOsiKe+
,#ere 7ains are e=pressed in decie$s *your "i$ea7e "ay vary+
NNN
def setO7ain*se$f) 7ain+:
NNN
'et t#e 7ain.
\para" 7ain: 7ain in decie$s
\returns .rue!&a$se
NNN
def isO@uadrature*se$f+:
NNN
Return .rue if t#is dau7#teroard does @uadrature up or down conversion.
.#at is) return .rue if t#is oard re@uires ot# - _ B ana$o7 c#anne$s.
.#is it of info is usefu$ w#en settin7 up t#e U'R% R= "u= re7ister.
NNN
,#en we create an instance of a usrp source or sin9) we now 7et an additiona$ attriute) NdN) t#at
$ets us contro$ t#e dau7#teroard sudevices.
u T usrp.sourceOc*0) <:+
u.d is a tup$e of $en7t# 2.
u.dR0S contains a tup$e of t#e sudevices for Nside 1N
u.dR1S contains a tup$e of t#e sudevices for Nside 6N
.#e tup$es of sudevices eac# #ave eit#er 1 or 2 e$e"ents dependin7 on t#e dau7#teroard
insta$$ed on t#e respective side. 4ac# sudevice is an instance of a c$ass t#atQs derived fro"
dOase and e=ports t#e "et#ods $isted aove. ,#en weQre tunin7) t#ere are rea$$y at $east two
9nos to twist:
%a7e :> of C0
*1+ 'o"e 9ind of %LL on t#e dau7#teroard t#at deter"ines w#at R& fre@uency appears in t#e
-&.
*2+ .#e di7ita$ down converter t#at e=tracts t#e and of interest fro" t#e di7itiKed -&.
Given a tar7et fre@uency) we contro$ t#e" ot# $i9e t#is:
def setOfre@*se$f) tar7etOfre@+:
NNN
'et t#e center fre@uency weQre interested in.
\para" tar7etOfre@: fre@uency in /K
\rtype: oo$
.unin7 is a two step process. &irst we as9 t#e front-end to
tune as c$ose to t#e desired fre@uency as it can. .#en we use
t#e resu$t of t#at operation and our tar7etOfre@uency to
deter"ine t#e va$ue for t#e di7ita$ down converter.
NNN
I se$f.sudev is t#e sudevice we are contro$$in7
o9) aseandOfre@ T sudev.setOfre@*tar7etOfre@+
ddcOfre@) inverted T usrp.ca$cOd=cOfre@*tar7etOfre@) aseandOfre@) se$f.u.converterOrate*++
o9 _T se$f.u.setOr=Ofre@*0) ddcOfre@+

.#e Loca$ 0sci$$ator *L0+ fre@uency of t#e R&? oards is set auto"atica$$y w#en we set t#e
fre@uency of reception or trans"ission. .#e L0 is a "u$tip$e of 2 or : 3/K dependin7 on w#ic#
R&? oard we #ave. ,e can c#an7e t#at to e a "u$tip$e of 13/K) ut we wi$$ #ave worse p#ase
noise.
B+ -n L&R? oard) wit# t#e input open) - "easure 108 "A on t#e '31 connector and a ;5
co"ponent fro" t#e 1;5. ,#at is t#e pro$e"L
1+ -f you connect a 80 o#" resistor across t#e '31) you do indeed 7et <2"A at t#e connector)
ut 0A at t#e 1;5) w#ic# is w#at we rea$$y care aout. -f you $eave t#e '31 open) you do 7et a
s"a$$ vo$ta7e ein7 read at t#e 1;5.
'o yes) t#e L&R? does #ave ;5 ias on its input) ut as $on7 as you drive it wit# a 80 o#" $oad)
you 7et t#e ri7#t answer at t#e 1;5. .#e L&R? wasnQt desi7ned for "easurin7 ;5 vo$ta7es)
a$t#ou7# it can as $on7 as you #ave a 80 o#" source. 1nd if your source is not 80 o#"s) you can
do t#e ca$cu$ations necessary to sca$e t#e 7ain. 1$so) p$ease note t#at t#e a"p is invertin7) so if
you put 1A t#rou7# 80 o#"s into t#e '31) t#e 1;5 wi$$ te$$ you t#at it is -1A.
%a7e :8 of C0
B+ .#e 74;1 %56 $ayout pro7ra" returns i$$e7a$ fi$e for"at w#en openin7 R&? oards)
#owever) it reads t#e asic R?!.? dau7#ter oards) w#yL
1+ .#e R&? dau7#teroard %56s were desi7ned usin7 a co""ercia$ pro7ra" ca$$ed %1;') not
usin7 %56 fro" t#e 74;1 suite.
B+ 5an any one te$$ "e #ow far apart t#e '31 connectors are set on t#e asic .? dau7#ter oard;
-E" tryin7 to desi7n a %56 to "atc# up wit# it.
1+ 0.8>0 inc#es
B+ /ow we can 9now w#at our dau7#teroard type isL
1+ 2ou can find out w#at version you #ave y runnin7 print-d in t#e usrp!#ost!apps directory.
B+ ,#at is invo$ved in c#an7in7 an R&?2:00 to an R&?1200L
1+ .o convert to an R&?1200) you need to:
- 5ut t#e traces w#ic# &-L1
- %ut a capacitor in 520:) anyt#in7 etween aout 80p& and 1000p& is fine) siKe 0<0(
- %ut t#e oard on side 1 of a U'R%) power it up) and reurn t#e 44%R03 usin7 t#e co""and
usrp!#ost!apps!urn-d-eepro" -1 -f -t rf=1200O"i"oO
2ou can a$so c#an7e so"e of t#e fina$ a"p tunin7 co"ponents if t#e power out is a $itt$e $ow..#is
is not a$ways necessary) ut so"eti"es 7ets anot#er d6 of e=tra power.
B+ ,#at is invo$ved in c#an7in7 an R&?C00 to an R&?1800L
.o convert t#e you on$y #ave to do ( t#in7s:
1. 5ut t#e traces w#ic# 7o to &-L1.
2. %ut a capacitor in 520:.
(. Run t#e fo$$owin7 co""and:
.!urn-d-eepro" -1 --force -t rf=1800O"i"oO
-f you cut t#e fi$ter out you need to co"p$ete t#e si7na$ pat# y popu$atin7 520: wit# a capacitor
in rou7#$y t#e 100p& to 10)000p& ran7e *I&-?34I+. Aery #i7# capacitor va$ues #ave ad
parasitic effects -- 0.1u& is fine ut donQt use 10u&. .o turn it ac9 into a R&?C00 a7ain) or to turn
your R&?1800 into a R&?C00) you can run t#e co""and:
.!urn-d-eepro" -1 --force -t rf=C00O"i"oO
%a7e :C of C0
B+ - cou$dnQt find any docu"entation on w#at is stored in t#e U'R% dau7#teroards 44%R03sL

1+ .#e 44%R03s on t#e dau7#teroards asica$$y store an identifier for t#e type of oard) and
can store so"e ;5 offsets and t#e $i9e. .#e dau7#teroard 44%R03 for"at is defined in
usrp!fir"ware!inc$ude!usrpOi2cOaddr.#
B+ - wou$d $i9e to deve$op a user dau7#ter card) to interface wit# t#e U'R% "ot#eroard) %$ease
7ive "e so"e c$ues *pointer to infor"ation+ to 9now w#at s#ou$d e written in t#e R03
*44%R03+ and conse@uences in t#e devices pro7ra""in7L
1+ .#e for"at of t#e R03 is docu"ented in usrp!fir"ware!inc$ude!usrpOi2cOaddr.#. Just e sure
t#at ytes 0=00 t#rou7# 0=02 "a9e sense. 2ou can set t#e re"ainder to 0=00) ut e sure to set
t#e c#ec9su" correct$y in 0=1f. .#ereQs a script t#at wi$$ do t#is for you over t#e U'6. 'ee
usrp!#ost!apps!urn-d-eepro".
.#e re$evant portion is:
!! for"at of dau7#teroard 44%R03
!! 00: 0=;6 code for YY-Q" a dau7#teroardQQ
!! 01: .. ;au7#teroard -; *L'6+
!! 02: .. ;au7#teroard -; *3'6+
!! 0(: .. io its >-0 direction *it set if itQs an output fro" "ot#eroard+
!! 0:: .. io its 18-8 direction *it set if itQs an output fro" "ot#eroard+
!! 08: .. 1;50 ;5 offset correction *L'6+
!! 0<: .. 1;50 ;5 offset correction *3'6+
!! 0>: .. 1;51 ;5 offset correction *L'6+
!! 08: .. 1;51 ;5 offset correction *3'6+
!! ...
!! 1f: .. ne7ative of t#e su" of ytes R0=00) 0=1eS
Idefine ;6O44%R03O31G-5 0=00
Idefine ;6O44%R03O31G-5OA1LU4 0=;6
Idefine ;6O44%R03O-;OL'6 0=01
Idefine ;6O44%R03O-;O3'6 0=02
Idefine ;6O44%R03O04OL'6 0=0(
Idefine ;6O44%R03O04O3'6 0=0:
Idefine ;6O44%R03O0&&'4.O0OL'6 0=08 !! offset correction for 1;5 or ;15 0
Idefine ;6O44%R03O0&&'4.O0O3'6 0=0<
Idefine ;6O44%R03O0&&'4.O1OL'6 0=0> !! offset correction for 1;5 or ;15 1
Idefine ;6O44%R03O0&&'4.O1O3'6 0=08
Idefine ;6O44%R03O5/H'U3 0=1f
%a7e 80 of C0
Idefine ;6O44%R03O5L4N 0=20 !! $en7t# of co""on portion of 44%R03
2ou can use t#e e=istin7 N4=peri"enta$ R=N dau7#teroard id) 0=ffff) or define a new one. 'ee
usrp!#ost!$i!$e7acy!usrpOdid.dat
.#e did is read fro" t#e dau7#teroards and is use to instantiate t#e correct dau7#teroard code.
2ou can see w#at youQve 7ot y ca$$in7 u.dau7#teroardOid*0+ and u.dau7#teroardOid*1+ to
retrieve t#e didQs fro" s$ots 0 and 1.
.o ta$9 to your dau7#teroard usin7 our standard interface) youQ$$ need to write a it of pyt#on.
.a9e a $oo9 at 7r-usrp!src!dO[.py. 'tart wit# dOase.py) t#en "aye dOasic.py
%a7e 81 of C0
)AA 2n$erfa#ing 7ues$i"ns
B+ /ow we can write Linu= 5DD app$ication pro7ra" to interface wit# U'R%L
1+ /ere it #ow we can do it:
1- .#e 7nuradio proJect provides a co"p$ete U'R% interface $irary. ,#en co"pi$in7 t#e
interface pro7ra") t#ese $irary "ust e $in9ed wit# our code y usin7 GDD $irary co""and
*-$usrp+.
2- .o s#ow t#e used procedure) suppose we #ave written a 5DD U'R% interface pro7ra" ca$$ed
usrpOtestOcDD.cpp. .o co"pi$e t#is pro7ra") we use t#e fo$$owin7 co""and:
d 7DD usrpOtestOcDD.cpp eo testusrp e$usrp
,#ere:
7DD is t#e GNU 5DD co"pi$er
usrpOtestOcDD.cpp is our cDD source fi$e
testusrp is our output fi$e
-$usrp is t#e U'R% 5DD $irary
Note:
.#e fo$$owin7 U'R% two #eader fi$es s#ou$d e in t#e sa"e co"pi$ation directory:
fp7aOre7sOco""on.#
fp7aOre7sOstandard.#
(- .o run t#e output fi$e fro" Linu= co""and $ine:
.!testusrp
B+ -s t#ere a si"p$e 5DD U'R% interfacin7 de"onstration pro7ra"L
1+ 6e$ow is t#e $ist for suc# pro7ra"
!! 'i"p$e 5DD U'R% interfacin7 de"onstration pro7ra"
!!
!!
!! .#is pro7ra" was derived and "odified fro" testOusrpOstandardOr=.cc
![ -[- cDD -[- [!
![
[ 5opyri7#t 200()200<)200>)2008 &ree 'oftware &oundation) -nc.
[
[ .#is fi$e is part of GNU Radio
[
%a7e 82 of C0
[ GNU Radio is free software; you can redistriute it and!or "odify
[ it under t#e ter"s of t#e GNU Genera$ %u$ic License as pu$is#ed y
[ t#e &ree 'oftware &oundation; eit#er version () or *at your option+
[ any $ater version.
[
[ GNU Radio is distriuted in t#e #ope t#at it wi$$ e usefu$)
[ ut ,-./0U. 1N2 ,1RR1N.2; wit#out even t#e i"p$ied warranty of
[ 34R5/1N.16-L-.2 or &-.N4'' &0R 1 %1R.-5UL1R %UR%0'4. 'ee t#e
[ GNU Genera$ %u$ic License for "ore detai$s.
[
[ 2ou s#ou$d #ave received a copy of t#e GNU Genera$ %u$ic License
[ a$on7 wit# GNU Radio; see t#e fi$e 50%2-NG. -f not) write to
[ t#e &ree 'oftware &oundation) -nc.) 81 &ran9$in 'treet)
[ 6oston) 31 02110-1(01) U'1.
[!
Iinc$ude NusrpOstandard.#N
!! ;u"y &unction to process U'R% data
void processOdata*int [uffer+
W
X
Idefine '13%4L'O%4ROR41; *812+ !! 3ust e a "u$tip$e of 128
int
"ain *int ar7c) c#ar [[ar7v+
W
oo$ $oopac9Op T fa$se;
oo$ countin7Op T fa$se;
oo$ widt#O8Op T fa$se;
int w#ic#Ooard T 0;
int deci" T 8; !! (2 36!sec
dou$e centerOfre@ T 0;
int fusO$oc9OsiKe T 0;
int fusOn$oc9s T 0;
int nc#anne$s T 1;
int 7ain T 0;
int "ode T 0;
int noverruns T 0;
oo$ overrun;
int tota$Oreads T 10000;
int i;
int ufR'13%4L'O%4ROR41;S;
int ufsiKe T '13%4L'O%4ROR41;[:;
if *$oopac9Op+ "ode bT usrpOstandardOr=::&%G1O30;4OL00%615H;
%a7e 8( of C0

if *countin7Op+ "ode bT usrpOstandardOr=::&%G1O30;4O50UN.-NG;
usrpOstandardOr= [ur= T usrpOstandardOr=::"a9e *w#ic#Ooard) deci") 1) -1) "ode)
fusO$oc9OsiKe) fusOn$oc9s+;
if *ur= TT 0+
W
fprintf *stderr) N4rror: usrpOstandardOr=::"a9e^nN+;
e=it *1+;
X
if *widt#O8Op+
W
int widt# T 8;
int s#ift T 8;
oo$ wantO@ T true;
if *Uur=-ZsetOfor"at*usrpOstandardOr=::"a9eOfor"at*widt#) s#ift) wantO@+++
W
fprintf *stderr) N4rror: ur=-ZsetOfor"at^nN+;
e=it *1+;
X
X
!! 'et ;;5 center fre@uency
ur=-ZsetOr=Ofre@ *0) centerOfre@+;
!! 'et Nu"er of c#anne$s
ur=-ZsetOnc#anne$s*1+;
!! 'et 1;5 %G1 7ain
ur=-ZsetOp7a*0)7ain+;
!! 'et &%G1 3u=
ur=-ZsetO"u=*0=(210(210+; !! 6oard 1 on$y
!! 'et ;;5 deci"ation rate
ur=-ZsetOdeci"Orate*deci"+;
!! 'et ;;5 p#ase
ur=-ZsetOddcOp#ase*0)0+;
ur=-Zstart*+; !! 'tart data transfer
%a7e 8: of C0
printf*NU'R% .ransfer 'tarted^nN+;
!! ;o U'R% 'a"p$es Readin7
for *i T 0; i a tota$Oreads; iDD+
W
ur=-Zread*_uf) ufsiKe) _overrun+;
if *overrun+
W
printf *NU'R% R= 0verrun^nN+;
noverrunsDD;
X
!! ;o w#atever you want wit# t#e data
processOdata*_ufR0S+;
X
ur=-Zstop*+; !! 'top data transfer
printf*NU'R% .ransfer 'toped^nN+;
de$ete ur=;
return 0;
X
B+ 5urrent$y) a$$ U'R% dau7#teroards contro$ is #and$ed fro" %yt#on. ,#ere - can find t#e 5DD
drivers for t#ese oardsL
1+ .#e 7nuradio tea" is deve$opin7 an a$$ 5DD dau7#teroards drivers R- donEt 9now if t#ey
finis#ed itS. .#ere are so"e 7nuradio users t#at deve$oped t#eir own 5DD drivers ut t#ey did not
pu$is# it yet R- .#in9 .#ey '#ou$dS.
.#e on$y pu$is#ed 5DD driver was for ;6'R? dau7#teroard y Gre7ory , /ec9$er.
B+ 5an we use Gre7ory ;6'R? driver direct$yL /owL
1+ 2es. 'ee t#e pro7ra" e$ow *&ro" Gre7ory we site www.7ps-sdr.co"+. .#is is t#e 3ain.cpp
pro7ra". .#e pro7ra") i"p$e"ents a t#read safe routines for data recordin7 fro" t#e U'R% to
#arddis9 drive. .#e pro7ra" is $isted #ere for a docu"entation purpose.
Iinc$ude aunistd.#Z
Iinc$ude aerrno.#Z
Iinc$ude actype.#Z
Iinc$ude asys!types.#Z
%a7e 88 of C0
Iinc$ude asys!stat.#Z
Iinc$ude afcnt$.#Z
Iinc$ude aiostrea"Z
Iinc$ude astdio.#Z
Iinc$ude a"at#.#Z
Iinc$ude apt#read.#Z
Iinc$ude asc#ed.#Z
Iinc$ude NusrpOpri"s.#N
Iinc$ude NusrpOspiOdefs.#N
Iinc$ude Nus.#N
Iinc$ude NusrpOstandard.#N
Iinc$ude NusrpOytese=.#N
Iinc$ude Nfp7aOre7sOco""on.#N
Iinc$ude Nfp7aOre7sOstandard.#N
Iinc$ude NusrpOi2cOaddr.#N
Iinc$ude NdOdsOr=.#N
usin7 na"espace std;
typedef struct O5%?
W
s#ort r;
s#ort i;
X 5%?;
typedef struct Ooptions
W
int rea$ti"e;
int oardOa;
int oardO;
int deci"ate;
int softOdeci"ate;
int inte7rate;
int verose;
int s#ift;
dou$e 7a;
dou$e 7;
dou$e 7i;
dou$e 7r;
dou$e fO$o;
dou$e fOddc;
dou$e seconds;
dou$e andwidt#;
c#ar fi$ena"eR102:S;
X options;
!!1.5/UNGUUUUUUUUUUUUUUUUUUUU
!!'et t#is to t#e "ainoardQs c$oc9 fre@uency
!!Idefine &O'13%L4 *<8.8(<e<+
Idefine &O'13%L4 *<:.0e<+
Idefine &O'13%L4ON03 *<:e<+
Idefine ;;5O&-? *&O'13%L4ON03!&O'13%L4+
Idefine '13%'O%4ROR41; *20:8+
Idefine R41; *0+
Idefine ,R-.4 *1+
void %ost'tatus*c#ar [Ostr+ Wfprintf*stdout)NMsN)Ostr+; ff$us#*stdout+;X
int record*options [Oopt+;
void [dis9Ot#read*void [Oopt+;
void [inte7rateOt#read*void [Oar7+;
void [9eyOt#read*void [Oar7+;
int dis9OpipeR2S;
int inte7rateOpipeR2S;
oo$ 7run;
void usa7e*c#ar [Ostr+
W
fprintf*stderr) Nusa7e: R-RS R-sS R-1S R-6S R-oS R-dS R-;S R-fS R-7rS R-7iS R-$S R-wS^nN+;
fprintf*stderr) NR-RS run in rea$ti"e *data written to na"ed pipe+^nN+;
%a7e 8< of C0
fprintf*stderr) NR-sS asecondsZ to record^nN+;
fprintf*stderr) NR-iS asa"p$esZ inte7ration period^nN+;
fprintf*stderr) NR-1S record fro" R? oard 1^nN+;
fprintf*stderr) NR-6S record fro" R? oard 6^nN+;
fprintf*stderr) NR-oS afi$ena"eZ output fi$e na"e^nN+;
fprintf*stderr) NR-;S adeci"ationZ software deci"ation *1-1<+ ^nN+;
fprintf*stderr) NR-dS adeci"ationZ U'R% deci"ation *8-128+^nN+;
fprintf*stderr) NR-fS afre@uencyZ di7ita$ downconvert fre@uency^nN+;
fprintf*stderr) NR-7aS a7ainZ set -& 7ain for oard 1 *6asic R? on$y+^nN+;
fprintf*stderr) NR-7S a7ainZ set -& 7ain for oard 6 *6asic R? on$y+^nN+;
fprintf*stderr) NR-7rS a7ainZ set rf 7ain in d6 *;6'R? on$y+^nN+;
fprintf*stderr) NR-7iS a7ainZ set if 7ain in d6 *;6'R? on$y+^nN+;
fprintf*stderr) NR-$S afre@uencyZ R& downconvert fre@uency *;6'R? on$y+^nN+;
fprintf*stderr) NR-wS aandwidt#Z andwidt# of $owpass fi$ter *6;'R? on$y+^nN+;
ff$us#*stderr+;
e=it*1+;
X
void ec#oOoptions*options [Oopt+
W
![ 'tep one) find out w#at dau7#teroards are popu$ated [!
![ 0pen t#e ase R? c$ass [!
usrpOstandardOr= [ur= T usrpOstandardOr=::"a9e*0) 8) 1) -1) 0) 0) 0+;
if*ur= TT NULL+
W
printf*NusrpOstandardOr=::"a9e &1-L4;^nN+;
return;
X
switc#*ur=-Zdau7#teroardOid*0++
W
case 1:
fprintf*stdout)N6oard 1:^t^t6asic R?^nN+; rea9;
case 2:
fprintf*stdout)N6oard 1:^t^t;6' R?^nN+; rea9;
defau$t:
fprintf*stdout)N6oard 1:^t^tUn9nown^nN+; rea9;
X
switc#*ur=-Zdau7#teroardOid*1++
W
case 1:
fprintf*stdout)N6oard 1:^t^t6asic R?^nN+; rea9;
case 2:
fprintf*stdout)N6oard 1:^t^t;6' R?^nN+; rea9;
defau$t:
fprintf*stdout)N6oard 1:^t^tUn9nown^nN+; rea9;
X
fprintf*stdout) NRea$ti"e^t^tMd^nN)Oopt-Zrea$ti"e+;
fprintf*stdout) N'econds:^t^tMf^nN)Oopt-Zseconds+;
fprintf*stdout) N-nte7ration:^t^tMd^nN)Oopt-Zinte7rate+;
fprintf*stdout) N6oard 1 Record:^t^tMd^nN)Oopt-ZoardOa+;
fprintf*stdout) N6oard 6 Record:^t^tMd^nN)Oopt-ZoardO+;
fprintf*stdout) N&i$ena"e:^t^tMs^nN)Oopt-Zfi$ena"e+;
fprintf*stdout) N'oft ;eci"ation:^tMd^nN)Oopt-ZsoftOdeci"ate+;
fprintf*stdout) NU'R% ;eci"ation:^tMd^nN)Oopt-Zdeci"ate+;
fprintf*stdout) N;;5 &re@uency:^t^tMf^nN)Oopt-ZfOddc+;
fprintf*stdout) N6asic R? Gain:^t^tMf^nN)Oopt-Z7a+;
fprintf*stdout) N6asic R? Gain:^t^tMf^nN)Oopt-Z7+;
fprintf*stdout) NR& Gain:^t^tMf^nN)Oopt-Z7r+;
fprintf*stdout) N-& Gain:^t^tMf^nN)Oopt-Z7i+;
fprintf*stdout) N;6'R? L0:^t^tMf^nN)Oopt-ZfO$o+;
fprintf*stdout) N;6'R? 6andwidt#:^tMf^nN)Oopt-Zandwidt#+;
de$ete ur=;
X
int "ain*int ar7c) c#ar [[ar7v+
W
%a7e 8> of C0
options recordOoptions;
c#ar [parse;
![ 'et defau$t recordin7 options [!
recordOoptions.rea$ti"e T 0;
recordOoptions.oardOa T 1;
recordOoptions.oardO T 0;
recordOoptions.deci"ate T (2;
recordOoptions.softOdeci"ate T 1;
recordOoptions.inte7rate T 0;
recordOoptions.verose T 0;
recordOoptions.s#ift T 0;
recordOoptions.7r T :0;
recordOoptions.7i T 10;
recordOoptions.7a T 0;
recordOoptions.7 T 0;
recordOoptions.fO$o T 1.8>8:2eC;
recordOoptions.fOddc T 0;
recordOoptions.seconds T 1.0;
recordOoptions.andwidt# T :.0e<;
strcpy*recordOoptions.fi$ena"e) NdataN+;
for*int $cv T 1; $cv a ar7c; $cvDD+
W
switc# *ar7vR$cvSR1S+
W
case QsQ:
$cvDD;
if*isdi7it*ar7vR$cvSR0S++
recordOoptions.seconds T strtod*ar7vR$cvS) _parse+;
e$se
usa7e *ar7vR0S+;
rea9;
case QiQ:
$cvDD;
if*isdi7it*ar7vR$cvSR0S++
recordOoptions.inte7rate T strto$*ar7vR$cvS) _parse) 10+;
e$se
usa7e *ar7vR0S+;
rea9;
case Q1Q:
recordOoptions.oardOa T 1;
rea9;
case Q6Q:
recordOoptions.oardO T 1;
rea9;
case QoQ:
$cvDD;
strcpy*recordOoptions.fi$ena"e) ar7vR$cvS+;
rea9;
case QdQ:
$cvDD;
if*isdi7it*ar7vR$cvSR0S++
recordOoptions.deci"ate T strto$*ar7vR$cvS) _parse) 10+;
e$se
usa7e *ar7vR0S+;
rea9;
case Q;Q:
$cvDD;
if*isdi7it*ar7vR$cvSR0S++
recordOoptions.softOdeci"ate T strto$*ar7vR$cvS) _parse) 10+;
e$se
usa7e *ar7vR0S+;
rea9;
%a7e 88 of C0
case QfQ:
$cvDD;
recordOoptions.fOddc T strtod*ar7vR$cvS) _parse+;
rea9;
case Q7Q:
if*ar7vR$cvSR2S TT QrQ+
W
$cvDD;
if*isdi7it*ar7vR$cvSR0S++
recordOoptions.7r T strtod*ar7vR$cvS) _parse+;
e$se
usa7e *ar7vR0S+;
rea9;
X
e$se if*ar7vR$cvSR2S TT QiQ+
W
$cvDD;
if*isdi7it*ar7vR$cvSR0S++
recordOoptions.7i T strtod*ar7vR$cvS) _parse+;
e$se
usa7e *ar7vR0S+;
rea9;
X
e$se if*ar7vR$cvSR2S TT QaQ+
W
$cvDD;
if*isdi7it*ar7vR$cvSR0S++
recordOoptions.7a T strtod*ar7vR$cvS) _parse+;
e$se
usa7e *ar7vR0S+;
rea9;
X
e$se if*ar7vR$cvSR2S TT QQ+
W
$cvDD;
if*isdi7it*ar7vR$cvSR0S++
recordOoptions.7 T strtod*ar7vR$cvS) _parse+;
e$se
usa7e *ar7vR0S+;
rea9;
X
e$se
usa7e*ar7vR0S+;
rea9;
case Q$Q:
$cvDD;
if*isdi7it*ar7vR$cvSR0S++
recordOoptions.fO$o T strtod*ar7vR$cvS) _parse+;
e$se
usa7e *ar7vR0S+;
rea9;
case QwQ:
$cvDD;
if*isdi7it*ar7vR$cvSR0S++
recordOoptions.andwidt# T strtod*ar7vR$cvS) _parse+;
e$se
usa7e *ar7vR0S+;
rea9;
case QvQ:
recordOoptions.verose T 1;
rea9;
case QRQ:
recordOoptions.rea$ti"e T 1;
rea9;
defau$t:
usa7e *ar7vR0S+;
X
%a7e 8C of C0
X
struct sc#edOpara" para";
sc#edO7etpara"*0) _para"+;
para".OOsc#edOpriority T CC;
sc#edOsetpara"*0) _para"+;
![ 4c#o t#e record options [!
ec#oOoptions*_recordOoptions+;
![ 5a$$ t#e recordin7 function [!
record*_recordOoptions+;
e=it*1+;
X
int record*options [Oopt+
W
pt#readOt pdis9Ot#read;
pt#readOt pinte7rateOt#read;
pt#readOt p9eyOt#read;
dOdsOr= [dsOr=Oa T NULL;
dOdsOr= [dsOr=O T NULL;
dou$e ddcOcorrect T 0;
int uffR'13%'O%4ROR41;S;
int uffsiKe T '13%'O%4ROR41;[:;
int $cv) tota$Oreads) 9) $cv2;
int npipe;
oo$ overrun;
![ 3a9e t#e UR? [!
usrpOstandardOr= [ur= T usrpOstandardOr=::"a9e*0) Oopt-Zdeci"ate) 1) -1) 0) 0) 0+;
if*ur= TT NULL+
W
printf*NusrpOstandardOr=::"a9e &1-L4;^nN+;
return*-1+;
X
![ N c#anne$s accordin7 to w#ic# oards are ena$ed [!
ur=-ZsetOnc#anne$s*Oopt-ZoardOa D Oopt-ZoardO+;
![ 5reate ;6O;6'OR? oJect if t#e dau7#ter oard -; "atc#es [!
if*ur=-Zdau7#teroardOid*0+ TT 2+
W
dsOr=Oa T new dOdsOr=*ur=) 0+;
dsOr=Oa-Zandwidt#*Oopt-Zandwidt#+;
dsOr=Oa-ZifO7ain*Oopt-Z7i+;
dsOr=Oa-ZrfO7ain*Oopt-Z7r+;
dsOr=Oa-Ztune*Oopt-ZfO$o+;
if*Oopt-Zverose+
W
printf*N;6'-R? 1 6,: ^t^tMf^nN)dsOr=Oa-Zw*++;
printf*N;6'-R? 1 L0: ^t^tMf^nN)dsOr=Oa-Zfre@*++;
printf*N;6'-R? 1 -& Gain: ^tMf^nN)dsOr=Oa-ZifO7ain*++;
printf*N;6'-R? 1 R& Gain: ^tMf^nN)dsOr=Oa-ZrfO7ain*++;
printf*N;6'-R? 1 ;iff: ^t^tMf^nN)dsOr=Oa-Zfre@*+-Oopt-ZfO$o+;
X
![ 1dd additiona$ fre@uency to ddc to account for i"precise L0 pro7ra""in7 [!
ddcOcorrect T dsOr=Oa-Zfre@*+ - Oopt-ZfO$o;
X
e$se
W
ur=-ZsetOp7a*0) Oopt-Z7a+;
X
![ 5reate ;6O;6'OR? oJect if t#e dau7#ter oard -; "atc#es [!
if*ur=-Zdau7#teroardOid*1+ TT 2+
W
dsOr=O T new dOdsOr=*ur=) 1+;
dsOr=O-Zandwidt#*Oopt-Zandwidt#+;
dsOr=O-ZifO7ain*Oopt-Z7i+;
%a7e <0 of C0
dsOr=O-ZrfO7ain*Oopt-Z7r+;
dsOr=O-Ztune*Oopt-ZfO$o+;
if*Oopt-Zverose+
W
printf*N;6'-R? 6 6,: ^t^tMf^nN)dsOr=O-Zw*++;
printf*N;6'-R? 6 L0: ^t^tMf^nN)dsOr=O-Zfre@*++;
printf*N;6'-R? 6 -& Gain: ^tMf^nN)dsOr=O-ZifO7ain*++;
printf*N;6'-R? 6 R& Gain: ^tMf^nN)dsOr=O-ZrfO7ain*++;
printf*N;6'-R? 6 ;iff: ^t^tMf^nN)dsOr=O-Zfre@*+-Oopt-ZfO$o+;
X
![ 1dd additiona$ fre@uency to ddc to account for i"precise L0 pro7ra""in7 [!
ddcOcorrect T dsOr=O-Zfre@*+ - Oopt-ZfO$o;
X
e$se
W
ur=-ZsetOp7a*2) Oopt-Z7+;
X
![ 'et t#e "u= [!
if**Oopt-ZoardOa D Oopt-ZoardO+ Z 1+
ur=-ZsetO"u=*0=(210(210+; !!for ot# c#anne$s
e$se if*Oopt-ZoardOa+
ur=-ZsetO"u=*0=(210(210+; !!oard 1 on$y
e$se
ur=-ZsetO"u=*0=10(210(2+; !!oard 6 on$y
![ 'et t#e deci"ation [!
ur=-ZsetOdeci"Orate*Oopt-Zdeci"ate+;
![ 'et t#e ;;5 fre@uency [!
Oopt-ZfOddc DT ddcOcorrect;
Oopt-ZfOddc [T ;;5O&-?;
if*Oopt-ZfOddc Z *&O'13%L4ON03!2.0++
Oopt-ZfOddc T &O'13%L4ON03 - Oopt-ZfOddc;
ur=-ZsetOr=Ofre@*0) Oopt-ZfOddc+;
ur=-ZsetOr=Ofre@*1) Oopt-ZfOddc+;
![ Reset ;;5 p#ase to Kero [!
ur=-ZsetOddcOp#ase*0) 0+;
ur=-ZsetOddcOp#ase*1) 0+;
printf*N;;5 0: ^t^t^tMf^nN)ur=-Zr=Ofre@*0++;
printf*N;;5 1: ^t^t^tMf^nN)ur=-Zr=Ofre@*1++;
![ .#e nu"er of reads we want [!
tota$Oreads T *int+cei$**f$oat+Oopt-Zseconds[<8.8(<e<!*f$oat+Oopt-Zdeci"ate+;
tota$Oreads !T '13%'O%4ROR41;;
if**Oopt-ZoardOa D Oopt-ZoardO+ Z 1+
tota$Oreads [T 2;
7run T true;
![ 4veryt#in7 set) now create a dis9 t#read _ pipe) and do so"e recordin7U [!
if*Oopt-Zrea$ti"e+
W
pt#readOcreate*_p9eyOt#read) NULL) 9eyOt#read) *void [+Oopt+;
$cv T "9fifo*N!t"p!G%'%-%4N) 0<<<+;
if **$cv TT -1+ __ *errno UT 44?-'.++
printf*N4rror creatin7 t#e na"ed pipeN+;
e$se
printf*NNa"ed pipe created^nN+;
printf*N,aitin7 for c$ient^nN+;
npipe T open*N!t"p!G%'%-%4N) 0O,R0NL2+;
printf*N5$ient connected^nN+;
![ 3a9e pipe write non-$oc9in7) t#is is to prevent t#e U'R% fro" overf$owin7)
%a7e <1 of C0
[ w#ic# #oses t#e data stea". -t is up to t#e 5L-4N. to "a9e sure it is
[ receivin7 contin7uous data pac9ets [!
fcnt$*npipe) &O'4.&L) 0ON0N6L05H+;
X
e$se
W
![ 4veryt#in7 set) now create a dis9 t#read _ pipe) and do so"e recordin7U [!
if*UOopt-Zinte7rate+
W
pipe*dis9Opipe+;
pt#readOcreate*_pdis9Ot#read) NULL) dis9Ot#read) *void [+Oopt+;
X
![ -f inte7rate option is set) start t#at t#read a$so [!
if*Oopt-Zinte7rate+
W
pipe*inte7rateOpipe+;
pt#readOcreate*_pinte7rateOt#read) NULL) inte7rateOt#read) *void [+Oopt+;
X
X
ur=-Zstart*+;
printf*NU'R% 'tart^nN+;
![ 5$ear out any Jun9 data [!
for*$cv T 0; $cv a 100; $cvDD+
ur=-Zread*_uff) uffsiKe) _overrun+;
overrun T 0;
if*Oopt-Zrea$ti"e+
W
9 T 0;
w#i$e*7run+
W
ur=-Zread*_uff) uffsiKe) _overrun+;
write*npipe) _uff) uffsiKe+;
if*overrun+
W
fprintf*stderr) NoN+;
ff$us#*stderr+;
X
X
X
e$se
W
![ Now do actua$ recordin7 [!
for*$cv T 0; $cv a tota$Oreads; $cvDD+
W
ur=-Zread*_uff) uffsiKe) _overrun+;
if*UOopt-Zinte7rate+
write*dis9OpipeR,R-.4S) _uff) uffsiKe+;
if*Oopt-Zinte7rate+
write*inte7rateOpipeR,R-.4S) _uff) uffsiKe+;
if*overrun+
W
fprintf*stderr) NoN+;
ff$us#*stderr+;
X
X
X
ur=-Zstop*+;
printf*NU'R% 'top^nN+;
%a7e <2 of C0
7run T fa$se;
![ Hi$$ t#e dis9 t#read [!
uffR0S T 0=dacaafa;
if*UOopt-Zrea$ti"e+
W
if*UOopt-Zinte7rate+
write*dis9OpipeR,R-.4S) _uff) uffsiKe+;
if*Oopt-Zinte7rate+
write*inte7rateOpipeR,R-.4S) _uff) uffsiKe+;
![ ,ait for t#read to return [!
if*UOopt-Zinte7rate+
pt#readOJoin*pdis9Ot#read) NULL+;
if*Oopt-Zinte7rate+
pt#readOJoin*pinte7rateOt#read) NULL+;
X
e$se
W
pt#readOJoin*p9eyOt#read) NULL+;
printf*N5$osin7 pipe^nN+;
c$ose*npipe+;
printf*N%ipe c$osed^nN+;
X
if*dsOr=Oa UT NULL+
de$ete dsOr=Oa;
if*dsOr=O UT NULL+
de$ete dsOr=O;
if*ur= UT NULL+
de$ete ur=;
return*1+;
X
![ 3onitor 9eyoard to 9i$$ rea$-ti"e t#read [!
void [9eyOt#read*void [Oar7+
W
int 9ey;
printf*NHey t#read start^nN+;
w#i$e*7run+
W
9ey T 7etc#ar*+;
printf*NMcN)*c#ar+9ey+;
if**c#ar+9ey TT QBQ+
7run T fa$se;
X
printf*NHey t#read stop^nN+;
pt#readOe=it*0+;
X
void [dis9Ot#read*void [Oar7+
W
options [Oopt T *options [+Oar7;
int uffR'13%'O%4ROR41;S) uff1R'13%'O%4ROR41;S) uff2R'13%'O%4ROR41;S;
c#ar fna"e1R102:S) fna"e2R102:S;
&-L4 [fp1) [fp2;
%a7e <( of C0
int nc#anne$) $cv) 9) sa"psOperOwrite;
oo$ Orun T true;
printf*NRecord t#read start^nN+;
![ 'et fi$e na"es [!
if*Oopt-ZoardOa+
W
strcpy*fna"e1) Oopt-Zfi$ena"e+;
strcat*fna"e1) N.daN+;
fp1 T fopen*fna"e1) NwN+;
X
if*Oopt-ZoardO+
W
strcpy*fna"e2) Oopt-Zfi$ena"e+;
strcat*fna"e2) N.dN+;
fp2 T fopen*fna"e2) NwN+;
X
![ Nu"er of c#anne$s [!
nc#anne$ T Oopt-ZoardOa D Oopt-ZoardO;
![ Nu"er of sa"p$es du"ped per write [!
sa"psOperOwrite T '13%'O%4ROR41;!Oopt-ZsoftOdeci"ate;
if**Oopt-ZoardOa D Oopt-ZoardO+ Z 1+
sa"psOperOwrite !T 2;

w#i$e*7run+
W
!! Get data fro" pipe
read*dis9OpipeRR41;S) _uff) '13%'O%4ROR41;[siKeof*int++;
!! 5#ec9 for t#read e=it
if*[**unsi7ned int[+_uffR0S+ TT 0=dacaafa+
W
Orun T fa$se;
rea9;
X
!! ;eci"ate and uninter$eave if ot# oards are ein7 used
if*nc#anne$ aT 1+
W
9 T 0;
for*$cv T 0; $cv a '13%'O%4ROR41;; $cvDD+
W
uff1R9S T uffR$cvS;
9DD;
X
if*Oopt-ZoardOa+ fwrite*uff1) sa"psOperOwrite) siKeof*int+) fp1+;
if*Oopt-ZoardO+ fwrite*uff1) sa"psOperOwrite) siKeof*int+) fp2+;
X
e$se
W
9 T 0;
for*$cv T 0; $cv a '13%'O%4ROR41;; $cvDT2+
W
uff1R9S T uffR$cvS;
uff2R9S T uffR$cvD1S;
9DD;
X
if*Oopt-ZoardOa+ fwrite*uff1) sa"psOperOwrite) siKeof*int+) fp1+;
if*Oopt-ZoardO+ fwrite*uff2) sa"psOperOwrite) siKeof*int+) fp2+;
X
X
if*fp1+ fc$ose*fp1+;
if*fp2+ fc$ose*fp2+;
%a7e <: of C0
printf*N^nRecord t#read stop^nN+;
pt#readOe=it*0+;
X
![U -nte7rates and t#en du"ps t#e resu$tin7 - _ B data in int(2 for"at [!
void [inte7rateOt#read*void [Oar7+
W
options [Oopt T *options [+Oar7;
c#ar fna"e1R102:S) fna"e2R102:S;
&-L4 [fp1) [fp2) [fp(;
int nc#anne$) $cv) sa"psOperOread) ytesOperOread;
int -1) -2) -() B1) B2) B(;
int nytes) read) nsa"ps;
5%? [uff;
printf*N-nte7rate t#read start^nN+;
sa"psOperOread T Oopt-Zinte7rate;
if**Oopt-ZoardOa D Oopt-ZoardO+ Z 1+
sa"psOperOread [T 2;
ytesOperOread T sa"psOperOread[siKeof*5%?+;
uff T *5%? [+"a$$oc*ytesOperOread+;
![ 'et fi$e na"es [!
if*Oopt-ZoardOa+
W
strcpy*fna"e1) Oopt-Zfi$ena"e+;
strcat*fna"e1) N.p#aN+;
fp1 T fopen*fna"e1) NwN+;
X
if*Oopt-ZoardO+
W
strcpy*fna"e2) Oopt-Zfi$ena"e+;
strcat*fna"e2) N.p#N+;
fp2 T fopen*fna"e2) NwN+;
X
if*Oopt-ZoardOa __ Oopt-ZoardO+
W
strcpy*fna"e2) Oopt-Zfi$ena"e+;
strcat*fna"e2) N.p#cN+;
fp( T fopen*fna"e2) NwN+;
X
![ Nu"er of c#anne$s [!
nc#anne$ T Oopt-ZoardOa D Oopt-ZoardO;

w#i$e*7run+
W
!! Get data fro" pipe
nsa"ps T nytes T 0;
w#i$e**nytes a ytesOperOread+ __ 7run+
W
read T read*inte7rateOpipeRR41;S) _uffRnsa"psS) ytesOperOread-nytes+;

if*read ZT 0+
W
nytes DT read;
X
nsa"ps T nytes!siKeof*5%?+;
X
!! 5#ec9 for t#read e=it
if*[**unsi7ned int [+uff+ TT 0=dacaafa+
rea9;
%a7e <8 of C0
!! ;eci"ate and uninter$eave if ot# oards are ein7 used
if*nc#anne$ aT 1+
W
-1 T -2 T B1 T B2 T 0;
for*$cv T 0; $cv a sa"psOperOread; $cvDD+
W
-1 DT uffR$cvS.r;
B1 DT uffR$cvS.i;
X
if*Oopt-ZoardOa+
W
fwrite*_-1) 1) siKeof*int+) fp1+;
fwrite*_B1) 1) siKeof*int+) fp1+;
X
if*Oopt-ZoardO+
W
fwrite*_-1) 1) siKeof*int+) fp2+;
fwrite*_B1) 1) siKeof*int+) fp2+;
X
X
e$se
W
-1 T -2 T -( T B1 T B2 T B( T 0;
for*$cv T 0; $cv a sa"psOperOread; $cvDT2+
W
-1 DT uffR$cvS.r;
B1 DT uffR$cvS.i;
-2 DT uffR$cvD1S.r;
B2 DT uffR$cvD1S.i;
B( DT uffR$cvS.r [ uffR$cvD1S.r D uffR$cvS.i [ uffR$cvD1S.i;
-( DT uffR$cvS.r [ uffR$cvD1S.i - uffR$cvS.i [ uffR$cvD1S.r;
X
!!if*Oopt-ZoardOa __ UOopt-ZoardO+
if*Oopt-ZoardOa+
W
fwrite*_-1) 1) siKeof*int+) fp1+;
fwrite*_B1) 1) siKeof*int+) fp1+;
X
!!if*Oopt-ZoardO __ UOopt-ZoardOa+
if*Oopt-ZoardO+
W
fwrite*_-2) 1) siKeof*int+) fp2+;
fwrite*_B2) 1) siKeof*int+) fp2+;
X
if*Oopt-ZoardOa __ Oopt-ZoardO+
W
fwrite*_-() 1) siKeof*int+) fp(+;
fwrite*_B() 1) siKeof*int+) fp(+;
X
X
X
if*fp1+ fc$ose*fp1+;
if*fp2+ fc$ose*fp2+;
if*fp(+ fc$ose*fp(+;
free*uff+;
printf*N^n-nte7rate t#read stop^nN+;
pt#readOe=it*0+;
%a7e << of C0
X
B+ /ow we can co"pi$e Gre7ory pro7ra" *3ain.cpp+L
1+ ,e can use:
d 7DD dOdsOr=.cpp 3ain.cpp -o testdriver -$" -$usrp e$pt#read
Note:
.#e fo$$owin7 fi$es s#ou$d e in t#e sa"e co"pi$ation directory:
d-dsOr=.cpp
dOdsOr=.#
fp7aOre7sOco""on.#
fp7aOre7sOstandard.#
%a7e <> of C0
RSS2 Measureen$ 7ues$i"ns
B+ -s R''- "easurin7 possi$e wit# t#e U'R% "ot#eroard and t#e R&? transceiver oardL -
9now we #ave t#e R''- circuit onoard) ut - donQt 9now on w#ic# fre@uencies it scansL
1+ .#e R''- on t#e "ot#eroard wi$$ te$$ you t#e power wit#in appro=. D!- 18 3/K fro" your
carrier. 2ou can a$so 7et a di7ita$ R''- w#ic# wi$$ te$$ you t#e power wit#in your si7na$ of
interest. .#e way we #ave envisioned R''- is as a (-part "easure"ent:
1+ 1na$o7 R''- *we can read it usin7 1U? 1;5+
2+ ;i7ita$ R''- in &%G1 *fro" output of 1;5s+
(+ ;i7ita$ R''- in #ost *co"puted #owever you $i9e) fro" t#e c#anne$ Ked si7na$ sent over t#e
us y t#e U'R%+
-f you want to use t#e "easured ana$o7 R''-) it wi$$ "easure w#atever passes t#rou7# t#e ana$o7
c#anne$ fi$ter. 2ou can on$y c#an7e t#at andwidt# y c#an7in7 inductors and capacitors. Note
a$so t#at ana$o7 R''- is on$y on t#e R&?C00) R&?1200) R&?1800) and
R&?2:00. .#e R&?:00) .AR?) and ;6'R? do not #ave t#at capai$ity.
B+ -s t#ere an R''- circuit on t#ese oardsL -Q" usin7 t#e &$e= 2:00.
1+ .#e R&?C00) 1200) 1800) and 2:00 #ave an R''- circuit on oard. .#e R&?:00 does not.
.o read t#e R''- va$ue) use readOau=Oadc*side)0+. .#e R''- "easures t#e ana$o7 si7na$ $eve$
after t#e $owpass fi$ters on t#e oard. .#ese fi$ters are aout 18-20 3/K wide. .#us) anyt#in7
fa$$in7 in t#at and wi$$ cause a rise in t#e R''- va$ue. -t is connected to t#e $ow-speed adc
1U?O1;5O11) so you need to read t#at wit# readOau=Oadc*w#ic#Odoard)0+ 'ee usrp1.i *and in
usrpOasic.Wcc) #X+:
int readOau=Oadc *int w#ic#Odoard) int w#ic#Oadc+;
.#e R''- reads t#e power in t#e ana$o7 aseand si7na$s *power *-+ D power *B++. .#e ana$o7
aseand wi$$ contain si7na$s fro" appro=i"ate$y D!- 18 3/K fro" t#e L0 fre@uency.
B+ - can read t#e ana$o7 R''- indicator wit# t#e au=i$iary 1;5s) ut it is not connected to t#e
7ain contro$. -nstead) an au=i$iary ;15 contro$s t#e 7ain contro$) ri7#tL
1+ 2es) t#at is correct. 2ou can reconfi7ure t#e oard y "ovin7 so"e resistors around to "a9e
it auto"atic if you wanted.
B+ /ow do - set t#e "u= re7ister to $oo9 at t#e 1U?O1;5 inputsL
1+ 2ou donQt use t#e "u= re7ister to read t#e 1U?O1;5s. 'ee
usrp!#ost!$i!usrpOWasic)standardX.# for docs on a$$ of t#is stuff. 'ee especia$$y
%a7e <8 of C0
usrpOasicOr=::readOau=Oadc and usrpOasicOt=::readOau=Oadc
![U
[ ^rief Read au=i$iary ana$o7 to di7ita$ converter.
[
[ ^para" w#ic#Odoard R0)1S w#ic# dau7#teroard
[ ^para" w#ic#Oadc R0)1S
[ ^para" va$ue return 12-it va$ue R0):0C8S
[ ^returns true iff successfu$
[!
oo$ readOau=Oadc *int w#ic#Odoard) int w#ic#Oadc) int [va$ue+;
![U
[ ^rief Read au=i$iary ana$o7 to di7ita$ converter.
[
[ ^para" w#ic#Odoard R0)1S w#ic# dau7#teroard
[ ^para" w#ic#Oadc R0)1S
[ ^returns va$ue in t#e ran7e R0):0C8S if successfu$) e$se R41;O&1-L4;.
[!
int readOau=Oadc *int w#ic#Odoard) int w#ic#Oadc+;
.#e second version #as a pyt#on indin7:
v T u.readOau=Oadc*0) 0+
w#ere u is an instance of a usrp.sourceOc or usrp.sin9Oc
.#e ad news is t#at t#ese are read async#ronous$y usin7 a s$ow pat# over t#e U'6. 2ou proa$y
canQt read t#e" fast enou7# to sa"p$e to your input si7na$) and t#e sa"p$in7 is async#ronous.
%a7e <C of C0
M"$herb"ard Re<),"#Bing 7ues$i"ns
B+ - wou$d $i9e to run "y U'R% off a :: 3/K c$oc9 instead of t#e <: 3/K c$oc9 t#at is current$y
used. 5an - 7enerate a :: 3/K c$oc9 fro" t#e <: 3/K or do - #ave to c#an7e t#e crysta$L -f -
c#an7e over to t#e :: 3/K wi$$ everyt#in7 e$se sti$$ wor9L 4specia$$y t#e ;6'R? and R&?2:00
oardsL
1+ 2ou need a new crysta$ or an e=terna$ osci$$ator. 2ouQ$$ need to c#an7e t#e definition of
![U
[ ^rief return fre@uency of "aster osci$$ator on U'R%
[!
$on7 fp7aO"asterOc$oc9Ofre@ *+ const W return <:000000; X
in usrpOasic.#
%rocedure:
- purc#ased a :: 3/K osci$$ator fro" di7i-9ey *p!n (00->28:-1-N;) 5'?>80&J5::+ for d(.(8.
.#e first atte"pt to re"ove t#e U'R% <: 3/K fai$ed "isera$y wit# a pen iron. - purc#ased a
#eat 7un fro" di7i-9ey *311008-N;+ for d82) set it to t#e 1000 de7ree settin7 and t#e o$d
osci$$ator ca"e up in aout 10 seconds. -nsta$$ed t#e new osci$$ator and c#ec9ed t#e :: 3/K
c$oc9 wit# a scope. - a" usin7 t#e stdO:r=O0t=.rf &%G1 i"a7e.
- t#en tried to run "y custo"iKed ds app$ication t#at records 8-it -!B data to a fi$e for "e fro"
any of t#e 802.11 c#anne$s. - 7ot a$$ Keros in t#e data. .#en re"e"ered 4ric to$d "e to c#an7e
t#e c$oc9 in dOdsOr=.py.
3y code is a $itt$e o$der t#an current ut #ere are "y "odifications:
- 7r-usrp!src!dOdsOr=.py:
1. c#an7ed $ine 88 fro"
se$f.refc$9Odivisor T 1<
to
se$f.refc$9Odivisor T 11
2. - c#an7ed $ine 108 fro"
return <:e<!se$f.refc$9Odivisor
to
return ::e<!se$f.refc$9Odivisor
t#en in !7r-usrp - did
"a9e c$ean
"a9e
"a9e c#ec9
"a9e insta$$
%a7e >0 of C0
Rerun "y custo" ds pro7ra" and it wor9ed fine. - used a deci"ation of : so -Q" recordin7 at 11
3'sa"p$es per second.*I&-?34I is t#is correct L+
B+ -s t#ere anot#er way to ac#ieve 10 3'a"p$e!second wit#out c#an7in7 U'R% c$oc9L
1+ - #ave een wor9in7 wit# fractiona$ rate deci"eter!interpo$ators inside t#e U'R% &%G1. 2ou
can put a fractiona$ rate deci"eter inside t#e &%G1 w#ic# deci"ates y <.:.
-t is a it #ard to 7et t#e" to fit ut you 7et a $ot of f$e=ii$ity out of t#e" wit#out c#an7in7 t#e
c$oc9s. .*I&-?34I is t#is correct L+
B+ .#e fi$e usrpOasic.# #as t#e fo$$owin7 "e"er:
$on7 fp7aO"asterOc$oc9Ofre@ *+ const W return <:000000; X
-f - want "y syste" to wor9 at 80 3/K) wi$$ - need to c#an7e t#is constantL
1+ 2es. .#e idea was t#at t#ere was a sin7$e p$ace in t#e code *fp7aO"asterOc$oc9Ofre@+ t#at
N9nowsN t#e actua$ fre@uency.
B+ -Qve 7ot a U'R% v: oard t#at -Q" p$annin7 to run off of a 1( 3/K e=terna$ c$oc9. /owever)
-Q" intendin7 to use a pair of R&? C00 dau7#teroards) and -E" wonderin7 if t#ere are any 9nown
"odifications needed to a$$ow t#ese dau7#teroards to operate wit# a 1( 3/K c$oc9L
1+ 2ou need to 7o into t#e dOf$e=rf.py and dOf$e=rfO"i"o.py fi$es in t#e 7r-usrp!src directory.
1ny references to <: 3/K need to e c#an7ed to 1( 3/K. 2ou a$so need to "a9e sure t#at you
te$$ t#e usrp oJect w#at its sa"p$in7 rate is.
B+ ,#at is t#e vo$ta7e $eve$ for t#e U'R% e=terna$ c$oc9L -s 1.0A pea9 to pea9 o9L ;o - need to
add a dc offset to "y e=terna$ c$oc9 to prevent t#e ne7ative swin7sL
1+ 2es 1A p-p for U'R% rev :. Use (.(A for rev 2 and (.
B+ ,#at are t#e $i"its on t#e U'R% e=terna$ c$oc9L ,i$$ usin7 a Fnon-standardN c$oc9 fre@uency
rea9 any parts of GnuradioL
1+ 2ou can drive t#e c$oc9 $ine anyw#ere etween aout 103/K and <83/K. 6e sure to edit
usrpOasic::fp7aO"asterOc$oc9Ofre@*+ to return t#e new va$ue.
%a7e >1 of C0
B+ - re-c$oc9ed "y U'R% fro" <: to <8.8(< 3/K and #ave recent$y discovered t#at - _ B
sa"p$es are no $on7er ort#o7ona$) rat#er t#ey see" to e on$y >0 de7rees or so apart. - wou$d
7uess t#is is due to so"e #ard coded va$ues in t#e 5-5 or /6 fi$tersL -s t#ere a U'R% co""and
to correct for t#is p#ase i"a$anceL
1+ .#atQs an odd pro$e". 'ounds $i9e a ti"in7 issue. Heep in "ind t#at t#e 1;5s are on$y
specified to wor9 to <: 3/K and t#e &%G1 i"a7e is co"pi$ed to "eet ti"in7 at <: 3/K. 2ou
"i7#t need to reco"pi$e it wit# t#e stricter ti"in7 nu"ers. 1$$ of t#e ;'% stuff in t#e &%G1
s#ou$d not care aout t#e aso$ute fre@uency as $on7 as it "eets ti"in7.
%a7e >2 of C0
L"ading FP%A Bi$ S$rea 7ues$i"ns
B+ /ow t#e U'R% &%G1 confi7uration it strea" fi$e $oadedL
1+ ,#en usin7 GNU Radio U'R% functions) t#e #ost $irary ta9es care of $oadin7 t#e F.rfG fi$e
into t#e &%G1 for you. .#is ta9es p$ace over t#e U'6.
/owever) you can "anua$$y $oad t#e .rf usin7 t#e usrper co""and:
d usrper --#e$p
usa7e:
usrper R-vS R-w aw#ic#OoardZS R-=S ...
usrper $oadOstandardOits
usrper $oadOfir"ware afi$e.i#=Z
usrper $oadOfp7a afi$e.rfZ
usrper writeOfp7aOre7 are78Z ava$ue(2Z
usrper setOfp7aOreset WonboffX
usrper setOfp7aOt=Oena$e WonboffX
usrper setOfp7aOr=Oena$e WonboffX
----- dia7nostic routines -----
usrper $ed0 WonboffX
usrper $ed1 WonboffX
usrper setO#as#0 a#e=-strin7Z
usrper 7etO#as#0
usrper i2cOread i2cOaddr $en
usrper i2cOwrite i2cOaddr a#e=-strin7Z
usrper C8<2aOwrite re7no va$ue
usrper C8<2Owrite re7no va$ue
usrper C8<2aOread re7no
usrper C8<2Oread re7no
d usrper $oadOfp7a ana"e of your .rf fi$eZ
wi$$ $oad t#e .rf fi$e into t#e &%G1. P,ease n"$e t#at it is possi$e to per"anent$y da"a7e t#e
U'R% y $oadin7 u77y code into t#e &%G1.
B+ ,#en we pro7ra" t#e &%G1 usin7 pyt#on pro7ra"s *e7. usrpOfft.py+) are t#e sa"e .rf fi$es
7eneratedL ,#ereL

1+ .#e fi$es arenQt 7enerated) t#ey are $oaded. 6y defau$t) an rf is $oaded fro"
!usr!$oca$!s#are!usrp!revW2):X. .#e one used un$ess you specify t#e fp7aOfi$ena"e constructor
ar7u"ent w#en instantiatin7 a usrp source or sin9 is stdO2r=#O2t=.rf. &2-) we $oad std.i#=)
standard fir"ware for t#e 5ypress &?2 U'6 contro$$er) efore $oadin7 t#e &%G1 .rf fi$e. ,e
%a7e >( of C0
$oad t#e &?2 fir"ware over t#e U'6. .#at fir"ware i"p$e"ents additiona$ contro$ endpoint
co""ands) inc$udin7 t#ose t#at 9now #ow to $oad an .rf into t#e &%G1.
%a7e >: of C0
Tiing La$en#y 7ues$i"ns
B+ ,e can ca$cu$ate t#e $atency introduced y t#e U'6 since t#e U'6 pac9et is on$y sent w#en
we #ave a sufficient a"ount of data co$$ected in t#e U'R% uffer) i.e.) t#e s"a$$est a$$owed U'6
pac9et is 812 yte) and t#e $ar7est one is specified y t#e user y two para"eters) fusb_nblock
and fusb_block_size. 1s a paper "entions: *#ttp:!!nes$.ee.uc$a.edu!docu"ent!s#ow!2:2+) t#e U'6
de$ay *.u+ is accordin7 to t#e e@uation:
.u T f*812) fusO$oc9OsiKe[fusOn$oc9+ ! *fs[sa"p$eOsiKe +
,#ere:
f*=)y+ is depends on t#e data in t#e uffer and it is at $east = and at "ost y and fs is t#e sa"p$in7
fre@uency. 'ince we use co"p$e= 1< it sa"p$es) t#e sa"p$e siKe is
sampleO size = 2 *f1<bit= g: bytes.
'o) does t#at "ean if we #ave $ar7e product of fusO$oc9OsiKe and fusOn$oc9) t#en t#e
t#eoretica$ "a=i"u" de$ay wi$$ e increasedL
1+ 2es t#at is true. -f youQre tryin7 to "ini"iKe $atency you want t#e s"a$$est va$ues t#at wor9
re$ia$y *no over!underruns+ and wit# accepta$e over#ead. -f you ena$e rea$ ti"e sc#edu$in7)
you can re$ia$y use s"a$$er va$ues. .ry fusO$oc9OsiKe 20:8 and fusOn$oc9 : or 8. 2ou "ay
e a$e to run wit# fusO$oc9OsiKe 102:. -t depends on your data rate across t#e U'6.
B+ ,#at is t#e t#eoretica$ "ini"u" roundtrip $atency t#at we can ac#ieve wit# t#e U'R%L
1+ ;ifferent cases:
1+ 0n t#e #ost - t#in9 t#at t#e "ini"u" nu"er of pac9et uffers we can $ive wit# is 2 in eac#
direction. .#is is to ensure t#at t#e 4/5- U'6 #ost contro$$er end point @ueue a$ways #as
so"et#in7 in it for our end points. .#is is re@uired to 9eep t#e t#rou7#put up and to 9eep us fro"
sufferin7 underrun or overruns on t#e U'R%.
2+ 0n t#e &?2 t#e "ini"u" we can use is two in eac# direction.
(+ 0n t#e output pat# to t#e &%G1) t#ereQs a &-&0) ut t#e pipe$ine runs if t#ereQs any data in t#e
&-&0. .#is doesnQt appear to add any de$ay. -n U'R%) weQre current$y runnin7 wit# 812 yte
pac9ets.
.#eoretica$ 5a$cu$ations:
Let t#e %H.'-`4 T 812
-n ot# directions we canQt start t#e transport unti$ youQve asse"$ed a fu$$ pac9et. 1ssu"e weQre
runnin7 at (236!sec) t0 T 1<usec
.#e transport ti"e of a sin7$e pac9et fro" t#e #ost contro$$er to t#e &?2 is

%a7e >8 of C0
t1 T %H.'-`4 *ytes+!(2*3yte!sec+ T 1< usec
.#e transport ti"e of a sin7$e pac9et fro" t#e &?2 to t#e &%G1 is aout

t2 T : us D %H.'-`4 *ytes+!C<*3yte!sec+ T C.(( usec

R.#e : us is fir"ware over#ead in t#e &?2. -t cou$d e i"provedS
.#e est case:
0utound $oo9s $i9e T t0 D t1 D t2 T :1.(( usec
-nound is t#e sa"e :1.(( usec.
,it# 812 yte pac9ets) tota$ round trip $atency
2 [ *t0 D t1 D t2+ T 8( usec
Lowerin7 t#e pac9et siKe to <: ytes wou$d reduce t#is to
2 [ *2 D 2 D :.>+ T 8.> us
R.#is is opti"istic) since our t#rou7#put wi$$ drop) and t#ere are $ots of ot#er unaccounted factors.
4.7.) 7reater U'6 over#ead ecause of t#e s"a$$ pac9etsS
B+ /ow we can practica$$y "easure t#e round trip $atencyL
1+ /ereQs an easy way to "easure round trip $atency:
/oo9 up a si7na$ 7enerator to one of t#e R= asic inputs and to one input of an osci$$oscope.
/oo9 up one .= asic output to anot#er input on t#e oQscope. ,rite so"e code on t#e #ost t#at
reads fro" usrp.sourceOc and writes to usrp.sin9Oc Loo9 at t#e de$ay etween t#e two traces on
your oQscope.
%a7e >< of C0
USB )"n$r",,er FX; 7ues$i"ns
B+ 1" - correct in sayin7 t#at t#e usrp code treats t#e device as a strea" of data enterin7 t#e
syste" via t#e U'6 connectionL
1+ -tQs a $itt$e "ore co"p$icated t#an t#at) ut t#atQs t#e asic idea. U'6 supports t#ree 9inds of
transfers across t#e U'6: co""and) u$9 read!write and isoc#ronous. ,e use co""and pac9ets
to confi7ure t#e U'R%) $oad fir"ware) t#e &%G1 itstrea") etc. ,e use endpoint 0 for t#at
interface. -n addition) we use two ot#er endpoints) one for strea"in7 input data and t#e ot#er for
strea"in7 output data. .#ese endpoints are used wit# u$9 transfers) since t#ey are t#e U'6
transfers t#at support t#e #i7#est t#rou7#put. - su77est readin7 c#apter C) NU'6 ;evice
&ra"ewor9N of t#e U'6 2.0 specification. #ttp:!!www.us.or7!deve$opers!docs!
-t covers "ost of w#at you need to 9now to ui$d a U'6 perip#era$.
B+ /ow "any endpoints we can support wit# &?2L
1+ .#e &?2 is $i"ited in t#e nu"er of endpoints t#at it supports. 'ee pa7e 18 of t#e
52>5<801( datas#eet. Ri7#t now we are runnin7 wit# endpoints 2 and < N@uad ufferedN) : 812
yte uffers eac#. 0ne is used for .= data) t#e ot#er for R= data. -t wou$d e possi$e wit# a it
of #ac9in7 to run endpoints 2) :) < and 8 Ndou$e ufferedN) 2 812 yte uffers eac#. .#at wou$d
7ive us : u$9 endpoints to wor9 wit# *and wou$d a$so $ower t#e worst case $atency+.
B+ - a" $oo9in7 at t#e t=Ouffer "odu$e. &ro" "y understandin7) t#at "odu$e does t#e
inter$acin7 of t#e data to e trans"itted *2 - c#anne$s and 2 B c#anne$s+. -s t#at correctL
1+ -t i"p$e"ents t#e trans"it direction part of t#e &?2!&%G1 G%-& interface. -t a$so de"u=es
t#e data to e trans"itted and sends it to t#e appropriate ;15s.
B+ ;oes &?2 refor"at inco"in7!out7oin7 &%G1 dataL
1+ No. .#e for"attin7 of t#e data is a$$ #and$ed in t#e &%G1. .#e &?2 fir"ware doesnQt even
see t#e u$9 data 7oin7 in and out. .#e data is transferred y ;31 to!fro" t#e G%-& fro"!to t#e
&%G1 U'6 uffers.
B+ 1$so) ne=t to t#e usOreset input dec$aration t#ere is a co""ent sayin7 FUsed #ere for t#e 28>
#ac9 to fi= t#e &?2 u7N. ,#ic# u7 is it ta$9in7 aoutL
1+ 0n t#e &?2) t#e ,R pu$se is asserted one c$oc9 $on7er t#an it s#ou$d e.
%a7e >> of C0
B+ - t#in9 t#at a$on7 t#e way - "isunderstood t#e purpose of t#e writeOcount re7ister. /ow does it
actua$$y wor9L ,R tri77ers every ti"e a 1< it pac9et is ready fro" t#e &?2 doesnQt itL
1+ writeOcount counts fro" 0 to 28<) t#en ac9 to 0. -tQs at 28< w#en ,R is sti$$ asserted ut
t#ereQs rea$$y no data to receive. .#is wor9s around so"e stran7e e#avior in t#e &?2 G%-&
interface and!or pro7ra""in7.
B+ .#e wre@ tri77er of t#e &-&0 is tri77ered y *,R _ cwriteOcountR8S+. ;oes t#is "ean t#at
on$y 28< 1< it sa"p$es enter t#e &-&0 efore t#e ,R is re"ovedL ,#y is t#isL /ow cou$d -
deter"ine e=act$y w#en t#ere is - or B sa"p$e t#at "ust e written into t#e &-&0L
1+ wrre@ te$$s t#e &-&0 w#en data s#ou$d e written to t#e &-&0. 'o) we write w#en *,R _
cwriteOcountR8S+. .#at is) w#en ,R is asserted) ut t#e count does not #ave 0=100 it set. 1s -
reca$$) ,R is asserted an e=tra cyc$e) and t#e counter tric9 wor9s around t#is.
.#e $oc9 ca$$ed t=Ofifo is one of t#eir standard $oc9s. -tQs t#e dua$ c$oc9 version of t#e fifo) and
is used *a"on7st ot#er t#in7s+) to rid7e etween t#e U'6 c$oc9 do"ain *.wrc$9*usc$9++ and t#e
si7na$ processin7 c$oc9 *.rdc$9*t=c$9++.
B+ ,#en t#e &?2 detects t#e #aveOspace pin on t#e &%G1) does it transfer 1 entire uffered U'6
pac9et to t#e &%G1) t#en re-c#ec9 t#e #aveOspace pin) ri7#tL
1+ 2es. /aveOspace is used y t#e feedin7 &?2 to 9now if t#e &%G1 can #and$e one "ore pac9et.
.#e #aveOspace pin is used y t#e &?2 to 9now if t#e &%G1 &-&0 can store 1. L41'. one "ore
pac9et.
B+ ,ou$d it e reasona$e to assu"e a 1 c$oc9 de$ay etween t#e $ast yte of one 812-yte
pac9et ein7 written to t#e &%G1 and t#e first yte of a second 812-yte pac9et ein7 written to
t#e &%G1L
1+ 2es. .#at s#ou$dnQt e a pro$e". .#ereQs software inside t#e &?2 t#at po$$s t#e pin. 2ouQve
7ot at $east 100 ns etween pac9ets) proa$y "ore.
B+ - cou$dnQt find any docu"entation on w#at is stored in t#e U'R% "ot#eroard 44%R03L

1+ 0n t#e "ot#eroard) weQre current$y usin7 a N52N for"atted 44%R03 so t#at we can run code
at power-up ti"e to 7et t#e C8<2Qs into a reasona$y $ow-power state. .#e detai$s of t#e 50 vs 52
&?2 oot can e found in t#e &?2 .ec#nica$ Reference 3anua$.
#ttp:!!www.9ei$.co"!dd!docs!datas#ts!cypress!f=2Otr".pdf
%a7e >8 of C0
.#e 44%R03 on t#e "ot#eroard stores so"e U'6 info) and so"e very si"p$e code to put t#e
oard in a $ow power state w#en it powers up. -t a$so $in9s one L4; @uic9$y. 0nce you start
runnin7 anyt#in7 on t#e U'R%) a "ore co"p$ete fir"ware *w#ic# is "uc# i77er t#an t#e
44%R03 wou$d #o$d+ is sent over t#e U'6 us.
B+ ,#at aout t#e U'R% operation of 5ypress 4`-U'6 &?2 U'6 3icrocontro$$er L
1+ 3any points:
1- 0fficia$ docu"entation:
#ttp:!!www-corot.osp".fr!50R0.-4.5!&i$es!52>5<801(.pdf
2- .#e "ain contro$$in7 pro7ra" is usrpO"ain.c *co"pi$ed fir"ware for t#e 8081 in t#e &?2
U'6 c#ip y ';55+ found in 7nuradio!usrp!fir"ware!src!usrp2
(- .#e fo$$owin7 $oops were e=a"ined fro" t#e usrpO"ain.c pro7ra":
"ain* +
W
-nitia$iKe U'R%
-nitia$iKe G%-&
%atc# U'6 ;escriptors *read fro" 44%R03) set /, device -;+
'etup 1utovectors
-nsta$$ U'6 /and$ers
Re-enu"erate
Run "ainO$oop* +
X
"ainO$oop* +
W
5#ec9 for U'6 setup pac9ets
5#ec9 and $o7 t#e R? 0verruns and t#e .? Underruns
5#ec9 for pac9ets to send ac9 to #ost
5#ec9 for pac9ets to send to &%G1
X
:- U'6 4ndpoints:
;ifferent U'6 endpoints *4%+ are used to $o7ica$$y separate different operations occurrin7 on t#e
us into separate f$ows. .#ere are current$y ( U'6 endpoints c#ec9ed!used wit#in t#e
"ainO$oop*+ as descried ear$ier.
4ndpoint ;escription
0 5ontro$!status
2 /ost -Z &%G1
< &%G1 -Z /ost
8- U'6 .ransfers are a$ways 812-yte u$9 transfers. 1$$ contro$ infor"ation is written usin7
endpoint 0 and t#e vendor co""ands. .#ese co""ands are separated into two different
cate7ories: AR.OA4N;0RO-N and AR.OA4N;0RO0U.. .#ese are processed in t#e
appOvendorOc"d* + function seen in usrpO"ain.c.
%a7e >C of C0
1$$ contro$ co""unication etween t#e &%G1 and &?2 "icrocontro$$er is done over t#e '%-.
;au7#teroards a$$ see" to e contro$$ed y t#e 7eneric ARBO-25O[ and ARBO'%-O[
co""ands.
< - AR.OA4N;0RO-N 5o""ands:
ARBOG4.O'.1.U'
G'O.?OUN;4RRUN
G'OR?O0A4RRUN
ARBO-25OR41;
ARBO'%-OR41;
> -AR.OA4N;0RO0U. 5o""ands:
ARBO'4.OL4;
ARBO&%G1OL01;
&LO64G-N
&LO?&4R
&LO4N;
ARBO&%G1O'4.OR4'4.
ARBO&%G1O'4.O.?O4N16L4
ARBO&%G1O'4.OR?O4N16L4
ARBO&%G1O'4.O.?OR4'4.
ARBO&%G1O'4.OR?OR4'4.
ARBO-25O,R-.4
ARBO'%-O,R-.4
B+ /ow t#e U'R% &?2 wor9sL
1+ .#e &?2 "icrocontro$$er contains an e"edded U'6 2.0 transceiver and #and$es a$$ U'6
transfers wit# t#e upstrea" U'6 #ost. -t presents a data us to t#e outside wor$d *in t#is case t#e
&%G1+) wit# 7eneric contro$ si7na$s w#ic# can e pro7ra""ed to e#ave in a custo" "anner.
.#is interface is ca$$ed t#e G%-& *Genera$ %urpose -nterface+)
.#e &?2 a$so #and$es a$$ U'6 contro$ re@uests *via endpoint 0+) w#ic# a$$ U'6-ena$ed devices
"ust support to fu$$y co"p$y wit# t#e U'6 standard. .#ese inc$ude responses to device capai$ity
interro7ations and standard setup re@uests.
%a7e 80 of C0
&?2 -nterna$ 6$oc9 ;ia7ra" *&ro" Ha$en .#esis+
1 si"p$ified view of t#e &?2 is s#own in &i7ure aove. -t #ouses an industry-standard 8081
"icrocontro$$er core *wit# severa$ e=tensions and en#ance"ents+) w#ic# #and$es a$$ interna$
contro$. .#e 8081 initia$iKes t#e transceiver) w#ic# #and$es t#e actua$ U'6 transactions. -t is a$so
responsi$e for confi7urin7 t#e &?2Qs 7enera$-purpose -!0 ports *not s#own+ and t#e G%-& state
"ac#ine. ;ata is transferred in a U'6 syste" via endpoints) w#ic# are si"i$ar to Ethernet
networ9 soc9et. 4ac# endpoint "ust #ave a specified data-f$ow direction) eit#er -N or 0U.
*U'6-centric+) e=cept t#e contro$ endpoint 0 w#ic# is idirectiona$. .#e endpoints) "ust a$so
#ave defined data transaction types w#ic# indicate t#eir andwidt# re@uire"ents.
;ata enterin7 or $eavin7 t#e &?2 on t#e U'6 #ost side is stored in t#e endpoint &-&0Es) w#ic#
can e confi7ured to #ave various siKes and $eve$s of ufferin7. .#e G%-& #as direct access to
t#ese &-&0Es) a$$owin7 for sea"$ess data transfer etween an e=terna$ device and t#e U'6 #ost
t#rou7# a series of uffered &-&0Es.
B+ ,#at aout &?2 fir"wareL
1+ 1s we$$ as 7enera$ #ouse-9eepin7 and confi7uration) t#e &?2 fir"ware is responsi$e for t#e
fo$$owin7 areas:
h G%-& initia$iKation
Rat#er t#an atte"pt to #and$e data transfers direct$y at U'6 2.0 #i7#-speed *:8036its!s+) data
transfers are carried out y t#e G%-&. .#e &?2Qs 8081 core initia$iKes t#is interface.
h U'6 contro$ re@uest #and$in7
.#e 8081 core responds to contro$ re@uests sent y t#e U'6 #ost over endpoint 0. 1$$ U'6
co"p$iant devices "ust return responses in a pre-deter"ined for"at to standard re@uests aout
t#e device *e.7. GetDeviceame w#ic# returns t#e deviceQs description+.
h U'6 transfer re@uests
%a7e 81 of C0
.#ese are i"p$e"ented as a po$$in7 $oop t#at $oads G%-& setup re7isters wit# t#e transfer
para"eters as and w#en re@uests are received fro" t#e #ost. .#e &?2 fir"ware is written in !)
and co"pi$ed wit# t#e open-source co"pi$er) "D!! *'"a$$ ;evice 5ross 5o"pi$er+. .#e
e"edded functions are invo9ed usin7 t#e usrp_basic and ursp_prims $iraries.
B+ ,#at is t#e &?2 G%-&L
1+ .#e G%-& *Genera$ %urpose -nterface+ is a "ec#anis" i"p$e"ented y t#e &?2 to a$$ow for
si"p$e interfacin7 wit# "any different types of devices. 4ssentia$$y it is a i-directiona$ data us
wit# a set of 7eneric contro$ si7na$s w#ic# are 7overned y a confi7ura$e state "ac#ine. .#e
G%-& can e confi7ured to e t#e interface us "aster or can e driven as a s$ave y t#e device
itse$f. .#e G%-& is t#e us "aster. 'i= states can e defined for a particu$ar wavefor") wit#
decision points t#at dictate t#e state transitions dependin7 on t#e va$ues of t#e 7eneric contro$
$ines.
.#ere are four us cyc$e wavefor"s avai$a$e w#ic# can e confi7ured. .#ese are:-
h 'in7$e ,rite
.#is us cyc$e writes a sin7$e data word fro" t#e U'6 to t#e device *a$$ transactions are defined
to e U'6-centric+
h 'in7$e Read
.#is cyc$e reads a sin7$e word fro" t#e device.
h &-&0 ,rite
.#is cyc$e writes a $oc9 of data ased on so"e previous$y setup para"eters. ;urin7 t#e transfer
state) data f$ow can e t#rott$ed y t#e receivin7 device.
h &-&0 Read
.#is cyc$e reads a $oc9 of data fro" t#e device) and is used to strea" 1;5 data up to t#e #ost.
1n e=a"p$e of a si"p$e G%-& &-&0 read wavefor" is s#own in &i7ure e$ow.
G%-& wavefor" 4=a"p$e *&ro" Ha$en .#esis+
.#e G%-& #as si= contro$ inputs #D$%&0) and si= contro$ outputs !'(%&0. .#ese can e used to
i"p$e"ent a 7reat variety of standard and proprietary us contro$ cyc$es. -n t#e fi7ure aove) t#e
decision point in state 1 wi$$ #o$d t#e cyc$e in a sta$$ed state unti$ #D$0 *in t#is case representin7
%a7e 82 of C0
)*)+ Empty )la,+ is de-asserted w#en t#e G%-& state "ac#ine wi$$ advance to state 2 and $atc#
in t#e data presented on t#e D-'- us. .#e &?2 i"p$e"ents t#e U'6 endpoints as interna$
endpoints E.0/ E.0/ E.2/ E.1/ E.2 and E.3) w#ic# can e confi7ured in various ways to suit
t#e app$icationEs ufferin7 re@uire"ents. E.0 is a$ways a <: yte !+'#+( endpoint and E.0
"ay on$y e of t#e 45(6 or *'E##5.' types *a$so <: ytes+. .#e re"ainin7 endpoint &-&0Es
can e confi7ured to e dou$e-) trip$e- or @uad-uffered) wit# a "a=i"u" tota$ uffer siKe of :H.
-n t#is "anner) data can e continua$$y strea"ed to or fro" t#e #ost) provided ade@uate f$ow
contro$ is in p$ace.
5ypress 'e"iconductor #as deve$oped G.*) Desi,ner) a free$y avai$a$e app$ication w#ic# can
e used to desi7n G%-& state "ac#ines wit# a 7rap#ica$ interface. .#e app$ication a$$ows a user to
custo"iKe t#e state "ac#ines) after w#ic# t#e appropriate confi7uration and initia$iKation source
code is 7enerated w#ic# can e inc$uded wit# t#e "ain &?2 fir"ware. .#is si"p$ifies t#e process
of confi7urin7 t#e G%-& wavefor" re7isters w#ic# wou$d ot#erwise #ave to e coded "anua$$y.
-n t#e U'R%Qs case) t#e deve$opers c#ose to parse t#e G.*) Desi,ner7s output code) and to insert
t#eir own initia$iKation routines. .#is was done in part ecause t#e output code 7enerated y
G.*)Desi,ner is so"ew#at a"i7uous *u7s #ave een encountered y t#e Gnu#adio tea".
-nterna$$y in U'R%) t#e G%-& acts autono"ous$y fro" t#e actua$ &?2 8081 core and provides data
to and fro" t#e interna$ endpoint &-&0Es for strea"in7 up to and down fro" t#e U'6 #ost. .#e
U'R% &?2 interface at t#e app$ication $eve$ is defined and i"p$e"ented in t#e usrp_prims and
usrp_basic source and #eader fi$es.
'he 5srp_prims defines a set of functions i"p$e"ented on t#e &?2 in response to contro$
re@uests via U'6 endpoint 0 t#at e=tend t#e 7eneric U'6 function set. .#ese function pri"itives
typica$$y write to or read fro" various &?2 re7isters) or initiate data transfers via t#e G%-&.
'he 5srp_basic provides a si"p$e 1%- to t#e usrp_prims functions in t#e for" of an oJect-
oriented structure. .#e interface to t#e syste" provides #i7#er-$eve$ functiona$ity) #idin7 "ost of
t#e under$yin7 interface "ec#anis"s.
B+ ,#at is t#e usrperL
1+ -t is a data strea"in7 test app$ication. -t can $oad &%G1 confi7uration data *fed seria$$y into
t#e confi7uration $ines of t#e &%G1 itwise+) assert deu7 U'R% L4;s) read and write data to t#e
U'R%.
0n start up) usrper first atte"pts to create an interface oJect t#at can co""unicate wit# a va$id
U'R% device. .#is creates a #and$e to a 7eneric U'6 device) and t#en traverses a$$ t#e devices
found attac#ed to t#e U'6) searc#in7 for t#e &?2Qs vendor and product -; nu"ers *080141 and
083209 respective$y+. 0n successfu$$y $ocatin7 a powered) un-confi7ured &?2 device) usrper t#en
down$oads t#e Gnu#adio fir"ware to t#e &?2) w#ic# sets up t#e syste". 1fter syste" setup) t#e
fir"ware $oads custo" va$ues into t#e Aendor and %roduct -; fie$ds and initiates a software reset)
causin7 t#e &?2 device to disconnect and t#en reconnect to t#e U'6 us.
.#is process is ca$$ed re-enu"eration) and t#e (inu8 9erne$ now sees t#e U'R% oard as a U'6
device wit# t#e %roduct -; and Aendor -; 08)))E and 080002) w#ic# correspond to a
confi7ured U'R% device deve$oped y t#e &ree 'oftware &oundation.
0nce t#is #as een ac#ieved) ca$$s are "ade to U'R%-specific "et#ods w#ic# can e reads) writes
or contro$ re@uests.
%a7e 8( of C0
h 5ontro$ re@uests:
.#ese ena$e or confi7ure various aspects of t#e U'R% syste") and are "ade to U'6 endpoint 0.
.#e fir"ware intercepts t#ese ca$$s *interrupts are 7enerated on a$$ U'6 contro$ re@uests t#at are
received fro" t#e #ost+ and services t#e".
.#ey for" vendor-e=tension functions) and carry out various data transfers to and fro" interna$
re7isters ased on t#e #ostQs contro$ re@uest para"eters.
&or e=a"p$e to down$oad t#e &%G1Es fir"ware) t#e confi7uration it strea" data is sent via
endpoint 0 wit# t#e appropriate contro$ para"eters indicatin7 a re@uest to confi7ure t#e &%G1.
.#e &?2 intercepts eac# yte in t#is strea") and sends it itwise over t#e &%G1Es confi7uration
$ines *t#e 1$tera 4%1512 &%G1 supports seria$ confi7uration "odes+. ,#i$e servicin7 t#e contro$
re@uest) t#e &?2 fir"ware sends ac9 t#e appropriate #ands#a9in7 si7na$s to t#e #ost to indicate
t#at t#e contro$ re@uest is ein7 #and$ed correct$y.
h Read re@uests:
.#e U'6 re@uests data fro" t#e U'R% y "a9in7 read re@uests over endpoint 2 *set up for 812
yte u$9 2& transfers+. .#e &?2 intercepts t#ese re@uests and pri"es t#e G%-& transfer state
"ac#ine wit# t#e transfer para"eters efore re$in@uis#in7 contro$ to t#e G%-&.
.#e G%-& enters t#e &-&0 read state "ac#ine and re"ains in t#is confi7uration unti$ t#e transfer
is co"p$ete) or an error #as occurred. .#e &?2 #and$es a$$ ac9now$ed7e and #ands#a9in7 si7na$s
wit# t#e U'6 #ost transparent$y fro" t#e fir"ware.
h ,rite re@uests:
1s wit# read re@uests) t#e #ost %5 "a9es 7eneric U'6 write re@uests) t#is ti"e to endpoint <
*confi7ured for 812 yte u$9 (UT transfers+. .#e G%-& in t#is ti"e set up for t#e &-&0 write
state "ac#ine) and transfers data unti$ t#e transaction is co"p$ete) or an error is encountered.
B+ ,#at does t#e &?2 $ow-$eve$ interface $irary *U'R%O%R-3'.55+ doL
1+ .#is $irary code for"s t#e direct interface wit# t#e &?2 as a set of $ow-$eve$ functions. ;ata
transfers and various contro$ re@uests are passed to t#e &?2 via U'6 endpoint 0) w#i$e t#e data
received is sent ac9 via endpoint 2.
B+ ,#at does t#e &?2 app$ication-$eve$ interface $irary *U'R%O61'-5.55+ doL
1+ .#is $irary presents a #i7#er-$eve$ interface to t#e &?2) in t#e for" of oJect-oriented
"et#ods w#ic# ca$$ t#e functions in usrpOpri"s.cc.
B+ ,#y we use G%-& "odeL
1+ ,e use t#e &?2 in G%-& "ode ecause it a$$ows us to urst data across t#e G%-& interface at
C< 36!sec.
%a7e 8: of C0
B+ U'R%-&?2 interface - 1s - understand it) a$$ contro$ ca$$s to endpoint 0 are #and$ed wit#in t#e
&?2 and do not re@uire t#e invo$ve"ent of t#e &%G1) ri7#tL
1+ 2es
B+ G%-& ! &%G1 fir"ware - /ow "any G%-& wavefor" confi7urations do you i"p$e"entL
1+ .wo: &-&0Rd and &-&0,r
B+ ;o you #and$e &%G1 confi7uration e=p$icit$y usin7 t#e &? 8081 coreL
1+ ,e it an7 t#e &%G1 confi7uration fro" t#e 8081.
B+ %$ease cou$d you point "e to t#e correct &?2 source to deter"ine your G%-& 5.L=!R;2=
$ines and wavefor" descriptions)L
1+ ,e used t#e 5ypress G%-& desi7ner. 'ee 7pif.7pf.
B+ /ow we can "odify t#e U'R% w#ic# uses U'62.0 *:803it!sec+ #i7# speed interfaces to use
U'6 1.1 *123yte!sec+ fu$$ speed contro$$er. .#e U'6 1.1 sends <: yte pac9ets) w#i$e U'62.0
uses 812 yte pac9etsL
1+ -f you 7o to:

#ttp:!!7nuradio.uta#.edu!trac!rowser!7nuradio!trun9!usrp!fp7a!sdrO$i!t=Ouffer.v
and $oo9 at $ine C:) you wi$$ see t#e test for Nend of pac9etN. writeOcountR8S 7oes #i7# w#en we
#ave put 28< e$e"ents *812 ytes+ into t#e &-&0. 2ou wou$d need to "odify t#is to
writeOcountR8S w#ic# wi$$ 7o #i7# w#en (2 e$e"ents *<: ytes+ #ave een put into t#e &-&0.
2ou proa$y a$so need to "odify so"e fir"ware. 1$so you #ave to deci"ate t#e source down to
a very $ow data rate) so it wonQt overf$ow.
B+ ;oin7 su77ested aove "odifications) it $oo9s $i9e data is co"in7 out) ut it $oo9s $i9e - 7et <:
ytes out) t#en t#ere is a N#iccupN aout 8 "icroseconds $on7. - a" 7ettin7 suspicious t#e %5
doesnQt 7et t#e data on t#e U'6 us fast enou7#. - a" wonderin7 if t#ere is a way to $et t#e
uffers in t#e &?2 c#ip fi$$ up "ore efore t#e &%G1 starts pu$$in7 data fro" t#e &?2L
%a7e 88 of C0
1+ Un$ess your &?2 code sets up t#e transfer siKe to <:) t#en t#is is proa$y w#at is #appenin7.
.#at is) t#e #ost is sendin7 <: ytes) ut t#e &?2 is i7norin7 t#e rea$ $en7t#) and is assu"in7 t#at
itQs 812 ytes. Re"e"er t#at t#e G%-& is current$y set up to ;31 28< 1<-it va$ues. %er#aps
t#at part needs c#an7in7. .#e "a7ic va$ue is proa$y uried in t#e ,ave;ata ta$e in
usrpO7pif.c.
1not#er t#in7 you cou$d try is to set up t#e G%-& in a non-f$owstate "ode. 2ouQd need to use t#e
5ypress too$ to do t#is *or Larry ;oo$itt$eQs per$ *L+ code. Runnin7 in fu$$ speed) you donQt need
to e a$e to urst data at C<36!sec etween t#e &?2 and &%G1.
Note:
.#ere is a su77ested patc# to "a9e U'R% a$e to use U'6 1.1 at:
#ttp:!!$ists.7nu.or7!arc#ive!#t"$!discuss-7nuradio!200<-0:!"s70028:.#t"$
B+ - $oo9ed over t#e G%-& stuff wit# t#e 5ypress too$ - do not see any reference to transfer siKe in
t#ere. - a" t#in9in7 t#e transfer siKe is set in t#e &%G1L
1+ Nope. .#e G%-& is in c#ar7e of t#e transfer. -Q" assu"in7 t#at w#at you are seein7 is t#at t#e
&?2 is urstin7 a 28< word transfer) 7iven #ow you #ave pro7ra""ed everyt#in7. 6.,) -Q" not
9iddin7 aout t#is ein7 near$y i"possi$e wit#out a $o7ic ana$yKer. ,#atQs current$y rea$$y
#appenin7 on t#e G%-& usL *6rin7 out t#e re$evant G%-& pins to t#e dau7#teroard deu7
#eaders.+
Loo9in7 at pa7e 10-1< *10.(.2.2.2 ;ecision %oint 'tates+ of t#e &?2 .ec#nica$ Reference 3anua$
*and dustin7 off "y "e"ory+) t#e wavefor" decision point is contro$$ed y t#e N.ransaction
5ount 4=piredN si7na$. %a7e 10-2:) NL0G-5 &UN5.-0N Re7isterN) .4R31 and!or .4R36
wi$$ e coded as R;28 *or .ransaction-5ount 4=piration) if
G%-&R41;25&G.8 T 1 *w#ic# it is++
'ee pa7e 10-:1) 10.:.(.1 N.ransaction 5ounterN.
.o use t#e .ransaction 5ounter for &-&0 N=N $oad G%-&.56(:0 wit# t#e desired nu"er of
transactions. ,#en a &-&0-R41; or -,R-.4 wavefor" is tri77ered on t#at &-&0) t#e G%-&
wi$$ transfer t#e specified nu"er of ytes *or words) if ,0R;,-;4T1+.
'ee III /4R4 III e$ow *fro" usrp!fir"ware!src!usrp2!usrpO"ain.c+:
1re you settin7 t#ese to (2 instead of 28<L -f not) t#atQs proa$y t#e root of t#e pro$e".
!! Ne=t see if t#ere are any N0U.N pac9ets waitin7 for our attention)
!! and if so) if t#ereQs roo" in t#e &%G1Qs &-&0 for t#e".
if *7Ot=Oena$e __ U*4%2:&-&0&LG' _ 0=02++W !! U'6 end point fifo is not e"pty...
if *fp7aO#asOroo"OforOpac9et *++W !! ... and &%G1 #as roo" for pac9et
G%-&.561 T 0=01; '2N5;4L12; IIIIIII /4R4 IIIIIII
G%-&.560 T 0=00; '2N5;4L12; IIIIIII /4R4 IIIIIII
setupOf$owstateOwrite *+;
%a7e 8< of C0
'2N5;4L12;
G%-&.R-G T "G%-&O4%2O'.1R. b "G%-&O,R-.4; !! start t#e =fer
'2N5;4L12;
w#i$e *U*G%-&.R-G _ "G%-&O-;L4++W
!! wait for t#e transaction to co"p$ete
X
X
X
!! 'ee if t#ere are any re@uests for N-NN pac9ets) and if so
!! w#et#er t#e &%G1Qs 7ot any pac9ets for us.
if *7Or=Oena$e __ U*4%<5' _ "4%&ULL++W !! U'6 end point &-&0 is not fu$$...
if *fp7aO#asOpac9etOavai$ *++W !! ... and &%G1 #as pac9et avai$a$e
G%-&.561 T 0=01; '2N5;4L12; IIIIIII /4R4 IIIIIII
G%-&.560 T 0=00; '2N5;4L12; IIIIIII /4R4 IIIIIII
setupOf$owstateOread *+;
'2N5;4L12;
G%-&.R-G T "G%-&O4%<O'.1R. b "G%-&OR41;; !! start t#e =fer
'2N5;4L12;
w#i$e *U*G%-&.R-G _ "G%-&O-;L4++W
!! wait for t#e transaction to co"p$ete
X
'2N5;4L12;
-N%H.4N; T <; !! te$$ U'6 we fi$$ed uffer *< is our endpoint nu"+
X
X
Un$ess you 7et $uc9y and t#e "odification aove $ae$ed N/4R4N wor9s) youQre Orea$$yO 7oin7 to
want access to a $o7ic ana$yKer.
B+ -Q" $oo9in7 into writin7 a native U'6 driver for ,indows and t#e U'R%; -E" tryin7 to find
out so"e infor"ation on t#e U'6 interface of t#e U'R%.
1+ 'ee:
usrp!fir"ware!inc$ude!usrpOinterfaces.#
usrp!fir"ware!inc$ude!usrpOco""ands.#
%a7e 8> of C0
B+ ;oes anyone 9now w#ere t#e est p$ace is to find docu"entation *if any+ of t#e U'6 data
structures t#at are sent on interface 0) 1 _ 2 *ep0) ep2 and ep<+ so t#at - can ac#ieve t#is. -
assu"e t#e ep0 data structures are t#at of t#e U'6 ;evice Re@uest structure on t#e defau$t contro$
pipe) ut - a$so assu"e t#ere are "ore contro$ re@uests t#an t#e standard U'6 ones.
1not#er t#in7 - was wonderin7) since t#e vendor id is a standard free for a$$ type) #ow do you
actua$$y deter"ine if it is indeed a U'R% t#at you are connected to) and on top of t#at if you are
connected to an &?2 c#ip w#ic# is not t#e U'R% and #as not een initia$iKed) can you deter"ine
t#at it is an &?2 t#at in on a U'R% or notL
1+ 1$$ t#e s#ipped U'R%s #ave a non-5ypress U'6 A-;!%-; urned into t#e". .#ere is no
confusion etween a U'R% and an un-pro7ra""ed &?2. ,e use: A-; T 0=fffe) %-; T 0=0002.
,e distin7uis# oard revs and w#et#er or not weQve $oaded our fir"ware via t#e ;-;.
'ee usrp!fir"ware!inc$ude!usrpOids.#
%retty "uc# every @uestion aout #ow to contro$ t#e U'R% is answered in one of t#e .# fi$es in
usrp!fir"ware!inc$ude
-n particu$ar; see fp7aOre7sOco""on.# and fp7aOre7sOstandard.# for t#e definitions of t#e
confi7uration re7isters in t#e &%G1.
B+ 3y pro$e" is t#at - co"p$ete$y "iss t#e $ow $eve$ U'6 pro7ra""in7 s9i$$s and - #oped to
find so"e sort of driver for t#e cypress c#ip in Linu=.
1+ No need for any driver pro7ra""in7. Just use $ius.
'ee #ttp:!!$ius.sf.net
B+ /ow do - ensure t#at t#e appropriate us driver*s+ are associated wit# "y U'6 device w#en -
connect to t#e syste"L
1+ /ere is t#e out$ine of a few steps:
1. 1ssi7n yourse$f a U'6 product -; in t#e space defined y:
fir"ware!inc$ude!usrpOids.# and 7et t#e U'R% deve$opers to ac9now$ed7e it.
2. /ac9 #ost!$i!usrpOpri"s.cc to accept your %-; in addition to t#e nor"a$ U'R% ones.
(. %ro7ra" t#e &?2 44%R03 to your product -; usin7 usrper i2cOwrite.
:. 1dd a user"ap fi$e and initia$iKation script to !etc!#otp$u7!us!
B+ -s it feasi$e to "odify e=istin7 &?2 fir"ware to "y own needs for testin7 purposesL
1+ 1so$ute$y. 2ou can use a s$i7#t$y "odified usrper and testOusrpOstandardOr= to 7et yourse$f
7oin7 unti$ you ui$d your own custo"iKed e=ecuta$e fro" t#e $iraries.
B+ ,e created a custo" oard ased on t#e U'R%. -Qd $i9e to avoid reco"pi$in7 t#e &? *8081+
source code if possi$e. -s t#ere a function t#at wi$$ a$$ow "e to write direct$y to one of t#e &?
%a7e 88 of C0
re7istersL - want to c#an7e t#e fre@uency of t#e 5LH output fro" t#e defau$t of 12 3/K to 2:
3/K.
1+ No co""and. -n U'R% we run t#e &?2 at :8 3/K after our fir"ware is $oaded.
B+ -t was said t#at U'R% &%G1 &-&0 6uffers is 2H $ines. ;oes it "ean 20:8 itsL
1+ No) it "eans 2H $ines) eac# $ine is (2 its. .#e &?2 a$so i"p$e"ents @uad ufferin7 in ot#
.? and R? directions) eac# uffer is 812 ytes.
B+ ,#at do t#e para"eters fusOn$oc9 and fusO$oc9OsiKe e=act$y do in #ow data is
trans"itted over t#e U'6 to t#e U'R%L
1+ .#e fusO$oc9OsiKe is t#e siKe in ytes of t#e "a=i"u" transfer t#at we wi$$ as9 t#e 9erne$ to
"a9e to!fro" user-space. .#e fusOn$oc9 is t#e "a=i"u" nu"er of transfers *of "a=i"u"
siKe fusO$oc9OsiKe+ t#at we can #ave in f$i7#t at any 7iven ti"e. .a9e a $oo9 at fusO$inu=.
W#)ccX for t#e detai$s.
B+ -f t#ere is $ess data avai$a$e on t#e U'R% *i.e. not fusOn$oc9[fusO$oc9OsiKe+) does it sti$$
7et sent over t#e U'R% to t#e co"puterL
1+ 2es. .#e U'R% pac9a7es data into 812 yte U'6 pac9ets and sends t#e" as soon as it can.
.#atQs 128 co"p$e= sa"p$es *1<-it - _ B+.
B+ /ow is t#e s"a$$est a"ount of data necessary in t#e U'R% defined suc# t#at a pac9et is sent
over t#e U'6 to t#e co"puterL -s it fusO$oc9OsiKeL
1+ -ts 812 ytes. -tQs set in t#e &?2 fir"ware.
B+ $oo9in7 t#rou7# t#e &?2 data s#eet) t#e G%-& desi7ner appQs 7enerated code and your
editO7pif script output) - *#ope+ - #ave an understandin7 of t#e actua$ data f$ow us cyc$e *- a"
on$y focusin7 on &-&0Rd+: 2ou use f$ow states. .#ere is a f$owstate in state '1) w#ic#
constant$y asserts R4N and 04 *and 60GU'+ w#i$e t#e transaction #as not yet e=pired. -t de-
asserts a$$ 5.L= si7na$s w#en t#e transfer is co"p$ete.
U'R% do data transfers on ot# ed7es of -&5LH. .#e &L0,'.6 re7ister indicates t#at 5.L: is
your "aster stroe. - t#ou7#t 5.L: was a reset si7na$ *5LR'.+. .o su""ariKe:
04 and R4N are active-#i7#) and data is c$oc9ed out on ot# ed7es of -&5LH. -s t#is correctL
%a7e 8C of C0
1+ 2es) "odu$o pro$e" wit# si7na$s ein7 asserted one cyc$e too $on7 on ,R
B+ ,#at part do t#e R;2= pins p$ay in t#e f$owstateL
1+ None.
B+ ;o t#ey on$y affect transitions etween '1) '2..'<L
1+ Nope) not t#at eit#er...
2 H"+e $he d"#uen$ 4as Usefu,CCC.Firas
%a7e C0 of C0

S-ar putea să vă placă și