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

DSP Lab 9

This lab focuses on implementing linear convolution using the TMS320C6713 DSP Starter Kit and Code Composer Studio. It covers the theoretical background of linear convolution, the setup procedure, and the C code implementation, along with expected results and verification methods. The lab concludes with a discussion on efficiency considerations and the importance of convolution in digital signal processing applications.
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)
7 views6 pages

DSP Lab 9

This lab focuses on implementing linear convolution using the TMS320C6713 DSP Starter Kit and Code Composer Studio. It covers the theoretical background of linear convolution, the setup procedure, and the C code implementation, along with expected results and verification methods. The lab concludes with a discussion on efficiency considerations and the importance of convolution in digital signal processing applications.
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

Lab 9: Linear Convolution via DSK C6713

Student Name
Department of Electrical Engineering
College of Electrical & Mechanical Engineering (CEME), NUST-Pakistan
April 23, 2025

1 Aim
The aim of this lab is to implement linear convolution using the TMS320C6713 DSP
Starter Kit and verify it using Code Composer Studio (CCS).

2 Equipment
• Operating System: Windows XP

• Software: Code Composer Studio 3.3

• DSK 6713 DSP Trainer kit

• USB Cable

• Power Supply

3 Theory
3.1 Linear Convolution
Linear convolution is a fundamental operation in digital signal processing that produces
the output response of a system based on its impulse response and an input signal. For
discrete-time signals, the linear convolution of two sequences x[n] and h[n] is defined as:

X
y[n] = x[n] ∗ h[n] = x[k] · h[n − k] (1)
k=−∞

For finite-length sequences, where x[n] has length M and h[n] has length N , the
convolution will produce an output sequence y[n] of length M + N − 1.

1
3.2 TMS320C6713 DSP
The TMS320C6713 is a floating-point digital signal processor developed by Texas Instru-
ments. It features:

• 32-bit floating-point processor

• Operating at 225 MHz clock rate

• 1800 Million Instructions Per Second (MIPS)

• 1350 Million Floating-Point Operations Per Second (MFLOPS)

• 264KB L1 internal memory

• 256KB L2 internal memory

The C6713 DSP uses the VelociTI architecture, with eight execution units including
two multipliers and six arithmetic logic units (ALUs).

4 Procedure
1. Open Code Composer Setup and select C6713 simulator, click save and quit.

2. Start a new project using Project → New pull-down menu, save it in a separate
directory (C:\My projects) with file name linearconv.pjt.

3. Create a new source file using File → New Source file menu and save it in the
project folder as linearconv.c.

4. Add the source file (linearconv.c) to the project: Project → Add files to Project →
Select linearconv.c.

5. Add the linker command file hello.cmd: Project → Add files to Project (path:
C:\CCstudio\tutorial\dsk6713\hello\hello.cmd).

6. Add the run time support library file rts6700.lib: Project → Add files to Project
(Path: C\CCStudio\cgtools\lib\rts6700.lib).

7. Compile the program using ’Project → Compile’ menu or by Ctrl+F7.

8. Build the program using ’Project → Build’ menu or by F7.

9. Load the linearconv.out file (from project folder impulse response\Debug) using
File → Load Program.

10. Run the program using ’Debug → Run’ or F5.

11. To view the output graphically, select View → Graph → Time and Frequency.

12. Observe the values in the output window.

2
5 Implementation
5.1 C Code for Linear Convolution
The following C code implements linear convolution on the DSK C6713:
1 /*
2 * Linear Convolution on DSK C6713
3 */
4
5 # include < stdio .h >
6 # include < stdlib .h >
7
8 # define INPUT_LEN 5 // Length of input sequence
9 # define IMPULSE_LEN 4 // Length of impulse response
10 # define OUTPUT_LEN ( INPUT_LEN + IMPULSE_LEN - 1) // Length of output
sequence
11
12 // Global variables for visualization in CCS
13 float input [ INPUT_LEN ] = {1.0 , 2.0 , 3.0 , 2.0 , 1.0}; // Input sequence
14 float impulse [ IMPULSE_LEN ] = {0.5 , 1.0 , 0.5 , 0.25}; // Impulse
response
15 float output [ OUTPUT_LEN ]; // Output sequence
16
17 // Function to perform linear convolution
18 void li nearCo nvolut ion ( float *x , int lenX , float *h , int lenH , float * y
) {
19 int n , k ;
20

21 // Initialize output array to zero


22 for ( n = 0; n < lenX + lenH - 1; n ++) {
23 y [ n ] = 0.0;
24 }
25
26 // Perform convolution
27 for ( n = 0; n < lenX + lenH - 1; n ++) {
28 for ( k = 0; k < lenX ; k ++) {
29 if ( n - k >= 0 && n - k < lenH ) {
30 y [ n ] += x [ k ] * h [ n - k ];
31 }
32 }
33 }
34 }
35
36 int main () {
37 // Perform linear convolution
38 line arConv oluti on ( input , INPUT_LEN , impulse , IMPULSE_LEN , output ) ;
39
40 // Display results ( visible in CCS watch window or console )
41 printf ( " Input sequence :\ n " ) ;
42 for ( int i = 0; i < INPUT_LEN ; i ++) {
43 printf ( " % f " , input [ i ]) ;
44 }
45 printf ( " \ n \ nImpulse response :\ n " ) ;
46 for ( int i = 0; i < IMPULSE_LEN ; i ++) {
47 printf ( " % f " , impulse [ i ]) ;
48 }
49 printf ( " \ n \ nConvolution result :\ n " ) ;

3
50 for ( int i = 0; i < OUTPUT_LEN ; i ++) {
51 printf ( " % f " , output [ i ]) ;
52 }
53 printf ( " \ n " ) ;
54
55 // Keep program running to allow observation in CCS
56 while (1) ;
57
58 return 0;
59 }
Listing 1: Linear Convolution Implementation

5.2 Explanation of the Implementation


The implementation consists of:

1. Definition of input sequence, impulse response, and output array as global variables
to facilitate visualization in CCS.

2. A function linearConvolution() that performs the convolution operation between


input sequence and impulse response.

3. The main function that calls the convolution function and displays the results.

The linear convolution algorithm follows these steps:


1. Initialize the output array to zeros.

2. For each output sample index n:

• For each input sample index k:


– If n-k is within the bounds of the impulse response, multiply x[k] with
h[n-k] and add to y[n].
P −1
This implements the discrete convolution sum: y[n] = M k=0 x[k] · h[n − k]

6 Results
6.1 Expected Output
For the given input sequence x[n] = {1.0, 2.0, 3.0, 2.0, 1.0} and impulse response h[n] =
{0.5, 1.0, 0.5, 0.25}, the expected convolution result is:
y[0] = 1.0 × 0.5 = 0.5
y[1] = 1.0 × 1.0 + 2.0 × 0.5 = 2.0
y[2] = 1.0 × 0.5 + 2.0 × 1.0 + 3.0 × 0.5 = 4.0
y[3] = 1.0 × 0.25 + 2.0 × 0.5 + 3.0 × 1.0 + 2.0 × 0.5 = 5.25
y[4] = 2.0 × 0.25 + 3.0 × 0.5 + 2.0 × 1.0 + 1.0 × 0.5 = 4.0
y[5] = 3.0 × 0.25 + 2.0 × 0.5 + 1.0 × 1.0 = 2.75
y[6] = 2.0 × 0.25 + 1.0 × 0.5 = 1.0
y[7] = 1.0 × 0.25 = 0.25
Therefore, y[n] = {0.5, 2.0, 4.0, 5.25, 4.0, 2.75, 1.0, 0.25}

4
6.2 Visualization
When executed on the DSK C6713, the output can be visualized through CCS’s graphing
capabilities. The Time/Frequency Graph tool allows us to observe the input sequence,
impulse response, and the resulting convolution as shown in Figure 1.

Figure 1: Example of linear convolution visualization in CCS

7 Verification
To verify the correctness of our implementation, we can compare the results with the
built-in convolution function in MATLAB or with manual calculations.
The length of the convolution result should be:

Length of y[n] = Length of x[n] + Length of h[n] − 1 = 5 + 4 − 1 = 8 (2)

This matches our implementation’s output length of 8 samples.

5
8 Discussion
8.1 Efficiency Considerations
The implemented algorithm has a time complexity of O(N²), where N is the length of the
longer sequence. For real-time DSP applications, more efficient algorithms such as Fast
Convolution using the Fast Fourier Transform (FFT) might be preferable, especially for
longer sequences.

8.2 Fixed-Point vs. Floating-Point Considerations


While the C6713 is a floating-point processor, many DSP applications implement convo-
lution using fixed-point arithmetic for efficiency. Our implementation uses floating-point
values for simplicity and precision, but in memory-constrained environments, a fixed-
point implementation might be more appropriate.

9 Precautions
1. Switch ON the computer only after connecting the USB cable and ensure the DSP
kit is ON.

2. Perform the diagnostic check before opening Code Composer Studio.

3. Ensure all connections are tight and secure.

4. Be aware of memory limitations when working with large arrays.

5. Initialize all variables properly to avoid undefined behavior.

10 Conclusion
In this lab, we successfully implemented linear convolution on the TMS320C6713 DSP
using Code Composer Studio. The implementation correctly calculates the convolution
of an input sequence with an impulse response, producing the expected output sequence.
This demonstrates the fundamental operation of convolution, which is crucial for many
digital signal processing applications such as filtering, system identification, and signal
analysis.
Through this lab, we gained practical experience with:

• Programming the TMS320C6713 DSP

• Implementing linear convolution in C

• Using Code Composer Studio for DSP development

• Visualizing and analyzing DSP results

Understanding linear convolution is essential for implementing more complex DSP


algorithms and systems. The skills acquired in this lab provide a foundation for developing
more advanced DSP applications on the C6713 platform.

You might also like