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.

TLV320AIC3106: How to set the TLV320aic3106 to cut down the input through the software setting ?

Part Number: TLV320AIC3106
How to set the TLV320aic3106 to not connected , I use the TLV320AIC3106 as several input switch mode, that inclode 1/ line2r single ended ,2/line2L differential  3/mic3L three mic input ,when i set the register as not connected ,it is could get audio date from audio recorder .such as , i set page0/register17 11111111,it also could get audio date from audio recorder software , if i could cut down the connect through the how could set not connected through software setting? if can not ,how could i cut down the recorder ?

  • Hi Andrew,

    I'm not sure I understand your question.
    If you set page 0 register 17 to 11111111, Mic3L and Mic 3R will be disconnected.
    the inputs can be mixed using R17-R24

    all of the Analog signals get mixed, go through the PGA, and then can be sent directly to the analog outs, but once they go through the ADC the only place they can go is the DOUT.
    so if you want to mix a digital signal from another source, you would have to do that in an external DSP, or something similar. The AIC3106 doesn't support mixing two digital signals

    I hope I understood you correctly, and was able to answer your question, but if not please let me know.
    best regards,
    -Steve Wilson
  • Hi Steve,

    What Andrew mean is we had tried to set page 0 register 17 to 11111111 for Mic3L and Mic 3R, but we found that the input was still work.
    and when we had been disconnected other route just like Line2L , Line2R and so on. The MIc3L and Mic 3R are disconnected successfully. So
    we want to know, if we need to set other registers when disconnecting Mic3L and Mic3R other than set only register 17 to 11111111.
    This problem had been found when we tried to disconnect other input routes.
    so please help analysis this problem.

    best regards
    Fans
  • Hello Fans,

    are you certain that you are writing to the correct registers? MIC3L/R is controled with Registers 17 and 18 (left and Right ADC) so you will have to write 0xFF to both if you want to totally disconnect.

    I Just tested on an EVM at my desk and when I set Register 17 and 18 to 0xFF, Mic 3 is off.

    best regards,
    -Steve Wilson
  • Hi Steve,

    If there are some problem on hardware device, today we find some of boards are ok, but some others are not.

    We tried to read the registers from these  boards, the reg value are correct, but the actual results are not.

    Best Regards

    Fans

  • Hello Fans,

    I've sent you a connection request, perhaps we can get more details on your application... schematics/layout that sort of thing and see if we can get to the bottom of this. Obviously this is not standard behavior.

    best regards,
    -Steve
  • Fans,

    I wanted to check back in with you regarding your problem, as I have not heard from you. Are you still experiencing the same problem? The way that you have described the problem tells me that there is a problem somewhere, as this is not standard behavior for this device, the more information I can get from you the more likely it is that I can help you solve it. let me know if I can be of assistance.
    best regards,
    -Steve Wilson
  • if you can send me your register configurations I can perhaps find what the problem is.

    best regards,
    -steve
  • Hi Steve,
    the following code is used to set input mode, I disconnect all of the inputs firstly, and then set the required input mode via the parameter "int type" of function setAudioInput.

    Best Regards
    Fans


    151 void resetInput() 152 { 153 int ret = -1; 154 155 i2c_write(17, 0xff); //front mic2 156 i2c_write(18, 0xff); //front mic1 157 i2c_write(19, 0xff); //front mic4 158 i2c_write(20, 0xfc); //micphone 159 i2c_write(22, 0xff); //front mic3 160 i2c_write(23, 0xfc); //line in 161 162 //usb mic 163 ret = init_mixer("2"); 164 if(!ret) 165 { 166 setUsbAISwitch(0); 167 close_mixer(); 168 }
    169 } 170 171 void setAudioInput(int type) 172 { 173 char value[4] = {'\0'}; 174 int ret = -1; 175 176 if(type > 3 || type < 0) 177 { 178 ALOGE("set input type invalid\n"); 179 return; 180 } 181 182 ALOGI("reset all input first\n"); 183 resetInput(); 184 185 ALOGI("start to set input type\n"); 186 switch (type) { 187 188 case USB_MIC: 189 ret = init_mixer("2"); 190 if(!ret) 191 { 192 setUsbAISwitch(1); 193 close_mixer(); 194 } 195 break; 196 case FRONT_MIC: 197 i2c_write(17, 0x0f); //MIC3L MIC2 198 i2c_write(18, 0x0f); //MIC3R MIC1 199 i2c_write(19, 0x07); //LINE1LP MIC4 200 i2c_write(22, 0x07); //LINE1RP MIC3 201 break; 202 case LINE_IN: 203 i2c_write(23, 0x4); //line2r to right adc single_end mode; biased; 204 break; 205 case MICPHONE: 206 i2c_write(20, 0x84); //line2lp & line2lm differential mode; biased; 207 break; 208 default: 209 ALOGE("unknown input type\n"); 210 } 211 212 sprintf(value, "%d", type); 213 property_set("persist.sw.input.type", value); 214 215 }



  • Fans,

    There is an Error in your code

    Line 198 should read  i2c_write(18, 0xf0)

    register 17 has controls for both MIC3L and Mic3R.   so if you write 0x0F to register 17,  Mic3L will be connected to the LEFT PGA mix with input gain =0dB and Mic3R will be disconnected from the LEFT PGA mix

    register 18 has controls for both MIC3L and MIC3R.  so if you write 0x0F to register 18  Mic3L will be connected to the Right PGA mix with input gain =0dB and Mic3R will be disconnected from the Right PGA mix

    if you want to turn on and off MIC3R to the Right PGA mix,  you need to write 0xF0 to register 18. 

    does that makes sense?

    best regards, 

    -STeve

  • Hi Steve,

    Ok, I'll modify this error in my code,

    But there is another problem about these audio inputs control. If I tried to turn on another audio input(e.g. LINE_IN input) via coding, then MIC3R and MIC3L would be disconnected via setting i2c registers 17 and 18 to 0xff, but I found MICR and MICL were still work. I'm sure that I had unplugged other physical devices(e.g. LINE_IN input devices) except this mic which had been connected to MIC3R and MIC3L. I tried to read registers 17 and 18 , the values had been set to 0xff, but  I can record audio from it., I don't konw why this mics are still work,

    Best Regards

    Fans

  • Fans,

    The TLC320AIC3106 does not behave this way for me. can you show me all of your I2C register writes to the AIC3106? A schematic would be helpful too.

    -Steve
  • Hi Steve,

    we just get some new devices from factory,we can close the front mic, probably there is some problem on previous device,  but I find a similar problem on these new devices. If I close all input via calling function resetInputs() mentioned in previous reply, the front mic are really closed, but when I open the register 20 (LINE2l to  Left ADC Control) via set i2c with value 0x84, the front mic can capture audio again with small volume. The front mic are connected to MIC3R/L, they should not be affected by register 20, but I don't know why?

    Best Regards

    Fans

  • Hi Steve,

    the uploaded file is init code for tlv320aic3106, the setting input code had been written in previous reply.

    Best Regards

    Fans

    tlv320aic3106.c
    void tlv320_DrvInit(void)
    {
        HI_INFO_AIC3X("tlv320_Init\n ");
    
        tlv320aic31_write(I2C_AIC31, 0x1, 0x80);
        time_delay_us(50);
    
        /* Mclk = 12.288M,not PLL mode*/
        tlv320aic31_write(I2C_AIC31, 102, 0x32); //if pll,p=r=1,k=8
        tlv320aic31_write(I2C_AIC31, 101, 0x01);
        tlv320aic31_write(I2C_AIC31, 3, 0x10);
    
        tlv320aic31_write(I2C_AIC31, 2, 0x00);
    
        //tlv320aic31_write(I2C_AIC31, 10, 0x08);
    
        tlv320aic31_write(I2C_AIC31, 8, 0x30);
    
        tlv320aic31_write(I2C_AIC31, 9, 0x27 );  //16bits
    
        tlv320aic31_write(I2C_AIC31, 12, 0x50);  //0 means disabled
    
        tlv320aic31_write(I2C_AIC31, 25, 0x06 ); // enable mic bias
    
        tlv320aic31_write(I2C_AIC31, 15, 0); //Left ADC Control
        tlv320aic31_write(I2C_AIC31, 16, 0); //Right ADC Control
    
        tlv320aic31_write(I2C_AIC31, 17, 0x0f); //left adc single_end mode, 0dB volume; ena power for mic2
        tlv320aic31_write(I2C_AIC31, 18, 0x0f); //left adc single_end mode, 0dB volume; ena power for mic1
        tlv320aic31_write(I2C_AIC31, 19, 0x07); //left adc single_end mode, 0dB volume; ena power for mic4
        tlv320aic31_write(I2C_AIC31, 20, 0x84); //line2lp & line2lm differential mode; biased 
        tlv320aic31_write(I2C_AIC31, 22, 0x07); //right adc single_end mode, 0dB volume; ena power for mic3
        tlv320aic31_write(I2C_AIC31, 23, 0x04); //line2r to right adc single_end mode, 0dB volume; biased 
    
        tlv320aic31_write(I2C_AIC31, 28, 0);
        tlv320aic31_write(I2C_AIC31, 31, 0);
        tlv320aic31_write(I2C_AIC31, 26, 0x80);
        tlv320aic31_write(I2C_AIC31, 29, 0x80);
    
        tlv320aic31_write(I2C_AIC31, 7, 0xa); //set Fsref;dual rate mode or not;D1~D4 set I2S into dac,both dac open
        tlv320aic31_write(I2C_AIC31, 14, 0x80); //high-power outputs for ac-coupled
        tlv320aic31_write(I2C_AIC31, 37, 0xc0);   //left and right dac power
        tlv320aic31_write(I2C_AIC31, 40, 0x80); //Output common-mode voltage 1.65v, disable soft_step volume
    
        tlv320aic31_write(I2C_AIC31, 41, 0x00); //select DAC_L(R)1 to hi-power;left and right volume dependent controls
    
        tlv320aic31_write(I2C_AIC31, 42, 0x68); //Output Driver Pop Reduction(medium)
    
        tlv320aic31_write(I2C_AIC31, 43, 0x08); //left DAC channel not muted;DAC Digital Volume Control(attenuation,adjust value level)
        tlv320aic31_write(I2C_AIC31, 44, 0x08); //right DAC channel not muted;DAC Digital Volume Control(attenuation,adjust value level)
    
        tlv320aic31_write(I2C_AIC31, 47, 0x80); //DAC_L1 is routed to HPLOUT;Output Stage Volume Control(no attenuation)
        tlv320aic31_write(I2C_AIC31, 64, 0x80); //DAC_L1 is routed to HPROUT;Output Stage Volume Control(no attenuation)
    
        tlv320aic31_write(I2C_AIC31, 51, 0x9f); //left output level control(enlarge,max);output mute,power;
        tlv320aic31_write(I2C_AIC31, 65, 0x9f); //right output level control(enlarge,max);output mute,power;
        /* enable LEFT_LOP/M and RIGHT_LOP/M */
        tlv320aic31_write(I2C_AIC31, 81, 0x00); //0: PGA_L is not routed to LEFT_LOP/M;
        tlv320aic31_write(I2C_AIC31, 82, 0x80); //0: DAC_L1 is routed to LEFT_LOP/M
        tlv320aic31_write(I2C_AIC31, 86, 0x0b); //left LEFT_LOP level 0dB, un-mute, power up;
    
        tlv320aic31_write(I2C_AIC31, 91, 0x00); //0: PGA_R is not routed to RIGHT_LOP/M;
        tlv320aic31_write(I2C_AIC31, 92, 0x80); //0: DAC_R1 is routed to RIGHT_LOP/M
        tlv320aic31_write(I2C_AIC31, 93, 0x0b); //left LEFT_LOP level 0dB, un-mute, power up;
    
    }
    
    
    

  • Hi Steve,

    I found a way to avoid this problem, when I read the register 27 (left AGC control), I found the gain had been set maximum value, so I tried to set the gain to 0x50, then the front mic audio input can be muted almost, if I plug other input device, the recorded volume is ok. So do you think if this resolution can be accepted, thanks.

    Best Regards
    Fans
  • Fans, 

    The AGC has a wide range functional use.  I recommend reviewing the Datasheet section that covers the AGC, to make sure you understand what it is doing. This is really up to you.  if you really would like to keep the AGC gain at Maximum,  then when you want to turn the microphones off, you should also turn off the AGC.  

    there is also a noise gate that you can use.  My guess is that the AGC is simply boosting the gain,  and a small amount of mic signal is coupling in,  and getting amplified 60dB.   if the noise gate threshold is set to a higher value, this could also solve your issue. 

    -Steve Wilson

  • Dear Steve 

    Thank you for your help ! as felow accessory is the tlv320aic3106 schematics , plesase help to check if there any wrong ,whicth may cause the issue , many thanks !TLV320AIC3106IRGZR.pdf

  • Andrew,

    I apologise for the delayed response.

    R194, 195, R197 and R198 should not be there or should be 0R. (The unused inputs should be AC coupled to gnd)

    you are using quite a few microphones and they all pull current from the micbias pin. You must be sure that the combined current draw doesn't exceed 4ma.


    best regards,
    -Steve Wilson