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.

TLV320AIC3110: Sound looks like blown speaker while capturing and playing at the same time.

Part Number: TLV320AIC3110

Tool/software:

We are working with a Linux design which has a TLV320AIC3110 as audio codec. The system works perfect while capturing and recording separately. However the sound looks like a blown speaker while capturing and playing at the same time.  The system is based on Linux Kernel 6.6.x with ALSA. We couldn't figure out why it is happening. Could anyone help?  Thanks.

This is the schematic:

This is the amixer contents:

numid=4,iface=MIXER,name='Mic PGA Capture Volume'
; type=INTEGER,access=rw---R--,values=1,min=0,max=119,step=0
: values=110
| dBscale-min=0.00dB,step=0.50dB,mute=0
numid=1,iface=MIXER,name='ADC Fine Capture Volume'
; type=INTEGER,access=rw---R--,values=1,min=0,max=4,step=0
: values=2
| dBscale-min=0.00dB,step=0.10dB,mute=0
numid=2,iface=MIXER,name='ADC Capture Switch'
; type=BOOLEAN,access=rw------,values=1
: values=on
numid=3,iface=MIXER,name='ADC Capture Volume'
; type=INTEGER,access=rw---R--,values=1,min=0,max=64,step=0
: values=56
| dBscale-min=-20.00dB,step=0.50dB,mute=0
numid=15,iface=MIXER,name='DAC Left Input'
; type=ENUMERATED,access=rw------,values=1,items=4
; Item #0 'Off'
; Item #1 'Left Data'
; Item #2 'Right Data'
; Item #3 'Mono'
: values=1
numid=8,iface=MIXER,name='DAC Playback Volume'
; type=INTEGER,access=rw---R--,values=2,min=0,max=175,step=0
: values=119,119
| dBscale-min=-63.50dB,step=0.50dB,mute=0
numid=16,iface=MIXER,name='DAC Right Input'
; type=ENUMERATED,access=rw------,values=1,items=4
; Item #0 'Off'
; Item #1 'Right Data'
; Item #2 'Left Data'
; Item #3 'Mono'
: values=1
numid=11,iface=MIXER,name='HP Analog Playback Volume'
; type=INTEGER,access=rw---R--,values=2,min=0,max=127,step=0
: values=0,0
| dBscale-min=-63.50dB,step=0.50dB,mute=0
numid=9,iface=MIXER,name='HP Driver Playback Switch'
; type=BOOLEAN,access=rw------,values=2
: values=off,off
numid=10,iface=MIXER,name='HP Driver Playback Volume'
; type=INTEGER,access=rw---R--,values=2,min=0,max=9,step=0
: values=0,0
| dBscale-min=0.00dB,step=1.00dB,mute=0
numid=17,iface=MIXER,name='HP Left Switch'
; type=BOOLEAN,access=rw------,values=1
: values=off
numid=12,iface=MIXER,name='HP Output Driver Power-On time'
; type=ENUMERATED,access=rw------,values=1,items=12
; Item #0 '0us'
; Item #1 '15.3us'
; Item #2 '153us'
; Item #3 '1.53ms'
; Item #4 '15.3ms'
; Item #5 '76.2ms'
; Item #6 '153ms'
; Item #7 '304ms'
; Item #8 '610ms'
; Item #9 '1.22s'
; Item #10 '3.04s'
; Item #11 '6.1s'
: values=0
numid=13,iface=MIXER,name='HP Output Driver Ramp-up step'
; type=ENUMERATED,access=rw------,values=1,items=4
; Item #0 '0ms'
; Item #1 '0.98ms'
; Item #2 '1.95ms'
; Item #3 '3.9ms'
: values=3
numid=18,iface=MIXER,name='HP Right Switch'
; type=BOOLEAN,access=rw------,values=1
: values=off
numid=22,iface=MIXER,name='MIC1LM M-Terminal'
; type=ENUMERATED,access=rw------,values=1,items=4
; Item #0 'Off'
; Item #1 'FFR 10 Ohm'
; Item #2 'FFR 20 Ohm'
; Item #3 'FFR 40 Ohm'
: values=0
numid=21,iface=MIXER,name='MIC1LM P-Terminal'
; type=ENUMERATED,access=rw------,values=1,items=4
; Item #0 'Off'
; Item #1 'FFR 10 Ohm'
; Item #2 'FFR 20 Ohm'
; Item #3 'FFR 40 Ohm'
: values=0
numid=19,iface=MIXER,name='MIC1LP P-Terminal'
; type=ENUMERATED,access=rw------,values=1,items=4
; Item #0 'Off'
; Item #1 'FFR 10 Ohm'
; Item #2 'FFR 20 Ohm'
; Item #3 'FFR 40 Ohm'
: values=1
numid=20,iface=MIXER,name='MIC1RP P-Terminal'
; type=ENUMERATED,access=rw------,values=1,items=4
; Item #0 'Off'
; Item #1 'FFR 10 Ohm'
; Item #2 'FFR 20 Ohm'
; Item #3 'FFR 40 Ohm'
: values=1
numid=23,iface=MIXER,name='Output Left From Left DAC'
; type=BOOLEAN,access=rw------,values=1
: values=on
numid=24,iface=MIXER,name='Output Left From MIC1LP'
; type=BOOLEAN,access=rw------,values=1
: values=off
numid=25,iface=MIXER,name='Output Left From MIC1RP'
; type=BOOLEAN,access=rw------,values=1
: values=off
numid=27,iface=MIXER,name='Output Right From MIC1RP'
; type=BOOLEAN,access=rw------,values=1
: values=off
numid=26,iface=MIXER,name='Output Right From Right DAC'
; type=BOOLEAN,access=rw------,values=1
: values=on
numid=7,iface=MIXER,name='Speaker Analog Playback Volume'
; type=INTEGER,access=rw---R--,values=2,min=0,max=127,step=0
: values=127,127
| dBscale-min=-63.50dB,step=0.50dB,mute=0
numid=5,iface=MIXER,name='Speaker Driver Playback Switch'
; type=BOOLEAN,access=rw------,values=2
: values=on,on
numid=6,iface=MIXER,name='Speaker Driver Playback Volume'
; type=INTEGER,access=rw---R--,values=2,min=0,max=3,step=0
: values=1,1
| dBscale-min=6.00dB,step=6.00dB,mute=0
numid=28,iface=MIXER,name='Speaker Left Switch'
; type=BOOLEAN,access=rw------,values=1
: values=on
numid=29,iface=MIXER,name='Speaker Right Switch'
; type=BOOLEAN,access=rw------,values=1
: values=on
numid=14,iface=MIXER,name='Volume Soft Stepping'
; type=ENUMERATED,access=rw------,values=1,items=3
; Item #0 'fast'
; Item #1 'slow'
; Item #2 'disabled'
: values=0

  • Hi,

    Can you explain what you mean by it sounds like a blown speaker? Is it distorted? Too loud or too quiet? Could you provide some scope output for the speaker output and/or input? Are you changing any device settings between playback and recording and simultaneous playback and record? Thank you and let me know this info.

    Best,
    Mir Jeffres

  • Hi Mir Jeffres, I made two recording to demonstrate the issue. It looks like the sound too loud.

    I made both recording 20 cm away from the speaker with my mobile phone. Sorry about high sound levels! Both mic and speaker physically located at the same device looking opposite directions. I am not changing any settings between playback and capture. Thanks for your help.

     

  • I identified the problem, but I haven't been able to fix it yet. The issue occurs due to different sampling rates. I am playing at 48kHz and recording at 16kHz. This results in down sampling the playback data to 16kHz, making the sound resemble that of a blown speaker. According to the Linux documentation, there is a symmetric sample rate option. I disabled it in the driver, but it didn't resolve the issue.

  • I see, yes it does sound like a sample rate reduction in the output. You may be able to have different audio sample rates for the ADC and DAC, if you look at the device PLL clock tree in the datasheet (page 66) you can see there is a "DAC_CLK" and "ADC_CLK". Maybe you could adjust the NADC to be 3x that of NDAC, to be able to divide the clocks down to 16kHz on the ADC path and 48kHz on the DAC path. You could set the PLL parameters with I2C. You can access a PLL calculator tool here to find the other values you will need to set: https://e2e.ti.com/support/audio-group/audio/f/audio-forum/946529/faq-i-need-help-configuring-the-pll-on-my-audio-codec-adc-is-there-an-easy-way-to-do-so

    If you do not want to deal with setting the PLL manually, may I ask why you have the input sample rate so much lower? It might be easier to do recording and playback both at 48kHz and deal with downsampling the input audio in the processing stage of your project.

    Let me know if you need more help with this.

    Best,
    Mir

  • Thank you for your reply. Yes, I noticed the different clocks while reading the datasheet, and I’m aware that using the same sample rates can avoid the issue. However, I want to do things correctly. I've been looking into the Linux driver for a while but haven't been able to resolve it yet. If you have any knowledge about Linux driver, please point me in the right direction to fix this.

    I appreciate your support.

    Thanks,

    Levent

  • Hi Levent,

    I am working on trying to replicate your use case but it is taking me a while to set up. You will need to edit the TLV320AIC3110 node in the device tree, like in the Linux kernel's documentation/devicetree/bindings/sound/tlv320aix31xx.txt example. I will update here if I have any updates about this. Unfortunately we do not currently have any Linux audio experts on the team. But, you can see some example PLL divider values in the aic31xx_rate_divs structure in the tlv320aic31xx.c driver file, and you can use the PLL calculator to get the correct values to set the audio rate to 48kHz and then set the NADC to be 3x the expected value, to get an ADC clock of 16kHz and DAC clock of 48kHz.

    Best,
    Mir

  • Actually I spent a few days on it but I can't fix the issue. Currently, I manual set the clock driver, like you mentioned. It is working but just for the specific rate. Thanks for your support. 

  • Hi,

    Do you still need help with this? What is left to figure out?

    Best,
    Mir

  • Hi again, for now, we’ve forced the system to work with specific rates: 48kHz for output and 16kHz for input. We need to address this issue over time. Currently, all audio input and output are unnecessarily downsampled or upsampled if they don’t match these rates. It’s not as big of a problem as it was initially, but if you could offer any help or guidance on this matter, it would be greatly appreciated. Thanks for your assistance.

  • Hi,

    Is the issue that you cannot output at 48k and input at 16k simultaneously? Or, are you trying to also play back at different rates, like 44.1kHz, and still record at 16kHz? 

    If you are trying to play and record at different sample rates simultaneously, you should be able to change your PLL settings to accommodate this. Using the CodecControl software, I was able to generate some example PLL values, you need the input clock and its frequency, as shown here:

    Here is the I2C code that the first clock configuration in this list generated, as an example for you. If you have a different input clock frequency these values will not work. You can calculate it and record the I2C yourself with CodecControl software downloadable here: https://www.ti.com/tool/download/SLAC366

    w 30 4 03 91 07 06 90
    w 30 12 83
    w 30 13 8e
    w 30 14 00 80
    w 30 16 20
    w 30 17 04
    w 30 b 87
    w 30 c 82
    w 30 d 00 80
    w 30 f 20
    w 30 10 04

    Let me know if you need more help, and if you are still having problems can you post your device tree or the parameters you are setting in the configuration of the device?

    Best,
    Mir

  • Hi Mir,

    The issue we encountered was that we couldn’t output a different sample rate than the input simultaneously, and it’s related to the Linux "tlv320aic31xx" driver. I didn’t try updating the codec via I2C because, AFAIK, ALSA manages the audio control and the I2C workload. I appreciate your help, it has been helpful in keeping things moving forward. I might need to reach out to the developer at TI who wrote the codec driver for further assistance. 

    Thanks,

    Levent

  • Hi,

    If you want to implement this with just the driver, you should set the PLL dividers to be this line:

    {12000000, 48000, 7, 1680, 128, 7, 2, 128, 14, 3}

    I took these values from the CodecControl EVM software with the specs that you wanted. This is for an MCLK of 12MHz. 

    If you replace the 48k section of the aic31xx_divs table in the tlv320aic31xx.c driver file with that line, it may solve your problem. You would set the device to 48kHz rate and then the PLL would be set to give the ADC a clock of 16kHz and DAC a clock of 48kHz. 

    Let me know if you need more help with this.

    Best,
    Mir