You are currently viewing FFT USING TMS320C5505 DSP

FFT USING TMS320C5505 DSP

Spread the love

Aim

To perform the FFT process from a given discrete sequence in TMS320C5505 KIT

Requirements

☞CCS v4

TMS320C5505 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.

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 e2∏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 USING TMS320C5505 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: C5500.

☞Tick Debug And Release. → NEXT → NEXT.

☞Output type: Executable.

☞Device Variant : TMS320C55XX – TMS320C5505.

☞Device Endianness : big

☞Code Generation Tools: TI v4.3.5.

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

☞include 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)    :   5505 OK.

8. FILE ⇒ NEW ⇒ TARGET CONFIGURATION FILE

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

☞Connection: Texas Instrument XDS100 v1 USB Emulator.

☞Device: TMS320C5505. (Tick the TMS320C5505)→ SAVE → TARTGET CONFIGURATION →C55XX_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 TMS320C5505 KIT

☞Connect the 5v adapter.

☞Power on the kit.

11. TARGET ⇒ DEBUG ACTIVE PROJECT.

12. TARGET ⇒ RUN.(wait few seconds)

13. TARGET ⇒ HALT.

14. Output is displayed at Console Window.

Program for FFT USING TMS320C5505 DSP

#include 
float x[8],t[8],s1[8],s2r[8],s2i[8],Xr[8],Xi[8],Yr[8],Yi[8];
float T[8] = {1,2,3,4,4,3,2,1};	 // Change Input for  different o/p.
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 i=0,j=0;
	
for(i=0;i<8;i++)
	{		
			t[i] = 0;
			x[i] = 0;
			s1[i] = 0;
			s2r[i] = 0;
			s2i[i] = 0;
			Xr[i] = 0;
			Xi[i] = 0;
			Yr[i] = 0;
			Yi[i] = 0;
			t[i] = T[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++;
}
printf("  Real    &    Imaginary");
	for(i=0;i<8;i++)
	{	
		printf("\n %f   %f ",Xr[i],Xi[i]);
	}
}

Result

Thus, the FFT process was performed and displayed the results in console window.

Leave a Reply

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