You are currently viewing FFT 8 Point DIT Using TMS320C6745 DSP

FFT 8 Point DIT Using TMS320C6745 DSP

Spread the love

Aim

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

Requirements

☞CCS v 4

TMS320C6745 KIT

☞USB Cable

☞5V Adapter

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 FFT 8 Point DIT 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 – TMS320C6745.

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.

☞Common folder (contains header files)

☞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. (Tick the 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.

☞Connect the 5v adapter.

☞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:

 
0xC0001000 – 00000001
0xC0001004 – 00000002
0xC0001008 – 00000003
0xC000100C – 00000004
0xC0001010 – 00000004
0xC0001014 – 00000003
0xC0001018 – 00000002
0xC000101C – 0000000

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

14. View ⇒ Watch window ⇒ watch1.

☞Type the following array variable.    –  Xr( real part output)    –  Xi( 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 – 00000000
0xC000103C – 00000000
0xC0001040 – 00000000
0xC0001044 – 00000000
0xC0001048 – 00000000
0xC000104C – FFFFFFFB 

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

 
0xC0001050 – 00000000
0xC0001054 – FFFFFFFFF
0xC0001058 – 0000000C
0xC000105C – 00000000
0xC0001060 – 00000000
0xC0001064 – 00000000
0xC0001068 – 00000000
0xC000106C - 00000002

17. Or see the ouput at watch window.

hexadecimal-values

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

Program for FFT 8 Point DIT Using TMS320C6745 DSP

 
#include 
#define PI     3.14159
float x[8],t[8],s1[8],s2r[8],s2i[8],Xr[8],Xi[8],Yr[8],Yi[8];
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,j=0;
        Input = (int *)0xC0001000;
        Real_out = (int *)0xC0001030;
        Imag_out = (int *)0xC0001050;
        for(i=0;i<8;i++)
        {              
                        t[i] = 0;
                        t[i] = *(Input + i);
        }
// Bit reversal process
        x[0] = t[0];
        x[1] = t[4];
        x[2] = t[2];
        x[3] = t[6];
        x[4] = t[1];
        x[5] = t[5];
        x[6] = t[3];
        x[7] = t[7];
// stage one process
        s1[0] = (int)(x[0] + (x[1] * W0r));
        s1[1] = (int)(x[0] - (x[1] * W0r));
        s1[2] = (int)(x[2] + (x[3] * W0r));
        s1[3] = (int)(x[2] - (x[3] * W0r));
        s1[4] = (int)(x[4] + (x[5] * W0r));
        s1[5] = (int)(x[4] - (x[5] * W0r));
        s1[6] = (int)(x[6] + (x[7] * W0r));
        s1[7] = (int)(x[6] - (x[7] * W0r));
// stage two process
        s2r[0] = (s1[0] + (s1[2] * W0r));                                                                                                                                                                                                             
        s2i[0] = 0;
        s2r[1] = s1[1];
        s2i[1] = (s1[3] * W2i);
        s2r[2] = (s1[0] - (s1[2] * W0r));
        s2i[2] = 0;
        s2r[3] = s1[1];
        s2i[3] = - (s1[3] * W2i);
        s2r[4] = (s1[4] + (s1[6] * W0r));
        s2i[4] = 0;
        s2r[5] = s1[5];
        s2i[5] = (s1[7] * W2i);
        s2r[6] = (s1[4] - (s1[6] * W0r));
        s2i[6] = 0;
        s2r[7] = s1[5];
        s2i[7] = -(s1[7] * W2i);
//  output
// complex multiplication for B * Wn
        Yr[0] = (s2r[4] * W0r) - (s2i[4] * W0i);
        Yi[0] = (s2r[4] * W0i) + (s2i[4] * W0r);
        Yr[1] = (s2r[5] * W1r) - (s2i[5] * W1i);
        Yi[1] = (s2r[5] * W1i) + (s2i[5] * W1r);
        Yr[2] = (s2r[6] * W2r) - (s2i[6] * W2i);
        Yi[2] = (s2r[6] * W2i) + (s2i[6] * W2r);
        Yr[3] = (s2r[7] * W3r) - (s2i[7] * W3i);
        Yi[3] = (s2r[7] * W3i) + (s2i[7] * W3r);
        Yr[4] = (s2r[4] * W0r) - (s2i[4] * W0i);
        Yi[4] = (s2r[4] * W0i) + (s2i[4] * W0r);
        Yr[5] = (s2r[5] * W1r) - (s2i[5] * W1i);
        Yi[5] = (s2r[5] * W1i) + (s2i[5] * W1r);
        Yr[6] = (s2r[6] * W2r) - (s2i[6] * W2i);
        Yi[6] = (s2r[6] * W2i) + (s2i[6] * W2r);
        Yr[7] = (s2r[7] * W3r) - (s2i[7] * W3i);
        Yi[7] = (s2r[7] * W3i) + (s2i[7] * W3r);
// complex addition for A + BWn
        j=0;
        for(i=0;i<4;i++)
        {
                Xr[i] = s2r[j] + Yr[i];
                Xi[i] = s2i[j] + Yi[i];
                j++;
        }
// complex subtraction for A - BWn
        j=0;
        for(i=4;i<8;i++)
        {
                Xr[i] = s2r[j] - Yr[i];
                Xi[i] = s2i[j] - Yi[i];
                j++;
        }
// sending output array to memory location        
        for(i=0;i<8;i++)
        {      
                *Real_out ++= Xr[i];
                *Imag_out ++= Xi[i];
        }
        for(;;);
}

Result

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

Leave a Reply

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