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.

TLV320AIC3105: Routing Left DAC to HPLOUT/HPLCOM and Right DAC to HPROUT/HPRCOM issue

Part Number: TLV320AIC3105


Hello, 

I execute the following commands. 

  //======PHONES OUT ========//
  //Table 53. Page 0/Register 47: DAC_L1 to HPLOUT Volume Control Register
  writeRegister(wires, dev, Page_00, 47, 0x80);
  //Table 70. Page 0/Register 64: DAC_R1 to HPROUT Volume Control Register
  writeRegister(wires, dev, Page_00, 64, 0x80);
  // Table 57. Page 0/Register 51: HPLOUT Output Level Control Register
  writeRegister(wires, dev, Page_00, 51, 0b10011101);
  // Table 71. Page 0/Register 65: HPROUT Output Level Control Register
  writeRegister(wires, dev, Page_00, 65, 0b10011101);


  //===========RCA OUT===============//
  //Table 60. Page 0/Register 54: DAC_L1 to HPLCOM Volume Control Register
  writeRegister(wires, dev, Page_00, 54, 0b10000000);
  // Table 77. Page 0/Register 71: DAC_R1 to HPRCOM Volume Control Register
  writeRegister(wires, dev, Page_00, 71, 0b10000000);
  //Table 64. Page 0/Register 58: HPLCOM Output Level Control Register
  writeRegister(wire1, 0x18, Page_00, 58, 0b10011101);
  //Table 78. Page 0/Register 72: HPRCOM Output Level Control Register
  writeRegister(wire1, 0x18, Page_00, 72, 0b10011101);

But for some reason I'm getting LEFT only on HPLOUT/HPROUT and RIGHT only on HPLCOM/HPRCOM. Is there something that you can imagine that I'm doing wrong?

I know that I'm getting stereo separation on the DAC>DACVolume register because I can confirm left on left and right on right. Just not LEFT/RIGHT for each pair...

Does anyone have some things I can look into? Thank you!

Jay

  • Hi Jay,

    Before diving into debugging this further, I want to confirm that the use of "wire1" instead of "wires" as the first argument of your last two writeRegister calls is intentional (lines 18 and 20). Since it doesn't match the other lines, I'm thinking this could be a simple copy/paste error.

    Regards,
    Lukas

  • Hello Lukas, 

    Thanks for pointing that out, but unfortunately it wasn't related to my issue. 

    I have a 3.5mm jack connected to HPLOUT and HPROUT, and RCA jacks connected to HPLCOM and HPRCOM. On the headphone Jack I get RIGHT and on the rca jack, I only get LEFT. I therefore can confirm that both DAC's are enabled and functioning. Therefore my data lines are working correctly. i must have a misconfiguration of the HP drivers or mixers. 

    I've noticed a few places on the Datasheet that are incorrect, and I'm wondering if maybe this is why I'm struggling to get the right settings. 

    Here is the updated relevant code. 

    bool AudioControlTLV320AIC3105::enableTLV320AIC3105(select_wire wires, device dev, AudioMode mode, int slot){
      Serial.println("AudioControlTLV320AIC3105::enableTLV320AIC3105");
      aic3105_hardReset();
      aic3105_softReset(wires, dev);
      aic3105_initCLK(wires, dev);
      aic3105_initDAC(wires, dev);
      Serial.println("====END: AudioControlTLV320AIC3105::enableTLV320AIC3105====");  Serial.println();
      return true;
    }
    
    bool AudioControlTLV320AIC3105::aic3105_hardReset() {
      // hardware reset
      Serial.println("-----Hardware reset starting-----");delay(1000);
      pinMode(RESET_PIN,OUTPUT); 
      digitalWrite(RESET_PIN,HIGH);delay(1000); //not reset
      digitalWrite(RESET_PIN,LOW);delay(1000);  //reset
        // Serial.println("-----Hardware reset, the following should fail-----");
        // writeRegister(0, 0x18, Page_00, 0x01, 0x01); 
        // Serial.println("-----now turning it back on-----");
      digitalWrite(RESET_PIN,HIGH);delay(1000);//not reset
      Serial.println("-----Hardware reset complete-----");delay(1000);
      return true;
    }
    
    bool AudioControlTLV320AIC3105::aic3105_softReset(select_wire wires, device dev) {
      // reset to defaults                    
      // wires, device, page, register, value
      writeRegister(wires, dev, Page_00, 0x01, 0x01); delay(5000);
      writeRegister(wires, dev, Page_00, 0x01, 0b00000000); delay(1000);
      if (_debugToSerial) Serial.println("-- Software Reset Complete ---");
      // wait for device to initialize
    	delay(50);
      return true;
    }
    
    bool AudioControlTLV320AIC3105::aic3105_initCLK (select_wire wires, device dev){
      // Table 14. Page 0/Register 9: Audio Serial Data Interface Control Register B
      writeRegister(wires, dev, Page_00, 0x09, 0b00000000);
      //Table 12. Page 0/Register 7: Codec Datapath Setup Register
      writeRegister(wires, dev, Page_00, 0x07, 0b10001010);
      //Table 100. Page 0/Register 102: Clock Generation Control Register
      writeRegister(wires, dev, Page_00, 0x66, 0b00000010);
      return true;
    }
    
    void AudioControlTLV320AIC3105::aic3105_initDAC (select_wire wires, device dev){
    
      //========POWER UP THE DAC==========//
      // configure the HPLCOM as single-ended. 
      //Table 42. Page 0/Register 37: DAC Power and Output Driver Control Register
      writeRegister(wires, dev, Page_00, 0x25, 0b11100000);// 10: HPLCOM configured as independent single-ended output (ERROR IN DATASHEET, THE RESET VALUE SHOULD BE 0000)
      //=======TURN ON THE HIGH POWER DRIVER, AND CONFIGURE THE SHORT CIRCUIT PROTECTION============//
      // configure the HPRCOM as single-ended. 
      //Table 43. Page 0/Register 38: High-Power Output Driver Control Register
      writeRegister(wires, dev, Page_00, 38, 0b00001100); //CONFUSING DATASHEET WITH 3 DIGIT BIT AND A : BEFORE ONE... WHY?
      //Table 45. Page 0/Register 40: High-Power Output Stage Control Register
      //writeRegister(wires, dev, Page_00, 40, 0b10000001); // TURNING UP THE COMMON-MODE VOLTAGE TO 1.65V
    
      //======UNMUTE THE DAC OUTPUT========//
      //Table 48. Page 0/Register 43: Left-DAC Digital Volume Control Register
      writeRegister(wires, dev, Page_00, 43, 0b00000000);
      //Table 49. Page 0/Register 44: Right DAC Digital Volume Control Register
      writeRegister(wires, dev, Page_00, 44, 0b00000000);
    
      //=======SET THE DAC LEFT/RIGHT TO ROUTE TO MIXER LEFT/RIGHT=====//
      //Table 46. Page 0/Register 41: DAC Output Switching Control Register
      writeRegister(wires, dev, Page_00, 41, 0b00000000);
      //00: Left-DAC output selects DAC_L1 path.
      //00: Right DAC output selects DAC_R1 path.
      
      //======SPECIFY THE CONFIG OF HP OUT (DIFFERENTIAL OR SINGLE ENDED)========//
      //Table 19. Page 0/Register 14: Headset/Button Press Detection Register B
      //writeRegister(wires, dev, Page_00, 0x0E, 0b10000000);// w 30 0E C0 P0_R14	 	 0b11000000
      //1: Programs high-power outputs for ac-coupled driver configuration
    
    
    
      //======PHONES OUT ========//
    
      //Table 53. Page 0/Register 47: DAC_L1 to HPLOUT Volume Control Register
      writeRegister(wires, dev, Page_00, 47, 0x10000000);
      //Table 70. Page 0/Register 64: DAC_R1 to HPROUT Volume Control Register
      writeRegister(wires, dev, Page_00, 64, 0x10000000);
    
      // Table 57. Page 0/Register 51: HPLOUT Output Level Control Register
      writeRegister(wires, dev, Page_00, 51, 0b10011101);
      // Table 71. Page 0/Register 65: HPROUT Output Level Control Register
      writeRegister(wires, dev, Page_00, 65, 0b10011101);
    
    
      // //===========RCA OUT===============//
      // Table 60. Page 0/Register 54: DAC_L1 to HPLCOM Volume Control Register
      writeRegister(wires, dev, Page_00, 54, 0b10011101);
      // Table 77. Page 0/Register 71: DAC_R1 to HPRCOM Volume Control Register
      writeRegister(wires, dev, Page_00, 71, 0b10011101);
      // Table 64. Page 0/Register 58: HPLCOM Output Level Control Register
      writeRegister(wires, 0x18, Page_00, 58, 0b10011101);
      // Table 78. Page 0/Register 72: HPRCOM Output Level Control Register
      writeRegister(wires, 0x18, Page_00, 72, 0b10011101);
    
    
      // Table 107. Page 0/Register 109: DAC Quiescent Current Adjustment Register
      writeRegister(wires, dev, Page_00, 109, 0b11000000); // w 30 66 A0 P0_R102 0b10100000	  Table 100. Page 0/Register 102: Clock Generation Control Register
    
      }
    }
    
    bool AudioControlTLV320AIC3105::volume(float volume) {
    	volume = max(0.0, min(1.0, volume));
      uint8_t volumeTable = (uint8_t)round((1 - volume) * 127);
      if (_debugToSerial) {Serial.print("Volume Value: ");Serial.println(volumeTable);}
      
      //Table 53. Page 0/Register 47: DAC_L1 to HPLOUT Volume Control Register
      writeRegister(wire1, 0x18, Page_00, 47, 0b10000000 | volumeTable);
      //Table 70. Page 0/Register 64: DAC_R1 to HPROUT Volume Control Register
      writeRegister(wire1, 0x18, Page_00, 64, 0b10000000 | volumeTable);
      //Table 60. Page 0/Register 54: DAC_L1 to HPLCOM Volume Control Register
      writeRegister(wire1, 0x18, Page_00, 54, 0b10000000 | volumeTable);
      //Table 77. Page 0/Register 71: DAC_R1 to HPRCOM Volume Control Register
      writeRegister(wire1, 0x18, Page_00, 71, 0b10000000 | volumeTable);
      //Table 82. Page 0/Register 82: DAC_L1 to LEFT_LOP/M Volume Control Register
      writeRegister(wire1, 0x18, Page_00, 82, 0b10000000 | volumeTable);
      //Table 92. Page 0/Register 92: DAC_R1 to RIGHT_LOP/M Volume Control Register
      writeRegister(wire1, 0x18, Page_00, 92, 0b10000000 | volumeTable);
    	return true;
    }

  • Hi Jay,

    You're right; that datasheet table is a bit confusing. I'm going to put in a request for a revision.

    In the meantime, I've downloaded the EVM GUI here in order to inspect the register table configurations: https://www.ti.com/tool/TLV320AIC3105EVM-K

    You can download this too and verify register configurations, running the software in demo mode if you don't have an EVM.

    Would you mind trying these changes and seeing if it fixes your issue?:

    Page 0/Reg 38: 00010000 (or 00010100 to use short circuit protection).


    Regards,
    Lukas Hazen-Bushbaker

  • I've been making "Comments" on the PDF when I find discrepancies. 

    Table 42. Page 0/Register 37: DAC Power and Output Driver Control Register

    D3-D0 | 4 bits counted and 3 bits shown "000".

    Table 43. Page 0/Register 38: High-Power Output Driver Control Register

    D5–D3 | it's confusing the way the bits are specified. Is 101 or 001 necessary???

    Table 95. Page 0/Register 95: Output Driver Short-Circuit Detection Status Register

    D1-D0 | Should be 2 bits, shown as one "0". 

    I hope this helps with the documentation. 

    I also wanted to show something else I'm experiencing. For some reason P0_R47 is failing (when nothing else does). 

     

    START: AudioControlTLV320AIC3105::volume
    Volume Value: 52
    Write: 	 Wire:1	 TLV320AIC3105:24	 P0_R47	 P0x00_R0x2F	 Value: 0xB4	 180	 0b10110100
    controlTLV320AIC3105: Received Error During writePage(): Error = 4
    controlTLV320AIC3105: Received Error During writePage(): Error = 4
    Write: 	 Wire:1	 TLV320AIC3105:24	 P0_R64	 P0x00_R0x40	 Value: 0xB4	 180	 0b10110100
    Go to Page Successful.
    Write Reigster Successful.
    Write: 	 Wire:1	 TLV320AIC3105:24	 P0_R71	 P0x00_R0x47	 Value: 0xB4	 180	 0b10110100
    Go to Page Successful.
    Write Reigster Successful.
    Write: 	 Wire:1	 TLV320AIC3105:24	 P0_R82	 P0x00_R0x52	 Value: 0xB4	 180	 0b10110100
    Go to Page Successful.
    Write Reigster Successful.
    Write: 	 Wire:1	 TLV320AIC3105:24	 P0_R92	 P0x00_R0x5C	 Value: 0xB4	 180	 0b10110100
    Go to Page Successful.
    Write Reigster Successful.
    END: AudioControlTLV320AIC3105::volume
    START AudioControlTLV320AIC3105::readFlags
    Table 94. Page 0/Register 94: Module Power Status Register
    Read:	 Wire:1	 TLV320AIC3105:24	 P0_R94	 P0x00_R0x5E	 Value: 0x0	 0	 0b0
    Table 95. Page 0/Register 95: Output Driver Short-Circuit Detection Status Register
    Read:	 Wire:1	 TLV320AIC3105:24	 P0_R95	 P0x00_R0x5F	 Value: 0x0	 0	 0b0
    Table 96. Page 0/Register 96: Sticky Interrupt Flags Register
    Read:	 Wire:1	 TLV320AIC3105:24	 P0_R96	 P0x00_R0x60	 Value: 0x0	 0	 0b0
    Table 97. Page 0/Register 97: Real-Time Interrupt Flags Register
    Read:	 Wire:1	 TLV320AIC3105:24	 P0_R97	 P0x00_R0x61	 Value: 0x0	 0	 0b0
    Table 7. Page 0/Register 2: Codec Sample Rate Select Register
    Read:	 Wire:1	 TLV320AIC3105:24	 P0_R2	 P0x00_R0x2	 Value: 0x0	 0	 0b0
    Table 8. Page 0/Register 3: PLL Programming Register A
    Read:	 Wire:1	 TLV320AIC3105:24	 P0_R3	 P0x00_R0x3	 Value: 0x10	 16	 0b10000
    Table 9. Page 0/Register 4: PLL Programming Register B
    Read:	 Wire:1	 TLV320AIC3105:24	 P0_R4	 P0x00_R0x4	 Value: 0x4	 4	 0b100
    Table 10. Page 0/Register 5: PLL Programming Register C (1)
    Read:	 Wire:1	 TLV320AIC3105:24	 P0_R11	 P0x00_R0xB	 Value: 0x1	 1	 0b1
    Table 20. Page 0/Register 15: Left-ADC PGA Gain Control Register
    Read:	 Wire:1	 TLV320AIC3105:24	 P0_R15	 P0x00_R0xF	 Value: 0x80	 128	 0b10000000
    Table 21. Page 0/Register 15: Left-ADC PGA Gain Control Register
    Read:	 Wire:1	 TLV320AIC3105:24	 P0_R16	 P0x00_R0x10	 Value: 0x80	 128	 0b10000000
    Table 24. Page 0/Register 19: LINE1L to Left-ADC Control Register
    Read:	 Wire:1	 TLV320AIC3105:24	 P0_R19	 P0x00_R0x13	 Value: 0x0	 0	 0b0
    Table 25. Page 0/Register 20: LINE2L to Left (1)-ADC Control Register
    Read:	 Wire:1	 TLV320AIC3105:24	 P0_R20	 P0x00_R0x14	 Value: 0x0	 0	 0b0
    END AudioControlTLV320AIC3105::readFlags

  • You can download this too and verify register configurations, running the software in demo mode if you don't have an EVM.

    I have been using that during development. I have a separate thread about this project where I was directed to this tool. I wish the tool used decimals for page numbers, and binary digits for values. It is so much easier to read, as opposed to converting from Hex to Binary or Decimal (as I have done in code for debug purposes). In addition to the decimalal, I also wish the datasheet had listed the Hex value for each Register ##. Anyhow, I'm making it work and the tool is very helpful. I'm just stuck on this one thing. I clearly have the DACS working right, just routing them to L1>HPL and R1>HPR doesn't seem to be working for me. I'll keep testing. Thanks for your help. 

  • Hello Lukas, 

    I'm pleased to announce that with your help I've resolved my issue. Turns out that the registry setting you mentioned (Register 38 to 0b00010000). This fixed the RCA output (LCOM/RCOM).

    I also had a short on one of the output pins (HPL), which is fixed. And now it's working.

    Thank you!

    Jay