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.

TLV320DAC32: I2S DAC configuration problems

Part Number: TLV320DAC32

Tool/software:

I have the EVM for this part and I am trying to get it working with some small speakers.

I also have the USB board but I haven't been able to get the software to work (it freezes up on Windows 10 and on Windows 7) so I'm trying to manually control it over the I2C bus instead. The part is detected on the I2C bus and seems to respond as expected.

The problem is that there is no sound coming out the speakers, but also the datasheet has a few things that aren't clear to me so I'd like to have some clarification on a few things just to make sure I'm setting all the registers correctly.

The I2S source can be configured for a 48kHz or 96kHz sample rate.

MCLK = 24.576MHz (regardless of sample rate selected)
LRCLK = 1 during right channel, 0 during left channel
SCLK = bit clock, 1.536MHz at 48kHz sample rate, 3.072MHz at 96kHz sample rate
DATA = 16 bits per channel

I have worked out the following parameters for using SCLK as the clock source and ignoring MCLK:

R=8
P=1
K=8.0    J=8    D=0
DAC Fs = Fsref/1   ??? (seems the higher values are used to eliminate noise at low sample rates so is this correct for my application?)
Use DAC_CLKIN to select PLLDIV_OUT

Apparently PLLCLK_IN / P needs to be >=2MHz and <=20MHz so BCLK PLL can't actually be done at 48kHz as this value would only be 1.536MHz - seems a bit pointless given the popularity of that sample rate, but 96kHz would be in that range so I will use that sample rate initially. Or do I understand that incorrectly?

Then in the register map, I noticed a register for PLL Clock Divider N Value (register 102)
It's not mentioned anywhere else in the datasheet and not in the PLL block diagram. What is this? Does this mean the /8 divider is not fixed? Maybe this should be set to 8?

I've come up with the following data to write

<slave address h18>, <register address h00>, h00, h80, h00, h81, h20, h00, h00, h0a, h00, h04, h00, h08, h00, h17, hc0, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, hc0, h04, h00, hc0, h00, h9c, h00, h00, h00, h80, h00, h00, h80, h0d, h00, h00, h80, h00, h00, h00, h00, h0d, h00, h00, h00, h00, h00, h80, h0d, h00, h00, h00, h80, h00, h80, h0d, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h28

As that didn't work, I decided to try dividing MCLK instead.

Option 2 - MCLK divider at 48kHz or 96kHz sample rate
PLL can be disabled as MCLK only needs to be divided by 8
Q = 16 for 48kHz or 8 for 96kHz
Use DAC_CLKIN to select CLKDIV_OUT

<slave address h18>, <register address h00>, h00, h80, h00, h41, h20, h00, h00, h0a, h00, h04, h00, h08, h00, h17, hc0, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, hc0, h04, h00, hc0, h00, h9c, h00, h00, h00, h80, h00, h00, h80, h0d, h00, h00, h80, h00, h00, h00, h00, h0d, h00, h00, h00, h00, h00, h80, h0d, h00, h00, h00, h80, h00, h80, h0d, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h01, h28

Still no sound

There's a few other things I'm not sure about. How should these be set?:
Routing to HPRCOM?
Output common mode voltage?
DAC bypass - enabled or disabled? Assumed disabled

At the moment, the speakers are connected to the + and - terminals of J12 and J13 of the evaluation kit. Eventually it will be desired to have a headphone jack so what configuration will I need for that?

  • Hi Nick,

    Try changing the slave address to h30 for the writes, this appends a write bit 0 to the 7 bit I2C address 0011000. I have directed this thread to our DAC expert if further assistance is needed. 

    Best,

    Garret

  • Hi Garret,

    Thanks for the suggestion.

    h18 is correct for the system I'm using to write the data (Digilent Digital Discovery + Waveforms software); the output console shows that the read/write bit is appended automatically ("Start, h30 [ h18 | WR ]") and that the entire data transfer is accepted by the slave. Changing the address in the address box results in a NACK.

  • I've been over my register map carefully and noticed a mistake with one of the channel's configurations so the updated configuration data for option 1 (96kHz, using BCLK) is now:

    h00, h80, h00, h81, h20, h00, h00, h0a, h00, h04, h00, h08, h00, h17, hc0, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, hc0, h04, h00, hc0, h00, h9c, h00, h00, h00, h00, h80, h00, h00, h00, h0d, h00, h00, h80, h00, h00, h00, h0d, h00, h00, h00, h00, h00, h80, h0d, h00, h00, h00, h80, h00, h80, h0d, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h28

    In any case, the other channel should have still worked, and this didn't fix the problem.

    I read back all the bytes to validate the data and this is what I read back:

    h00, h00, h00, h81, h20, h00, h00, h0A, h00, h04, h00, h08, h00, h17, hC0, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h02, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, hC0, h04, h00, hC0, h00, h9C, h00, h00, h00, h00, h80, h00, h00, h00, h0F, h00, h00, h80, h00, h00, h00, h0F, h00, h00, h00, h00, h00, h80, h0F, h00, h00, h00, h80, h00, h80, h0F, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, h00, hC6, h0C, h00, h00, h00, h00, h00, h00, h28, 

    Most notable is the following bit in Registers 51,58,65,72 - Not all programmed gains to HPLOUT/HPLCOM/HPROUT/HPRCOM have been applied yet

    I didn't see a byte I had to write to make it apply the programmed gains, so does that bit mean that the PLL/DAC clock isn't configured correctly or syncing? There doesn't seem to be any PLL status register, which would have been helpful.

    Status bytes starting at address decimal 94 are: hC6, h0C, h00, h00

    Edit: With the register map shown above, I am currently getting very distorted audio out of the left speaker and reasonbly good audio out of the right speaker.

  • Hello Nick,

    The values of your I2S clk and PLL coefficients are okay and I did not see any issue with them. The fact that right audio works fine but left speaker is distorted might be pointing to the a large gain on left channel. So either you can debug the code you have or start from a working code and then make modifications. I personally prefer to work from a known state and do modification on a working script rather than find the issue with a script.

    Here is a link to few different working scripts for this device.

    example scripts (FAQ)  :

     https://e2e.ti.com/support/audio-group/audio/f/audio-forum/826372/faq-tlv320dac32-example-scripts-and-unused-i-o-pins-connection-tips 

    You can find the following link with its scripts useful as well.

    https://e2e.ti.com/support/audio-group/audio/f/audio-forum/735306/tlv320dac32-tlv320dac32-gui/2714588#2714588

    I hope this will help you to resolve the issue, if not let me know.

    Regards,

    Arash

  • Hi Arash,

    Thank you for the links. The stereo single-ended example in the second link was useful for reconfiguring the chip for headphone output. The differential example looked the same as what I was using already.

    I turned the gain down a bit (both digital volume control and output stage) but there was no improvement to the noise. Also, with the headphones it was possible to hear the audio more clearly than with the speakers, and that revealed that the audio coming out of the right channel is in fact not fine, it's just that it's a lot less noisy than the audio coming out of the left channel. There is no noise during silent parts of the source audio, but as soon as there's any sound even a quiet sound, it will be noisy.

    I was trying different values for register 2 (only doing a single byte write) and the audio went silent. Ever since that happened, the board has produced no audio even after a power cycle and writing the register map that previously worked but had noisy output. The signal integrity on the DSO doesn't look great so I'll try shorter wiring if the DAC board comes back to life tomorrow.

  • Hi Nick,

    Arash was out of office today and can review your response tomorrow.

    Best,

    Garret

  • The board is working again so I was able to continue testing it. I think the cause of it being seemingly dead yesterday was the Digital Discovery needing a reboot.

    The I2S wiring was the issue. The rise time of WCLK was too slow which was probably messing up the order of the data bits. With this resolved, the noise is eliminated and the sound quality is great out of both speakers and out of the headphones.

  • That is great. Thanks for the update.

    Regards,

    Arash