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.

TLV320ADC6140: Gain Calibration Register Sometimes Not Set Correctly.

Part Number: TLV320ADC6140

Hello E2E Experts,

Good day.

I control TLV320ADC6140 over a SPI (2 MHz clock). From time to time are loaded different configurations, that involve updating following registers of the IC. Lets name:

Configuration A (PGA gain 8dB):

SpiWrite2(0xd6, 0x00); //AudioSetDecimatorFilter
SpiWrite2(0x28, 0xdd); //AudioSetSampleRate
SpiWrite2(0x7c, 0xc9); //AudioSetDvol
SpiWrite2(0x90, 0xc9); //AudioSetDvol
SpiWrite2(0x7a, 0x20); //AudioSetGain
SpiWrite2(0x8e, 0x20); //AudioSetGain
SpiWrite2(0x7e, 0x80); //AudioSetCal
SpiWrite2(0x92, 0x80); //AudioSetCal
SpiWrite2(0x80, 0x00); //AudioSetPhase
SpiWrite2(0x94, 0x00); //AudioSetPhase

 

Configuration B (PGA gain 9dB):

SpiWrite2(0xd6, 0x00); //AudioSetDecimatorFilter
SpiWrite2(0x28, 0xdd); //AudioSetSampleRate
SpiWrite2(0x7c, 0xc9); //AudioSetDvol
SpiWrite2(0x90, 0xc9); //AudioSetDvol
SpiWrite2(0x7a, 0x24); //AudioSetGain
SpiWrite2(0x8e, 0x24); //AudioSetGain
SpiWrite2(0x7e, 0x80); //AudioSetCal
SpiWrite2(0x92, 0x80); //AudioSetCal
SpiWrite2(0x80, 0x00); //AudioSetPhase
SpiWrite2(0x94, 0x00); //AudioSetPhase

The difference between is only in the PGA values.

The transfers are sent in the listed order, no other registers are modified, the ADC is fully operational and not stopped, DRE and AGC disabled.

What I notice is when the current configuration is A and send update to B, in many cases the first channel level is around 0.5dB lower. The problem is traced to the channel gain calibration register (0x39 = 0x72>>1). If later is updated only that register, the issue disappears.

With less chance, the other channel sometimes is 0.5dB lower or both are with correct level.

Never had a problem when update from B->A, or A->A or B->B.

The SPI signals are recorded with a oscilloscope, and checked that match the desired data.

Regards,

TICSC

  • I made a mistake in the description: The affected calibration register is: 0x3f = 0x7e>>1

  • Hi Svilen,

    A couple comments:

    The problem is traced to the channel gain calibration register (0x39 = 0x72>>1).

    What value do you read in register 0x3f that you see the problem described? Is it not the value that was written?

    Can you state the intention of the following write?

    • SpiWrite2(0x28, 0xdd); //AudioSetSampleRate

    This configures the master mode clock, but the device is not set to master mode, and 0xdd refers to reserved bit values. I would remove this line unless I am missing something. I am not sure if it is causing an error, but we should clarify the goal here in order to correctly implement.

    The following lines are setting to their default, or reset values:

    • SpiWrite2(0x7c, 0xc9); //AudioSetDvol
    • SpiWrite2(0x90, 0xc9); //AudioSetDvol
    • SpiWrite2(0x7e, 0x80); //AudioSetCal
    • SpiWrite2(0x92, 0x80); //AudioSetCal
    • SpiWrite2(0x80, 0x00); //AudioSetPhase
    • SpiWrite2(0x94, 0x00); //AudioSetPhase

    As in, these registers will have these values at start-up and do not need to be rewritten to. These should not cause an error, however, if the writes successfully execute.

    Do you mean to configure Channel 1 and Channel 3? The device by default expects 32-bit gap between these channels, unless additional configurations are made to move Channel 3 to Slot 1.

    I look forward to hearing your response, and let me know if you need any clarifications.

    Best,

    Garret

  • Hi Garret.

    About SpiWrite2(0x28, 0xdd); Because I manually copied the values from decimal to hex, there was made a calculation mistake. The actual value for the test is 0x44 (48 KHz).

    At the moment there is not a function to read back the values. There is not a way to visualize them. Anyway, will add the function and read the value with a oscilloscope.

    The other parameters are with the default values in this example, but in the real product is reserved a function where can be many presets and they to be non-default.

    The all 4 channels of TLV320ADC6140 are utilized, but they are routed to stereo Left Justified signal. At the moment ch. 1 and 3 are in use.

    I attach the SPI dump, after which the left channel get a lower value.

  • Hello Again.

    I made a tool to manually read and set a registers. I put the device in 0.5dB error and read back the registers - all looks correct and here is the result:

    >audiocmd 0xd7 0
    Read back: 0x0

    >audiocmd 0x29 0
    Read back: 0x44

    >audiocmd 0x7d 0
    Read back: 0xc9

    >audiocmd 0x91 0
    Read back: 0xc9

    >audiocmd 0x7b 0
    Read back: 0x24

    >audiocmd 0x8f 0
    Read back: 0x24

    >audiocmd 0x7f 0
    Read back: 0x80

    >audiocmd 0x93 0
    Read back: 0x80

    >audiocmd 0x81 0
    Read back: 0x0

    >audiocmd 0x95 0
    Read back: 0x0

    #After this command the level is set to expected value. The read value is not valid, as it is a write operation.
    >audiocmd 0x7e 0x80
    Read back: 0xff

    >audiocmd 0x7f 0x80
    Read back: 0x80

    The measured level error is like the calibration register have a value of 0x40. But if set 0x40, then is read back a 0x40, while above is read as 0x80.

  • Hi Svilen,

    To confirm, the SPI writes are successful to every register except 0x7e (0x3f)? What value do you read back from this register if you do not write to it, i.e. the default value?

    Best,

    Garret

  • Hi.

    In a version that never writes to 0x7e (0x3f), a read operation returns 0x80.

  • Hi Svilen,

    If this version also solves the issue at the output, my recommendation is to remove this write so the 0x3f register is always at the default value 0x80.

    Best,

    Garret

  • That is exactly what i do as a workaround.

    Anyway there is a risk to hit a similar problem when write to other registers.

    Maybe there is internal to TLV320ADC6140 copy and from analog gain, digital, gain and correction registers to some internal registers, converting dB to coefficients and quick update of the registers in a row affect that calculation?

  • Hi Svilen,

    I'm sorry I misread a prior post - this register is reading back correctly after it is set to 0x80 it seems? I am not sure the problem lies here. Are you able to send a full register dump and/or schematic to debug further?

    Best,

    Garret

  • Hi.

    Here is the registers dump when the device is on gain difference:

    Read reg: 0x00: Read back: 0x0
    Read reg: 0x01: Read back: 0x0
    Read reg: 0x02: Read back: 0x81
    Read reg: 0x03: Read back: 0x0
    Read reg: 0x04: Read back: 0x0
    Read reg: 0x05: Read back: 0x5
    Read reg: 0x06: Read back: 0x0
    Read reg: 0x07: Read back: 0xbe
    Read reg: 0x08: Read back: 0x0
    Read reg: 0x09: Read back: 0x0
    Read reg: 0x0a: Read back: 0x0
    Read reg: 0x0b: Read back: 0x0
    Read reg: 0x0c: Read back: 0x1
    Read reg: 0x0d: Read back: 0x20
    Read reg: 0x0e: Read back: 0x3
    Read reg: 0x0f: Read back: 0x4
    Read reg: 0x10: Read back: 0x5
    Read reg: 0x11: Read back: 0x6
    Read reg: 0x12: Read back: 0x7
    Read reg: 0x13: Read back: 0x80
    Read reg: 0x14: Read back: 0x44
    Read reg: 0x15: Read back: 0x44
    Read reg: 0x16: Read back: 0x10
    Read reg: 0x17: Read back: 0x10
    Read reg: 0x18: Read back: 0x4
    Read reg: 0x19: Read back: 0x20
    Read reg: 0x1a: Read back: 0x2
    Read reg: 0x1b: Read back: 0x8
    Read reg: 0x1c: Read back: 0x0
    Read reg: 0x1d: Read back: 0x0
    Read reg: 0x1e: Read back: 0x2
    Read reg: 0x1f: Read back: 0x40
    Read reg: 0x20: Read back: 0x0
    Read reg: 0x21: Read back: 0xa0
    Read reg: 0x22: Read back: 0x0
    Read reg: 0x23: Read back: 0x0
    Read reg: 0x24: Read back: 0x0
    Read reg: 0x25: Read back: 0x0
    Read reg: 0x26: Read back: 0x0
    Read reg: 0x27: Read back: 0x0
    Read reg: 0x28: Read back: 0x0
    Read reg: 0x29: Read back: 0x0
    Read reg: 0x2a: Read back: 0x0
    Read reg: 0x2b: Read back: 0x0
    Read reg: 0x2c: Read back: 0x0
    Read reg: 0x2d: Read back: 0x0
    Read reg: 0x2e: Read back: 0x0
    Read reg: 0x2f: Read back: 0x0
    Read reg: 0x30: Read back: 0x0
    Read reg: 0x31: Read back: 0x0
    Read reg: 0x32: Read back: 0x0
    Read reg: 0x33: Read back: 0xff
    Read reg: 0x34: Read back: 0x0
    Read reg: 0x35: Read back: 0x0
    Read reg: 0x36: Read back: 0x0
    Read reg: 0x37: Read back: 0x0
    Read reg: 0x38: Read back: 0x40
    Read reg: 0x39: Read back: 0x0
    Read reg: 0x3a: Read back: 0x0
    Read reg: 0x3b: Read back: 0x0
    Read reg: 0x3c: Read back: 0x8
    Read reg: 0x3d: Read back: 0x24
    Read reg: 0x3e: Read back: 0xc9
    Read reg: 0x3f: Read back: 0x80
    Read reg: 0x40: Read back: 0x0
    Read reg: 0x41: Read back: 0x8
    Read reg: 0x42: Read back: 0x0
    Read reg: 0x43: Read back: 0xc9
    Read reg: 0x44: Read back: 0x80
    Read reg: 0x45: Read back: 0x0
    Read reg: 0x46: Read back: 0x8
    Read reg: 0x47: Read back: 0x24
    Read reg: 0x48: Read back: 0xc9
    Read reg: 0x49: Read back: 0x80
    Read reg: 0x4a: Read back: 0x0
    Read reg: 0x4b: Read back: 0x8
    Read reg: 0x4c: Read back: 0x0
    Read reg: 0x4d: Read back: 0xc9
    Read reg: 0x4e: Read back: 0x80
    Read reg: 0x4f: Read back: 0x0
    Read reg: 0x50: Read back: 0x0
    Read reg: 0x51: Read back: 0x0
    Read reg: 0x52: Read back: 0xc9
    Read reg: 0x53: Read back: 0x80
    Read reg: 0x54: Read back: 0x0
    Read reg: 0x55: Read back: 0x0
    Read reg: 0x56: Read back: 0x0
    Read reg: 0x57: Read back: 0xc9
    Read reg: 0x58: Read back: 0x80
    Read reg: 0x59: Read back: 0x0
    Read reg: 0x5a: Read back: 0x0
    Read reg: 0x5b: Read back: 0x0
    Read reg: 0x5c: Read back: 0xc9
    Read reg: 0x5d: Read back: 0x80
    Read reg: 0x5e: Read back: 0x0
    Read reg: 0x5f: Read back: 0x0
    Read reg: 0x60: Read back: 0x0
    Read reg: 0x61: Read back: 0xc9
    Read reg: 0x62: Read back: 0x80
    Read reg: 0x63: Read back: 0x0
    Read reg: 0x64: Read back: 0x0
    Read reg: 0x65: Read back: 0x0
    Read reg: 0x66: Read back: 0x0
    Read reg: 0x67: Read back: 0x0
    Read reg: 0x68: Read back: 0x0
    Read reg: 0x69: Read back: 0x0
    Read reg: 0x6a: Read back: 0x0
    Read reg: 0x6b: Read back: 0x0
    Read reg: 0x6c: Read back: 0x40
    Read reg: 0x6d: Read back: 0x7b
    Read reg: 0x6e: Read back: 0x0
    Read reg: 0x6f: Read back: 0x0
    Read reg: 0x70: Read back: 0xe7
    Read reg: 0x71: Read back: 0x0
    Read reg: 0x72: Read back: 0x0
    Read reg: 0x73: Read back: 0xf0
    Read reg: 0x74: Read back: 0xf0
    Read reg: 0x75: Read back: 0x60
    Read reg: 0x76: Read back: 0xf0
    Read reg: 0x77: Read back: 0xe0
    Read reg: 0x78: Read back: 0x0
    Read reg: 0x79: Read back: 0x0
    Read reg: 0x7a: Read back: 0xff
    Read reg: 0x7b: Read back: 0x0
    Read reg: 0x7c: Read back: 0xff
    Read reg: 0x7d: Read back: 0x8c
    Read reg: 0x7e: Read back: 0xc
    Read reg: 0x7f: Read back: 0x0

  • Thanks Svilen,

    I'll look over this today and provide comment back.

    Best,

    Garret

  • Hi Svilen,

    I see one issue that could be contributing to the problem you are seeing. Register 0x74 reads back as 0xf0, which suggests output channels 1,2,3, and 4 are enabled. To enable only channels 1 and 3, you should write 0xa0 to this register (SpiWrite2(0xe8, 0xa0)). Let me know if this solves the issue.

    Best,

    Garret

  • Hi.

    Setting the channel enable register to 0xa0 doesn't change the erratic behavior.

  • Hi Svilen,

    I will look into trying to confirm this issue on bench. The input levels can differ slightly from each other and may not match exactly every time, with the small difference being amplified by the channel gain. What is the input you are sending? Could you share a schematic?

    Best,

    Garret

  • Hi Garret.

    This is the schematic. The source is a signal generator with all inputs connected to it.

    The input levels differ by 0.4 - 0.5 dB, like the gain calibration register is set to 0x40, but it is read back and have 0x80.

  • Hi Svilen,

    I was able to recreate the issue in the lab, and have figured out that power cycling the device will fix the gain difference. Leave the gain calibration at the default 0x80, and send the following commands after your initial script while still supplying the inputs:

    • SpiWrite2(0x00, 0x00); // Set Page 0
    • SpiWrite2(0xea, 0x00); // Power off ADC
    • SpiWrite2(0x04, 0x80); // Enter Sleep Mode
    • SpiWrite2(0x04, 0x81); // Exit Sleep Mode
    • SpiWrite2(0xea, 0x60); // Power On ADC

    I recommend adding delays (maybe 10ms) after the entering and exiting sleep mode.

    Best,

    Garret

  • Thank you for the support, I will use it.

    Do you think that an other register than gain calibration can be affected by such behavior?

  • Hi Svilen,

    I do not think there should be further issues.

    Best,

    Garret