Aim
To perform the Auto Correlation of a given discrete sequence in TMS320F2812 KIT.
Requirements
☞CCS v3.3
☞USB Cable
☞5V Adapter
Theory
Autocorrelation is the cross correlation of a signal with itself. Informally, it is the similarity between observations as a function of the time separation between them. It is a mathematical tool for finding repeating patterns, such as the presence of a periodic signal which has been buried under noise, or identifying the missing fundamental frequency in a signal implied by its harmonic frequencies. It is often used in signal processing for analyzing functions or series of values, such as time domain signals.
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.
Given a signal , the continuous autocorrelation is most often defined as the continuous cross-correlation integral of with itself, at lag .
where represents the complex conjugate and represents convolution. For a real function, f = f .
Procedure for build a project on Auto Correlation using TMS320F2812 DSP
Note: Once you install the Code Composer Studio v 3.3 software, the two icons will display in desktop
☞Setup Code Composer Studio v3.3
☞Code Composer Studio
1. Open Setup Code Composer Studio v3.3.
2. In System Configuration, select the board then → Remove all → yes.
☞In family, select C28xx.
☞In platform, select xds100 usb emulator.
☞In Endianness, select little.
☞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.
☞ Project name: type the project name.
☞ Location: Browse, select the project location .
☞ Project Type: Executable(.out)
☞ Target: TMS320C28XX. → Finish.
5. File → New → Source file.
☞Type the program in untitled window.
File→ Save.
☞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.
☞F2812_EzDSP_RAM_lnk.cmd
☞DSP281x_Headers_nonBIOS.cmd
☞DSP281x_GlobalVariableDefs.c
1. Project → Add files to project.
In file of type : All files
Ctrl + Select the following files
☞projectname.c
☞DSP281x_GlobalVariableDefs.c
☞F2812_EzDSP_RAM_lnk.cmd
☞DSP281x_Headers_nonBIOS.cmd → open.
9. Project → Build Option.
In compiler tab, select Preprocessor
☞Include search path(-i): C:\tidcs\c28\DSP281x\v120\DSP281x_headers\include
In linker tab, select libraries
☞Search path(-i): C:\CCStudio_v3.3\C2000\cgtools\lib
☞Incl libraries(-l): rts2800_ml.lib.
In linker tab, select Basic
☞Stack Size(-stack): 0x400 → ok.
10. Project → Build (or) Rebuild all.
11. Connections for TMS320F2812 KIT
☞Connect 5v adpter to TMS320F2812 KIT.
☞Connect usb cable to TMS320F2812 KIT from pc.
☞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
Enter An Address:0x3F9100 → Enter.
Type the input.
For example:
☞0x3F9100 – 0x0001
☞0x3F9101 – 0x0002
☞0x3F9102 – 0x0003
☞0x3F9103 – 0x0004
16. Debug → Run.
17. Debug → Halt.
18. See the output at following location, View → memory
Enter An Address:0x3F9200 → Enter.
For example:
☞0x3F9200 – 0x0004
☞0x3F9201 – 0x0012
☞0x3F9202 – 0x0020
☞0x3F9203 – 0x0030
☞0x3F9203 – 0x0020
☞0x3F9203 – 0x0012
☞0x3F9203 – 0x0004
Program for Auto Correlation using TMS320F2812 DSP
#include "DSP281x_Device.h"
#define xn 4
#define hn 4
void main()
{
int *xval,*outval,j;
int n,k,i,t[100]={0};
xval = (int *)0x003F9100; /* input */
outval = (int *)0x003F9200; /* output */
for(i=0;i<(xn+hn-1);i++)
{
outval[i] = 0;
t[i]=0;
xval[xn+i]=0;
}
for(i=0,j=(hn-1);i<(hn);i++,j--)
t[i] = xval[j];
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 Auto Correlation of a given discrete sequence has performed and the result is stored at memory location(0x3F9200).