This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Acoustic Echo Canceller Help

Other Parts Discussed in Thread: CCSTUDIO, TMS320C6711D

I am doin real time implementation of a acoustic echo canceller with help of chassaing book and dsk tms320c6713 or 6711, CCS..3.1 I got code for the same, but not knw how 2 see output (real time)..i cant chk whether ccs and dsk is taking input(mic) and produce output(speaker/headfone).. pls tell which additional files i need 2 add 2 my project.Pls hlp asap.. THanx in advance file at website-"dsprelated.com" file:acoustic echo cancellation using digital signal processing

  • I tried looking at www.dsprelated.com, but did not quickly find the file you are referencing. If it is needed for us to continue this discussion, please give us more specific instructions.

    My old-style and basic understanding of acoustic echo cancellation is that a large buffer will contain as much input signal history as possible/practical for the required echo delay range. The input samples will be added to the end of the buffer and a correlation algorithm will be run from time-to-time to compare a recent segment of the buffer with other segments of the buffer. If a high correlation is found, then another algorithm will be run which removes acoustic components from the recent segment that are similar to the older segment. That modified recent segment is then sent to the output device.

    The Chassaing book should have some helpful information about where the data is stored, what the names of the buffers are for input and output. You will want to "see" the valid input data getting to the input buffer and valid output data getting to the output buffer. The easiest way to view the data is with the CCS command menu using View->Memory and setting the address to the name of the input or output buffer. I usually recommend to change the view style (bottom left corner of the View Memory Window to fit the width of the data and to use TI format so it shows the hex value without the 0x prefix - this lets you have more data on the screen since you know it is hex already. You can refresh this window to see it change, but in stop-mode emulation this will result in stalls to the processor so that you may get stutters in the output results.

    It is possible that you will be viewing the data while it is being updated, so you might see partly new data and partly old data. This is just the way it is with real-time debug. You can control this by putting in code to copy from an active buffer to a viewing buffer, but that is a high-touch type of debug tool.

    There is also a graphical data display tool that can let you look at a plot of the data that you would be looking at in the memory window. If this is what you want instead of looking at the raw data in the memory window, I will try to get the instructions for that. I am sure there are some help files, so you might want to search the forum and the tiexpressdsp wiki pages for information.

  • http://www.dsprelated.com/showabstract/65.php is the link for the thesis i'm referring.

    i'm using c6713 dsk instead. i have added c6x.h,c6xdsk.h,c6xdskinit.h,c6xdskinterrupts.h,c6xdskinterrupts.h,nlms_adaptfilt.c,nlms.gel,rtslib6701,and cmd files to my project in ccsv 3.1. doineed2 add codec.c ? i'm connecting mic 2 mic in and headphones to headphones pin on the dsk.

    How 2 generate acoustic echo. should i add file echo.c ?

    can i see output real time on CRO ? how ?

     

  • Thank you for the link to the AEC paper. That helped me understand a little more of what you are doing.

    You most likely have quite a few additional files from the CD accompanying Chassaing 2002, but it is probably not appropriate to post any of those here without permission from the publisher. But your project will need to include all the files that Chassaing says are part of this project. For example, the function comm_intr() is called in main() to setup the communication interrupts and peripherals, and the output_sample() function is called at the end of the ISR c_int11(). Without the source files for these functions being included in your project (or object or libraries with them), you should not be able to get a valid compile/build from which to load and run your program.

    I will guess for now that you need to go back to the Chassaing 2002 CD and the instructions in that book to figure out what files are needed to get the full application built. There could be some differences between the DSK6711 and the DSK6713, but those might just be handled by making references to a different file or function from the support files that come with the DSK you are using.

    Once you get a complete build and can load and run your program, then if everything is working right you will hear audio on your headphones that sounds like what was fed to your microphone.

    From examining what I can of the code from the thesis on dsprelated.com, the input audio should be viewable by looking at "input_vector" in a memory window. You can also look at the data as a waveform using the Graphical Data display, CCS command menu View->Graph->Time/Frequency [when the Graph Property Dialog comes up, you can click Help on that Dialog to get some good information on the capabilities of the Graphical Data display].

    Since the the output_sample() function appears to write a single sample at a time, there may not be a buffer that contains a history of output sample (like input_vectors does for input samples). You may be limited as to what you can view real-time other than watching the variable "output" in a Watch Window - you will be able to see the latest value, but I doubt it will be very meaningful. If you get the output peripheral working and can see anything changing on the output of the DAC, then the program does have hooks to allow you to select an "output_type" to select what should be sent to the audio output. An oscilloscope would be the easiest way to see this real-time. But you could also add a buffer to hold some number of samples (1024 for example) then grab those whenever told by a GEL command, then display that buffer with the Graphical Data display. Here is what I mean to add:

    In nlms_adfilt.c add at the top:

    #define OUTBUF_LEN 1024
    short OutputBuffer[OUTBUF_LEN];
    short ob_index = OUTBUF_LEN;  // pretend it is full when not in use

    In nlms_adfilt.c add at the end of c_int11() after "output_sample(output);":

        if ( ob_index < OUTBUF_LEN )
            OutputBuffer[ob_index++] = output;

    In NLMS.gel add at the end:

    menuitem "Capture";
    hotmenu Capture_Output_Buffer ()
    {
    ob_index = 0;  // new buffer will be captured, then refresh the graphical display or memory window
    }

    I do not know what "CRO" means.

    Please let me know how well your build process is working. If there are problems, please add some information like CodeGen Tools version and anything else that may be unique to your implementation.

  • i have added c6x.h,c6xdsk.h,c6xdskinit.h,c6xdskinterrupts.h,c6xdskinit.c,nlms_adaptfilt.c,nlms.gel,rtslib6700,and cmd files to my project in ccsv 3.1. do i need to add .cdb file 2 my project ? do i need 2 add codec.c, or is it inbuilt ?? my prof told that codec.c is essential if we r using mic, headfones...is it ?? shud i need to include header file dsk6713.h,dsk6713_aic23.h in nlms_adaptfilt.c INSTEAD ? Without using codec.c, sucessful build and compile and load and run, but cant chk input and output..!! **************codec.c****************** #include "xyzcfg.h" #include "dsk6713.h" #include "dsk6713_aic23.h" /* Codec Configuration settings */ DSK6713_AIC23_Config config={ \ 0x0017, /* 0 DSK6713_AIC23_LEFTINVOL Left line input channel volume */\ 0x0017, /* 1 DSK6713_AIC23_RIGHTINVOL Right line input channel volume */\ 0x00d8, /* 2 DSK6713_AIC23_LEFTHPVOL Left channel headphone volume */\ 0x00d8, /* 3 DSK6713_AIC23_RIGHTHPVOL Right channel headphone volume */\ 0x0015, /* 4 DSK6713_AIC23_ANAPATH Analog audio path control */\ 0x0000, /* 5 DSK6713_AIC23_DIGPATH Digital audio path control */\ 0x0000, /* 6 DSK6713_AIC23_POWERDOWN Power down control */\ 0x0043, /* 7 DSK6713_AIC23_DIGIF Digital Audio Interface Format */\ 0x0081, /* 8 DSK6713_AIC23_SAMPLERATE Sample rate control */\ 0x0001, /* 9 DSK6713_AIC23_DIGACT Digital Interface Activation */\ }; /* main() - main code routine, initializes BSL and generates tone */ void main() { DSK6713_AIC23_CodecHandle hCodec; int l_input, r_input, l_output, r_output; /* Initialize the board support library, must be called first */ DSK6713_init(); /* Start the codec */ hCodec=DSK6713_AIC23_openCodec(0, &config); /* set codec sampling frequency */ DSK6713_AIC23_setFreq(hCodec,3); while(1) { /* Read a sample to the left channel */ while (!DSK6713_AIC23_read(hCodec, &l_input)); /* Read a sample to the right channel */ while (!DSK6713_AIC23_read(hCodec, &r_input)); /* Send a sample to the left channel */ while (!DSK6713_AIC23_write(hCodec, l_input)); /* Send a sample to the right channel */ while (!DSK6713_AIC23_write(hCodec, r_input)); } /* Close the codec */ DSK6713_AIC23_closeCodec(hCodec); } ****************************************** if i add codec.c 2 my project i face this error: error: symbol _main is defined multiple times: C:\CCStudio_v3.1\MyProjects\i\Debug\codec.obj and C:\CCStudio_v3.1\MyProjects\i\Debug\nlms_adfilt.obj hw 2 solve this.? How 2 generate acoustic echo. should i add file echo.c (chassaing book) ? i think dsk isnt taking input thru mic....why? if yes then hw can i see it ? in graphical display i can see input n output only for 1 sample. how 2 see real time input and real time (echo cancelled ) output or hear it thru headfones.. i cant hear any output. can i see output real time on cro(analog osciloscope) ? how ?
  • I do not know what happened to your cr-lf chars at the end of each line. Some may have been taken by the trailing "\" on some lines - these are only needed for #defines but seem to be used too much in many TI-supplied examples - sorry if this is affecting the display here. It is not possible for me to easily understand the code you supplied in the word-wrap formatting as shown.

    Since this code came from the Chassaing 2002 book and I do not have that book, there is not a way for me to know what is in the files you ask about. Put one way, the Chassaing book should tell you all the files you need to implement what they have on the CD, but without access to that I cannot give you complete helpful advice.

    It appears from your comments that nlms_adaptfilt.c implements an executable program that you are able to run. It is not clear what relationship there is between this and codec.c or the acoustic echo cancellation application you are targetting. nlms_adaptfilt.c does seem to take input data and generate output data. If you cannot see data on the headphone output with your CRO, then you will need to debug the program using some of the techniques I have discussed earlier, or even be starting with a simpler application to just prove that a program can get data from input to output on your board (the board could be broken, or the code could be configured wrong or other issues may be present).

    When you added codec.c, you created an invalid program since codec.c also contained a main() function. So this is not the right thing to do. There may be functions from codec.c that you need instead, or it is possible codec.c should replace nlms_adaptfilt.c, but again I cannot tell you what is in the files that you got from Chassaing 2002.

    When you want to look at the output from the headphone connector with your CRO, you will need to build a plug with wires so that the plug can be plugged into the headphone jack and the wires can be connected to the scope probes. But if you are not hearing any output, there probably is not any output to see on the CRO. If it is very low level, then you might see it on the CRO even though you did not hear it on the headphones, but that might not be the case. It will be useful to have that connection anyway.

    It will make it easier for me to understand your statements and questions if you will try to minimize the use of shorthand notations.

  • codec.c--------------------- #include "xyzcfg.h" #include "dsk6713.h" #include "dsk6713_aic23.h" /* Codec Configuration settings */ DSK6713_AIC23_Config config={ \ 0x0017, /* 0 DSK6713_AIC23_LEFTINVOL Left line input channel volume */\ 0x0017, /* 1 DSK6713_AIC23_RIGHTINVOL Right line input channel volume*\ 0x00d8, /* 2 DSK6713_AIC23_LEFTHPVOL Left channel headphone volume */\ 0x00d8, /* 3 DSK6713_AIC23_RIGHTHPVOL Right channel headphone volume */\ 0x0011, /* 4 DSK6713_AIC23_ANAPATH Analog audio path control */\ 0x0000, /* 5 DSK6713_AIC23_DIGPATH Digital audio path control */\ 0x0000, /* 6 DSK6713_AIC23_POWERDOWN Power down control */\ 0x0043, /* 7 DSK6713_AIC23_DIGIF Digital Audio Interface Format */\ 0x0081, /* 8 DSK6713_AIC23_SAMPLERATE Sample rate control */\ 0x0001, /* 9 DSK6713_AIC23_DIGACT Digital Interface Activation */\ }; /* main() - main code routine, initializes BSL and generates tone */ void main() { DSK6713_AIC23_CodecHandle hCodec; int l_input, r_input, l_output, r_output; /* Initialize the board support library, must be called first */ DSK6713_init(); /* Start the codec */ hCodec=DSK6713_AIC23_openCodec(0, &config); /* set codec sampling frequency */ DSK6713_AIC23_setFreq(hCodec,3); while(1) { /* Read a sample to the left channel */ while (!DSK6713_AIC23_read(hCodec, &l_input)); /* Read a sample to the right channel */ while (!DSK6713_AIC23_read(hCodec, &r_input)); /* Send a sample to the left channel */ while (!DSK6713_AIC23_write(hCodec, l_input)); /* Send a sample to the right channel */ while (!DSK6713_AIC23_write(hCodec, r_input)); } /* Close the codec */ DSK6713_AIC23_closeCodec(hCodec); }
  • this was codec.c file..... hard 2 paste it here..
  • QUeries were : i have added c6x.h,c6xdsk.h,c6xdskinit.h,c6xdskinterrupts.h,c6xdskinit.c,nlms_adaptfilt.c,nlms.gel,rtslib6700,and cmd files to my project in ccsv 3.1. do i need to add .cdb file 2 my project ? do i need 2 add codec.c, or is it inbuilt ?? my prof told that codec.c is essential if we r using mic, headfones...is it ?? shud i need to include header file dsk6713.h,dsk6713_aic23.h in nlms_adaptfilt.c INSTEAD ? Without using codec.c, sucessful build and compile and load and run, but cant chk input and output..!! if i add codec.c 2 my project i face this error: error: symbol _main is defined multiple times: C:\CCStudio_v3.1\MyProjects\i\Debug\codec.obj and C:\CCStudio_v3.1\MyProjects\i\Debug\nlms_adfilt.obj hw 2 solve this.? How 2 generate acoustic echo. should i add file echo.c (chassaing book) ? i think dsk isnt taking input thru mic....why? if yes then hw can i see it ? in graphical display i can see input n output only for 1 sample. how 2 see real time input and real time (echo cancelled ) output or hear it thru headfones.. i cant hear any output. can i see output real time on cro(analog osciloscope) ? how ?
  • ftp://ftp.wiley.com/sci_tech_med/digital_signal/ is link for CD associated with chassaing 2002 book i have connected headphone wire to headphones out (DSK) and mic wire to mic in (dsk) and scope probe to line out (dsk) i had read in chassaing that mic in, line in are multiplexed and so only 1can be used at a time. similarly for line out and headphones out..
  • how 2 chk my code using a stored audio file (.wav or any) ?

    if i can do this, mayb i can debug errors in real-time implementtion..

     

  • Please try the following:

    Create an audio file using ASCII text with audio samples one-per-line in decimal format. You may create a sample file using the File->Data->Save command in CCS and check the format of that file (use decimal format output).

    Create a large input buffer and a large output buffer in your external memory. Use File->Data->Load to copy from your ASCII audio file into the large input buffer.

    Modify your input_sample() function and your output_sample() function to access the large input and output buffers, respectively. Stop when either reaches the end of the buffer.

    This procedure will use your stored audio file as input to your program and let you also view the output from the program in the large output buffer.

  • Instead i used sound recorder of windows for  recording voice and adding echo  to it,

    i played it  on windows and using a stereo cable, i input it to mic in port of dsk6713. (.wav)

    i can hear only (and see on oscilloscope) echoed version of output.. other 3 output (using gel file)

    is not seen. that too doesnt seem to be  exact output




     

  • Excellent. You have input and output across the audio codecs and through the DSP. That proves out all of the hardware.

    Now it is just a matter of debugging the program. Compare the different output selections and try to determine what is happening differently.

  • #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);                                                               

    }

    Is the program I’m using

    Support files: (found on google or ccsv3.1 folder)

    ftp://ftp.wiley.com/sci_tech_med/digital_signal/ is link for CD associated with chassaing 2004 book

      c6713dskinit.c

      C6X.H

      c6xdsk.h

      c6713dskinit.h

      c6xinterrupts.h

      vectors_11.asm

      rts6700.lib

      C6xdsk.cmd

    Nlms.gel

    Dsk6713.h, dsk6713_aic23.h (change default config from 0x0011 to 0x0015 for using mic )

    Csl6713.lib, dsk6713bsl.lib

    SIR, PLs try running this on 6713 kit

  • Dsk6713.h,

    dsk6713_aic23.h

    (change default config from 0x0011 to 0x0015 in  c6713dskinit.h  for using mic )
    Csl6713.lib,

    dsk6713bsl.lib


    PLs try running above program on tms320c6713 kit     CCSv3.1

    Modifications : (debugging i done) so that zero errors,zero warnings
    build options--compiler--basic--family--c671x
    build options--compiler--basic--files location--(give address where all support files stored)
    build options--compiler--advanced--memory model--far
    build options--compiler--advanced--preprocessor--debug--CHIP_6713
    build options--linker--library path--(give address where all support files stored)
    build options--linker--stack size-- 400hex
    build options--linker--execution--(pls chk absolute executable or relocatable executable)

    I am not able to relate the input with output.
    for given input (thru mic or stored audio file or signal generator-1 to 10 Hz),

    I'v used display variables 1. input   2. output
    I am getting some output. on cro as well as headfones and graphical display. But I dont think its expected output..
    Also output 3, 4 not coming. I'v tried 2 debug a lot but not suceeded.

    Pls chk n tell.
    Thanx n regards

  • It will not be possible for me to run your program and debug it for you.

    You must get correct functionality with output_type set to 1, which sends exact input to output, or you cannot do anything more with your program until that is fixed. If there is another of the same DSK available to you, you could try running on it to make sure the problem is not in your board. Next, you have to look at the input data from CCS to see if it looks like valid audio data - set the incoming volume level very low and you will see a smaller range of numbers, set it higher and you will see a larger range of numbers, adjacent samples should not be "too far" from each other depending on the pitch of the sound, and so forth. Then when you are convinced you have good audio input, start following the data through the output_sample() function to find out why it does not work; if you do not have source code for that, it will be difficult.

    Perhaps someone else on the forum has done this before. Your prof may have good insights from past experiences with this book and the code examples in it, or may know if others have had similar problems to yours.

  • Support files:

     • c6xdskinit.c
    • C6X.H
    • c6xdsk.h
    • c6xdskinit.h
    • c6xinterrupts.h
    • vectors_11.asm
    • rts6700.lib
    • C6xdsk.cmd
    Nlms.gel

    // nlms_adfilt.c
    // Real time implementation of NLMS algorithm for echo cancellation system.
    // Uses TI TMS320C6711 DSK.
    #include <math.h>
    #include <stdio.h>
    #include <stdlib.h>
     
    #define FILTER_LENGTH 2300
    #define ECHO_DELAY 600
    #define STEP_SIZE 5e-5
    #define SCALE 5000.0
    #define GAIN 15
     
    double af_output;
    float input, echoed, error_signal;
    float input_vector[FILTER_LENGTH];
    float filter[FILTER_LENGTH];
    float echo_buffer[ECHO_DELAY];
    float step_size = STEP_SIZE; // fixed step size for standard LMS implementation
    float nstep_size;
    short output;
    short output_type=1;
    short delay_param=0;
    short i, j, eb_index;
     
    double dotp (float a[], float b[]) // Procedure for determining dot product of two arrays
    {
        double suml, sumh;// based on Chassaing 2002, p. 242
        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);
    }
    // // This interrupt is triggered at every sample instant
    interrupt void c_int11()           
    {
        input=(float)(input_sample())/SCALE;    // newest input cast to float 
            input_vector[0] = input;    // put sample     
         
    //Firsly calculate echoed output. Using delay-buffer method.
        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;
     
            //calculate output of adaptive filter
        af_output=dotp(filter, input_vector);
                 
        error_signal = echoed-af_output;
         
        // calculate variable step size
        nstep_size=1/dotp(input_vector, input_vector);
         
        //update tap weights
        for (i=FILTER_LENGTH-1; i>0; i--)
        {
            filter[i] = filter[i] + *nstep_size*error_signal*input_vector[i];
    //calculate taps
            input_vector[i]=input_vector[i-1]; //shift vector         
        }
             
        // Switch for controlling the output type using lms.gel
     
        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 the sample
        output_sample(output);     
    }
     
     
    // This is main procedure executed on start up of program
    main()
    {
         // Initialise variables
        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++) // initialise filter, input vector
        {
            filter[i]=0.0;
            input_vector[i]=0.0;         
        }
        for (i=0; i<ECHO_DELAY; i++) // init echo buffer
        {
            echo_buffer[i]=0.0;     
        }
         comm_intr();                     //init DSK, codec, McBSP
         while(1);                        //infinite loop
    }
    input thru signal generator or .wav file stored on pc.
    i ran this prog on 6711 kit. me gettin output for case 1,2.  but not for case 3,4. I ran on ccsv2. i saw output on oscilloscope

  • If you want someone to debug this for you, maybe someone else will join in. If you want me to quit replying with the direction I take you, please let me know. I want you to succeed, and most of that success will depend on what you are able to do in debugging this application. I will not ask you questions about your program and try to lead you find your answers. I do not know the answers, but I know some of the questions you must answer before you will be able to find your solution.

    The good work you have done up to now has been to get the project to successfully build and execute on the DSK. And you have been able to verify that you can put in audio input and get out audio output. Even though only options 1 and 2 give you audio output, you at least have proven that some of the functionality is working - the hardware is operating and some of the software is operating, you are getting interrupts, you can read input samples and you can write output samples and hear/see those output samples. This is a lot of the hard work already done.

    Questions:

    1. In main(), do you understand what the two for loops are doing? What required function do they perform?
    2. Do you understand how the dotp() function determines the dot-product? How does it do that?
    3. Can you list the sequence of operations that are performed in the interrupt service routine (ISR), c_int11()?
    4. Where did you get the program code for the ISR c_int11()? Directly from the Chassiang CD or did you author it or did you re-type it from somewhere?
    5. Have you looked through all the code you wrote line-by-line to see if anything is different from what you meant to type in? And I really mean every single line. No one but you can compare the code with what you meant to type; only you can do that.
    6. Do you agree that output_type==1 is trivial in terms of data generation, but very important in terms of proving out your basic I/O data flow?
    7. Since output_type==2 also works, what data is being sent to the output for this selection? What type of sound do you expect to hear on the output for this selection? Is that what you do hear?
    8. If output_type==3 does not work, what type of sound would you have expected for this selection? What variables and what arrays does the ISR use to generate this value?
    9. If output_type==4 does not work, what type of sound would you have expected for this selection? What variables and what arrays does the ISR use to generate this value?
    10. Do you know how to set breakpoints and view variables in a watch window? Try opening a watch window with all the scalars used in the ISR, then set a breakpoint in the ISR and run with the animate run feature.
    11. Do you notice anything unusual about any of the variables that makes them seem suspect?

    Please reply back with your answers to these questions so you/we can hopefully progress.

  • sir thanx for ur hlp

    i gt output.

    wil reply later .. got my final exams...

  • sir, i guess u r from US Thank u for ur valuable suggestions. I worked out ur instructions line by line n solved out my problem. Thank u very much for the consistent help n support.

    I am M.Tech student from India. My second year is project work in industry (internship) . can u pls guide me, how to apply for internship in TI.

  • Please go to www.ti.com and click on Contact Us near the upper left corner. Good luck to you!

  • hi im also doing the same project as u have done with the same source code from the same document im also facing the same problems as u faced on 6713 kit so can u plz giude me through as u r the best in this world who can guide me now plz help me

  • b specific wat hlp u want...

    am helping bcoz some1 hlpd me whn i needed hlp.. n am not the best

  • Thanks for ur response by the way im sampath doing my final b.tech now. im also doing the same project of acoustic echo cancellation using dsp on the same platform as of u on dsk 6713. i also used the same code of mr.huston which i have got in dsprelated .com.now im trying to compile the program but have no idea wat additional files need to be added to gat the output and where to check the output. so plz help in finding wat are the files need to be attatched to the .c file given in the document and also help me through the process of giving the input and finding out the output.

    thanks in advance

  • pls contact me on gtalk: anup.kori@gmail.com ... 4 faster communication

    get e-book by ralph chassaing on website: esnips.com or google it (6713 book)

    u'll get details u need in that book.. step-by step

    also try 2 get 6713 user manual frm ur lab or internet

  • Sir i m also facing d same problem.....

    i have run d code successfully as stated above....bt m nt able to implement it on d kit.....not able to view any output graphs....notg able to hear any sound using microphone....

    plz help me in dis.....i m having ma preliminary project representation on wednesday......i want to show d output graphs in d presenation n wanna show

    d real time implementation in ma final phase......plz reply as soon as possible either at dis forum or at ma email: gauravchhabra1987@gmail.com

    i knw i have asked for help at such a short notice bt i m helpless dis time .....i dont wanna screw ma grades n d presentation.......

  • Not sure who you are asking for help, so I hope the right one answers you.

    Also, I for one cannot read your message. Technical discussions and concepts are hard enough to convey using full words. Without words it is much more difficult.

  • I was a student in Vietnam. We're doing graduation thesis, our research is proving that you are doing subject. I urge you to help and share intelligence with experience.
    look forward to the help of people
    TMS320C6711 DSK

    • c6xdskinit.c
    • C6X.H
    • c6xdsk.h
    • c6xdskinit.h
    • c6xinterrupts.h
    • vectors_11.asm
    • rts6700.lib
    • C6xdsk.cmd
    Nlms.gel

    I did and run but only run a few seconds was stopped. I urge you to support

    i don't find C6711 DSK Port 278 EPP

  • any help please send the address dinhmaodt3@gmail.com
    thank you

    [ed- The E2E team prefers support discussions to remain on the forum so future readers will benefit. We appreciate your contributions, both by asking and by answering questions.]

  • Acoustic Echo Canceller Help

  • Dinh Mao,

    Welcome to the TI E2E forum. I hope you will find many good answers here and in the TI.com documents and in the TI Wiki Pages. Be sure to search those for helpful information and to browse for the questions others may have asked on similar topics.

    General information:

    The TMS320C6711D has been in production for many years. There are several Application Notes written for it.

    Please go to TI.com and search for "audio echo cancellation" (no quotes) to find a list of E2E articles and other documentation on this subject.

    List of files:

    dinh mao said:

    - c6xdskinit.c
    - C6X.H
    - c6xdsk.h
    - c6xdskinit.h
    - c6xinterrupts.h
    - vectors_11.asm
    - rts6700.lib
    - C6xdsk.cmd
    - Nlms.gel

    This list of files does not tell us anything about the project or the problem you have. There is only one C file and the name implies it is not where any application work is done for your project. What is your expectation of support?

    Support:

    dinh mao said:

    I did and run but only run a few seconds was stopped. I urge you to support

    i don't find C6711 DSK Port 278 EPP

    I am not sure what ran for a few seconds and stopped. Try using an internet search program to look for "Port 278 EPP" (no quotes) and "C6711 DSK Port 278 EPP" (no quotes). You can learn what this port is, for example.

    Also, try searching the E2E forum for some of these topics, then reply back with what you have found and any specific questions you have.

    Regards,
    RandyP

  • Thanks for your help. I made ​​this theme is the graduation thesis. this is new and its contents are facing many difficulties. following process has been added to your KIT. but it's not nice and intelligent do not know what to do next. speaker output is 3 seconds, then hear the BIP I use CCS v3.3

    [nlms_adfilt.c] "C:\CCStudio_v3.3\C6000\cgtools\bin\cl6x" -g -k -s -fr"C:/CCStudio_v3.3/MyProjects/NLMS/Debug" -d"CHIP_6711" -mv6710 -@"Debug.lkf" "nlms_adfilt.c"

    [c6xdskinit.asm] "C:\CCStudio_v3.3\C6000\cgtools\bin\cl6x" -g -k -s -fr"C:/CCStudio_v3.3/MyProjects/NLMS/Debug" -d"CHIP_6711" -mv6710 -@"../Debug.lkf" "c6xdskinit.asm"

    [vectors_11.asm] "C:\CCStudio_v3.3\C6000\cgtools\bin\cl6x" -g -k -s -fr"C:/CCStudio_v3.3/MyProjects/NLMS/Debug" -d"CHIP_6711" -mv6710 -@"../Debug.lkf" "vectors_11.asm"

    [Linking...] "C:\CCStudio_v3.3\C6000\cgtools\bin\cl6x" -@"Debug.lkf"

    /*C6xdsk.cmd Generic Linker command file*/

    MEMORY
    {
    VECS: org = 0h, len = 0x220
    IRAM: org = 0x00000220, len = 0x0000FDC0 /*internal memory*/
    SDRAM: org = 0x80000000, len = 0x01000000 /*external memory*/
    FLASH: org = 0x90000000, len = 0x00020000 /*flash memory*/
    }

    SECTIONS
    {
    vectors :> VECS
    .text :> IRAM
    .bss :> IRAM
    .cinit :> IRAM
    .stack :> IRAM
    .sysmem :> SDRAM
    .const :> IRAM
    .switch :> IRAM
    .far :> SDRAM
    .cio :> SDRAM
    }


    <Linking>

  • Dinh Mao,

    It appears you need to learn how to use CCS 3 to develop and debug your program. You have done a lot of good work and have a project you can run. The next steps are just to become experienced with using CCS 3 and its debug capabilities.

    Please go to the TI Wiki Pages and search for "C6000 training" (no quotes). Look for training that will include the C6711, although it may have some X's in the part number, such as C671x or C6x1x. There is an old C6000 Integration Workshop that has been archived onto the TI Wiki Pages, with the complete Student Guide and the labs available for download.

    You will want to take the time to go through the entire workshop and do the labs. After doing that, you will understand how to use CCS 3 and you will be ready to start debugging your application.

    Your application is doing 90% of the operation correctly. Your debug skills (after the training class) will allow you to find where the problems are in your application.

    Regards,
    RandyP

  • hello
    I was perform acoustic echo cancellation using a latexTMS320C6711 DSK. I did add running on KIT. but signaldistortion. signal is not as you want. can anyone help me fix thiswith

    // nlms_adfilt.c
    // Real time implementation of NLMS algorithm for echo cancellation system.
    // Uses TI TMS320C6711 DSK.
    #include <math.h>
    #include <stdio.h>
    #include <stdlib.h>

    // Defines
    #define FILTER_LENGTH 2300
    #define ECHO_DELAY 600
    #define STEP_SIZE 5e-5
    #define SCALE 5000.0
    #define GAIN 15

    // Declare variables
    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; // fixed step size for standard LMS implementation
    float nstep_size;
    short output;
    short output_type=1;
    short delay_param=0;
    short i, j, eb_index;


    // Procedure for determining dot product of two arrays
    float dotp (float a[], float b[])// based on Chassaing 2002, p. 242
    {
    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);
    }

    // This interrupt is triggered at every sample instant
    interrupt void c_int11()
    {
    input=(float)(input_sample())/SCALE; // newest input cast to float
    input_vector[0] = input; // put sample

    //Firsly calculate echoed output. Using delay-buffer method.
    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;

    //calculate output of adaptive filter
    af_output=dotp(filter, input_vector);

    // calculate error value
    error_signal = echoed-af_output;

    // calculate variable step size
    nstep_size=1/dotp(input_vector, input_vector);

    //update tap weights
    for (i=FILTER_LENGTH-1; i>0; i--)
    {
    filter[i] = filter[i] + 2*nstep_size*error_signal*input_vector[i]; //calculate taps
    input_vector[i]=input_vector[i-1]; //shift vector
    }

    // Switch for controlling the output type using lms.gel
    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 the sample
    output_sample(output);
    }


    // This is main procedure executed on start up of program
    main()
    {
    // Initialise variables
    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++) // initialise filter, input vector
    {
    filter[i]=0.0;
    input_vector[i]=0.0;
    }
    for (i=0; i<ECHO_DELAY; i++) // init echo buffer
    {
    echo_buffer[i]=0.0;
    }
    comm_intr(); //init DSK, codec, McBSP
    while(1); //infinite loop
    }


  • What does it sound like if you set output_type to 1? That needs to be working cleanly before any additional steps.

  • it is just noise that comes out. you can say specifically

  • I have tested on DSK. but there is no output signal. only noise. onCCS I change the LMS 1 to 4. noise only 1.2, 3.4, there is no noise.can anyone help me. do not have the output signal

    TMS320C6711 DSK BOARD

    // nlms_adfilt.c
    // Real time implementation of NLMS algorithm for echo cancellation system.
    // Uses TI TMS320C6711 DSK.
    #include <math.h>
    #include <stdio.h>
    #include <stdlib.h>

    // Defines
    #define FILTER_LENGTH 2300
    #define ECHO_DELAY 600
    #define STEP_SIZE 5e-5
    #define SCALE 5000.0
    #define GAIN 15

    // Declare variables
    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; // fixed step size for standard LMS implementation
    float nstep_size;
    short output;
    short output_type=1;
    short delay_param=0;
    short i, j, eb_index;


    // Procedure for determining dot product of two arrays
    float dotp (float a[], float b[])// based on Chassaing 2002, p. 242
    {
    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);
    }

    // This interrupt is triggered at every sample instant
    interrupt void c_int11()
    {
    input=(float)(input_sample())/SCALE; // newest input cast to float
    input_vector[0] = input; // put sample

    //Firsly calculate echoed output. Using delay-buffer method.
    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;

    //calculate output of adaptive filter
    af_output=dotp(filter, input_vector);

    // calculate error value
    error_signal = echoed-af_output;

    // calculate variable step size
    nstep_size=1/dotp(input_vector, input_vector);

    //update tap weights
    for (i=FILTER_LENGTH-1; i>0; i--)
    {
    filter[i] = filter[i] + 2*nstep_size*error_signal*input_vector[i]; //calculate taps
    input_vector[i]=input_vector[i-1]; //shift vector
    }

    // Switch for controlling the output type using lms.gel
    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 the sample
    output_sample(output);
    }


    // This is main procedure executed on start up of program
    main()
    {
    // Initialise variables
    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++) // initialise filter, input vector
    {
    filter[i]=0.0;
    input_vector[i]=0.0;
    }
    for (i=0; i<ECHO_DELAY; i++) // init echo buffer
    {
    echo_buffer[i]=0.0;
    }
    comm_intr(); //init DSK, codec, McBSP
    while(1); //infinite loop
    }


  • Either comment out or put an if(0)... or #if 0 around the code in c_int11 between the "input_vector[0] = " line and the "if(output_type==1)" line, keeping those lines outside of the if or #if. Set output_type to 1 in main.

    If you get noise, then your problem is very basic and you need to find an example program supplied with the DSK that demonstrates how to move input audio from input to output.

    If you do not get noise, then you can continue debugging you code that is within the if or #if.

    You may be trying to do too much work between input/output samples.

    In any case, you will benefit from the training material I have already pointed you to. Code optimization, real-time programming, using CCS for debug, these are topics covered in that training.

    Regards,
    RandyP