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.

TLV320AIC23: Right channel audio out not working?

Part Number: TLV320AIC23


Hi there, I have my left line in and line out audio working fine, and I can verify audio is coming into my right Line channel input, however I am not getting any output.

I have the RLINE audio register activated but still can't get anything. Here is my code.

If anyone has any suggestions please let me know.

    #define TLV320_ADDR             0x1A // CODEC Address

#define TLV320_RESET            0x1E // Reset register
#define TLV320_AUD_INT_ACT      0x12 // Digital interface activation
#define TLV320_SAMPLE_CTRL      0x10 // Sample rate control
#define TLV320_AUD_INT_FMT      0x0E // Digital audio interface register
#define TLV320_PWR_CTRL         0x0C // Power control register
#define TLV320_AAUD_PATH        0x08 // Analog audio path control
#define TLV320_DAUD_PATH        0x0A // Digital audio path control
#define TLV320_LLINE_VOL        0x00 // Left Line Input Channel Volume Control  0x00
#define TLV320_RLINE_VOL        0x02// Right Line Input Channel Volume Control 0x02

#define RESET                   0x00
#define ACTIVATE_INTERFACE      0x01
#define SAMPLE_RATE             0x00
#define DAI                     0x02
#define PWR_CONTROL             0x02
#define LLINE_VOL               0x17
#define RLINE_VOL               0x17
#define AAUD_PATH               0x10
#define DAUD_PATH               0x06
    
    
    
    
    //Reset buffer
    uint8_t         bfr_res[I2C_BUFFER_BYTES];
                    bfr_res[1]= RESET;
                    bfr_res[0]= TLV320_RESET;

    //Digital audio interface activation buffer
    uint8_t         bfr_DAI_act[I2C_BUFFER_BYTES];
                    bfr_DAI_act[1]= ACTIVATE_INTERFACE;
                    bfr_DAI_act[0]= TLV320_AUD_INT_ACT;

    //Sample rate control buffer
    uint8_t         bfr_samp_ctrl[I2C_BUFFER_BYTES];
                    bfr_samp_ctrl[1]= SAMPLE_RATE;
                    bfr_samp_ctrl[0]= TLV320_SAMPLE_CTRL;

    //Digital audio interface format buffer
    uint8_t         bfr_DAI_frm[I2C_BUFFER_BYTES];
                    bfr_DAI_frm[1]= DAI;
                    bfr_DAI_frm[0]= TLV320_AUD_INT_FMT;

    //Left line input channel volume control
    uint8_t         Lline_vol[I2C_BUFFER_BYTES];
                    Lline_vol[1]= LLINE_VOL;
                    Lline_vol[0]= TLV320_LLINE_VOL;

    //Right line input channel volume control
    uint8_t         Rline_vol[I2C_BUFFER_BYTES];
                    Rline_vol[1]= RLINE_VOL;
                    Rline_vol[0]= TLV320_RLINE_VOL;

    //Analog Audio Path Control
    uint8_t         Aaudio_path[I2C_BUFFER_BYTES];
                    Aaudio_path[1]= AAUD_PATH;
                    Aaudio_path[0]= TLV320_AAUD_PATH;

    //Digital Audio Path Control
    uint8_t         Daudio_path[I2C_BUFFER_BYTES];
                    Daudio_path[1]= DAUD_PATH;
                    Daudio_path[0]= TLV320_DAUD_PATH;

    //Power control buffer
    uint8_t         bfr_pwr_on[I2C_BUFFER_BYTES];
                    bfr_pwr_on[1]= PWR_CONTROL;             //PWR_CONTROL;
                    bfr_pwr_on[0]= TLV320_PWR_CTRL;

    printf("resetting CODECs\n");

  /* Reset register (Address: 00011110) */
  /* bit[8:0] : Reset              : Set all to 0 for reset
  */                               //00000000
     i2c.write(TLV320_ADDR, bfr_res, 2, num_bytes_sent,1);

  /* Sample rate control (Address: 00010000) */
  /* bit[8]     : Reserved
   * bit[7]     : Clock output divider           : Clock output divider 0 = MCLK
   * bit[6]     : Clock input divider            : Clock input divider 0 = MCLK
   * bit[5:2]   : Sample rate control            : 0000 for 48Khz, 48Khz with MCLK/2 of 12.288Mhz
   * bit[1]     : Base oversampling rate         : Normal mode        0= 256*fs
   * bit[0]     : Clock mode select              : Clock mode select  0 = normal mode
   */                                            //00000000
     i2c.write(TLV320_ADDR, bfr_samp_ctrl, 2, num_bytes_sent,1);

  /* Digital Audio Interface Format (Address: 00001110) */
  /* bit[8:7]   : Reserved
   * bit[6]     : Master/slave mode                  : Set to 0 for slave
   * bit[5]     : DAC left/right swap                : 0 = disable
   * bit[4]     : DAC left/right phase               : 0 = Right channel on, LRCIN high
   * bit[3:2]   : IWL[1:0] Input bit length          : 00 = 16 bit
   * bit[1:0]   : FOR[1:0] Data format               : 10 = I2S format
   */                                                // 00000010
     i2c.write(TLV320_ADDR, bfr_DAI_frm, 2, num_bytes_sent,1);

  /* Digital Interface Activation (Address: 00010010) */
  /* bit[8:1] : Reserved
  *  bit[0] : Activate interface                    : 1 = Activate
  */                                                //00000001
   i2c.write(TLV320_ADDR, bfr_DAI_act, 2, num_bytes_sent,1);

  /* Left line input channel volume control (Address: 00000000) */
  /* bit[8]     : Simultaneous update                   : 0 = Off
   * bit[7]     : Left line input mute                  : 0 = Unmute
   * bit[6:5]   : Reserved                              : 0
   * bit[4:0]   : Left line input volume control        : 10111 = 0 dB
   */                                                   //000010111
  i2c.write(TLV320_ADDR, Lline_vol, 2, num_bytes_sent,1);

  /* Right line input channel volume control (Address: 0000001) */
  /* bit[8]     : Simultaneous update                   : 0 = Off
   * bit[7]     : Right line input mute                 : 0 = Unmute
   * bit[6:5]   : Reserved                              : 0
   * bit[4:0]   : Right line input volume control       : 10111 = 0 dB
   */                                                   //00010111

  i2c.write(TLV320_ADDR, Rline_vol, 2, num_bytes_sent,1);

  /*   Analog Audio Path Control (Address: 0000100)     */
  /* bit[8:5]   : Added sidetone
   * bit[4]     : DAC on/off                    : 1 = on
   * bit[3]     : Bypass                        : 0 = disable
   * bit[2]     : Input select for ADC          : 0 = Line
   * bit[1]     : Mic mute                      : 0 = Normal
   * bit[0]     : Mic boost                     : 0 = no boost
   */                                           //000010000
    i2c.write(TLV320_ADDR, Aaudio_path, 2, num_bytes_sent,1);

  /*   Digital Audio Path Control (Address: 0000101)     */
  /* bit[8:4]   : Reserved
   * bit[3]     : DAC soft mute                   : 0 = off
   * bit[2:1]   : De-emphasis control             : 11 = enable for 48kHz
   * bit[0]     : ADC high-pass filter            : 0 = Enable
   */                                           //000000110
    i2c.write(TLV320_ADDR, Daudio_path, 2, num_bytes_sent,1);

  /* Power Control (Address: 00001100) */
    /* bit[8] : Reserved
     * bit[7] : Device power          : Set to 0 for on
     * bit[6] : Clock                 : Set to 0 for on
     * bit[5] : Oscillator            : Set to 0 for on
     * bit[4] : Outputs               : Set to 0 for on
     * bit[3] : DAC                   : Set to 0 for on
     * bit[2] : ADC                   : Set to 0 for on
     * bit[1] : Mic input             : Set to 0 for on
     * bit[0] : Line input            : Set to 0 for on
   */                                 //00000000
     i2c.write(TLV320_ADDR, bfr_pwr_on, 2, num_bytes_sent,1);

  • Hi,

    The registers look correct from the define state above, maybe do a register read and check they are as expected and analyze the ADC side by itself to ensure you have both the left and right line inputs. You can take the digital output and post process or use audio precision to see you have the tone for both as example. If digital side is good then see if you can use analog bypass to check the output right side...just suggestion to isolate the issue.

  • Hey there. Sorry about the late response. I put the CODEC in bypass mode and I was able to get audio from both channels fine. It's just when I turn off bypass mode that I can only get audio out from a single channel, which is why I thought i had a problem with frimware. Also I douuble checked with another TI chip and got the same issue so no way both have a faulty ADC I would assume.

  • Are you able to check just the ADC side and capture the digital output - are both Left and right channels present?

    Can you also send i2cdump just to confirm the registers are what we expect them to be?

  • I don't think I am/ not sure how I would do that. I can only tell you the digital interface is setup and both analog signals are present on the lineout pins under bypass mode, but as soon as I switch over to regular mode, I only see the left analog signal. I am using the same register  settings for both left and right line channel. Not sure if there is an order in which the registers need to be written? or if there is a startup sequence to get both to work I am missing? Or a register instruction needed in one of the registers to get both channels audio working? I am very perplexed at this point.

  • The bypass mode tells you the analog input and output are ok, but in your case the issue is in your digital so we need to check that.

    Where is your digital connected to - what's your host? You will need to find a way to analyze the digital to confirm it's correct maybe Audacity or Audio Precision PSIA.

  • Thanks for all your help. I'm using an XMOS audio chip as my main controller, and just had to change some things in the firmware on the digital side and it works good now. Thanks!

  • Good to know.

    Thanks.