You are currently viewing Cross Correlation using TMS320F2812

Cross Correlation using TMS320F2812

Spread the love

Aim

To perform the Cross Correlation of two given discrete sequence in TMS320F2812 KIT.

Requirements

☞CCS v3.3

TMS320F2812 KIT

☞USB Cable

☞5V Adapter

Theory

In signal processing, cross-correlation is a measure of similarity of two waveforms as a function of a time-lag applied to one of them. This is also known as a sliding dot product or sliding inner-product. It is commonly used for searching a long-duration signal for a shorter, known feature. It also has applications in pattern recognition, single particle analysis, electron tomographic averaging, cryptanalysis, and neurophysiology.

For continuous functions, f and g, the cross-correlation is defined as’:continuous functions

Where f * denotes the complex conjugate of f.

Similarly, for discrete functions, the cross-correlation is defined as:discrete functions

The cross-correlation is similar in nature to the convolution of two functions.

In an auto correlation, which is the cross-correlation of a signal with itself, there will always be a peak at a lag of zero unless the signal is a trivial zero signal.

Procedure for build a project on Cross Correlation using TMS320F2812

Note: Once you install the Code Composer Studio v 3.3 software, the two icons will display in desktop

I. Setup Code Composer Studio v3.3 II. Code Composer Studio

1.Open Setup Code Composer Studio v3.3.

2.In System Configuration, select the board then >> Remove all >> yes.

a.In family, select C28xx.

b.In platform, select xds100 usb emulator.

c.In Endianness, select little.

d.Select F2812 XDS100 USB Emulator >> add >> save & quit >>no.

Note: The above two steps only for first time to setup the processor in CCS.

3.Open Code Composer Studio v3.3.

4.Project >> New.

a.Project name: type the project name.

b.Location: Browse, select the project location.

c.Project Type: Executable(.out)

d.Target: TMS320C28XX. >> Finish.

5. File >> New >> Source file.

a.Type the program in untitled window.

6. File >> Save.

a. Browse our project location then type our project name.c ( .c extension is must) >>save.

7. Paste the following two cmd files in our project folder.

a.F2812_EzDSP_RAM_lnk.cmd

b.DSP281x_Headers_nonBIOS.cmd

c.DSP281x_GlobalVariableDefs.c

8. Project >> Add files to project.

a. In file of type : All files

b. Ctrl + Select the following files

☞projectname.c

☞DSP281x_GlobalVariableDefs.c

☞F2812_EzDSP_RAM_lnk.cmd

☞DSP281x_Headers_nonBIOS.cmd >> open.

9.Project >> Build Option.

a.In compiler tab, select Preprocessor

>>   Include search path(-i): C:\tidcs\c28\DSP281x\v120\DSP281x_headers\include

b.In linker tab, select libraries

>>   Search path(-i): C:\CCStudio_v3.3\C2000\cgtools\lib

>>   Incl libraries (-l): rts2800_ml.lib.

c.In linker tab, select Basic

>>   Stack Size (-stack): 0x400 >> ok.

10.Project >> Build (or) Rebuild all.

11.Connections for TMS320F2812 KIT:

a.Connect 5v adapter to TMS320F2812 KIT.

b.Connect usb cable to TMS320F2812 KIT from pc.

c.Power on the TMS320F2812 KIT.

12.Debug >> connect.

13.File >> Load Program >> Browse and select the projectname.out file >> open

14.Debug >> Go main.

15.View >> memory

a.Enter an Address: 0x3F9100 >> Enter.

b.Type the input.

>>   For example:

1.0x3F9100 – 0x0001

2.0x3F9101 – 0x0002

3.0x3F9102 – 0x0003

4.0x3F9103 – 0x0004

16.View >> memory

a.Enter an Address: 0x3F9200 >> Enter.

>>   For example:

1.0x3F9200 – 0x0001

2.0x3F9201 – 0x0002

3.0x3F9202 – 0x0002

4.0x3F9203 – 0x0002

17.View >> memory

a.Enter an Address: 0x3F9300 >> Enter.

18.Debug >> Run.

19.Debug >> Halt.

20.See the output at following location,

>>   For example:

1.0x3F9300 – 0x0002

2.0x3F9301 – 0x0006

3.0x3F9302 – 0x000C

4.0x3F9303 – 0x0013

5.0x3F9304 – 0x0010

6.0x3F9305 – 0x000B

7.0x3F9306 – 0x0004

Program for Cross Correlation using TMS320F2812

#include "DSP281x_Device.h"
#define xn 4
#define hn 4
void main()
{
        int *xval,*hval,*outval,j;
        int n,k,i,t[100]={0}; 
        xval = (int *)0x003F9100; /* input 1 */
        hval = (int *)0x003F9200; /* input 2 */
        outval = (int *)0x003F9300; /* output */ 
        for(i=0;i<(xn+hn-1);i++)
        {
                outval[i] = 0;
                t[i]=0;
                xval[xn+i]=0;
                hval[hn+i]=0;
        }
       
        for(i=0,j=(hn-1);i<(hn);i++,j--)
                t[j] = hval[i]; 
        for(n=0;n<(xn+hn-1);n++)
        {
                for(k=0;k<=n;k++)
                        outval[n] = (outval[n])+((xval[k])*(t[n-k]));
        }
       
 
while(1);       
}


Result

Thus, the Cross Correlation of two given discrete sequence has performed and the result is stored at memory location (0x3F9300).

Leave a Reply

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