Tool/software: Code Composer Studio
I am using TMS320C6713 DSK for Echo cancellation using nlms algorithm of adaptive filtering.
https://www.dsprelated.com/showabstract/65.php is the link i am refering to.
i have modified the code nlms_adfilt.c. The modified code looks like :
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <dsk6713.h>
#include <dsk6713_aic23.h>
#define FILTER_LENGTH 2300
#define ECHO_DELAY 600
#define STEP_SIZE 5e-5
#define SCALE 5000.0
#define GAIN 15
#define OUTBUF_LEN 1024
float input, echoed, af_output, error_signal;
float input_vector[FILTER_LENGTH];
float filter[FILTER_LENGTH];
float echo_buffer[ECHO_DELAY];
float step_size = STEP_SIZE;
float nstep_size;
short output;
short output_type=1;
short delay_param=0;
short i, j, eb_index;
Uint32 fs=DSK6713_AIC23_FREQ_8KHZ;
short OutputBuffer[OUTBUF_LEN];
short ob_index = OUTBUF_LEN;
float dotp (float a[], float b[])
{
float suml, sumh;
int j;
suml=0;
sumh=0;
for(j=0; j<FILTER_LENGTH; j+=2)
{
suml += a[j] * b[j];
sumh += a[j+1]*b[j+1];
}
return (suml+sumh);
}
interrupt void c_int11()
{
input=(float)(input_sample())/SCALE;
input_vector[0] = input;
echoed = input+0.4*echo_buffer[eb_index];
echo_buffer[eb_index]=echoed;
eb_index++;
if (eb_index >= ECHO_DELAY-delay_param)
eb_index=0;
af_output=dotp(filter, input_vector);
error_signal = echoed-af_output;
nstep_size=1/dotp(input_vector, input_vector);
for (i=FILTER_LENGTH-1; i>0; i--)
{
filter[i] = filter[i] + 2*nstep_size*error_signal*input_vector[i];
input_vector[i]=input_vector[i-1];
}
if (output_type==1)
output=(short)(input*SCALE*GAIN);
if (output_type==2)
output=(short)(echoed*SCALE*GAIN);
if (output_type==3)
output=(short)(af_output*SCALE*GAIN);
if (output_type==4)
output=(short)(error_signal*SCALE*GAIN);
output_sample(output);
if ( ob_index < OUTBUF_LEN )
OutputBuffer[ob_index++] = output;
}
main()
{
error_signal=0.0;
echoed=0.0;
af_output=0.0;
eb_index=0;
nstep_size=0;
for (i=0; i<FILTER_LENGTH-1; i++)
{
filter[i]=0.0;
input_vector[i]=0.0;
}
for (i=0; i<ECHO_DELAY; i++)
{
echo_buffer[i]=0.0;
}
comm_intr();
while(1);
}
i have added following support files:
c6x.h
c6xdsk.h
c6xdskinit.h
c6xinterrupts.h
c6xdskinit.h
modified nlms_adfilt.c
vectors_11.asm
C6xdsk.cmd
support libraries: rts6700.lib csl6713.lib dsk6713bsl.lib
Then I changed build options according to chassing book which are as follows:
compiler --> basic --> target version --> c671x(-mv6710)
compiler --> advanced --> memory models --> Far(--mem_model:data=far)
compiler --> preprocessor --> Include Search path --> (give address where all support files stored)
compiler --> preprocessor --> Pre define symbol(-d) : CHIP_6713
linker --> basic --> library Search Path --> (gave address where all support files stored)
linker --> basic --> include libraries(-l) --> rts6700.lib;dsk6713bsl.lib;csl6713.lib
linker --> advanced --> uncheck the Warn about the output sections (-w) checkbox.
Then I tried to build the program.
The build was successful with 0 errors 0 warnings 0 remarks.
Now my queries are:
How to give input to the kit?
How to get output?
How can I compare both input and output? Both physically by hearing through headphone out port and also by observing graphically.?
P.S. I used CCS V3.1 platinum edition which is available with The CD accompanying the TMS320C6713 Dsp kit.
Thanks In advance.
Pls Help asap.