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.

Dynamic DAC_ATTEN value change of audio codec

Other Parts Discussed in Thread: OMAPL138, TLV320AIC3106, TMS320C6748

Hi all,

I want to change the value of the DAC_ATTEN from the audio codec while executing the program, how could I do it? Because I've tried to use this: output_sample(buffer[inbuf_ptr]); And I change the values of the array (buffer) by multiplying them with a number between 0 and 1. But the output audio makes a lot of noise, and I don't get what I want. Any idea?

Thanks,

Miguel.

  • Hi Miguel,

    Thanks for your post.

    I assume that you are using omapl138 starterware package and in order to control the DAC (Left & right) volume control gain, please refer page0/Register 43 & page0/Register 44, you need to refer the TLV320AIC3106 codec data sheet as below:

    http://www.ti.com/lit/ds/symlink/tlv320aic3106.pdf

    Kindly refer Table 5 to control output stage volume control settings & gain from the above codec datasheet.

    Also, please check for the AIC31DACInit() function to initialize the DAC section of the AIC31 Codec and you could see this function in the aic31.c source file of omapl138 starterware package as specified in the below path:

    ~\ti\OMAPL138_StarterWare_1_10_03_03\examples\lcdkOMAPL138\mcasp\aic31.c

    You can configure the DAC left & right volume control gain codec registers through codec API function "CodecRegWrite".  Please see the instance of configuring codec register through this API are shown below:

    /* select the DAC L1 R1 Paths */   

    CodecRegWrite(baseAddr, AIC31_P0_REG41, 0x02);   

    CodecRegWrite(baseAddr, AIC31_P0_REG42, 0x6C);

    Likewise, you could also configure the appropriate codec registers to control output stage volume control settings & gain.

    In order to use "dac_atten" value while iniitialising OMAPL138 aic2106 codec register through the function L138_init_aic3106_registers(fs, adc_gain, dac_atten,input_type) which are referred in the below E2E posts in typical usecase scenarios. Kindly check the below E2E posts which would help you to configure aic3106 codec registers in controlling adc gain & dac attenuation in omapl138 platform

    http://e2e.ti.com/support/dsp/omap_applications_processors/f/42/p/334575/1167432.aspx#1167432

    http://e2e.ti.com/support/dsp/omap_applications_processors/f/42/t/292506.aspx

    Thanks & regards,
    Sivaraj K

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

    Please click the Verify Answer button on this post if it answers your question.

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



     

     

     

  • Hi,

    I don't understand what you are saying. I'm working with the TMS320C6748 and I don't get why I can't change the value of the array (input signal) and then send it to the output signal. There should be something else I can do instead of doing what you said, shouldn't be?

    Thanks,

    Miguel.

  • Hi Miguel,

    As a Moderator, let me move your post to Audio converter forum to be better answered.

    Your query will be better addresssed by right experts on Audio converter forum.

    Thanks & regards,

    Sivaraj K

     

  • Hi,

    My main idea is to make this:

    #include "L138_LCDK_aic3106_init.h" // codec AIC3106.
    #include <math.h>
    #include <stdio.h>
    #define BUFLENGTH 10

    //int16_t mic;
    int inbuf_ptr;
    //float mic, cancel = 0;
    float micbuffer[BUFLENGTH];
    float atten = 0.5;

    int main (void)
    {
        L138_initialise_poll(FS_19200_HZ,ADC_GAIN_6DB,DAC_ATTEN_0DB,LCDK_MIC_INPUT);
        float mic, cancel = 0;
        while(1)
        {
            for(inbuf_ptr=0; inbuf_ptr<BUFLENGTH; inbuf_ptr++)
            {
            mic = (float)(input_sample());
            micbuffer[inbuf_ptr] = mic;
            cancel=(-1)*atten*micbuffer[inbuf_ptr];
            output_sample((uint32_t)(cancel));
            }

        }
    }

    But when the value of atten is different from 1 I get a lot of noise through the speakers. Why this is happening? How could I do it?

    Thanks,

    Miguel.

  • Anyone could help me please?