You are on page 1of 18

LAB EXERCISE

IDFT 8 POINT DIF USING TMS320F2812 DSP

IDFT 8 POINT USING DIF Aim To perform the 8 point IDFT using DIF process from a given discrete sequence in TMS320F2812 KIT. Requirements CCS v3.3 TMS320F2812 KIT USB Cable 5V Adapter Theory The algorithm for ifft(X) is the same as the algorithm for fft(X), except for a sign change and a scale factor of n = length(X). As for fft, the execution time for ifft depends on the length of the transform. It is fastest for powers of two. It is almost as fast for lengths that have only small prime factors. It is typically several times slower for lengths that are prime or which have large prime factors. FFT algorithms can be used to compute an inverse DFT without any change in algorithm. The inverse DFT of an N-point sequence X(k) , k = 0,1, 2, . . . . ., N-1 is defined as Join the Technical Community Today! http://www.pantechsolutions.net

Where,

Procedure Note: Once you install the Code Composer Studio v 3.3 software, the two icons will display in desktop I. Setup Code Composer Studio v3.3 II. Code Composer Studio 1. Open Setup Code Composer Studio v3.3. 2. In System Configuration, select the board then Remove all yes. a. In family, select C28xx. b. In platform, select xds100 usb emulator. c. In Endianness, select little. d. Select F2812 XDS100 USB Emulator add save & quit no. Join the Technical Community Today! http://www.pantechsolutions.net

Note: The above two steps only for first time to setup the processor in CCS. 3. Open Code Composer Studio v3.3. 4. Project New. a. Project name: type the project name. b. Location: Browse, select the project location . c. Project Type: Executable(.out) d. Target: TMS320C28XX. Finish. 5. File New Source file. a. Type the program in untitled window. 6. File Save. a. Browse our project location then type our project name.c ( .c extension is must) save. 7. Paste the following two cmd files in our project folder. a. F2812_EzDSP_RAM_lnk.cmd b. DSP281x_Headers_nonBIOS.cmd c. DSP281x_GlobalVariableDefs.c 8. Project Add files to project. a. In file of type : All files b. Ctrl + Select the following files Join the Technical Community Today! http://www.pantechsolutions.net

projectname.c DSP281x_GlobalVariableDefs.c F2812_EzDSP_RAM_lnk.cmd DSP281x_Headers_nonBIOS.cmd open. 9. Project Build Option. a. In compiler tab, select Preprocessor Include search path(-i): C:\tidcs\c28\DSP281x\v120\DSP281x_headers\includ e b. In linker tab, select libraries Search path(-i): C:\CCStudio_v3.3\C2000\cgtools\lib Incl libraries(-l): rts2800_ml.lib. c. In linker tab, select Basic Stack Size(-stack): 0x400 ok. 10. Project Build (or) Rebuild all. 11. Connections for TMS320F2812 kit: a. Connect 5v adpter to TMS320F2812 kit. b. Connect usb cable to TMS320F2812 kit from pc. c. Power on the TMS320F2812 kit. 12. Debug connect. 13. File Load Program Browse and select the projectname.out file open Join the Technical Community Today! http://www.pantechsolutions.net

14. Debug Go main. 15. View Watch window watch1. a. Type the following array variable. Xr( sequence output) 16. Debug Run. 17. Debug Halt 18. See the output at following location, View memory a. Enter An Address:0x3F9200 Enter. b. Type the input. For example: 1. 0x3F9200 0x0008 2. 0x3F9201 0x0007 3. 0x3F9202 0x0008 4. 0x3F9203 0x0007 5. 0x3F9204 0x0000 6. 0x3F9205 0x0000 7. 0x3F9206 0x0000 8. 0x3F9207 0x0000

Join the Technical Community Today! http://www.pantechsolutions.net

19. Or see the ouput at watch window.

Note: watch window will show exact decimal values, processor memory location will show a hexadecimal values.

Join the Technical Community Today! http://www.pantechsolutions.net

Program

#include "DSP281x_Device.h" #include <math.h> void InitSystem(); float tr[8],ti[8],s1r[8],s1i[8],s2r[8],s2i[8],Xr[8],Xi[8],Yr[8],Yi[8],tempr[8], tempi[8]; const float xr[8] = {4, input 1, 0, 1, 0, 1, 0, 1 }; // real part

const float xi[8] = {0, 2.414, 0, 0.414, 0, -0.414, 0, -2.414 }; // imaginary part input const float W0r = 1, W0i = 0, W1r = 0.707, W1i = -0.707, W2r = 0, W2i = -1, Join the Technical Community Today! http://www.pantechsolutions.net

W3r = -0.707, W3i = -0.707; void main() { int *Seq_out; int i=0; Seq_out = (int *)0x003F9200; InitSystem();

// stage one process s1r[0] = (xr[0] + xr[4]); s1i[0] = (xi[0] + xi[4]); s1r[1] = (xr[1] + xr[5]); s1i[1] = (xi[1] + xi[5]); s1r[2] = (xr[2] + xr[6]); s1i[2] = (xi[2] + xi[6]); s1r[3] = (xr[3] + xr[7]); Join the Technical Community Today! http://www.pantechsolutions.net

s1i[3] = (xi[3] + xi[7]); s1r[4] = (xr[0] - xr[4]); s1i[4] = (xi[0] - xi[4]); tempr[0] = (xr[1] - xr[5]); tempi[0] = (xi[1] - xi[5]); s1r[5] = ((tempr[0] * W1r) - (tempi[0] * W1i)); s1i[5] = ((tempr[0] * W1i) + (tempi[0] * W1r)); tempr[1] = (xr[2] - xr[6]); tempi[1] = (xi[2] - xi[6]); s1r[6] = ((tempr[1] * W2r) - (tempi[1] * W2i)); s1i[6] = ((tempr[1] * W2i) + (tempi[1] * W2r)); tempr[2] = (xr[3] - xr[7]); tempi[2] = (xi[3] - xi[7]); s1r[7] = ((tempr[2] * W3r) - (tempi[2] * W3i)); s1i[7] = ((tempr[2] * W3i) + (tempi[2] * W3r));

Join the Technical Community Today! http://www.pantechsolutions.net

// stage two process s2r[0] = (s1r[0] + s1r[2]); s2i[0] = (s1i[0] + s1i[2]);

s2r[1] = (s1r[1] + s1r[3]); s2i[1] = (s1i[1] + s1i[3]); s2r[2] = (s1r[0] - s1r[2]); s2i[2] = (s1i[0] - s1i[2]); tempr[3] = (s1r[1] - s1r[3]); tempi[3] = (s1i[1] - s1i[3]); s2r[3] = ((tempr[3] * W2r) - (tempi[3] * W2i)); s2i[3] = ((tempr[3] * W2i) + (tempi[3] * W2r)); s2r[4] = (s1r[4] + s1r[6]); s2i[4] = (s1i[4] + s1i[6]); s2r[5] = (s1r[5] + s1r[7]); s2i[5] = (s1i[5] + s1i[7]); s2r[6] = (s1r[4] - s1r[6]); Join the Technical Community Today! http://www.pantechsolutions.net

s2i[6] = (s1i[4] - s1i[6]); tempr[4] = s1r[5] - s1r[7]; tempi[4] = s1i[5] - s1i[7]; s2r[7] = ((tempr[4] * W2r) - (tempi[4] * W2i)); s2i[7] = ((tempr[4] * W2i) + (tempi[4] * W2r));

// output Xr[0] = (s2r[0] + s2r[1]); Xi[0] = (s2i[0] + s2i[1]); Xr[1] = (s2r[0] - s2r[1]); Xi[1] = (s2i[0] - s2i[1]); Xr[2] = (s2r[2] + s2r[3]); Xi[2] = (s2i[2] + s2i[3]); Xr[3] = (s2r[2] - s2r[3]); Xi[3] = (s2i[2] - s2i[3]); Xr[4] = (s2r[4] + s2r[5]); Xi[4] = (s2i[4] + s2i[5]); Join the Technical Community Today! http://www.pantechsolutions.net

Xr[5] = (s2r[4] - s2r[5]); Xi[5] = (s2i[4] - s2i[5]); Xr[6] = (s2r[6] + s2r[7]); Xi[6] = (s2i[6] + s2i[7]); Xr[7] = (s2r[6] - s2r[7]); Xi[7] = (s2i[6] - s2i[7]);

// bit reversal tr[0] = Xr[0]; ti[0] = Xi[0]; tr[1] = Xr[4]; ti[1] = Xi[4]; tr[2] = Xr[2]; ti[2] = Xi[2]; tr[3] = Xr[6]; ti[3] = Xi[6]; tr[4] = Xr[1]; Join the Technical Community Today! http://www.pantechsolutions.net

ti[4] = Xi[1]; tr[5] = Xr[5]; ti[5] = Xi[5]; tr[6] = Xr[3]; ti[6] = Xi[3]; tr[7] = Xr[7]; ti[7] = Xi[7];

// sending output array to memory location for(i=0;i<8;i++) { *Seq_out ++= tr[i]; } for(;;); } void InitSystem() { Join the Technical Community Today! http://www.pantechsolutions.net

EALLOW; SysCtrlRegs.WDCR= 0x0068; watchdog Watchdog , Prescaler = 1 // 0x00AF to NOT disable the Watchdog, Prescaler = 64 SysCtrlRegs.SCSR = 0; RESET SysCtrlRegs.PLLCR.bit.DIV = 10;// Setup the Clock PLL to multiply by 5 SysCtrlRegs.HISPCP.all = 0x1; // Setup Highspeed Clock Prescaler to divide by 2 SysCtrlRegs.LOSPCP.all = 0x2; // Setup Lowspeed CLock Prescaler to divide by 4 // Peripheral clock enables set for the selected peripherals. SysCtrlRegs.PCLKCR.bit.EVAENCLK=0; SysCtrlRegs.PCLKCR.bit.EVBENCLK=0; Join the Technical Community Today! http://www.pantechsolutions.net // Watchdog generates a // Setup the

// 0x0068 to disable the

SysCtrlRegs.PCLKCR.bit.SCIAENCLK=0; SysCtrlRegs.PCLKCR.bit.SCIBENCLK=0; SysCtrlRegs.PCLKCR.bit.MCBSPENCLK=0; SysCtrlRegs.PCLKCR.bit.SPIENCLK=0; SysCtrlRegs.PCLKCR.bit.ECANENCLK=0; SysCtrlRegs.PCLKCR.bit.ADCENCLK=0; EDIS; }

Result Thus, the 8 point IDFT of given sequence has performed and the result is stored at memory location(0x3F9200).

Join the Technical Community Today! http://www.pantechsolutions.net

Did you enjoy the read?


Pantech solutions creates information packed technical documents like this one every month. And our website is a rich and trusted resource used by a vibrant online community of more than 1,00,000 members from organization of all shapes and sizes.

Join the Technical Community Today! http://www.pantechsolutions.net

What do we sell?
Our products range from Various Microcontroller development boards, DSP Boards, FPGA/CPLD boards, Communication Kits, Power electronics, Basic electronics, Robotics, Sensors, Electronic components and much more . Our goal is to make finding the parts and information you need easier and affordable so you can create awesome projects and training from Basic to Cutting edge technology.

Join the Technical Community Today! http://www.pantechsolutions.net

You might also like