You are on page 1of 25

TITLE: TMS320C6713 Fast Fourier Transform (FFT) OB ECTI!

ES i) To implement FFT using TMS320C6713 DSK ii) To visualize the f e!uen"# "ontent of signal $# implementing FFT on the ta gete% DSK th ough a %igital os"illos"ope& "#$%&#$E O$ SOFT&#$E LIST:' i) TMS320C6713 Digital Signal ' o"esso ii) Signal (ene ato iii) Digital )s"illos"ope iv) 'C*+o ,station- installe% +ith Co%e Compose Stu%io an% .eal Time DS' T aining S#stem Soft+a e& T"EO$( E)*L#+#TIO+:' I+T$O%,CTIO+ / Fast Fou ie T ansfo m 0FFT) is an effi"ient algo ithm to "ompute the %is" ete Fou ie t ansfo ms 0DFT) an% inve se& The esults of the FFT a e the same as +ith the DFT an% onl# %iffe en"e is that the algo ithm is optimize% to emove e%un%ant "al"ulations& 1n gene al2 the FFT "an ma,e these optimizations +hen the num$e of samples to $e t ansfo me% is an e3a"t po+e of t+o2 fo +hi"h it "an eliminate man# unne"essa # ope ations& The e a e man# %istin"t FFT algo ithms involving a +i%e ange of mathemati"s2 f om simple "omple34num$e a ithmeti" to g oup theo # an% num$e theo #& The most +ell ,no+n FFT algo ithms %epen% upon the fa"to ization of 52 $ut 0"ont a # to popula mis"on"eption) the e a e FFTs +ith )05 log 5) "omple3it# fo all 52 even fo p ime 5& Man# FFT algo ithm onl# %epen% on the fa"t that e
2 i N

is an 5th p imitive oof of unit#2 an% thus "an $e applie% to analogous t ansfo ms ove
1 N

an# finite fiel%2 su"h as num$e 4theo eti" t ansfo ms& Sin"e the inve se DFT is the same as the DFT2 $ut +ith the opposite sign the e3ponent an% a a%opt it& 1 fa"to 2 an# FFT algo ithm "an easil# $e

6et

0 2772 X N 1 $e "omple3 num$e s& The DFT is %efine% $# the fo mula

The Fast Fou ie T ansfo m 0FFT) is essentiall# the high spee% implementation of the DFT& The t+o app oa"hes fo implementing the FFT a e %e"imation in time 0D1T) an% %e"imation in f e!uen"# 0D1F)& The D1T isX 0k ) =
n =even

x0n) e3p0 j

2kn 2kn ) + x 0n) e3p0 j ) N N n =odd

The D1F isX 0k ) =


N 21 n =0

x0n) e3p0 j

N 21 2kn 2kn ) + x0 n) e3p0 j ) N N n =0

The f e!uen"# esolution of the FFT 0an% DFT) "an $e "al"ulate% $# using the e!uation-

f
sample size& Com-arison of .om-utationa/ .osts

res

fs N

8he e f res is the f e!uen"# esolution of FFT2 f s is the sampling f e!uen"# an% 5 is the FFT

The ta$le $elo+ illust ates the "omputational "osts asso"iate% +ith the DFT an% the FFT algo ithms in te ms of the num$e of eal4value% multipli"ations an% a%%itions fo %iffe ent values of 5& 5ote that +hile fo small values of 52 the "omputational savings of the FFT a e elativel# mo%est2 fo la ge values of 52 the "omputational savings $e"ome eno mous& 1t is %iffi"ult to ove state the impo tan"e of the FFT algo ithm in the %evelopment of mo%e n DS' appli"ations9 +ithout it2 man# of the te"hni!ues that have $een %evelope% in the DS' fiel% +oul% not $e "omputationall# t a"ta$le fo long %is" ete4time se!uen"es&

The follo+ing %iag ams sho+ the elationship $et+een the se ies in%e3 an% the f e!uen"# %omain sample in%e3& 5ote the fun"tions he e a e onl# %iag ammati"9 in gene al the# a e $oth "omple3 value% se ies&

Fo e3ample if the se ies ep esents a time se!uen"e of length T then the follo+ing illust ates the values in the f e!uen"# %omain&

The fi st sample :00) of the t ansfo me% se ies is the DC "omponent2 mo e "ommonl# ,no+n as the ave age of the input se ies& 3

The DFT of a eal se ies2 e3ample-4 imagina # pa t of 30,) ; 02 esults in a s#mmet i" se ies a$out the 5#!uist f e!uen"#& The negative f e!uen"# samples a e also the inve se of the positive f e!uen"# samples&

The highest positive 0o negative) f e!uen"# sample is "alle% the 5#!uist f e!uen"#& This is the highest f e!uen"# "omponent that shoul% e3ist in the input se ies fo the DFT to #iel% <un"o upte%< esults& Mo e spe"ifi"all# if the e a e no f e!uen"ies a$ove 5#!uist the o iginal signal "an $e e3a"tl# e"onst u"te% f om the samples&

The elationship $et+een the ha moni"s etu ns $# the DFT an% the pe io%i" "omponent in the time %omain is illust ate% $elo+&

>

S#M*LE T$#+SFO$M *#I$S #+% $EL#TIO+S"I*S

The Fou ie t ansfo m is linea 2 that is a f0t) ? $ g0t) 444@ a F0f) ? $ (0f) a 3, ? $ #, 444@ a :, ? $ A,

S"aling elationship f0t * a) 444@ a F0a f) f0a t) 444@ F0f * a) * a

Shifting f0t ? a) 444@ F0f) e4B 2 pi a f

Mo%ulation f0t) eB 2 pi a t 444@ F0t 4 a)

Dualit# :, 444@ 01*5) 354,

/ppl#ing the DFT t+i"e esults in a s"ale%2 time eve se% ve sion of the o iginal se ies& The t ansfo m of a "onstant fun"tion is a DC value onl#&

The t ansfo m of a %elta fun"tion is a "onstant

The t ansfo m of an infinite t ain of %elta fun"tions spa"e% $# T is an infinite t ain of %elta fun"tions spa"e% $# 1*T&

The t ansfo m of a "os fun"tion is a positive %elta at the app op iate positive an% negative f e!uen"#&

The t ansfo m of a sin fun"tion is a negative "omple3 %elta fun"tion at the app op iate positive f e!uen"# an% a negative "omple3 %elta at the app op iate negative f e!uen"#&

The t ansfo m of a s!ua e pulse is a sin" fun"tion

Mo e p e"isel#2 if f0t) ; 1 fo CtC D 0&>2 an% f0t) ; 0 othe +ise then F0f) ; sin0pi f) * 0pi f) Convolution f0t) 0 g0t) 444@ F0f) (0f) F0f) 0 (0f) 444@ f0t) g0t) 3, 0 #, 444@ 5 :, A, 3, #, 444@ 01*5) :, 0 A, Multipli"ation in one %omain is e!uivalent to "onvolution in the othe %omain an% visa ve sa& Fo e3ample the t ansfo m of a t un"ate% sin fun"tion a e t+o %elta fun"tions "onvolve% +ith a sin" fun"tion2 a t un"ate% sin fun"tion is a sin fun"tion multiplie% $# a s!ua e pulse& The t ansfo m of a t iangula pulse is a sin"2 fun"tion& This "an $e %e ive% f om fi st p in"iples $ut is mo e easil# %e ive% $# %es" i$ing the t iangula pulse as the "onvolution of t+o s!ua e pulses an% using the "onvolution4 multipli"ation elationship of the Fou ie T ansfo m& S#M*LI+1 T"EO$EM The sampling theo em 0often "alle% <ShannonEs Sampling Theo em<) states that a "ontinuous signal must $e %is" etel# sample% at least t+i"e the f e!uen"# of the highest f e!uen"# in the signal& Mo e p e"isel#2 a "ontinuous fun"tion f0t) is "ompletel# %efine% $# samples eve # 1*fs 0fs is the sample f e!uen"#) if the f e!uen"# spe"t um F0f) is ze o fo f @ fs*2& fs*2 is "alle% the 5#!uist f e!uen"# an% pla"es the limit on the minimum sampling f e!uen"# +hen %igitizing a "ontinuous signal& 1f 30,) a e the samples of f0t) eve # 1*fs then f0t) "an $e e3a"tl# e"onst u"te% f om these samples2 if the sampling theo em has $een satisfie%2 $#

8he e

5o mall# the signal to $e %igitize% +oul% $e app op iatel# filte e% $efo e sampling to emove highe f e!uen"# "omponents& 1f the sampling f e!uen"# is not high enough the high f e!uen"# "omponents +ill + ap a oun% an% appea in othe lo"ations in the %is" ete spe"t um2 thus "o upting it& The ,e# featu es an% "onse!uen"es of sampling a "ontinuous signal "an $e sho+n g aphi"all# as follo+s-4 Consi%e a "ontinuous signal in the time an% f e!uen"# %omain&

Sample this signal +ith a sampling f e!uen"# fs2 time $et+een samples is 1*fs& This is e!uivalent to "onvolving in the f e!uen"# %omain $# %elta fun"tion t ain +ith a spa"ing of fs&

1f the sampling f e!uen"# is too lo+ the f e!uen"# spe"t um ove laps2 an% $e"ome "o upte%&

/nothe +a# to loo, at this is to "onsi%e a sine fun"tion sample% t+i"e pe pe io% 05#!uist ate)& The e a e othe sinusoi% fun"tions of highe f e!uen"ies that +oul% give e3a"tl# the same samples an% thus "anGt $e %istinguishe% f om the f e!uen"# of the o iginal sinusoi%& H

*$OCE%,$ES OF E)*E$IME+T:' "ar23are Conne.ti4it5:' 1) The ste eo*I5C "onne"to +as "onne"te% f om the signal gene ato to the 6ine41n of the DSK& 2) The I5C*I5C "onne"to "a$le is "onne"te% in pa allel f om signal gene ato to "hannel 1 of the %igital os"illos"ope& 3) The ste eo*I5C "onne"to "a$le is "onne"te% f om 6ine4)ut of DSK to "hannel 2 of the %igital os"illos"ope& =) The signal gene ato is set to 1000 Jz2 2 Kp4p an% the input signal in "hannel 1 is o$se ve%& >) The DSK is "onne"te% to the 'C an% the DSK is po+e on& Soft3are *ro6ram:' Code Composer Studio:1) The DSK CCStu%io on the 'C %es,top is %ou$le4"li",e%& 2) To esta$lish "onne"tion to the DSK $oa %2 %e$ug is "li",e% an% then "onne"t is "li",e%& 3) The "o%e "ompose p oBe"t is opene% $# "hoosing p oBe"t4open an% fast Fourier transform (FFT).pjt +as "li",e%& Reviewing the Source Code:1) 1n the p oBe"t vie+ +in%o+2 the Fast Fourier Transform (FET).pjt(Debug) +as "li",e% an% the sou "e fol%e +as sele"te%& 2) The fft.c file in the p oBe"t vie+ +as %ou$le "li",e% to open the sou "e "o%e of the p og am Building and Running the program:-

10

1) ' oBe"t L .e$uil% /ll +as "hosen so that the p og am e"ompiles2 eassem$les an% elin,s all the files in the p oBe"t& The $uil% f ame at the $ottom of the +in%o+ %ispla#s messages a$out this p o"ess& 2) The fft.out file +as loa%e% $# sele"ting File4 6oa% p og am& 1t opens a file $ o+se & fft.out file +as sele"te% in the %e$ug %i e"to # to loa% the e3e"uta$le file& 3) Then De$ug4 un option +as sele"te% to un the p og am& =) The output in eal time "omes out in "hannel 2 of the os"illos"ope +hi"h is sho+n in the FFT po+e spe"t um& >) The f e!uen"# of the signal gene ato +as a%Buste% an% the FFT output +as o$se ve% in the %igital os"illos"ope& 6) 8hen all the esults +e e o$taine% as in the ta$le the p og am +as halt in the tool$a $utton&

$ES,LT FFT sample size2 5 ; 102= samples


sampling f e!uen"# FFT sample size

F e!uen"# esolution2 f ; ;

F000 102=

; 7&F12> Jz& Sampling f e!uen"#2 fs ; F000Jz


1 fs 1 F000

Sampling 1nte val2 Ts ; ;

;0&12>ms

11

For in-ut si6na/ fre7uen.5 of 1 8"9 In-ut Si6na/ Out-ut Si6na/

#m-/itu2e: 1&0=K Fre7uen.5: 1&00=, ,Jz

Time 2uration :et3een 2 -ea8 ; > %ivision 3 20ms ; 0&1s Sam-/e si9e :et3een 2 -ea8; n ; nTs * Ts ; 100ms*0&12>ms ; F00samples& Sam-/e si9e for <a/f -ea8; n=2 ; F00*2 ; =00 samples "a/f FFT sam-/es si9e; +=2 ; 102= *2 ; >12 sample size *ea8 FFT sam-/e si9e2 >12 L =00 ; 112 samples *ea8 fre7uen.5 ; f 3 112 samples ; 7&F12>Jz 3 112 samples 12

; F7> Jz&

For in-ut si6na/ fre7uen.5 of 2 8"9 In-ut Si6na/ Out-ut Si6na/

13

#m-/itu2e: 1&0=K Fre7uen.5: 2&00F ,Jz

Time 2uration :et3een 2 -ea8 ; 3&1 %ivision 3 20ms ; 62ms Sam-/e si9e :et3een 2 -ea8; n ; nTs * Ts ; 62ms*0&12>ms ; =H6 samples& Sam-/e si9e for <a/f -ea8; n=2 ; =H6*2 ; 2=F samples "a/f FFT sam-/es si9e; +=2 ; 102= *2 ; >12 sample size *ea8 FFT sam-/e si9e2 >12L 2=F; 26= samples *ea8 fre7uen.5 ; f 3 26= samples ; 7&F12>Jz 3 26= samples ; 2062&> Jz&

For in-ut si6na/ fre7uen.5 of > 8"9 In-ut Si6na/ Out-ut Si6na/ 1=

#m-/itu2e: 1&0= K Fre7uen.5: =&016 ,Jz

Time 2uration :et3een 2 -ea8 ; 0 %ivision 3 20ms ; 0ms Sam-/e si9e :et3een 2 -ea8; n ; nTs * Ts ; 0ms*0&12>ms ; 0 samples& Sam-/e si9e for <a/f -ea8; n=2 ; 0*2 ; 0 samples "a/f FFT sam-/es si9e; +=2 ; 102= *2 ; >12 sample size *ea8 FFT sam-/e si9e2 >12L0; >12 samples *ea8 fre7uen.5 ; f 3 >12 samples ; 7&F12>Jz 3 >12 samples ; = ,Jz&

OBSE$!#TIO+ 1? &<at is t<e fun2amenta/ fre7uen.5 t<at a/iasin6 -<enomenon o..ur at t<e s-e.trum@ 1>

#ns3er: The fun%amental f e!uen"# fo +hi"h the aliasing phenomenon sta ts to o""u is = ,Jz& This is $e"ause the sampling f e!uen"# of the Digital Signal ' o"essing $oa % is set to F ,Jz& /""o %ing to 5#!uist theo em2 the sampling f e!uen"# must mo e o e!ual to t+o times of the ma3imum f e!uen"# of the signal to avoi% aliasing phenomenon&
f s 2 f ma3

+he e f ma3 ;=,Jz

E)E$CISES
16

1? / "ontinuous time signal is %efine% as x0t ) = "os021000t ) + "os02 2000t ) i) 1f the signal is sample% at F000Jz2 +hat is the suita$le size fo DFT that "an ep esent $oth signal "omponentsM /ns+e f1; 1000Jz f2; 2000Jz

1 2

f res = 2000 1000

; 1000Jz f N = s f res
F000 1000 =F =

ii) For +A16

For +A32 17

1F

2) / %is" ete4time signal is %efine% as x0 n) = "os0 i) Cal"ulate the DFT fo 5;F an% 5;16& For +AB;
x0 n) = "os0
N 1 n =0
7

n
=

n
=

)
j 2kn N
jn = j 2kn F

:0,); x 0 n) e
1 = 0 e 2 0 1 7 = e 2 0
F F 2 2 2 = =2= =
jn =

1 + e 2

)e

j 2n 01k ) F

1 7 + e 2 0

j 2n 01+k ) F

,;1241 +ill $e the ma3 point of ,

For +A16
x0 n) = "os0
N 1 n =0
1>

n
=

)
j 2kn N
jn = j 2kn 16

:0,);

x 0 n) e
jn =

1 = 0 e 2 0 1 1> = e 2 0
=

1 + e 2

)e

k j 2n 01 2 ) F

1 1> + e 2 0

k j 2n 01+ 2 ) F

,;2242 +ill $e the ma3 point of ,


16 16 2 2 2 =F2F

ii) 'lot the DFT $# using Matla$& For +AB

1H

F 20

For +A16

21

3) / "ontinuous time signal is %efine% as x0t ) = "os021000t ) + sin0 212>0t ) i& 1f the signal is sample% at F000Jz2 +hat is the suita$le sample size fo DFT that "an ep esent $oth signal "omponentsM /ns+e f1;1000Jz f2;12>0Jz

1 2

f res = 12>0 1000

; 2>0Jz f N = s f res
F000 2>0 = 32 =

ii& 'lot the DFT of the signal $# using Matla$&

22

%ISC,SSIO+ 1& /liasing is an effe"t that "auses %iffe ent signals to $e"ome in%istinguisha$le +hen sample%& 1t also efe s to the %isto tion that esulte% +hen the signal e"onst u"te% f om samples is %iffe ent than the o iginal "ontinuous signal& 2& /t the input f e!uen"# of = ,Jz2 the sampling f e!uen"# is e!ual to the 5#!uist sampling f e!uen"#& The output signal is foun% that %iffe f om the e3pe"te% output signal as othe input f e!uen"#& The output signal %oes not sho+ the up+a % pa t +avefo m& The pea, to pea, spe"t um of the output +avefo m is a"tuall# ove lappe% +ith ea"h so the %istan"e $et+een the pea, to pea, spe"t ums is e!ual to ze o& This is the phenomenon +hen the sampling f e!uen"# e!ual to t+o times of the ma3imum f e!uen"# of the signal an% the aliasing effe"t is sta te% to o""u & 3& The Digital signal p o"esso $oa % TMS320C6713 has the p efi3e% sampling f e!uen"# an% FFT sample size +hi"h a e F000 ,Jz an% 102= samples espe"tivel#& The "o%ing $eing uploa%e% to the %igital signal p o"esso $oa % inst u"ts the FFT p o"ess $eing pe fo me%& FFT is a p o"ess of fou ie t ansfo m that give the same esult as Dis" ete Fou ie T ansfo m $ut FFT have a faste "omputational p o"essing& =& 8hen the input f e!uen"# is 1000 ,Jz2 the output +avefo m has t+o pea,s sho+n at the os"illos"ope an% the pea, is sepa ate% $# a gap& Jo+eve 2 as the f e!uen"# of the input signal is in" ease% to = ,Jz2 the gap $et+een the pea,s +as foun% to $e e%u"e%& This is $e"ause as f e!uen"# is in" ease%2 the pe io% +ill $e"ome smalle & The f e!uen"# esolution "al"ulate% in the esult pa t in%i"ate that the %iffe en"e $et+een t+o su""essive sample in the signal& >& Fo N3e "ise pa t2 !uestion 12 the simulate% output is e3pe"te% $e"ause the signal is summation of "osine signal an% sinusoi%al signal an% ea"h of them +ill p o%u"e t+o spe"t ums so the total spe"t um e3pe"te% is fou spe"t ums& Jo+eve 2 this e3pe"te% output is %ue to the sample size is suita$le& F om the e!uation2 the %iffe en"e $et+een the f e!uen"ies of the t+o signals is a"tuall# the f e!uen"# esolution& F om the e2 the sample size "an $e "al"ulate% so all the spe"t ums "an $e sho+n at the output&

23

6& Fo N3e "ise !uestion 12 as the sample size is in" ease%2 all of the spe"t ums still "an $e sho+n at the output& This is $e"ause as sample size in" eases2 the f e!uen"# esolution +ill $e %e" ease an% the s"ale of the g aph as if $e"ome mo e sensitive to %ete"t eve # pea, +hi"h ma# o""u & T+o pea,s a e foun% o""u at f e!uen"# 6000 Jz an% 7000 Jz& This also un%e e3pe"tation $e"ause the sample size is onl# %efine% f om ze o to infinite& The e +ill $e sample $eing "al"ulate% to $e negative value an% this is invali% so this pea, +ill $e efle"te% to ight han% si%e of the g aph& 7& Fo e3ample2 Fo 5;F2 if the pea, is "al"ulate% to o""u at ,;422 instea% of sho+ing the pea, at ,;422 the pea, +ill $e %ispla#e% at ,;F42 +hi"h is ,;6& F& 1f in "ase the sample size "hosen is too small2 some of the pea, +ill not sho+n in the spe"t um $e"ause the f e!uen"# esolution $e"ome la ge& H& The simulate% output of !uestion 1 an% 2 is the spe"t um is ep esente% +ith its 34a3is a e f e!uen"# an% sample espe"tivel#&

2=

CO+CL,SIO+ /fte "omplete% this la$ session +e lea ne% to implement the FFT using the DS' p o"esso TMS320C6713& 1ts output is un%e e3pe"tation as the %es" iption $eing $ ief $# le"tu e & F om this la$2 the f e!uen"# "ontent of the signal "an $e visualize% $# implementing FFT on the ta gete% DSK th ough a %igital os"illos"ope& Iesi%es2 the DFT p o"ess also $eing implemente% using M/T6/I soft+a e& The esult o$taine% also un%e e3pe"tation& /s a "on"lusion2 the o$Be"tive of this la$ session +as met& $EFE$E+CES a) http-**en&+i,ipe%ia&o g*+i,i*FastOFou ie Ot ansfo m :) http-**$eige&u"s&in%iana&e%u*I673*no%e12&html .) http-**"as&ensmp&f *P"haplais*8avetou Op esentation*t ansfo mees*Fou ie *FFTQS&html 2) http-**g us&$e ,ele#&e%u*PB g*ngst*fft*fft&html e) 6e"tu e

2>

You might also like