tonyp7 / TPA3128D2-Audio-Amplifier

A simple PCB for Texas Instrument's TPA3128D2 Stereo, 2x30W Class-D Amplifier
MIT License
7 stars 3 forks source link

TAS5805M format #1

Closed tjacobs closed 4 years ago

tjacobs commented 4 years ago

Hi Tony, sorry I couldn't find your email anywhere.

I'm using a TAS5805M, based on your recommendation of it, and all I'm getting is a big click sound from it.

I'm driving it with an ESP32-WROVER. I set it to 16-bit I2S, and play mode, and send it 16-bit I2S data, from https://github.com/earlephilhower/ESP8266Audio/blob/master/src/AudioOutputI2S.cpp#L61, but still just the speaker pops out for the duration of the sample, then returns. BTL mode. 13V. With ferrite filters. It can detect the chip via I2C just fine.

And I've driven an I2S DAC chip with the same code and heard audio just fine before: https://datasheets.maximintegrated.com/en/ds/MAX98357A-MAX98357B.pdf

I set the TAS5805M up with:

  i2c_write(0x2F, 3, 2); // Hi Z
  delay(10);
  i2c_write(0x2F, 0x33, 3); // 16-bit I2S
  delay(10);
  i2c_write(0x2F, 3, 3); // Play

Any ideas? Do you have any example code snippet to set it up?

Thanks, Tom

tonyp7 commented 4 years ago

This is not the right audio amp, I think you mean this one:

https://idyl.io/tas5805m-audio-amplifier-showcase/

I didnt publish PCB and code for this one and I can't find it back unfortunately. I don't remember you had to fiddle with the I2S setup though, just feed the codec I2S and good to go.

I used https://github.com/espressif/esp-idf/tree/master/examples/bluetooth/bluedroid/classic_bt/a2dp_sink for a BT player

tjacobs commented 4 years ago

Thanks for the reply - yes that seems to output I2S the same way I am: https://github.com/espressif/esp-idf/blob/master/examples/bluetooth/bluedroid/classic_bt/a2dp_sink/main/main.c#L59

I tried specifying 32-BLKs per frame via I2C as well, that didn't help either.

It still just either pops, or makes a high pitched buzzing sound on power-on. With two different chips.

Maybe something basic is wrong with the schematic? I based it on the ferrite example application schematic.

Screen Shot 2020-05-04 at 9 18 13 pm Screen Shot 2020-05-04 at 9 20 54 pm Screen Shot 2020-05-03 at 11 37 23 am

  out = new AudioOutputI2S();
  out->SetPinout(14, 27, 12); // int bclk, int wclk, int dout)
tonyp7 commented 4 years ago

I found the design file -- this is the layout I used

img

Somehow I doubt having the ferrite bead and not grounding the bottom pad would lead to no sound at all, but I am not sure :(

tonyp7 commented 4 years ago

You know what I saw that TI just released a newer revision (TAS5806M). I'll build a board and publish it properly this time :)

tjacobs commented 4 years ago

Thanks, still no sound. Tried a different data pin, still no sound. :(

tonyp7 commented 4 years ago

I found this interesting tidbit in the datasheet that might explains your issues:

12.1.2 Importance of PVDD Bypass Capacitor Placement on PVDD Network

Placing the bypassing and decoupling capacitors close to supply has long been understood in the industry. This applies to DVDD, AVDD and PVDD. However, the capacitors on the PVDD net for the TAS5806M device deserve special attention.

The small bypass capacitors on the PVDD lines of the DUT must be placed as close to the PVDD pins as possible. Not only dose placing these device far away from the pins increase the electromagnetic interference in the system, but doing so can also negatively affect the reliability of the device. Placement of these components too far from the TAS5806M device can cause ringing on the output pins that can cause the voltage on the output pin to exceed the maximum allowable ratings shown in the Absolute Maximum Ratings table, damaging the deice . For that reason, the capacitors on the PVDD net must be no further away from their associated PVDD pins than what is shown in the example layouts in the Layout Example section.

In the meantime I have created https://github.com/tonyp7/TAS5806M-Audio-Amplifier and have sent the board for manufacturing.

tjacobs commented 4 years ago

Nice! Would love to buy one of these from you if you have one available!

Thinking of wiring up one of these which looks pretty similar: http://www.ti.com/lit/ds/symlink/tas5727.pdf?HQS=TI-null-null-digikeymode-df-pf-null-wwe&ts=1589049882162

tonyp7 commented 4 years ago

I wouldn’t recommend it. This is an older chip that requires more components which have now been integrated in the 05M/06M and might be even more finicky to setup. I tried one of the older chip (TAS5733L) and got the same symptoms that you have: no sound and sometimes some pop and wouldn’t want to be bitten again.

The 06M has no more MCLK input for instance, and that’s a strong proof that TI is simplifying their designs to their best of their abilities.

I’ve bought enough components to make 3 boards so I’ll be happy to ship one over to you if it works and everything comes through well enough!

tonyp7 commented 4 years ago

I received the PCBs today -- assembled one board and it's working!

Btw I confirm that I'm just doing this:

ESP_LOGI("I2C", "Setting to HI Z");
ESP_ERROR_CHECK(tas5806m_write_byte(0x03, 0x02));
vTaskDelay(100 / portTICK_RATE_MS);
ESP_LOGI("I2C", "Setting to PLAY");
ESP_ERROR_CHECK(tas5806m_write_byte(0x03, 0x03));

There's nothing else on the I2C part, don't try to manually setup clocks and format, the chip should autodetect. I had no sound at first but I checked registered 70h and it read 0x04 clock fault. I changed the crappy jumper wires for proper wire wrapping and it worked like a charm! Maybe if you're using jumper they could be the cause of your issue.

Another thing is that there is a bit of code involved to make sure I setup the chip only after I2S is stable, as TI recommends. So there's a mutex that gets released once the sound starts, and that triggers the I2C setup.

I need to clean up the code but I'll upload it once it's less of a proof of concept mess.

tjacobs commented 4 years ago

Wow! I finally got it working!

It turns out I think the ESP32 wasn't connected to wifi, so loop() was never running. So silly.

tonyp7 commented 4 years ago

Great to hear; it's an amazing amp ;-)

I'm closing this issue and you can follow https://github.com/tonyp7/TAS5806M-Audio-Amplifier/ for further progress!