 ## FFT 8 Point DIF using TMS320C6745 DSP

### Aim

To perform the 8 point FFT using DIF process from a given discrete sequence in TMS320C6745 KIT

☞CCS v 4

☞USB Cable

### Theory

A fast Fourier transform (FFT) is an efficient algorithm to compute the discrete Fourier transform (DFT) and its inverse. There are many distinct FFT algorithms involving a wide range of mathematics, from simple complex number arithmetic to group theory and number theory.

A DFT decomposes a sequence of values into components of different frequencies. This operation is useful in many fields (see discrete Fourier transform for properties and applications of the transform) but computing it directly from the definition is often too slow to be practical. An FFT is a way to compute the same result more quickly: computing a DFT of N points in the naive way, using the definition, takes O(N2) arithmetical operations, while an FFT can compute the same result in only O(N log N) operations. The difference in speed can be substantial, especially for long data sets where N may be in the thousands or millions—in practice, the computation time can be reduced by several orders of magnitude in such cases, and the improvement is roughly proportional to N / log(N). This huge improvement made many DFT based algorithms practical; FFTs are of great importance to a wide variety of applications, from digital signal processing and solving partial differential equations to algorithms for quick multiplication of large integers.

The most well known FFT algorithms depend upon the factorization of N, but there are FFTs with O(N log N) complexity for all N, even for prime N. Many FFT algorithms only depend on the fact that e¯ 2∏ i /N is an th primitive root of unity, and thus can be applied to analogous transforms over any finitue field, such as number theoretic transforms. Since the inverse DFT is the same as the DFT, but with the opposite sign in the exponent and a 1/N factor, any FFT algorithm can easily be adapted for it.

### Procedure for build a project on FFT 8 Point DIF using TMS320C6745 DSP

1. Open Code Composer Studio v4 .

2. In WorkSpace Launcher.

BROWSE → Select the project location and make one new folder, MAKE NEW FOLDER → Type the Workspace name, OK → OK.

3. FILE → NEW → CCS PROJECT

☞Project name: Type your project name.

☞Tick use default location. → NEXT

☞Project type: C6000.

☞Tick Debug And Release. → NEXT → NEXT.

☞Output type: Executable.

☞Device Variant : generic C67XX Device.

☞Device Endianness : little

☞Code Generation Tools: TI v6.1.12.

☞Run time support library: automatic.

☞Target content: none. → FINISH

4.FILE → NEW → SOURCE FILE

☞Source file: Type your projectname.c( .c extension is must ).

☞Type the program.

FILE → SAVE.

5. Paste the following board library files in workspace location.

☞Gel folder (contains gel file)

☞Library folder(contains library files)

6. Paste the Linker file in the project location.(linker file is available in cd)

Note: Those folders and linker file are availble at cd.

7. PROJECT → PROPERTIES → C/C++ BUILD → BASIC OPTION

☞Target processor version(–silicon version, -mv) : 6400+ OK.

☞IN C/C++ BUILD, INCLUDE OPTIONS (Add dir to #include search path(–include_path,-I)) select the add icon and add the following three path by indivdually    –  “\${Diag}../../common/header”    –  “\${XDAIS_CG_ROOT}/packages/ti/xdais”    –  “\${C6000_CSL_CG_ROOT}/include”

8. FILE → NEW → TARGET CONFIGURATION FILE

☞file name: projectname. ccxml (.ccxml extension is must)

☞Connection: Texas Instrument XDS100 v1 USB Emulator.

☞Device: TMS320C6745. → SAVE → TARTGET CONFIGURATION → C674X_0 → BROWSE, browse the workspace location, open the gel folder and select the GEL file. → OPEN → SAVE.

9. In C/C++ Project window, Right click the project → REBUILD PROJECT.

10. Connections

☞Connect the usb cable, PC to TMS320C6745 KIT.

☞Power on the kit.

11. TARGET DEBUG ACTIVE PROJECT.

12. VIEW MEMORY

13. In right side, memory window will open. Type the adrress and give the input at particular location.

Give the input as follow:

Enter An Address:0xC0001000 → Enter.(Input) X(n)

```0xC0001000 – 00000001

0xC0001004 – 00000002

0xC0001008 – 00000003

0xC000100C – 00000004

0xC0001010 – 00000004

0xC0001014 – 00000003

0xC0001018 – 00000002

0xC000101C – 00000001
```

14. View Watch window watch1.

☞Type the following array variable.

☞tr( real part output)

☞ti( imaginary part output)

15.TARGET RUN.

16.TARGET HALT.

See the Output at Particular location:

Example :

Enter An Address:0xC0001030 Enter.(Real part output)

```0xC0001030 – 00000014

0xC0001034 – FFFFFFFB

0xC0001038 – 00000001

0xC000103C – 00000000

0xC0001040 – 00000000

0xC0001044 – 00000000

0xC0001048 – 00000000

0xC000104C – FFFFFFFB
```

Enter An Address:0xC0001050 → Enter.(Imaginary part output)

```0xC0001050 – 00000000

0xC0001054 – FFFFFFFFE

0xC0001058 – 00000000

0xC000105C – 00000000

0xC0001060 – 00000000

0xC0001064 – 00000000

0xC0001068 – 00000000

0xC000106C - 00000002

```

17. Or see the ouput at watch window.

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

### Program for FFT 8 Point DIF using TMS320C6745 DSP

``````#include
#define PI     3.14159
float x,tr,ti,s1r,s1i,s2r,s2i,Xr,Xi,Yr,Yi;
const float W0r = 1,
W0i = 0,
W1r = 0.707,
W1i = -0.707,
W2r = 0,
W2i = -1,
W3r = -0.707,
W3i = -0.707;
void main()
{
int *Input,*Real_out,*Imag_out;
int i=0;
Input = (int *)0xC0001000;
Real_out = (int *)0xC0001030;
Imag_out = (int *)0xC0001050;
for(i=0;i<8;i++)
{
x[i] = 0;
x[i] = *(Input + i);
}
// stage one process
s1r = (int)(x + x);
s1i = 0;
s1r = (int)(x + x);
s1i = 0;
s1r = (int)(x + x);
s1i = 0;
s1r = (int)(x + x);
s1i = 0;
s1r = (int)(x - x) * W0r;
s1i = 0;
s1r = (int)(x - x) * W1r;
s1i = (int)(x - x) * W1i;
s1r = 0;
s1i = (int)(x - x) * W2i;
s1r = (int)(x - x) * W3r;
s1i = (int)(x - x) * W3i;
// stage two process
s2r = (s1r + s1r);
s2i = (s1i + s1i);
s2r = (s1r + s1r);
s2i = (s1i + s1i);
s2r = (s1r - s1r) * W0r;
s2i = 0; // (s1i - s1i) * W0i;
s2r = 0; // (s1r - s1r) * W2r;
s2i = (s1r - s1r) * W2i;
s2r = (s1r + s1r);
s2i = (s1i + s1i);
s2r = (s1r + s1r);
s2i = (s1i + s1i);
s2r = (s1r - s1r) * 1;
s2i = (s1i - s1i) * 1;
Yr = s1r - s1r;
Yi = s1i - s1i;
Yr = ((Yr * W2r) - (Yi * W2i));
Yi = ((Yr * W2i) + (Yi * W2r));
s2r = Yr;
s2i = Yi;
//  output
Xr = (s2r + s2r);
Xi = (s2i + s2i);
Xr = (s2r - s2r);
Xi = (s2i - s2i);
Xr = (s2r + s2r);
Xi = (s2i + s2i);
Xr = (s2r - s2r);
Xi = (s2i - s2i);
Xr = (s2r + s2r);
Xi = (s2i + s2i);
Xr = (s2r - s2r);
Xi = (s2i - s2i);
Xr = (s2r + s2r);
Xi = (s2i + s2i);
Xr = (s2r - s2r);
Xi = (s2i - s2i);
// bit reversal
tr = Xr;
ti = Xi;
tr = Xr;
ti = Xi;
tr = Xr;
ti = Xi;
tr = Xr;
ti = Xi;
tr = Xr;
ti = Xi;
tr = Xr;
ti = Xi;
tr = Xr;
ti = Xi;
tr = Xr;
ti = Xi;
// sending output array to memory location
for(i=0;i<8;i++)
{
*Real_out ++= tr[i];
*Imag_out ++= ti[i];
}
for(;;);
}``````

### Result

Thus, the 8 point FFT of a given discrete sequence has performed and the result is stored at memory location(0xC0001030 and 0xC0001050).

This site uses Akismet to reduce spam. Learn how your comment data is processed.