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.

Sampling Rate Setting..

Expert 2370 points


Hi,

How can I set the sampling rate to 8Khz in dsk_app.c project shipped with C6713 kit ?

I tried to set it following ways but I am getting error.

 

    hCodec = DSK6713_AIC23_openCodec(0, &config);

    /* Change the sampling rate to 16 KHz */
    DSK6713_AIC23_setFreq(hCodec, DSK6713_AIC23_FREQ_8KHZ);

 

Please reply.

  • I think I need to change the value of this register, if I am correct what value should be set to get sampling rate of 8KHz ?

    0x0001, // 8 DSK6713_AIC23_SAMPLERATE Sample rate control

  • Or is it ok to add <dsk6713_aic23.h> and define Fs as Uint32 fs=DSK6713_AIC23_FREQ_8KHZ ?

    But dsk_app.c didn't include dsk6713_aic23.h file.

    How can I set the sampling rate using McBSP0 as it is used to control/configure the AIC23.

    Please help.

  • Please reply guys...

  • BAS said:
    I tried to set it following ways but I am getting error.

    The error message you received can be useful in determining the cause of the error. Compiler error messages will indicate a line number and text describing the problem that the compiler found on that line. This can lead you to understand if there is a typing error, syntax error, or other type of error.

    BAS said:
    I think I need to change the value of this register, if I am correct what value should be set to get sampling rate of 8KHz ?

    0x0001, // 8 DSK6713_AIC23_SAMPLERATE Sample rate control

    This seems like a good choice. But I need to ask if you have looked through the documentation that comes with the DSK6713 to understand how the serial ports are connected from the C6713 to the AIC23 and how the Board Support Library (BSL) is used. Have you accessed all of the documentation at Spectrum Digital's website for support of the DSK6713? Their support page is robust enough to even include a link to the datasheet for the AIC23, in case that is needed.

    While reading through, for example, the Technical Reference document for information on the AIC23, you may find register diagrams that show a table of registers inside the AIC23. If these correspond to information in the software you are modifying, then you will have an indication where that register is located and therefore which document to look in.

    BAS said:
    is it ok to add <dsk6713_aic23.h> and define Fs as Uint32 fs=DSK6713_AIC23_FREQ_8KHZ ?

    Yes, it is okay to add this. But what do you think that declaring and initializing a global C variable will have on your project? How would it behave differently if the variable were named FS or Fs or X?

    BAS said:
    But dsk_app.c didn't include dsk6713_aic23.h file.

    I find that hard to believe. You started this thread saying that you got an error. Could it be related to this? Which dsk header files *are* included?

    In CCS, you can find where a symbol is defined by hovering over the symbol and clicking on the box in the pop-up window that shows up. Use this method or your own search skills to find out where the symbol DSK6713_AIC23_open is defined. Then look for the symbol DSK6713_AIC23_FREQ_8KHZ.

  • These files are included in dsp_app.c project.

    #include <std.h>
    #include <swi.h>
    #include <log.h>
    #include <c6x.h>
    #include <csl.h>
    #include <csl_edma.h>
    #include <csl_irq.h>
    #include <csl_mcbsp.h>

    #include "dsk6713.h"
    #include "dsk6713_led.h"
    #include "dsk6713_dip.h"
    #include "aic23.h"

    Yes, I did look through the documentation of AIC23 codec.

    This structure is defined in dsp_app.c files as follows.

    AIC23_Params 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
        0x1101, // 8 DSK6713_AIC23_SAMPLERATE Sample rate control
        0x0001  // 9 DSK6713_AIC23_DIGACT     Digital interface activation
    };

    I realized from the document which can be found here (http://focus.ti.com/lit/ds/symlink/tlv320aic23.pdf) that sampling rate can be conrtrolled using register SR0 to SR3. For 8.021 KHz, I set those register to 1101 which can be seen from above mentioned AIC23 Params configuration.

    But there is another AIC23 default parameters which has been set inside AIC23.h file in the following way.

    #define AIC23_DEFAULTPARAMS {                                           \
        AIC23_REG0_DEFAULT,                                                 \
        AIC23_REG1_DEFAULT,                                                 \
        AIC23_REG2_DEFAULT,                                                 \
        AIC23_REG3_DEFAULT,                                                 \
        AIC23_REG4_DEFAULT,                                                 \
        AIC23_REG5_DEFAULT,                                                 \
        AIC23_REG6_DEFAULT,                                                 \
        AIC23_REG7_DEFAULT,                                                 \
        AIC23_REG8_8KHZ,                                                 \
        AIC23_REG9_DEFAULT                                                  \
    }

    It can be seen that I set register # 8 to 8 Khz in here as well to make it 8 KHz and when I put cursor over that statement, its hows me 8 KHz but I am not sure still it is working fine or not because I hear no disturbance while sampling audio at 8 Khz.

    Waiting for your response.

  • It is possible that you have made major changes to the original dsp_app.c and other project files. If you download the Target Content zip file from Spectrum Digital for the DSK6713, the dsk_app.c file has a different set of include files. In particular, it includes the dsk6713_aic23.h file.

    Your should go back to the original, get that working as-is, and then resume your modifications.

    How did you come up with the value of 0x1101 for the register 8 in the config struct above? If you look at the AIC23 datasheet, register 8 only has 9 bits.

    BAS said:
    I am not sure still it is working fine or not because I hear no disturbance while sampling audio at 8 Khz

    This sounds like it is working since there is no disturbance. Am I confused about what you mean, or is there still a problem you are trying to solve? If there is still a problem, I do recommend going back to the original or downloading it from spectrumdigital.com and start from a working version.

  • Ok Randy, I will see.

    Please have a look over this post.

    http://e2e.ti.com/support/dsp/tms320c6000_high_performance_dsps/f/115/p/56164/199356.aspx#199356

    Thanks.