PAM8304 - Filterless Class D amplifier clicking output - Page 1
Forum section: electronics / projects

author: fantasy2
author_rank: Contributor
timestamp: January 29, 2016, 09:10:25 pm
content: Hi Guys,I'm trying to integrate a PAM8304 Class D amplifier with an ARM processor to generate audio output. I followed the datasheet on the design but no luck. With a very low input I manage to get dimmed sound but as soon as I crank up the volume, the speaker starts to "click" without giving any output.This is the design:I thought the problem was the input, but a PWM generated sine wave looks pretty good. After adding 200nF between the speaker leads I get a little bit more volume before it started clicking.There is probably a simple solution I'm missing but does anyone have an idea what I'm doing wrong here?

author: fantasy2
author_rank: Contributor
timestamp: January 30, 2016, 01:24:34 pm
content: Performed some more testing(I'm a complete noob at audio circuits):When replacing the 10nF ceramic caps with 1µF elco's, I do get a loud output for a few seconds before it stops(I guess charging of the elco's). When I remove the IN- capacitor and directly connect the resistor to ground and leave the 1µF cap at IN+ I do get sound but the speaker is running quite hot.What kind of noobish mistake am I making here?

author: oPossum
author_rank: Super Contributor
timestamp: January 31, 2016, 12:43:59 am
content: Quote from: fantasy2 on January 30, 2016, 01:24:34 pmPCB layout can cause some strange behavior.

author: Paul Price
author_rank: Super Contributor
timestamp: January 31, 2016, 10:42:16 pm
content: The PAM8406 sets maximum RF =142k, minimum RI =18k, so the maximum closed-gain is 24dB.For the 8304, RF=300kIn the case of the 8304, both Rin resistors should match in value and likely conform to the limits above.Make sure if you are polarizing any polarized electrolytic caps properly.Note that the reference design doesn't give any values for Rin.

author: fantasy2
author_rank: Contributor
timestamp: January 31, 2016, 11:16:00 pm
content: Quote from: oPossum on January 31, 2016, 12:43:59 amTried two completely different designs, both gave the same result.Quote from: Paul Price on January 31, 2016, 10:42:16 pmRf = 300k and I tried a 10k, 82k, 150k and 330k at Rin. I figured one had to give some result.. No luck. As input I used ceramic X7R caps.The only way for it to work now is remove the input caps(so one Rin=150k goes to ground directly, the other connected to the source). The source is decoupled with a 1µF cap.This does in fact work. but I expected much more volume from the speaker. It could be that I'm expecting too much as it is only a 34*40mm 4 Ohm speaker.At 4 meters distance, you can just hear what the voice is saying in a quiet room.It is still not as described in the example schematic and I don't understand why! When I analyse the output without speaker I get big short peaks as what I hear so the speaker load is not too big for the chip to handle or at least is not causing the issue.

author: Paul Price
author_rank: Super Contributor
timestamp: January 31, 2016, 11:19:02 pm
content: Gv = Closed-loop Gain VDD = 2.8V to 5V Gv = 300K/Rin V/V andboth resistors must be the same value.150k gives a gain of two, you might need Rin= something more like 20k.

author: fantasy2
author_rank: Contributor
timestamp: January 31, 2016, 11:25:42 pm
content: Quote from: Paul Price on January 31, 2016, 11:19:02 pmYes, that is what I did. Both are called RIN so I changed the resistors in pairs for testing. Otherwise of course you have a difference in the op-amp and the speaker will be pulled in one direction.QuoteThe input source is 1Vpp. With this small gain of only 2, shouldn't I at least hear something but very softly? I tried 10k(the development board uses 10k) as well and it just made it worse. I had to turn down the potmeter almost completely to get any sound.

author: Paul Price
author_rank: Super Contributor
timestamp: January 31, 2016, 11:26:41 pm
content: What do you measure in P-P at the junction of Rin- input Cap?Try using a larger bypass capacitor from Vdd to ground and keep leads short.Also try connecting a .1uf in series with a 4.7 ohm resistor across the speaker outputs.You've posted: "When replacing the 10nF ceramic caps with 1µF elco's, I do get a loud output for a few seconds."When polarized capacitors are used the positive side of the capacitor should face the amplifier input in mostapplications as the DC level is held at VDD/2, which is likely higher than the source DC level. Please note that it is important to confirm the capacitor polarity in the application.10nF caps are much too small if Rin = 20k.Are you getting Vdd/2 at the input pins? Output Pins? Is the chip overheating? Do you see high freq. residual PWM noise at the input-cap-res junction?Finally, scope or measure the Vdd during operation, the instantaneous current may be overloading your P/S.Did you scope the output..(assumes you have scope!)Is Sound En pin > 2.8 V?

author: fantasy2
author_rank: Contributor
timestamp: February 12, 2016, 02:59:27 pm
content: Quote from: Paul Price on January 31, 2016, 11:26:41 pmHi Paul,Thanks for your extensive response. Unfortunately I was caught my a flu not being able to test anything out.I soldered a new board and used 100nF ceramic caps and 22k at both input stages.The enable pin is pulled to Vcc(5Volt) with a 10k Ohm resistor and there is a 1µF ceramic cap and a 1000µF elco close to the supply.I do measure 2.5 Volt (1/2Vcc) at the input stages which is good. Input is about 1Volt P-P single ended.On the output pins I measure 0.9Volt referenced to ground.I still do not get any sound output!One thing I noticed that is different from the reference design is that I routed VDD and PVDD together to the power supply. The application note separates them.

author: Kalvin
author_rank: Super Contributor
timestamp: February 12, 2016, 03:59:36 pm
content: Have you tried adding a capacitor (for example 10uF) in series with the speaker? That will block the DC path through the speaker and will help if the chip is running hot.

author: fantasy2
author_rank: Contributor
timestamp: February 12, 2016, 04:26:05 pm
content: Yes I tried that but no luck. Using the correct schematic the speaker doesn't get hot: the outputs don't seem to pull the speaker in any direction.

author: Paul Price
author_rank: Super Contributor
timestamp: February 12, 2016, 08:11:48 pm
content: From what you describe, especially with no output, this strongly suggests a miswiring of the circuit or chip. Any chance you've made a mistake here?Although some chips are a little sensitive to layout than would be desired, it should be too hard to get this simple circuit to work.(1) is the partnum correct?(2) Is the chip orientated(not reversed nserted?)(3) Do you have a bad chip (unlikely.).Maybe take a pic and post the front and back of your PCB or breadboard to allow someone else's eye to spot an error?Check each part (i.e.is your speaker fried and shorted-outand produces no sound, have you a 1meg where a 1k resistor is required..etc.)

author: fantasy2
author_rank: Contributor
timestamp: February 12, 2016, 10:44:39 pm
content: Well, I don't get any output when I follow all the directions you and the datasheet gave. When I change some stuff(like removing the cap at the IN-) it does give me an output and the speaker is pulled into a certain direction.I fried one or two by doing this. None of those chips gave any bias voltage at the input afterwards. The one I have fresh on the board still does give the 1/2Vcc(and more important I didn't abuse it yet!).Here is the board:Datasheet pinout:

author: Paul Price
author_rank: Super Contributor
timestamp: February 12, 2016, 11:00:12 pm
content: Your PCB layout for the enable/Shutdown pin shows the pin connects to a via and not anything else???EN/SD should be tied to Vdd +5

author: fantasy2
author_rank: Contributor
timestamp: February 12, 2016, 11:05:56 pm
content: Quote from: Paul Price on February 12, 2016, 11:00:12 pmNo, the "enable" is connected further down to a microcontroller, I verified that it is working at the via under the chip.Same goes for the +input. But at that pad I now connected a real audio source instead of one generated by a microcontrollerJust cut some bits off that are not relevant/for the sake of simplicity.When I change EN/SD from ground pulled to 5Volt you see the chip waking up by making the inputs 1/2Vcc.

author: Paul Price
author_rank: Super Contributor
timestamp: February 12, 2016, 11:14:59 pm
content: You are saying you can see that EN/SD is being held at ~5V by the MCU and you can see an input audio signal?The view you are showing of the PCB is top view and the chip is being mounted SMD top?No solder bridges?If so, the only possibility left is you have a bad chip.

author: fantasy2
author_rank: Contributor
timestamp: February 12, 2016, 11:19:58 pm
content: Correct. I can see all that.It is indeed the top view. Red = top layer; Blue = bottom layer.If the chip is bad, I have 4 bad chips from two different badges. That's why it is so confusing to me. I don't see what I am doing wrong.There are no solder bridges under the microscope.

author: Paul Price
author_rank: Super Contributor
timestamp: February 12, 2016, 11:26:20 pm
content: Have you cleaned your PCB and checked with an ohmmeter for leakage/solder bridges between pins?

author: Paul Price
author_rank: Super Contributor
timestamp: February 12, 2016, 11:29:42 pm
content: Have you bought your badges from Short-Circuit Chip Supply?

author: fantasy2
author_rank: Contributor
timestamp: February 12, 2016, 11:34:42 pm
content: Quote from: Paul Price on February 12, 2016, 11:26:20 pmYes I did.Quote from: Paul Price on February 12, 2016, 11:29:42 pmDirectly from Mouser which is an official distributor.I'm still not sure about that gain setting. Some last thing to check:- Input is 1Volt P-P- Output is 5Volt(Vcc)The datasheet describes the closed loop gain as 300k/Rin in V/V(not Decibel !).This would suggest I need a Rin = ~60k Ohm and not 22k.

author: Paul Price
author_rank: Super Contributor
timestamp: February 12, 2016, 11:39:55 pm
content: The output should be 2.5V not 5V.Have you checked for leakage/bridges at all the IC pins?The gain set resistors are not the problem.

author: fantasy2
author_rank: Contributor
timestamp: February 12, 2016, 11:53:49 pm
content: I checked and all are OK. The boards are made by a professional shop. Measuring the traces of empty boards I don't find anything wrong with the boards either.If you're interested in sharing my frustrations I can send you a few chips..

author: Paul Price
author_rank: Super Contributor
timestamp: February 13, 2016, 12:01:35 am
content: If this is true then what you need is an exorcist, not an engineer for help.Please fill in the following form for the circuit powered up and fed an audible signa:Voltages/Waveform/DC-Level Chart to be filled outPin P-P WaveForm Scoped DC Level12345678

author: fantasy2
author_rank: Contributor
timestamp: February 13, 2016, 12:14:58 am
content: I have better equipment at work so will do these measurements in the course of the coming week.Thanks for all the help so far! Highly appreciated!

author: fantasy2
author_rank: Contributor
timestamp: February 26, 2016, 08:50:27 pm
content: Took some more effort to get the scope from work so I finally bought one.It seems there is no signal arriving at the input. Is my input resistor value still too high or the input too weak to pull the bias voltage at the inputs around?! Or do I perhaps have weird resistors?Channel 1(yellow) = Sine wave inputChannel 2(cyan) = pinSignal before positive input resistor:Pin 4(negative input) - Bias voltage is OK:Pin 5(positive input) - Bias voltage is OK but no waveform:Nothing!Pin 2 & 3(Supply 5Volt):

author: fantasy2
author_rank: Contributor
timestamp: February 28, 2016, 10:04:50 am
content: Someone explained me that this audioamplifier has a transimpedance opamp configuration meaning it responds to a current rather than a voltage.I thought the current might be too low for the amplifier to sense anything so I used a headphone output from a phone as input source for the amplifier.. Still no luck.With this new info, is there a trick I'm missing with these amplifiers?

author: Faranight
author_rank: Unknown
timestamp: December 22, 2021, 05:39:09 pm
content: Hey!I know this is an old topic, but it kinda fits the problem I'm having, so I was wondering, if this has been solved yet.I'm trying to design a small audio player (mono) for a certain application and I've decided to use thePAM8304class-D amplifier. I ordered like 10 pcs from Mouser and now I'm trying to get one to work. I've soldered it onto a breakout board that I can use in a breadboard, but I've been having this clicking issue as well. Basically I managed to get the audio from a small 8 ohm speaker with some reasonable volume, but that was only working at 3.3VDC supply voltage. When I increased the voltage to above like 3.5V the audio vanished and the speaker started emitting clicking noises (the max allowed supply voltage is 6V according to the datasheet).So I hooked up the amplifier outputs to my scope to find out what's going on. I noticed that when the supply voltage is at 3V3 I would get a square waveform with some distortions when audio is applied or simply pure square wave when there is silence. But as soon as I increased the supply voltage past 3.5V, the output was... acting weird. It seems as if the chip was going through a shutdown, poweron, shutdown, poweron, shutdown, poweron loop. The square waveform was there, then it disappeared (turned into DC), reappeared for a moment and disappeared again, etc. And each time this happened, a click was emitted through the speaker.I ended up removing the speaker and connecting a 1 kOhm resistor across the output instead. I also wired both input terminals via 100k resistors and 100nF capacitors to the GND terminal, which did not solve the issue. It did move the anomaly to a higher voltages i.e. I would get the square waveform on the outputs up to like 4.8V, but once I increased it to 5.0V, the weird poweron-shutdown cycle repeated. I had to lower the voltage down below 4.0V to get a stable waveform on the outputs. I even tried connecting one input directly to the other over a 100k resistor with no success. It seems the waveforms were stable at some point, but as soon as the inputs were disturbed (I only touched the insulated hookup wires on the inputs), the circuit started oscillating. No idea what's causing this. Power pins were decoupled via 1uF foil cap and two 100nF ceramic caps right next to the IC. The power leads on the breadboard had two 100uF 25V electrolytic caps.https://www.diodes.com/assets/Datasheets/PAM8304.pdfEDIT: In case anyone else is wondering, I solved it.It turns out it was a decoupling problem. I had initially soldered the PAM8304 over a small breakout board and then used that in a breadboard circuit to perform the tests before deciding to make a PCB. The decoupling caps were also inserted on the breadboard, but apparently that wasn't enough. What I ended up doing is soldering two additional ceramic 1uF X7R 0805 caps directly across the breakout board just above the PAM8304 chip with some wire. One was soldered across the Vdd pin to GND and the other from PVdd pin to GND. I'm still getting some minor ringing on the scope, but at least the darn thing is now functioning properly. I get decent audio while running it at 5VDC without any oscillations.