MCU - 100nf cap to GND before and/or after the inductor AVCC pin - Page 1
Forum section: electronics / general

author: Psi
author_rank: Super Contributor
timestamp: May 19, 2022, 06:16:03 am
content: I've had some AVR's blow up and I have a suspicion as to why.Currently there's a 10uH inductor feeding VCC into the AVCC pin (VCC for ADC)There's a 100nF cap to GND on the VCC side of the inductor but not on the MCU side. The inductor connects directly to the AVCC pinCould this be resonating and created a high voltage spike on the AVCC pin at turn-on which is damaging the mcu?

author: daqq
author_rank: Super Contributor
timestamp: May 19, 2022, 06:28:19 am
content: Makes sense, if nothing else this should give bad performance from the ADC. There's a cap there recommended AFTER the inductor in any case, seehttps://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-7810-Automotive-Microcontrollers-ATmega328P_Datasheet.pdf, page 213.

author: Psi
author_rank: Super Contributor
timestamp: May 19, 2022, 06:55:15 am
content: yeah, i think I was just an idiot and forgot to add it.

author: Kleinstein
author_rank: Super Contributor
timestamp: May 19, 2022, 07:19:55 am
content: There should be a cap directly at the AVCC pin. The inductor is optional and may better be a ferrite "bead", so an inductor with damping. In some cases also a resistor (e.g. 10 ohm) instead of the inductor is good, especially if there is no significant load to the AVCC powered pins.

author: tom66
author_rank: Super Contributor
timestamp: May 19, 2022, 07:29:42 am
content: The purpose of decoupling capacitors is to counter the inductive PCB tracks and planes, which would reduce the energy available to the MCU at high switching frequencies. Placing the inductor there is almost the opposite of what you want to do.Now, an analog pin is likely to have less switching current on it, but it will probably still have some. The correct solution is to use a Pi network of C-L-C components, with a small value cap right next to the MCU pins, fed by a series L or FB, with another cap to GND on the other side. In some designs I've seen a resistor of 10-22 ohms in series as well: the current drawn by the pin is quite minimal, so this works to add further high-frequency filtering (using the 'R' and 'C' as a simple lowpass.)

author: T3sl4co1l
author_rank: Super Contributor
timestamp: May 19, 2022, 12:22:29 pm
content: And obviously the cap should have 10 ohms ESR, or be parallel connected with a somewhat larger (>0.3uF) cap of same ESR.A ferrite bead is safer than 10uH, without the ESR, as its own inductance and ESR are fairly modest. They do tend to ring at such low frequencies (i.e. underdamped; at low frequencies, a say 100R FB is typically around 1uH with a Q in the single digits), just not as bad.Note that the same is true of hot-plugging transients, if all you have onboard is ceramic and the power leads are long (which, relative to the quite low ESR of ceramics, could be just some 10cm of lead length, really). An electrolytic "bulk" cap is recommended.Tim

author: Siwastaja
author_rank: Super Contributor
timestamp: May 19, 2022, 12:52:01 pm
content: For a safe and robust design, use an AC-lossy inductor (say, ferrite bead), or a non-lossy inductor with parallel resistor (maybe a few hundred ohms). After this inductor, use a tantalum like 2.2uF to 4.7uF, and in parallel with this tantalum, just at the IO pin, put that tiny 100nF MLCC in small package.Said solution damps oscillations by providing AC loss in both the inductor, and the capacitor (the tantalum, with very well controlled ESR), and the 100nF capacitor provides minimum possible ESL right at the power pin.Though, the analog performance of the AVR sucks anyway. Try first without any inductor. Just the 100nF at each power pin, and AVDD directly tied to VDD.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: May 19, 2022, 01:30:39 pm
content: Quote from: Siwastaja on May 19, 2022, 12:52:01 pmYep, real point is this. The old MEGAs with 10 bit ADC, I mean they're so crunchy you can select bit-exact readings with a potentiometer and only a little patience. Supply doesn't have to be anything special, a linear regulator will do. Maybe you'd want a bit extra filtering from a switching regulator, that's easy enough to arrange -- and for the whole thing, not just the analog section.Indeed, filtering just AVCC (and thus AREF, presumably) could be worse for some applications, like where you're reading a bunch of pots, thermistors, or other ratiometric sources. These should all vary in concert with the source, and running them from VDD without filtering, or from VDD or an external VREF while using the internal VREF as AREF, gives poorer results than running them all together. But again, out of 10 bits, it's not hard to achieve reliable results despite that.Even on the nicer AVRs (XMEGA and AVR-DA both have 12-bit ADCs, with modest performance; the XMEGA's is pipelined up to 300kSps with additional nice features, while the DA's limited to 130k and is mostly one-and-done), stable bit readings are normal, i.e. the noise due to supply ripple and analog sources (thermal noise etc.) is still less than the quantization noise.Tim

author: thm_w
author_rank: Super Contributor
timestamp: May 19, 2022, 09:46:04 pm
content: No one actually addressed OPs question.Will the lack of a cap cause the MCU to blow? No I don't think so. But get out the oscilloscope and check if Vcc/AVcc is exceeding spec at any time.What are the symptoms after its died: MCU will not be detected by programmer at all? Have any of the pins shorted to ground after that?

author: T3sl4co1l
author_rank: Super Contributor
timestamp: May 20, 2022, 12:16:16 pm
content: I don't think AVCC draws transient current, but I haven't measured it so scoping it in operation would be a good idea (share your results!).I did offer one somewhat common failure mode (hot plugging), but it's not clear from this small snippet if it's relevant or not.Tim

author: Siwastaja
author_rank: Super Contributor
timestamp: May 20, 2022, 12:28:12 pm
content: Quote from: thm_w on May 19, 2022, 09:46:04 pmIt'spossible. Inductive supply and no bypass capacitor sure is a good way to create voltage peaks. AVDD definitely hassomeswitching going on, and maybe the distributed on-chip capacitance helps bypass it, but maybe not. Now whether these voltage peaks are energetic enough to actually break things... who knows. It's also possible such a spike would somehow cause latch-up and self-destruction.Maybe not very probable, but completely possible. I tend to just swap parts whenever I make a mistake where I suspect non-zero probability of having a dead chip; I have seen weird things from partial damage and they can be PITA to debug.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: May 20, 2022, 02:25:51 pm
content: Quote from: Siwastaja on May 20, 2022, 12:28:12 pmIn fact just the other day I seem to have zapped an AVR-DA, with the result that the ADC drawing quite significant current (~0.1mA) from whichever mux channel it's connected to at the time. That is, current into the AINx pin, depending on MUXPOS/NEG selection. Pin functions largely seem to be normal, CPU working 100% as normal. Best guess at cause, ESD on one of my debug wires, in particular one from the analog IO bank, which happened to just slightly fail in this way.I have an ATMEGA32 laying around I could poke at and measure AVDD current, though I don't really have the time to do so. Or, hmm I think I have one with a program running the ADC even, though it's on a Olimex board I'd have to cut traces to get at AVDD alone I think, dang...Tim

author: eugene
author_rank: Frequent Contributor
timestamp: May 20, 2022, 08:41:58 pm
content: Ugg. "Should the cap go before or after...?" After what? I've seen articles in respected electronics trade magazines that expressed the issue like that.The answers to all of these questions are nearly obvious if one pays attention to current (and current loops) instead of limiting their thinking to voltages. Any reader that doesn't understand what I mean -- or worse, disagrees -- should start training themselves to think in terms of current. It really is that simple. Learn to think in terms of current flow and questions like these will have obvious answers.

author: tom66
author_rank: Super Contributor
timestamp: May 20, 2022, 09:31:09 pm
content: I once nuked the AVR8 on my 3D printer by shorting the hotbed sensor to 24V. The result was all the sensors read 1023, but no channel showed any short circuits. A very "transparent" failure, that would only be obvious if you replaced the chip.

author: Psi
author_rank: Super Contributor
timestamp: May 21, 2022, 02:49:46 am
content: The failure of the latest chip (3rd) was AVCC pin shorted to GND and pulling down 5V rail through the AVCC inductor.I was lucky and was powering it off a lab PSU with a 300mA current limit, so I could check with the FLIR and see where the current was going before the chip physically popped.The series diode and AVCC inductor were getting hot, and there was a tiny area of the MCU package getting hot too.In the previous 2 chip failures it popped/smoked instantly due to being on battery so I had no idea what happened.That's what made me think about the AVCC pin and check the schematic to discover no cap to GND on the MCU side.I assembled 2 more units this time with a bodged in 1uF cap form AVCC to GND and those didn't blow up.That being said, i have a test board here without any cap bodge and it has been running totally fine for months.So it maybe silicone lottery as to how sensitive the AVCC pin is to overvoltage/latch-up.I have been meaning to put my scope on that original board to check whats happening at startup, but have not had time yet.

author: Psi
author_rank: Super Contributor
timestamp: May 21, 2022, 03:20:13 am
content: OK, i did some tests,Seems the issue isn't right at switch-on.It's when the MCU timer generates 6khz signal to drive the power on piezo beep.Looks like the 6khz current spikes from driving the piezo maybe causing the inductor to kickback.I'm seeing up to 5.75V on the AVCC pin to GND, but all the other VCC to GND caps on MCU are fine so it's just an AVCC issue.(I'm probing using the spring clip right on GND at the MCU).

author: Psi
author_rank: Super Contributor
timestamp: May 21, 2022, 03:31:42 am
content: Yep, I just replaced the inductor with 22R resistor. No more overvoltage.Looks like I do have a separate issue with the piezo circuit, it should not be pulling down the 5V rail like that. But at least it proves the overvoltage part of the problem was the 10uH inductor.So something to keep in mind. If you follow the datasheet recommendation of a 100nF cap to GND on AVCC and a 10uH inductor to VCC. Then you run the risk of killing the MCU if your 100nF cap goes open circuit and you have any high frequency noise on the supply rail.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: May 21, 2022, 04:55:59 am
content: You didn't zoom on the negative spike / ripple?Tim