0% found this document useful (0 votes)
4 views6 pages

FFT DSP

The lab report details the implementation of a Linear N points FFT on a DSK 6713 DSP kit, focusing on a 10 Hz sine wave sampled at 64 Hz. It describes the setup of the program, including the generation of twiddle factors and the FFT function that processes the input signal to calculate frequency magnitudes. The output reveals a strong peak at the 10 Hz frequency bin, confirming the presence of the sine wave with minimal noise in other bins.

Uploaded by

Mustafa Aasim
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views6 pages

FFT DSP

The lab report details the implementation of a Linear N points FFT on a DSK 6713 DSP kit, focusing on a 10 Hz sine wave sampled at 64 Hz. It describes the setup of the program, including the generation of twiddle factors and the FFT function that processes the input signal to calculate frequency magnitudes. The output reveals a strong peak at the 10 Hz frequency bin, confirming the presence of the sine wave with minimal noise in other bins.

Uploaded by

Mustafa Aasim
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

DEPARTMENT OF ELECTRICAL ENGINEERING

College of Electrical and Mechanical Engineering (CEME), NUST-Pakistan


B.E. Electrical Engineering

EE-330 Digital Signal Processing

Lab Report

Experiment
Implementation of a Linear N points FFT on Dsp Kit(DSK 6713)
Group Members Registration Number Syndicate
M.Ashiq Rasool 414361
Ali Iqbal 415290 A
Adnan Ishaq 413582
Shehrooz Akram 423739

Software Usage Debugging and Individual and Lab Report


Total
(P3) Results (P3) Teamwork (A3) (A3)
EE-330 DSP Experiment DSP KIT Lab Report
1

Tools:
>DSP KIT

>CODE COMPOSER 7.4.0

>HEADER AND LIBRARY FILES

Code Composer Settings:


#include "dsk6713.h"

#include "dsk6713_aic23.h"

#include <math.h>

#include <stdio.h>

#define PTS 64

#define PI 3.14159265358979

typedef struct {

float real;

float imag;

} COMPLEX;

COMPLEX w[PTS]; // Twiddle factors

COMPLEX samples[PTS]; // FFT buffer

float iobuffer[PTS]; // Input buffer (real-valued signal)

float x1[PTS]; // Magnitude of FFT result

void FFT(COMPLEX *Y, int N) {

int num_stages = 0;

int i, j, upper_leg, lower_leg;

int leg_diff, step, index;

COMPLEX temp1, temp2;

// Calculate number of stages (log2(N))

i = 1;

while ((1 << num_stages) < N)

num_stages++;
EE-330 DSP Experiment DSP KIT Lab Report
2

leg_diff = N / 2;

step = (PTS * 2) / N;

for (i = 0; i < num_stages; i++) {

index = 0;

for (j = 0; j < leg_diff; j++) {

for (upper_leg = j; upper_leg < N; upper_leg += 2 * leg_diff) {

lower_leg = upper_leg + leg_diff;

temp1.real = Y[upper_leg].real + Y[lower_leg].real;

temp1.imag = Y[upper_leg].imag + Y[lower_leg].imag;

temp2.real = Y[upper_leg].real - Y[lower_leg].real;

temp2.imag = Y[upper_leg].imag - Y[lower_leg].imag;

// Butterfly operation with twiddle factor

Y[lower_leg].real = temp2.real * w[index].real - temp2.imag * w[index].imag;

Y[lower_leg].imag = temp2.real * w[index].imag + temp2.imag * w[index].real;

Y[upper_leg].real = temp1.real;

Y[upper_leg].imag = temp1.imag;

index += step;

leg_diff /= 2;

step *= 2;

void main() {

int i;

// Generate twiddle factors

for (i = 0; i < PTS; i++) {

w[i].real = cos(2 * PI * i / (PTS * 2.0));

w[i].imag = -sin(2 * PI * i / (PTS * 2.0));


EE-330 DSP Experiment DSP KIT Lab Report
3

// Generate input signal: 10Hz sine wave sampled at 64Hz

for (i = 0; i < PTS; i++) {

iobuffer[i] = sin(2 * PI * 10 * i / PTS); // 10Hz tone

samples[i].real = iobuffer[i];

samples[i].imag = 0.0;

// Perform FFT

FFT(samples, PTS);

// Calculate magnitude of each bin

for (i = 0; i < PTS; i++) {

x1[i] = sqrt(samples[i].real * samples[i].real + samples[i].imag * samples[i].imag);

// Print frequency magnitude results

for (i = 0; i < PTS; i++) {

printf("Bin %2d: Magnitude = %f\n", i, x1[i]);

Code Explanation:

This program performs an FFT (Fast Fourier Transform) on a 10 Hz sine wave using the DSK6713 DSP kit. It begins
by including necessary headers and defining constants for the FFT size (64 points) and PI. It sets up data structures
to handle complex numbers and arrays to hold the input signal, FFT results, twiddle factors, and output
magnitudes. The input signal, a 10 Hz sine wave sampled at 64 Hz, is generated and stored in a buffer with
imaginary parts set to zero. The FFT function is then called, which performs the transformation using butterfly
operations and precomputed twiddle factors (sine and cosine values). After the FFT is complete, the program
calculates the magnitude of each frequency bin from the real and imaginary parts. These magnitudes represent the
strength of each frequency component in the input signal. Finally, the program prints the magnitudes of all 64 FFT
bins, allowing the user to analyze the frequency content of the original sine wave.
EE-330 DSP Experiment DSP KIT Lab Report
4

Library Settings:

Compiler Settings:

General Settings:
EE-330 DSP Experiment DSP KIT Lab Report
5

Output:

When the code is executed on the DSK6713, it performs an FFT on a 10 Hz sine wave sampled
at 64 Hz. The result is a set of 64 frequency bins, each representing 1 Hz. Since the input is a
pure 10 Hz tone, the output shows a strong magnitude peak at bin 10, which corresponds to 10
Hz. Due to the symmetry of the FFT for real-valued signals, another peak appears at bin 54 (64 -
10). All other bins show very small or near-zero magnitudes, indicating that no other frequency
components are present in the input. The program prints the magnitude of each bin to the
console, clearly showing the dominant frequency at 10 Hz.

You might also like