DSPAP
DSPAP
DEPARTMENT
OF
REGULATION : 2021
CEC337 / DSP ARCHITECTURE AND PROGRAMMING
Prepared By:
V.VENKATESWARAN
AP/ECE
RVSCET
Syllabus
COURSE OBJECTIVES:
LIST OF EXPERIMENTS:
COURSE OUTCOMES
At the end of this course, the students will be able to:
CO1: Understand the architectural features of DSP Processors.
CO2: Comprehend the organization of TMS320C54xx DSP processors
CO3: Build solutions using TMS320C6x DSP Processor
CO4: Implement DSP Algorithms
CO5: Study the applications of DSP Processors
EXP. EQUIPMENT / MACHINE /
NAME OF EXPERIMENTS
NO. TO BE USED
AIM:
To learn about the TMS320C6713 DSK and Code Composer Studio (CCS).
Package Contents
The C6713™ DSK builds on TI's industry-leading line of low cost, easy-to-use DSP Starter
Kit (DSK) development boards. The high-performance board features the TMS320C6713 floating-
point DSP. Capable of performing 1350 million floating-point operations per second (MFLOPS),
the C6713 DSP makes the C6713 DSK the most powerful DSK development board.
The DSK is USB port interfaced platform that allows to efficiently develop and test
applications for the C6713. The DSK consists of a C6713-based printed circuit board that will
serve as a hardware reference design for TI’s customers’ products. With extensive host PC and
target DSP software support, including bundled TI tools, the DSK provides ease-of-use and
capabilities that are attractive to DSP engineers.
The following checklist details items that are shipped with the C6713 DSK.
➢ TMS320C6713 DSK TMS320C6713 DSK development board
➢ Other hardware External 5VDC power supply & IEEE 1284 compliant male-to-female
cable
➢ CD-ROM Code Composer Studio DSK tools
➢ Technical reference manual
The C6713 DSK has a TMS320C6713 DSP onboard that allows full-speed verification of
code with Code Composer Studio. The C6713 DSK provides:
➢ A USB Interface
➢ SDRAM and Flash ROM
➢ An analog interface circuit for Data conversion (AIC)
➢ An I/O port
➢ Embedded JTAG emulation support
Connectors on the C6713 DSK provide DSP external memory interface (EMIF) and peripheral
signals that enable its functionality to be expanded with custom or third party daughter boards.
The DSK provides a C6713 hardware reference design that can assist you in the development of
your own C6713-based products. In addition to providing a reference for interfacing the DSP to
various types of memories and peripherals, the design also addresses power, clock, JTAG, and
parallel peripheral interfaces. The C6713 DSK includes a stereo codec.
➢ I 2 S-Compatible Interface Requiring Only One McBSP for both ADC and DAC
➢ Standard I 2 S, MSB, or LSB Justified-Data Transfers
➢ 16/20/24/32-Bit Word Lengths
Operating at 225 MHz, the C6713 delivers up to 1350 million floating-point operations per
second (MFLOPS), 1800 million instructions per second (MIPS), and with dual fixed-floating-
point multipliers up to 450 million multiply-accumulate operations per second (MMACS).The
DSK uses the 32-bit EMIF for the SDRAM (CE0) and daughter card expansion interface (CE2
and CE3). The Flash is attached to CE1 of the EMIF in 8-bit mode.
An on-board AIC23 codec allows the DSP to transmit and receive analog signals. McBSP0
is used for the codec control interface and McBSP1 is used for data. Analog audio I/O is done
through four 3.5mm audio jacks that correspond to microphone input, line input, line output and
headphone output. The codec can select the microphone or the line input as the active input. The
analog output is driven to both the line out (fixed gain) and headphone (adjustable gain)
connectors. McBSP1 can be re-routed to the expansion connectors in software.
A programmable logic device called a CPLD is used to implement glue logic that ties the
board components together. The CPLD has a register based user interface that lets the user
configure the board by reading and writing to the CPLD registers. The registers reside at the
midpoint of CE1.
The DSK includes 4 LEDs and 4 DIP switches as a simple way to provide the user with
interactive feedback. Both are accessed by reading and writing to the CPLD registers. An included
5V external power supply is used to power the board. On-board voltage regulators provide the
1.26V DSP core voltage, 3.3V digital and 3.3V analog voltages.
TMS320C6713 DSK Overview Block Diagram
A voltage supervisor monitors the internally generated voltage, and will hold the boards in
reset until the supplies are within operating specifications and the reset button is released. If
desired, JP1 and JP2 can be used as power test points for the core and I/O power supplies.
Code Composer communicates with the DSK through an embedded JTAG emulator with
a USB host interface. The DSK can also be used with an external emulator through the external
JTAG connector.
Device Configuration
➢ Boot Mode: HPI, 8-, 16-, 32-Bit ROM Boot
➢ Endianness: Little Endian/Big Endian
Code Composer Studio (CCS) is the first fully industrially development environment (IDE) with
DSP specific functionalities. This led us to edit, build, debug profile and manages projects from a
single unified environment.
Other features are
➢ Graphical signal analysis
➢ Injection and extraction of data signals by a file IO Multiprocessor debugging
➢ Automatic testing
➢ Customization via 'C' interpretive scripting language.
TMS Processor: This is TI industry leading line of low cost easy to use. DSP start kit development
boards with Floating point DSP, Capable of performing 1350 million floating point operations ina
second.
1. Connect the kit to USB(metal pin). power(black pin) supply,line in, line out.
2. Go to setup icon select family 67xx, platform DSK and all, save and quit, don't open CCS
studio
3. Run diagnostics--->start --->if everything is correct you will get "pass".
4. Open CCS studio ,go to debug---->connect -- >check for green color.
5. Projet---> new--->type project name-->select TMS320067XX,executable file .out---- >
finish.
6. File --->new--->DSP/BIOS configuration--->select DSK67XX---->select DSK6713.cdb---
>ok.
7. file---->save as---->file name.cdb in your project folder.
8. Project--->add files to the project---->select files of type .cdb with icon DSK6713.c--- >
double click on.
9. To create new source file: file--->new--->source file--->type FIR program --- >save as
filename.c.
10. Right click on source--->add files to the project -- >select filename.c and open.
11. Open file with path CCSstudio v 3.1--->c6000--->DSK6713--->include--->file type *.*---
>we get a set of files. In that select DSK6713_aic 23,DSK6713 files-->copy both.
Gotoyour project folder, paste these two files and close it.
12. Right click on libraries--->add files to the project-->ccstudio v 3.1-->c6000--> DSK6713-
->lib--->DSK6713bsl in *.o or *.l -- >select and open.
13. Go to generated files folder -- >open .c file copy the first line
#include<"configuration.h">
Go to source file paste it as first line of your c program remove the line
#include"XYZCGG.h".
14. Save the source program.
15.Compile,build and check for zero errors.
16. Switch on CRO and signal generator set the signal generator output up to 2V and less than
10KHz (around 5KHz) connect right channel, left channel and neutral properly.
17. Run the program.
Expt. No: 2 SINE GENERATION WITH TABLE VALUES GENERATED
WITHIN THE PROGRAM
Date :
AIM:
To generate Sine wave forms by using TMS320C6713 DSP processor and Code
Composer Studio (CCS).
APPARATUS REQUIRED:
PROCEDURE:
RESULT:
Thus the Sine Wave was generated using TMS320C6713 DSP Processor.
Expt. No: 3 PROGRAMMING EXAMPLES USING C, ASSEMBLY AND
LINEAR ASSEMBLY
AIM:
APPARATUS REQUIRED:
PROCEDURE:
PROGRAM:
//dotpopt.c Optimized dot product of two arrays
#include <stdio.h>
#include <dotp4.h> //header file with data
#define count 4
short x[count] = {x_array}; //declare 1st array
short y[count] = {y_array}; //declare 2nd array
volatile int result = 0; //result
main()
{
result = dotpfunc(x,y,count); //call optimized function
printf("result = %d decimal \n", result); //print result
}
PROGRAM:
#include <stdio.h>
main()
{
short n=6; //set value
short result; //result from asm function
result = sumfunc(n); //call ASM function sumfunc
printf("sum = %d", result); //print result from asm function
}
PROGRAM:
PROGRAM:
PROGRAM:
RESULT:
Thus the Programming examples Using C, Assembly and Linear Assembly is performed
using TMS320C6713 DSP processor and CCS.
Expt. No: 4 IMPLEMENTATION OF MOVING AVERAGE FILTER
Date :
AIM:
To design and implement a moving average filter by using TMS320C6713 DSK & Code
Composer Studio (CCS).
APPARATUS REQUIRED:
PROCEDURE:
The difference equation of the Simple Moving Average filter is derived from the
mathematical definition of the average of N values: the sum of the values divided by the number
of values. In this equation, movAvg is the current output, X[n] is the current input, X[n-1] is the
previous input, etc. N is the length of the average.
movAvg=-x[n]+x[n−1]+...+x[n−N]/(N+1)
int movingAvg(int *ptrArrNumbers, long *ptrSum, int pos, int len, int nextNum)
{
//Subtract the oldest number from the prev sum, add the new number
*ptrSum = *ptrSum - ptrArrNumbers[pos] + nextNum;
//Assign the nextNum to the position in the array
ptrArrNumbers[pos] = nextNum;
//return the average
return *ptrSum / len;
}
int pos = 0;
int newAvg = 0;
long sum = 0;
int len = sizeof(arrNumbers) / sizeof(int);
int count = sizeof(sample) / sizeof(int);
return 0;
}
RESULT:
Thus the moving average filter is implemented using TMS320C6713 DSK & CCS.
Expt. No: 5 FIR IMPLEMENTATION WITH A PSEUDORANDOM NOISE
SEQUENCE AS INPUT TO A FILTER
Date :
AIM:
To design and implement a FIR filter with a Pseudorandom Noise Sequence as input to a
filter.
APPARATUS REQUIRED:
PROCEDURE:
In the design of FIR filters most commonly used approach is using windows. The desired
frequency response Hd(ejw) of a filter is periodic in frequency and can be expanded in Fourier
series.
The resultant series is given by,
And known as Fourier coefficients having infinite length. One possible way of obtaining FIR
filter is to truncate the infinite Fourier series at n = ± [(N-1)/2] Where N is the length of the desired
sequence.
The Fourier coefficients of the filter are modified by multiplying the infinite impulse response
with a finite weighing sequence w(n) called a window.
Where w(n) = w(-n) ≠ 0 for |n| ≤ [(N-1)/2] = 0 for |n| > [(N-1)/2]
After multiplying w(n) with hd(n), we get a finite duration sequence h(n) that satisfies the desired
magnitude response,
h(n) = hd(n) w(n) for |n| ≤ [(N-1)/2] = 0 for |n| > [(N-1)/2]
The frequency response H(ejw) of the filter can be obtained by convolution of Hd(ejw) and
W(ejw) is given by, H(ejw) = Hd(ejw) * W(ejw).
PROGRAM:
RESULT:
Thus the FIR filter with a Pseudorandom Noise Sequence as input to a filter is
designed and implemented using TMS320C6713 DSK & CCS.
Expt. No: 6 FIXED POINT IMPLEMENTATION OF IIR FILTER
Date :
AIM:
To design and implement a Fixed Point IIR filter by using Code Composer Studio.
APPARATUS REQUIRED:
PROCEDURE:
The filters designed by considering all the infinite samples of impulse response are
called IIR filters. The impulse response is obtained by taking inverse Fourier Transform of ideal
frequency response. The popular methods for such filter design use the technique of transforming
the analog filter to an equivalent digital filter. We know that the analog filter with transfer function
Ha(s) is stable if all its poles lie in the left half of the s-plane. Consequently, if the conversion
technique is to be effective, it should possess the following desirable properties.
1. The imaginary axis in the s-plane should map into the unit circle in the z-plane .Thus there
will be a direct relationship between the two frequency variables in the two domains.
2. The left half of the s-plane should map into the interior of the unit circle in the z- plane.
Thus a suitable analog filter will be converted to a stable digital filter
The IIR filter is a discrete time system that is designed to pass the spectral content of the input
signal in a specified band of frequencies. Based on the frequency response the filters are classified
into four types. They are Low pass; High pass, Band pass, and Band stop filters. A number of
solutions to the approximation problem of analog filter design are well developed. The popular
among them are Butterworth and Chebyshev approximation. For designing a digital IIR filter, first
an equivalent analog filter is designed using any one of the approximation technique and the given
specifications. The result of the analog filter design will be an analog filter transfer function Ha(s)
.The analog transfer function is converted to digital transfer function H(z) using either Bilinear or
Impulse invariant transformation . The digital transfer function H(z) can be realized in a software
that runs on a digital hardware (or it can be implemented in firmware).
PROGRAM:
RESULT:
Thus the Fixed Point IIR filter is designed and implemented using TMS320C6713
DSK & CCS.
Expt. No: 7 FFT OF REAL-TIME INPUT SIGNAL
Date :
AIM:
To compute the FFT of real-time input signal by using Code Composer Studio.
APPARATUS REQUIRED:
PROCEDURE:
DFT of a sequence
For DFT
The no of multiplications in DFT = N2.
The no of Additions in DFT = N (N-1).
For FFT.
The no of multiplication = N/2 log 2N.
The no of additions = N log2 N.
FFT ALGORITHM
The FFT has a fairly easy algorithm to implement, and it is shown step by step in the list below.
This version of the FFT is the Decimation in Time Method
1. Pad input sequence, of N samples, with Zero’s until the number of samples is the nearest power
of two. e.g. 500 samples are padded to 512 (2^9)
2. Bit reverse the input sequence. e.g. 3 = 011 goes to 110 = 6
3. Compute (N / 2) two sample DFT's from the shuffled inputs. See "Shuffled Inputs"
4. Compute (N / 4) four sample DFT's from the two sample DFT's. See "Shuffled Inputs"
5. Compute (N / 2) eight sample DFT's from the four sample DFT's. See "Shuffled Inputs"
6. Until the all the samples combine into one N-sample DFT
PROGRAM:
#include "dsk6713_aic23.h"
Uint32 fs=DSK6713_AIC23_FREQ_8KHZ;
#include <math.h>
#define PTS 256 //# of points for FFT
#define PI 3.14159265358979
typedef struct {float real,imag;} COMPLEX;
void FFT(COMPLEX *Y, int n); //FFT prototype
float iobuffer[PTS]; //as input and output buffer
float x1[PTS]; //intermediate buffer
short i; //general purpose index variable
short buffercount = 0; //number of new samples in iobuffer
short flag = 0; //set to 1 by ISR when iobuffer full
COMPLEX w[PTS]; //twiddle constants stored in w
COMPLEX samples[PTS]; //primary working buffer
main()
{
for (i = 0 ; i<PTS ; i++) // set up twiddle constants in w
{
w[i].real = cos(2*PI*i/512.0); //Re component of twiddle constants
w[i].imag =-sin(2*PI*i/512.0); //Im component of twiddle constants
}
comm_intr(); //init DSK, codec, McBSP
while(1) //infinite loop
{
while (flag == 0) ; //wait until iobuffer is full
flag = 0; //reset flag
for (i = 0 ; i < PTS ; i++) //swap buffers
{
samples[i].real=iobuffer[i]; //buffer with new data
iobuffer[i] = x1[i]; //processed frame to iobuffer
}
for (i = 0 ; i < PTS ; i++)
samples[i].imag = 0.0; //imag components = 0
FFT(samples,PTS); //call function FFT.c
for (i = 0 ; i < PTS ; i++) //compute magnitude
{
x1[i] = sqrt(samples[i].real*samples[i].real
+ samples[i].imag*samples[i].imag)/16;
}
x1[0] = 32000.0; //negative spike for reference
} //end of infinite loop
} //end of main
interrupt void c_int11() //ISR
{
output_sample((short)(iobuffer[buffercount])); //output from iobuffer
iobuffer[buffercount++]=(float)((short)input_sample()); //input>iobuffer
if (buffercount >= PTS) //if iobuffer full
{
buffercount = 0; //reinit buffercount
flag = 1; //set flag
}
}
TIME-DOMAIN PLOT:
RESULT:
Thus the FFT of real-time input signal is implemented using CCS.
Expt. No: 8 IMPLEMENTATION OF LINEAR CONVOLUTION
Date :
AIM:
APPARATUS REQUIRED:
PROCEDURE:
#include<stdio.h>
main()
{
int m=6; /*Length of i/p samples sequence*/
int n=6; /*Length of impulse response Co-efficients */
inti=0,j;
int x[15]={1,2,3,4,5,6,0,0,0,0,0,0}; /*Input Signal Samples*/
int h[15]={1,2,3,4,5,6,0,0,0,0,0,0}; /*Impulse Response Co-efficients*/
int y[20];
for(i=0;i<m+n-1;i++)
{
y[i]=0;
for(j=0;j<=i;j++)
y[i]+=x[j]*h[i-j];
}
for(i=0;i<m+n-1;i++)
printf("%d\n",y[i]);
}
RESULT:
Thus the Linear Convolution is implemented using CCS.