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.

DSK C6713 Audio Codec

Hello. I have build the following code on DSP kit C6713. 1st time it work alright but now its not working. What problem it may be??? I have tested it on other kit but it didn't work...

#include<dsk6713.h>
#include<dsk6713_aic23.h>
#include<stdlib.h>
#include<math.h>

/* Configure Codec */

DSK6713_AIC23_Config config = {
0x0017, /* 0 - DSK6713_AIC23_LEFTINVOL Left line input channel volume */
0x0017, /* 1 - DSK6713_AIC23_RIGHTINVOL Right line input channel volume */
0x01f9, /* 2 - DSK6713_AIC23_LEFTHPVOL Left channel headphone volume */
0x01f9, /* 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 */
};

void main(){
DSK6713_AIC23_CodecHandle hCodec;
Uint32 IN,OUT;

/* Initialize the board support library. It must be called first */
DSK6713_init();
/* Start the codec */
hCodec = DSK6713_AIC23_openCodec(0, &config);
/* Set codec frequency to 48KHz */
DSK6713_AIC23_setFreq(hCodec, DSK6713_AIC23_FREQ_48KHZ);

while (1) {

/* Read sample from the left channel */
while (!DSK6713_AIC23_read(hCodec, &IN_L));
/* Feeding the input directly to output */
OUT = 500*IN;
while (!DSK6713_AIC23_write(hCodec, OUT_R));
}
/* Close the codec */
DSK6713_AIC23_closeCodec(hCodec);
}

  • Mukhtar,

    Get one of the examples that come with the board working. Or one supplied from some other trusted source. Then modify it to build your own so you know you are starting from something that works.

    Mukhtar Hussain said:
    Uint32 IN,OUT;
    while (!DSK6713_AIC23_read(hCodec, &IN_L));
    OUT = 500*IN;
    while (!DSK6713_AIC23_write(hCodec, OUT_R));

    In your mind, step through these three lines of code and tell me what you expect to happen. Be very precise.

    In CCS, step through these three lines of code and look at the variables in the debug window. Tell me if the values change as you expect them to do. Ignore the fact that you are not keeping up with real-time so there will be no audio output when you are single-stepping.

    Regards,
    RandyP

  • Well I want the input @ mic-in should transfer  to headphone-out port. It work when I test it two week ago but it is not working now.

  • Mukhtar,

    I am sorry I was not able to help you. I cannot tell you what broke from two weeks ago, so hopefully you saved a copy of the working project and can try it again as it was when it worked.

    If you decide that you have the time to answer my leading questions from my previous post, I will be glad to follow-up with you. That means you would describe exactly what each line of code does. It means "the first line of code does this writing to that", and the same for each of the 3 lines.

    But if you have another way or want someone else to step in, I will stay quiet for you.

    Regards,
    RandyP

  • RandyP,

    I don't have DSP kit C6713 at this time. I'll check the variables in CCS debug window.

    I'll check it tomorrow in university then I'll tell you. Thanks.

    Regards,

    Mukhtar

  • RandyP,

    There is a little mistake in my post.

    RandyP said:
    Uint32 IN,OUT;
    while (!DSK6713_AIC23_read(hCodec, &IN_L));
    OUT = 500*IN;
    while (!DSK6713_AIC23_write(hCodec, OUT_R));

    Right one is

    RandyP said:
    Uint32 IN,OUT;
    while (!DSK6713_AIC23_read(hCodec, &IN_L));
    OUT = 500*IN;
    while (!DSK6713_AIC23_write(hCodec, OUT));

    When I had checked it on DSK. It does not read from mic in. When I had observed the value of "IN_L" in watch window it does not change. There is some junk values in it. 

    I had checked another code of single tone sine.c in Ralph Chasing's book, and it work tone can be heard @ headphone.

    So problem is at here

    while (!DSK6713_AIC23_read(hCodec, &IN_L));

    It does not work. Would you Please tell me what will be the problem?

    Regards,

    Mukhtar

  • Mukhtar,

    Have you found any example programs from Chassaing or CSL or the workshop or the board vendor that transfer from input to output like you want to do? Look particularly for any example that uses the DSK6713_AIC23_read function so you can compare how they use it.

    It is surprising that the IN_L variable does not change. Does the IN variable change?

    By starting from a working example, you do not have to study every detail of the function calls and the operation of the McBSP peripherals. You learn more by writing your own code and debugging each small part of it, because you have to read the User Guide and datasheets in great detail to determine how to use it. But it is easier to start from a working example. As you see, it is very difficult to debug original code.

    Regards,
    RandyP

  • RandyP,

    Thanks a lot. I had sort out the problem.

    Well this is the example of Chassing's book on DSK6713 but it did not work. Maybe he add some user defined in libraries which are not available with CCSv3.1.

    Regards

    Mukhtar 

  • Mukhtar,

    That is good news that you have found the problem.

    Would you mind, please, posting on this thread what you had to correct from this example in Chassaing's book? And please state which example, which page, which revision of the book, so future readers with the same problem will be helped by your excellent experience on this project.

    Regards,
    RandyP

  • RandyP,

    No I didn't mind. Yeah surely I'll surely share my experience. Following is the code which work on DSK6713. It take input from Line-in or Mic-in and send output to Line-out or headphone out.

    -------------------------------------------------------------------------------------------------------

    #include<dsk6713.h>
    #include<dsk6713_aic23.h>
    #include<dsk6713_led.h>
    #include<dsk6713_dip.h>
    #include<stdlib.h>
    #include<math.h>

    /* Configure Codec */

    DSK6713_AIC23_Config config = {
    0x0017, /* 0 - DSK6713_AIC23_LEFTINVOL Left line input channel volume */
    0x0017, /* 1 - DSK6713_AIC23_RIGHTINVOL Right line input channel volume */
    0x01f9, /* 2 - DSK6713_AIC23_LEFTHPVOL Left channel headphone volume */
    0x01f9, /* 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 */
    };

    void main(){
    DSK6713_AIC23_CodecHandle hCodec;
    Uint32 IN,OUT;
    Uint16 OUT_L,OUT_R;

    /* Initialize the board support library. It must be called first */
    DSK6713_init();
    DSK6713_LED_init();
    /* Start the codec */
    hCodec = DSK6713_AIC23_openCodec(0, &config);
    /* Set codec frequency to 48KHz */
    DSK6713_AIC23_setFreq(hCodec, DSK6713_AIC23_FREQ_96KHZ);

    while(1) {

    /* Read sample from the left channel */
    while (!DSK6713_AIC23_read(hCodec, &IN));
    /* Feeding the input directly to output */
    OUT_L = 100*IN;
    OUT_R = 100*IN;
    while (!DSK6713_AIC23_write(hCodec, OUT_L));
    while (!DSK6713_AIC23_write(hCodec, OUT_R));
    if(DSK6713_DIP_get(1)==0)
    break;

    }
    /* Close the codec */
    DSK6713_LED_on(1);
    DSK6713_AIC23_closeCodec(hCodec);
    }

    -----------------------------------------------------------------------------------------

  • Following changes done by me

    When you complete the work and want to end program press DIP switch 1. It will come out of the infinite while loop and close the codec.

    if(DSK6713_DIP_get(1)==0)
    break;

    If this is not done it do problem when used again.

    Also give search path of DSK6713 header files and Pre-defined Symbol CHIP_6713 as shown below.

    Don't forget to add library dsk6713bsl.lib to this project. 

  • Hello all,

    I used this code for read audio from mic,But it is not working,SOund not coming out,

    only some noise coming,speech also not coming....

    plz solve it,

  • Hi Prasad,

    Change these line in code

    /* Feeding the input directly to output */
    OUT_L = 100*IN;
    OUT_R = 100*IN;

    with 

    /* Feeding the input directly to output */
    OUT_L = IN;
    OUT_R = IN;

    let me know if it work? because in my case it works. Please make connections before starting kit. Also make sure project is build the way I explained in my posts. 

    Regards,
    Mukhtar