TPA3122D2N Solderless Breadboard

Well, mixed success it is! The new boards are here and populated. The SD card now works perfectly - good news. But I wish I'd built the rest of the board anyway; it turns out I have two new problems.

Problem 1: One of the connectors for the DAC is upside down. Very annoying as there's nothing I can do about it. I've wired it up with jumper wires, but I'll need to rev the board to fix it.

Problem 2: This is the big one. Most of the PCB is under the speaker canals and has a maximum height of 12mm. Not many components come in under 12mm - just resistors, ceramic/film capacitors and DIP packages really. Large caps, regulators, heatsinks, connectors, diode bridges - none of these will fit. Anything over 12mm must be crammed into the back of the unit or the lid won't fit. I measured this wrong (the cavity is a very odd shape) and so the lid isn't even close to fitting. As such, I need to completely rearrange the PCB to make it fit.

On top of that, something odd happened while testing, I set a pin low on the ESP32 after a firmware update and somehow it's now shorting the 3.3v rail to ground on boot. I changed the pin state to the amplifier. The pins are supposed to be TTL safe so I don't know how it could have damaged the ESP32 but that certainly seems to be the case. Since everything worked fine before the change, I can only assume it's the ESP32 that's somehow damaged. Because of the short, I can't reprogram the ESP32 since it won't boot due to the short. Very frustrating!
 
Member
Joined 2015
Paid Member
Hi,
sorry to read that.


I’m not sure to get your issue, what did happen? to which pin ?
If you have trouble with the size and heat dissipation of PSU, you should move to a switching one :
Replace 7805 by either a LM2596 on your pcb or on a Ali/Ebay module : Module d'alimentation Ultra petit LM2596, BUCK cc/cc 3A reglable buck module regulateur ultra LM2596S interrupteur 24V 12V 5V 3V | AliExpress
or better use a more modern chip such as LM14010, it costs nothing at LCSC. It provide a clean 5V and run much faster than the LM2596 : 700kHz vs 150kHz.
Picture are diagram and PCB. For 5V values of R11 and R12 should be tuned.


Diode bridge pin could be folded or you can use low profile ones (square / flat)


Chris
 

Attachments

  • LMR_PCB.jpg
    LMR_PCB.jpg
    317.8 KB · Views: 152
  • LMR14010.jpg
    LMR14010.jpg
    84.5 KB · Views: 145
Last edited:
Thanks Chris,

Here's my updated PCB design. That large heatsink at the back (this is the only location with good airflow) is for the reg. Even still, I'm not sure it'll be enough once the display starts drawing power!
0YzL4Cs.png


Because of this, I was thinking the same (switching reg) and was already building a board around a switching reg. I was actually considering the LT1376 which comes in a 8-DIP and requires few external components. It's rated for 1.5A@5V and switches at 500kHz. I haven't done much with switching regulators until now, other than a small step-up for my Hypnic power controller.

I couldn't find the LM14010 you referred to - is that a typo?

Good idea on the bridges, that would certainly save some space.

The pins I changed were GPIO4, 25, 32 and 33. None of these have special purposes (except IO4, which is used for debug message output). I'm away from home at the moment, when I get back I'll replace the ESP32 with a blank one (oh, such fun) and see if that fixes it. It's very odd.
 
Last edited:
That is cheap, and for a switcher the application seems pretty simple. My only reservation is that it's only rated for 1A. Since the ESP32 and display can (potentially) draw 500mA between them (OK, that's the display with all pixels on and the ESP32 transmitting WiFi) that doesn't leave a lot for the SD card, ATTiny, passive components, DAC, etc. Especially since the 3.3V regulator will be running from this supply, further reducing efficiency. The LM2596 is 3A and the LT1376 is 1.5A. These may end up being more suitable simply due to power draw.
 
Well I got to the bottom of that. EBCASO (Error Between Chair And Soldering Iron). I had some solder paste that didn't melt under the ESP32 - at some point, it just spread across multiple pins I guess and shorted the board.

But good news, with that fixed, it turns out the board works just fine - the amplifier section works perfectly. Bonus, I discovered the PCM5012A DAC supports a gain setting - effectively volume control. This means I can remove the digital potentiometer as I don't need it, simplifying things a little.

The schematic is largely unchanged, except for the removed pot and the new 5V regulator (I went with the LMR14020 - the big brother of the LMR14010)
YJZlgl7.png


However, with the newly understood space constraints I've had to modify the design significantly. My dream of through-hole components is now largely gone. The entire MCU section and both the 5V and 3.3V regs are all surface mount so they can fit in the main body where height is an issue (12mm max height), as well as some of the amplifier sections - although these are for footprint reasons. Space is very tight and the DAC consumes a significant amount of the available space.
cK9D9Kj.png

eY5fLDr.png


It's so frustrating to bump into so many tiny mistakes, but today I heard music from the speakers for the first time... so that's put me in a good mood and now I'm ready to get started again!
 
Good catch! I can't believe I missed that... that would have cost me a fortune, thanks for spotting that.

So, latest PCB to go into production (probably later today). The placement of the DAC module is a pain, so I've decided to go all-in with bringing the PCM5102 onto the PCB instead of using an off-the-shelf component. I will admit I've not soldered a TSSOP package before, so the PCM5102 will be a little adventure. I have a hot-air reflow station but this is my first time working on something so tiny!

xr29uAT.png

MJ8ysPI.png

GuTdY1G.png


As for current progress:
dfGQUSK.jpg

TSnAkqC.jpg

It's not much to look at yet! Obviously I'll need the new PCB before I can pop the lid on so that'll be a while yet. Other than that, things are progressing on a software front - I have the display working (although it's basic) and the player plays a track encoded on an NFC tag. It can also write the NFC tags. I'll need a menu option of some sort to make that work - it would be good if you could upload tracks over WiFi directly to the SD card then trigger a tag write - I need to see if that's possible.

The buttons are the biggest challenge, but work on that is progressing. For that I have another PCB on the front of the device that includes an ATTiny 461 that works as an i2c slave to the ESP32 and raises and interrupt when one (or more) buttons are pressed.
 
Member
Joined 2015
Paid Member
Very impressive, perfect fit, soon in 3D !
That’s a great revamping!
To solder a TSSOP with a hot air gun is really feasible, you’ll also need some braid and eventually flux when it becomes necessary to do some rework or chase for unsoldered pins or excess of solder.
 
I can't tell you how much time I spent getting the board right. My arm went dead holding it up to the display... but it's pretty much dead on compared with the old board! I had to get things like the power connector and the transformer mount in exactly the right place too. The front-panel board wasn't easy either as it has specific mounting points and a very odd shape and the connector for the button module has to be in exactly the right place.

A little more soldering and I've got the front panel board connected for the first time. I'm glad I did. It turs out the display I'm using has the pins both rear-mounted and upside down. Very odd. Because of that, the display won't mount onto the PCB so I have more wires... but hey, at least it works! I've ordered a replacement board with the connector around the right way - it'll arrive with the new mainboard.

On the plus side, I could finally wire everything up. It sure isn't pretty, but it does work...

Imgur: The magic of the Internet

Thanks for the encouragement on the TSSOP. Of course, now I have the board ordered I can't find a PCM5102A in stock anywhere, so I've had to order a pre-bult module and I'll remove the IC from it
 
Well things are going from bad to worse. At least my last design worked!

I've put together the SMT board - the new regulators are working well, I added the ESP32 and flashed it with no issues - got the display working, too.

Then I added the PCM5102 and it's all gone wrong! First of all, the ESP32 wouldn't flash - after much investigation, it seems the serial output is garbled. My best guess here was that during soldering it to the board, I'd overheated it. The I2C lines were playing up too, so that makes sense.

I decided to remove the ESP32 and try out the PCM5102 as a standalone DAC - plugging in my old board as the source and amplifier - turning my new board into a very large DAC. When I powered it on there was a load of noise (static) and pretty much nothing else. Fiddling around with the pins, I get some sound (with a lot of static) when the DAC data line is connected but nothing else is. Even with the DAC configured for MUTE it doesn't really make much difference - still that static.

This leaves two possibilities right now:
  • The power supply is too noisy. But it would have to be REALLY noisy to stop the ESP32 from flashing - and it worked perfectly before I put the PCM5102 on. Which leads me to #2...
  • The PCM5102 is either faulty or has a short. It was surprisingly easy to solder, and electrical law #1 is that if it was really easy, it's probably wrong somewhere. This possibility is especially annoying, since it means I removed a perfectly working ESP32 WROOM module...

The second makes the most sense. If the DAC is messing with the power and/or ground lines (especially the ground line) this would mess with serial and the i2c connections as well as lead to some pretty nasty static. Therefore, this is my best guess as to what is wrong. The problem is that to troubleshoot this, I'll have to remove the PCM5102 and then have to try to put it back again later.
 
Member
Joined 2015
Paid Member
It is very unlikely PCM5102 has an incidence on ESP behavior, check for solder issue, such as shorts or solder drops on the board.


If I understand correctly, you are currently testing you last rev board, with the PCM5102 but without the ESP. I2S signals are fed by an external source and you have garbage sound. This may come from wiring issue between your source and your target board. Ensure wires are short, grounding ok and both devices (I2S source and your board) have same VDD value: 3.3V.

You can try some basics tests:

  • first, short L3. C31 and C33 are supposed to be ecap not MLCC (see DS.), shorting L3 will get rid of any major oscillation risk on the supply rail.

  • Measure VDD on the chip pins, should be 3.3V

  • Then check for the charge pump to operate: you should get close to -3.3V on Vneg (p5).
If KO, remove PCM, clean board and solder it back. Chip are often more resistant to heat than we believe. If still KO, try another PCM.

Chris
 
Thanks Chris,

I just removed the PCM5012 to try something else but it seems there's something very wrong with this board:
  • I can't get i2c working - I've even tried using different pins and all I ever get are messages from the ESP32 telling me that SDA/SCL are in the wrong state.
    [*}The onboard DAC is very "staticy"
  • Even when I've stripped everything off and added the external DAC it still won't produce any sound.

    The only thing that works reliably is the SPI display, although I have no idea why that's the case.

    The two common things are the ESP32 (which I liberated from another PCB) and the power supply. A *very* noisy power supply / ground rail could do this but I don't have an oscilloscope to check that. I've checked and double-checked the application notes for the LMR14020 and the LM1117T and both schematics are correct from what I can tell.

    At this point I'm at a loss; either the power supply design is bad somewhere or the PCB is a dud, I guess. I do have spare boards; I could try moving the components (again) although I'm not sure if the ESP32 will tolerate another move!
 
OK, I think I've figured it out.

After re-measuring everything, I've realized that the input voltage to the LMR is nearly 20V - much higher than expected and the circuit is off because of that. Switching regs are fairly sensitive to input voltages and require different components to offset output ripple - I suspect the ripple is pretty high on my output. This also makes sense as the PN532 NFC sensor is very sensitive to ripple and it's likely that's what's causing it to malfunction (i2c). This would also explain the noise on the I2S lines.
 
It is very unlikely PCM5102 has an incidence on ESP behavior, check for solder issue, such as shorts or solder drops on the board.
You were absolutely right...

If I understand correctly, you are currently testing you last rev board, with the PCM5102 but without the ESP. I2S signals are fed by an external source and you have garbage sound. This may come from wiring issue between your source and your target board. Ensure wires are short, grounding ok and both devices (I2S source and your board) have same VDD value: 3.3V.
Yes, this basic setup was working on my first prototype (the one with the linear regs that doesn't fit in the enclosure)

You can try some basics tests:

  • first, short L3. C31 and C33 are supposed to be ecap not MLCC (see DS.), shorting L3 will get rid of any major oscillation risk on the supply rail.

  • Measure VDD on the chip pins, should be 3.3V

  • Then check for the charge pump to operate: you should get close to -3.3V on Vneg (p5).
If KO, remove PCM, clean board and solder it back. Chip are often more resistant to heat than we believe. If still KO, try another PCM.
Chris
I re-added the PCM and measured all was as you said. The caps are recommended as eCaps, but most implementations use MLCC, largely for cost/footprint reasons. As far as I can gather, it will work fine with MLCCs but probably sound a little better with eCaps. Since I'm using a not-fantastic-sounding Bose radio, the pinnacle of sound quality of isn't my primary concern :)

Ultimately, I believe the DAC actually works fine. The very poor quality / quiet output was likely due to a combination of factors: XSMT not being pulled high or, more likely, I had BCK and LRCK backward. I've noticed this behavior on my DAC module as well.

No wonder the LM7805 was so hot - with a 20V input, it cannot run the ESP with wifi on without going into thermal shutdown. The transformer itself also gets pretty hot since the LM is drawing so much power - I doubt this output on the transformer was designed to provide so much current - only the 12V rail for the amplifier was. I've not been able to find any metrics on the transformer, but that's my best guess. I can only hope that a more efficient switching regulator will be (significantly) more efficient and the transformer won't get so hot...
 
A bit of an update.

Honestly, I'm not sure what was wrong with the last set of boards. I know what's wrong with the new ones, but I'll get to that in a minute. I've ordered a new set of PCBs, now based on the ADP2303 series switching regulator - keeping my PCM5102 schematic intact after triple-checking it.

The new PCBs are here, but the parts are not. I can't really build anything useful just yet, but I did decide to have another stab at the PCM5102 section of the board. I soldered on the various capacitors and the IC and supplied ground and 3v3 from the first prototype board I've been developing on. I switched the connections from the little DAC module to my main board and held my breath. I powered it on and there was a soft click. So far, so good. I swiped a card and... music! My DAC section works perfectly, at long last.

So, that's the good news, part 1.

Part 2 is that I've finished work on the button controller for the top panel. I've used an ATtiny861 on a breadboard to control the buttons and act as an I2C slave to the ESP32. For testing, it's connected to an ESP32 devkit. Using the ATtiny (instead of an IC) allows me to not only scan the buttons, but also send an interrupt to the ESP32 saying some button was pressed. Then, when the ESP32 requests, the ATtiny responds with this/these button(s) were pressed rather than raw button presses. It handles debounce and only notifies the ESP32 when one (or more) buttons are released. All the code is in a GitHub repo with a reasonable readme.

So, that's all the major components working, right? Well, sort of...

I popped the ATTiny into the front panel PCB and pretty much everything stopped working. The display was fine, but cards wouldn't register and the buttons wouldn't work. After quite some debugging, it turns out the ATtiny works fine and the NFC card reader work fine... but not at the same time. It appears to be a known issue with the PN532 on an ESP32 using I2C - it won't share the bus. This has left me with a few options:
  • Put the button controller on SPI
  • Put the PN532 on SPI (where it will behave)
  • Add a second I2C bus
All options will require me to respin both the front panel board and the main board. So, the day the new PCBs arrived, I discovered they were already obsolete...

I've decided to swap the PN532 to SPI. It's the least disruptive change but now the SPI bus is going to be fairly busy. It has to read from the SD card, write to the display and read/write from the PN532. The good news is that while the SD card is pretty intensive (during playback), writing to the display is done very rarely and the PN532 will only use the SPI bus when a card is present (it's IRQ-based - thanks to me! I had to modify the driver libraries to enable shared SPI-bus support and IRQ support - I've pushed the changes upstream).

Now I'm waiting for the ADP parts to arrive so I can assemble the board's basic components and test them. I'm not ordering any more PCBs or parts until I know it all works!

I'm working on getting my (backlog) and log into a hackaday project - you can follow it here if you like. It's a little behind, but I'm getting there!
Bose AWR-1W Restomod | Hackaday.io
 
OK, so this is my penultimate PCB, partially built (which is how it will stay...)

MeZ0oMs.jpg


This is it compared with the "old" prototype.

01r8Zcn.jpg


The green board on the left is the old prototype - you can tell by the heatsinks for the two LDOs. This board also has the amplifier stage built.

The blue board on the right is the new(er) board. It features the ADP2303 switching regulator and an SMT LDO for the 3.3V rail. The amplifier isn't built since this board has the I2C issue - I've ordered a new set of boards but they're still in production.

The compare between the two is nice, it shows how much more compact everything is with the PCM5102A on the PCB and the switching regulator as well.

Oh, and it fits in the radio case now! I've screwed the whole thing together and it looks like new. Well, old, because it's beige... but it was the 90's...
 
So Close...

I finally have the whole thing working - which is awesome, but it sounds pretty terrible! A ton of research last night made me realize my mistake(s), which are coming back to haunt me. I really must learn to read datasheets thoroughly.

  • After careful measurement, the left speaker is 4Ohms and the right speaker is 8Ohms. That's fine for the old class-AB that was in the old PCB, but Class-D requires a little more tuning on the output for this setup
  • The output filter is wrong for the 4Ohm circuit (no low end)
  • The DC blocking cap wrong for the 8Ohm circuit (no low end)
  • The input capacitor I'm using is a film 1uF, but going through the datasheet, this can be much smaller - 0.15uF would be fine for my gain setting. The 1uF value isn't a disaster (this sets the frequency cuttoff to ~7Hz with a gain setting of 20), but the datasheet specifically calls out tantalum or ceramic caps for the input capacitors

I've also discovered that without a pull-down capacitor on the amp's shutdown circuit, when I put the ESP32 into deep sleep, the shutdown pin floats, so the ESP can only go into light sleep, not deep sleep. Muting the DAC is a bit of a pain - timing it is very difficult as it's dependent on the sample rate of the stream. Switching to muting the amp would make far more sense as it has a static duration for mute/unmute (100ms).

Finally, since I'm trying to get a little better sound from this amp (and my power supply is a fairly low 12V), I'm stepping up to the TPA3122's bigger brother the TPA3123. It's basically the same chip, but it's in a TSOP package and the ground plane requirements are a little different.

You'll notice on the new schematic that the output filters are different on the left and right channels, as are the DC blocking caps - this matches the different speaker impedance ratings. The input capacitors are now 0.15uF tantalum caps, and there are pull up/downs on the amplifier controls.

I'd really appreciate some feedback on everything, especially the ground planes. The amplifier's ground plane is on the bottom layer as recommended by TI. The rest of the ground plane is on the top layer. The two ground planes intersect at the ground pin of the bridge rectifier for the digital components (D1).
 

Attachments

  • Schematic_Bose Upferb_2021-08-05.png
    Schematic_Bose Upferb_2021-08-05.png
    933.2 KB · Views: 59
  • PCB_PCB_Bose Upferb_2021-08-05.png
    PCB_PCB_Bose Upferb_2021-08-05.png
    228.4 KB · Views: 60
A little extra detail on the components for the TPA3123:


The other caps are all MLCCs - high quality ones, especially for C11, C12, C13 and C14.

Thanks in advance for any suggestions / corrections
Phill