# Circular Convolution using TMS320C6745 DSP

## Circular convolution using TMS320C6745 DSP

Tags: Circular convolution program for dsp,circular convolution implementation using tms320c6745,circular convolution program,
Overall rating

###### Aim

To perform the Circular Convolution of two given discrete sequence in TMS320C6745 KIT.

###### Requirements

• CCS v4
• TMS320C6745 KIT
• USB Cable

###### Theory

The circular convolution, also known as cyclic convolution. A convolution operation that contains a circular shift is called circular convolution. Circular convolution of two sequences x1[n] and x2[n] is given by

x1[n]*x2[n] = εk x1[k] x2((n-k))N, 0≤ n ≤N-1

where k ranges between 0 and N-1

One of the methods to find circular convolution....

In circular convolution the length of the output sequence will be equal to length of the input sequence ie. length(y)=length(x)

So first perform linear convolution using any of the methods u find easier.

If m is the length of 'x' and n is the length of the 'h' then length of 'yl' from linear conv is m+n-1.

Since length of output from circular conv is m, we will bring the last n-1 terms from 'yl' and add them to first n-1 terms. So the obtained output is circularly convoluted output.

For eg. if x= 1, 2, 3, 4 and h= 2,3,1
lin conv op ie. yl= 2,7,13,19,15,4

bring last two (n-1) terms to first two terms

so circularly convluted op is yc= 17, 11,13,19

###### Procedure

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 this add icon and add the following three path by indivdually
-  "\${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.
• Power on the kit.

11. TARGET ⇒ DEBUG ACTIVE PROJECT.

12. VIEW ⇒ MEMORY

13. In right side, memory window will open. Type the address and give the input at particular location.

Give the input as follow:

X(n)                                                   h(n)

0xC0001000 – 00000001          0xC0001030 – 00000001

0xC0001004 – 00000001          0xC0001034 – 00000001

0xC0001008 – 00000001          0xC0001038 – 00000001

0xC000100C – 00000001          0xC000103C – 00000001

14. TARGET ⇒ RUN.

15. TARGET ⇒ HALT.

See the Output at Particular location:

0xC0001050 – 00000004

0xC0001054 – 00000004

0xC0001058 - 00000004

0xC000105C - 00000004

#include <stdio.h>

int rot(int *x);

void main()

{

int *in1,*in2,*out,*temp,i,sum=0,j;

in1 = (int *)0xc0001000;

in2 = (int *)0xc0001030;

out = (int *)0xc0001050;

temp = (int *)0xc0002000;

for(i=0;i<4;i++)

{

if(i == 1)

temp[i+2] = in1[i];

else if(i == 3)

temp[i-2] = in1[i];

else

temp[i] = in1[i];

}

for(i=0;i<4;i++)

{

sum = 0;

for(j=0;j<4;j++)

{

sum+=(in2[j] * temp[j]);

}

out[i] = sum;

rot(temp);

}

while(1);

}

rot(int *x)

{

int t;

t = x[0];

x[0] = x[3];

x[3] = x[2];

x[2] = x[1];

x[1] = t;

}

###### Result

Thus, the Circular Convolution of two given discrete sequence has performed and the result is stored at memory location (0xC0001050).