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.

TLV320AIC3262: Audio frequency clipping in TLV320AIC3262

Part Number: TLV320AIC3262
Other Parts Discussed in Thread: AM5728

Hello,

We are using audio codec TLV320AIC3262 to interface to audio devices on a Video IP Phone product based on AM5728. In our board, we support handsfree mode and handset mode. In handsfree mode when we record audio using "arecord", the audio signal is seen till frequency of 20Khz.

In handset mode, when we record audio using "arecord", the audio signal  is limited to frequency of 4Khz.

The Voip phone has two microphones for handset and handsfree mode. Both the microphone devices are same.

Query

1) Why is the frequency of the signal limited to 4Khz in handset mode?

2) We are using wideband codecs and want audio signals to be in wideband  frequency range.

3) What register values in audeocodec device can we check for the frequency limiting issue?

Below are the frequency spectrum for the audio recorded with Handset and handsfree microphone.

A) Handsfree audio recording frequency spectrum

B) Handset audio recording frequency spectrum

Below are the audio scripts used to set register values for handsfree and handset modes.

a) Handsfree script

#!/bin/bash
#sw reset
#/usr/sbin/i2cset -f -y 3 0x18 0x00 0x00
#/usr/sbin/i2cset -f -y 3 0x18 0x7f 0x00
#/usr/sbin/i2cset -f -y 3 0x18 0x01 0x01

#power config
#/usr/sbin/i2cset -f -y 3 0x18 0x00 0x01
#/usr/sbin/i2cset -f -y 3 0x18 0x01 0x00
#/usr/sbin/i2cset -f -y 3 0x18 0x7a 0x01

#clock initialize
#/usr/sbin/i2cset -f -y 3 0x18 0x00 0x00
#/usr/sbin/i2cset -f -y 3 0x18 0x04 0x00
#/usr/sbin/i2cset -f -y 3 0x18 0x0b 0x88
#/usr/sbin/i2cset -f -y 3 0x18 0x0c 0x82
#/usr/sbin/i2cset -f -y 3 0x18 0x0d 0x00
#/usr/sbin/i2cset -f -y 3 0x18 0x0e 0x80

#ASI config
#/usr/sbin/i2cset -f -y 3 0x18 0x00 0x04
#/usr/sbin/i2cset -f -y 3 0x18 0x01 0x20
#/usr/sbin/i2cset -f -y 3 0x18 0x0a 0x00

#signal processing
#/usr/sbin/i2cset -f -y 3 0x18 0x00 0x00
#/usr/sbin/i2cset -f -y 3 0x18 0x3c 0x01
#/usr/sbin/i2cset -f -y 3 0x18 0x3d 0x01

#op channel
/usr/sbin/i2cset -f -y 3 0x18 0x00 0x00
/usr/sbin/i2cset -f -y 3 0x18 0x3f 0xc0
#/usr/sbin/i2cset -f -y 3 0x18 0x40 0x00 
/usr/sbin/i2cset -f -y 3 0x18 0x40 0x02  # CHANGE : Primary DAC Master Volume Configuration : Right channel controlled by left channel 
/usr/sbin/i2cset -f -y 3 0x18 0x00 0x01
/usr/sbin/i2cset -f -y 3 0x18 0x03 0x00
/usr/sbin/i2cset -f -y 3 0x18 0x04 0x00

#HANDSET-OFF
/usr/sbin/i2cset -f -y 3 0x18 0x08 0x00
/usr/sbin/i2cset -f -y 3 0x18 0x24 0x7f
/usr/sbin/i2cset -f -y 3 0x18 0x25 0x7f
/usr/sbin/i2cset -f -y 3 0x18 0x26 0x7f
/usr/sbin/i2cset -f -y 3 0x18 0x28 0x39 #Power-Down RECM & RECP
/usr/sbin/i2cset -f -y 3 0x18 0x29 0xb9 #RECM & RECP Volume Control
/usr/sbin/i2cset -f -y 3 0x18 0x2a 0x08 

#HEADSET-OFF                            
/usr/sbin/i2cset -f -y 3 0x18 0x1f 0xb9 
/usr/sbin/i2cset -f -y 3 0x18 0x20 0xb9 
/usr/sbin/i2cset -f -y 3 0x18 0x1b 0x33 

#SPEAKER-ON
/usr/sbin/i2cset -f -y 3 0x18 0x16 0xc3
#/usr/sbin/i2cset -f -y 3 0x18 0x2e 0x00 #Route LOL to SPK-Left @ 0dB
/usr/sbin/i2cset -f -y 3 0x18 0x2e 0x12 #CHANGE : Route LOL to SPK-Left @ -9dB
#/usr/sbin/i2cset -f -y 3 0x18 0x2f 0x00 # Route LOR to SPK-Right @ 0dB
/usr/sbin/i2cset -f -y 3 0x18 0x2f 0x80 #CHANGE : Control by LOL gain
#/usr/sbin/i2cset -f -y 3 0x18 0x30 0x10 #Set Speaker Gain @6DB
/usr/sbin/i2cset -f -y 3 0x18 0x30 0x30 #CHANGE : Set Speaker Gain @18DB
#/usr/sbin/i2cset -f -y 3 0x18 0x2d 0x03 # Power-UP Stereo Speaker
/usr/sbin/i2cset -f -y 3 0x18 0x2d 0x06 # CHANGE : Power-UP mono Speaker

#adc config                  
/usr/sbin/i2cset -f -y 3 0x18 0x00 0x01
/usr/sbin/i2cset -f -y 3 0x18 0x08 0x00
#/usr/sbin/i2cset -f -y 3 0x18 0x33 0x04 #MIC BIAS CHANGE
/usr/sbin/i2cset -f -y 3 0x18 0x33 0x05  # CHANGE : MIC BIAS TO 2.4V
#/usr/sbin/i2cset -f -y 3 0x18 0x34 0x08  # IN3L TO LPGA-P 20K
#/usr/sbin/i2cset -f -y 3 0x18 0x36 0x80  # CM1 TO LPGA-M 20K
#/usr/sbin/i2cset -f -y 3 0x18 0x37 0x08  # IN3R TO RPGA-P 20K
#/usr/sbin/i2cset -f -y 3 0x18 0x39 0x80  # CM1 TO RPGA-M 20K
/usr/sbin/i2cset -f -y 3 0x18 0x34 0x04  # CHANGE: IN3L TO LPGA-P 10K
/usr/sbin/i2cset -f -y 3 0x18 0x36 0x04  # CHANGE: IN3R TO LPGA-M 10K
/usr/sbin/i2cset -f -y 3 0x18 0x37 0x04  # CHANGE: IN3R TO RPGA-P 10K
/usr/sbin/i2cset -f -y 3 0x18 0x39 0x04  # CHANGE: IN3L TO RPGA-M 10K
                             
#/usr/sbin/i2cset -f -y 3 0x18 0x3b 0x3c
#/usr/sbin/i2cset -f -y 3 0x18 0x3c 0x3c
/usr/sbin/i2cset -f -y 3 0x18 0x3b 0x48 # CHANGE : MIC GAIN SET TO 36 db
/usr/sbin/i2cset -f -y 3 0x18 0x3c 0x48 # CHANGE : MIC GAIN SET TO 36 db
/usr/sbin/i2cset -f -y 3 0x18 0x3d 0x00
/usr/sbin/i2cset -f -y 3 0x18 0x00 0x00
/usr/sbin/i2cset -f -y 3 0x18 0x51 0xc0
/usr/sbin/i2cset -f -y 3 0x18 0x52 0x00

#enable headphone detection
/usr/sbin/i2cset -f -a -y 3 0x18 0x00 0x00
/usr/sbin/i2cset -f -a -y 3 0x18 0x43 0x80
/usr/sbin/i2cset -f -a -y 3 0x18 0x30 0x80
/usr/sbin/i2cset -f -a -y 3 0x18 0x33 0xc0
/usr/sbin/i2cset -f -a -y 3 0x18 0x00 0x04
/usr/sbin/i2cset -f -a -y 3 0x18 0x56 0x16
/usr/sbin/i2cset -f -a -y 3 0x18 0x00 0x00

#CHANGe : Enable AGC                                                                                                                                                                                                 
/usr/sbin/i2cset -f -a -y 3 0x18 0x00 0x00                                                                                                                                                                  
/usr/sbin/i2cset -f -a -y 3 0x18 0x56 0x82  #Left AGC control registr Gain -5.5db and hysteresis 1db                                                                                                                                                                   
/usr/sbin/i2cset -f -a -y 3 0x18 0x5e 0x82  #Right AGC control registr Gain -5.5db and hysteresis 1db                                                                                                                                
/usr/sbin/i2cset -f -a -y 3 0x18 0x57 0xb2  #Left noise control hysteresis 4db threshold is -78db :: 2023-08-02
/usr/sbin/i2cset -f -a -y 3 0x18 0x5f 0xb2  # Right noise control hysteresis 4db threshold is -78db
#/usr/sbin/i2cset -f -a -y 3 0x18 0x57 0xAE  #Left noise control hysteresis 4db threshold is -74db
#/usr/sbin/i2cset -f -a -y 3 0x18 0x5f 0xAE  # Right noise control hysteresis 4db threshold is -74db
/usr/sbin/i2cset -f -a -y 3 0x18 0x58 0x5a #Left AGC gain max 45db :: 2023-08-02
/usr/sbin/i2cset -f -a -y 3 0x18 0x60 0x5a  #Right AGC gain max 45db
#/usr/sbin/i2cset -f -a -y 3 0x18 0x58 0x54  #Left AGC gain max 42db
#/usr/sbin/i2cset -f -a -y 3 0x18 0x60 0x54  #Right AGC gain max 42db
/usr/sbin/i2cset -f -a -y 3 0x18 0x59 0x00 #attack time
/usr/sbin/i2cset -f -a -y 3 0x18 0x61 0x00 #attack time
/usr/sbin/i2cset -f -a -y 3 0x18 0x5a 0x32 #decay time
/usr/sbin/i2cset -f -a -y 3 0x18 0x62 0x32 #decay time

b) Handset script

#!/bin/bash

#sw reset
#/usr/sbin/i2cset -f -y 3 0x18 0x00 0x00
#/usr/sbin/i2cset -f -y 3 0x18 0x7f 0x00
#/usr/sbin/i2cset -f -y 3 0x18 0x01 0x01

#power config
#/usr/sbin/i2cset -f -y 3 0x18 0x00 0x01
#/usr/sbin/i2cset -f -y 3 0x18 0x01 0x00
#/usr/sbin/i2cset -f -y 3 0x18 0x7a 0x01

#clock initialize
#/usr/sbin/i2cset -f -y 3 0x18 0x00 0x00
#/usr/sbin/i2cset -f -y 3 0x18 0x04 0x00
#/usr/sbin/i2cset -f -y 3 0x18 0x0b 0x88
#/usr/sbin/i2cset -f -y 3 0x18 0x0c 0x82
#/usr/sbin/i2cset -f -y 3 0x18 0x0d 0x00
#/usr/sbin/i2cset -f -y 3 0x18 0x0e 0x80

#ASI config
#/usr/sbin/i2cset -f -y 3 0x18 0x00 0x04
#/usr/sbin/i2cset -f -y 3 0x18 0x01 0x20
#/usr/sbin/i2cset -f -y 3 0x18 0x0a 0x00

#signal processing
#/usr/sbin/i2cset -f -y 3 0x18 0x00 0x00
#/usr/sbin/i2cset -f -y 3 0x18 0x3c 0x01
#/usr/sbin/i2cset -f -y 3 0x18 0x3d 0x01

#op channel
/usr/sbin/i2cset -f -y 3 0x18 0x00 0x00
/usr/sbin/i2cset -f -y 3 0x18 0x3f 0xc0
/usr/sbin/i2cset -f -y 3 0x18 0x40 0x00
/usr/sbin/i2cset -f -y 3 0x18 0x00 0x01
/usr/sbin/i2cset -f -y 3 0x18 0x03 0x00
/usr/sbin/i2cset -f -y 3 0x18 0x04 0x00

#SPEAKER-OFF
/usr/sbin/i2cset -f -y 3 0x18 0x2e 0x7f #Not-Route LOL to SPK-Left @ 0dB  
/usr/sbin/i2cset -f -y 3 0x18 0x2f 0x7f #Not-Route LOR to SPK-Right @ 0dB 
/usr/sbin/i2cset -f -y 3 0x18 0x30 0x00 #Mute Left & Right Speaker
/usr/sbin/i2cset -f -y 3 0x18 0x2d 0x00 #Power-Down Stereo Speaker

#HEADSET-OFF
/usr/sbin/i2cset -f -y 3 0x18 0x1f 0xb9
/usr/sbin/i2cset -f -y 3 0x18 0x20 0xb9
/usr/sbin/i2cset -f -y 3 0x18 0x1b 0x33

#HANDSET-ON
/usr/sbin/i2cset -f -y 3 0x18 0x00 0x01
/usr/sbin/i2cset -f -y 3 0x18 0x08 0x03 
/usr/sbin/i2cset -f -y 3 0x18 0x16 0xa2
/usr/sbin/i2cset -f -y 3 0x18 0x24 0x00 
/usr/sbin/i2cset -f -y 3 0x18 0x25 0x80
/usr/sbin/i2cset -f -y 3 0x18 0x26 0x00
/usr/sbin/i2cset -f -y 3 0x18 0x28 0xc6 #Power-UP RECM & RECP @ 6dB
/usr/sbin/i2cset -f -y 3 0x18 0x29 0x86 #RECM & RECP Volume Control
/usr/sbin/i2cset -f -y 3 0x18 0x2a 0x04 

#adc config                  
/usr/sbin/i2cset -f -y 3 0x18 0x00 0x01
/usr/sbin/i2cset -f -y 3 0x18 0x08 0x00
#/usr/sbin/i2cset -f -y 3 0x18 0x33 0x04 #MIC Bias Power UP
/usr/sbin/i2cset -f -y 3 0x18 0x33 0x05 #CHANGE: MIC BIAS 2.4V
#/usr/sbin/i2cset -f -y 3 0x18 0x34 0x20 #IN2L TO LPGA-P, RIN = 20K
#/usr/sbin/i2cset -f -y 3 0x18 0x36 0x80 #CM1 TO LPGA-M, RIN = 20K, Internal to Left MIC PGA
#/usr/sbin/i2cset -f -y 3 0x18 0x37 0x20 #IN2R Selected, RIN = 20K
#/usr/sbin/i2cset -f -y 3 0x18 0x39 0x80 #CM1 Selected, RIN = 20K, Internal to Right MIC PGA
/usr/sbin/i2cset -f -y 3 0x18 0x34 0x10 #CHANGE: IN2L TO LPGA-P, RIN = 10K
/usr/sbin/i2cset -f -y 3 0x18 0x36 0x40 #CHANGE: CM1 TO LPGA-M, RIN = 10K, Internal to Left MIC PGA
/usr/sbin/i2cset -f -y 3 0x18 0x37 0x01 #CHANGE: IN2L TO RPGA-P, RIN = 10K
/usr/sbin/i2cset -f -y 3 0x18 0x39 0x40 #CHANGE: CM1 Selected, RIN = 10K, Internal to Right MIC PGA
                             
#/usr/sbin/i2cset -f -y 3 0x18 0x3b 0x3c #Left  MIC PGA is enabled, at 30dB
#/usr/sbin/i2cset -f -y 3 0x18 0x3c 0x3c #Right MIC PGA is enabled, at 30dB
/usr/sbin/i2cset -f -y 3 0x18 0x3b 0x12 #CHANGE: Left  MIC PGA is enabled, at 9dB
/usr/sbin/i2cset -f -y 3 0x18 0x3c 0x12 #CHANGE: Right MIC PGA is enabled, at 9dB
/usr/sbin/i2cset -f -y 3 0x18 0x3d 0x00
/usr/sbin/i2cset -f -y 3 0x18 0x00 0x00
/usr/sbin/i2cset -f -y 3 0x18 0x51 0xc0 #Left & Right ADC power UP, not configured for Digital Microphon, Volume changes by 1 step
/usr/sbin/i2cset -f -y 3 0x18 0x52 0x00 #Left & Right ADC Un-Mute , at 0dB

#enable headphone detection
/usr/sbin/i2cset -f -a -y 3 0x18 0x00 0x00
/usr/sbin/i2cset -f -a -y 3 0x18 0x43 0x80
/usr/sbin/i2cset -f -a -y 3 0x18 0x30 0x80
/usr/sbin/i2cset -f -a -y 3 0x18 0x33 0xc0
/usr/sbin/i2cset -f -a -y 3 0x18 0x00 0x04
/usr/sbin/i2cset -f -a -y 3 0x18 0x56 0x16
/usr/sbin/i2cset -f -a -y 3 0x18 0x00 0x00

#CHANGE: EnableAGC                                                                                                                                                                                                 
/usr/sbin/i2cset -f -a -y 3 0x18 0x00 0x00                                                                                                                                             
/usr/sbin/i2cset -f -a -y 3 0x18 0x56 0x82  #Left AGC control registr Gain -5.5db and hysteresis 1db                                                                                                                                                                   
/usr/sbin/i2cset -f -a -y 3 0x18 0x5e 0x82  #Right AGC control registr Gain -5.5db and hysteresis 1db                                                                                                                               
/usr/sbin/i2cset -f -a -y 3 0x18 0x57 0xae  #Left noise control hysteresis 4db 
/usr/sbin/i2cset -f -a -y 3 0x18 0x5f 0xae  #Right noise control hysteresis 4db
/usr/sbin/i2cset -f -a -y 3 0x18 0x58 0x2e  #Left AGC gain max 23dB
/usr/sbin/i2cset -f -a -y 3 0x18 0x60 0x2e  #Right AGC gain max 23dB
/usr/sbin/i2cset -f -a -y 3 0x18 0x59 0x00 #attack time
/usr/sbin/i2cset -f -a -y 3 0x18 0x61 0x00 #attack time             
/usr/sbin/i2cset -f -a -y 3 0x18 0x5a 0x32 #decay time                
/usr/sbin/i2cset -f -a -y 3 0x18 0x62 0x32 #decay time

  • Hi,

    Looking at the differences between the 2 scripts, I see only the analog block settings which are different. 

    This tells me that the sampling rate are configured outside the codec.

    Somehow when handset is selected, it's switching to voice band of 8KHz and when handsfree is selected it's to audio band likely 44.1KHz. 

    You can check the WCLK to see the sampling rate to confirm.

    Regards.

  • Hello,

    Audio codec is configured in SLAVE mode in our product. It is getting clock from the SOC (AM5728).

    We checked the WCLK, in handsfree mode it is 44KHz and in handset mode it is 11KHz.

    How can we configure the WCLK in SOC?

  • Hi,

    You can check with the AM5728 team by creating the thread with the part number.

    Basically, to get the same frequency response, you will need both sampling to be 44.1KHz.

    You can refer to the AM5728 datasheet on how to configure the clocks or submit the thread to get their support.

    I'll close this thread for now.

    Regards.