https://lcamtuf.substack.com/p/the-basics-of-decoupling-capacitors [https] lcamtuf's thing SubscribeSign in Read in the Substack app Open app Share this post [https] The basics of decoupling capacitors lcamtuf.substack.com Copy link Twitter Facebook Email The basics of decoupling capacitors Apr 16, 2023 12 5 Share this post [https] The basics of decoupling capacitors lcamtuf.substack.com Copy link Twitter Facebook Email Two decades ago, to build a portable music player, you had to clobber together several hundred electronic components. Today, you can accomplish the same with a single chip and a dozen passives. Heck, you might even get Wi-Fi and Bluetooth for free. One of the few discrete components that survive and thrive in the face of growing integration is the humble decoupling capacitor. It's not just that the device is hard to manufacture on the die of an integrated circuit; in the world high data speeds and low supply voltages, it has an increasingly important role to play in keeping the circuits humming along. Among hobbyists, the understanding of decoupling caps continues to be hit-and-miss. Some folks skip them altogether and live to tell; others follow ancient lore of uncertain origins, producing monstrosities such as this: stm32 [https] Decoupling capacitor galore. Found on the internet. In this article, I'm hoping to cast some light on the actual role of decoupling capacitors in digital circuits -- and to offer advice on how to integrate them into your designs without going overboard. What does a decoupling capacitor do, anyway? In a steady state, a typical CMOS integrated circuit needs very little power. The chip's energy consumption is associated predominantly with state transitions -- that is, toggling between "zero" and "one". That's because the process requires moving electrons back and forth to charge or discharge the gates of field effect transistors inside the chip. Some internal state transitions require relatively little current, but others are more demanding; this is particularly true for the operation of larger transistors that drive output lines. To toggle them at at megahertz speeds -- a task that demands rapid rise and fall times -- the chip must momentarily source significant currents; the phenomenon lasts just picoseconds or nanoseconds, but can involve quite a few amps. This poses a challenge. At high currents, PCB traces exhibit both resistive losses and inductive coupling; the demand response characteristics of the power supply also get in the way. In the end, even seemingly minor digital switching can cause significant voltage fluctuations and electrical noise across the entire circuit. The following oscilloscope plot shows the effect of an AVR microcontroller repeatedly toggling a couple of unconnected output pins while running at the relatively low speed of 8 MHz: [https] Observed supply voltage noise for a simple MCU application. The peak-to-peak amplitude of this noise, as sampled at the MCU supply pins, is almost 2 volts -- about 40% of the nominal supply voltage. This in itself can be enough to destabilize the MCU. Just as important, because the chip no longer has a stable Vdd and GND reference shared with other parts of the circuit, interfacing it to other devices might prove difficult. It's not that this setup is bound to malfunction, but unexplained and hard-to-diagnose issues can creep up with ease. This brings us to the purpose of decoupling capacitors: they are placed across the voltage supply lines and physically close to the offending chip to handle switching transients while preventing high currents and minimizing voltage fluctuations in other parts of the circuitry. To do this, the capacitors must have low impedance (i.e., be able to charge and discharge quickly); for this reason, multilayer ceramics (MLCCs) should be used instead of the comparatively sluggish electrolytic caps. But above all, to work effectively, the capacitors must be as close as practical to the chip's supply pins. The following oscilloscope trace illustrates the point: [https] The effect of capacitor distance on switching-induced noise. The sizing of the capacitors is not critical; a single 100 nF MLCC, operated well clear of its maximum voltage, is typically enough to deal with all intrinsic switching currents of PIC, AVR, or ARM microcontrollers. More capacitance might be appropriate if the MCU is driving substantial loads. This can be accomplished with a single larger MLCC (e.g., 1 or 10 uF); with several smaller MLCCs in parallel; or with a small fast-acting MLCC coupled with a larger but slower aluminum-polymer cap (10-100 uF), the latter possibly placed some distance away. Is a capacitor always enough? A well-chosen decoupling capacitor can greatly reduce switching noise, but the device has a finite capacitance and a non-zero impedance (increasing not only toward DC but also toward very high frequencies -- the latter due to parasitic inductance). In other words, some attenuated noise will still get through. In sensitive circuits, the problem of high-frequency noise can be further mitigated by placing a small ferrite bead in line with the supply and ahead of the decoupling caps. The inductor provides a low impedance path (few milliohms) for DC signals while impeding megahertz-range AC much better than a capacitor can. Here's an example from the spec for SAM S70 MCUs, recommending the use of two beads with an impedance of 470 O at 100 MHz on the supply lines for the USB transceiver and the phase-locked loop (PLL) clock multiplier: [https] Noise-filtering beads on MCU supply lines. It should be underscored that the arrangement doesn't eliminate switching noise; it merely contains it to the section between the MCU and the decoupling capacitor, protecting the remaining parts of your circuit. This is analogous to the use of ferrite EMI filters mounted on some cables and found inside quality power supplies. A related trick is to put ferrite beads on MCU output lines; this takes the edge off fast-rising square wave signals, and can reduce needless inrush currents when operating slower buses such as I2C or SPI. What if the manufacturer says... The datasheets for some digital chips will outline a suggested way of decoupling them. These recommendations should not be ignored, but are not to be taken as gospel. The manufacturer is trying to cover a variety of extremes, including: * Circuits operated at the lowest permissible supply voltage, * Devices running at the maximum supported clock speed, * Peak utilization of on-chip peripherals, * The customer using the worst decoupling capacitors money can buy (e.g., the "Y5V" variety that loses ~80% of rated capacitance when operated at elevated temperatures or near the cap's maximum voltage). Further, the manufacturer is making assumptions about customers' design preferences. A typical 100 nF MLCC costs about $0.005 a piece; in contrast, a 10 uF aluminum-polymer cap is about $0.25. A customer doing robotic assembly might favor a dozen MLCCs in lieu of a single MLCC paired with a polymer capacitor. A hobbyist soldering by hand might not. Instead of blindly following the spec -- a practice that still doesn't guarantee success -- it can more useful to validate your design in three ways: * Examine circuit supply noise under normal operating conditions. If the peaks exceed maximum permissible supply ripple, minimum supply voltage, or maximum supply voltage for the digital components, you should improve the design. * If relevant in your project, confirm that signals on any high-speed output busses (e.g., USB) look correct, especially in terms of expected rise and fall times, noise, and any periodic glitches. Oscilloscope "eye diagrams" can help. * As a final test, observe the circuit with IC supply voltage reduced 10-20% from the design goal. If the digital circuitry continues to operate correctly, you likely have a good safety margin when it comes to switching noise. What about the "1 nF / 10 nF / 100 nF" rule? There is this old adage that for optimal decoupling, you must combine at least three capacitors, one or two decades (orders of magnitude) apart. The exact progression of recommended values changes from one oral account to another, but the bottom line is that if you don't heed the warning, some terrible fate awaits. The advice made some sense back when each of these capacitors would be made in a different technology. The lowest capacitance would be ceramic, offering low impedance but not packing enough punch to smooth out longer-lasting flukes; the middle cap could be tantalum, offering balanced performance but not excelling in any dimension; and the last one would be aluminum electrolytic, delivering poor high-frequency response but storing quite a bit of juice. Today, low-cost MLCCs combine high capacitance and low impedance across a wide range of frequencies, so there's usually little to be gained by playing such tricks -- at least not for circuits operating at "hobby" speeds. A single 100 nF or 1 uF MLCC per each functionally distinct digital voltage supply line is almost always enough. It is true that at very high frequencies -- hundreds of megahertz -- the capacitor's residual inductance becomes a limiting factor. At that point, combining multiple different capacitors can offer somewhat better wideband noise suppression at the expense of potentially creating undesirable anti-resonance peaks in the system (rendering it ineffective at dealing with a handful of other frequencies). That said, a simpler solution with fewer side effects is to use a specialized low-inductance ("low-ESL") MLCC. [https] [ ]Subscribe For more articles about electronics, see this index page. 12 5 Share Share this post [https] The basics of decoupling capacitors lcamtuf.substack.com Copy link Twitter Facebook Email 5 Comments [https] [ ] Robi 2 hr ago You may wish to add new design thoughts with using balanced ( [https] X2Y.com) capacitors which have a referential third lead and can be self tunable. Expand full comment Reply Bryan Ackerly 10 hr ago No mention here of parallel resonance issues when combining different capacitor values and/or the effects of the same [https] when power planes are involved. And once again no mention of the increasing importance of "edge rates" as opposed to clock speeds... Expand full comment Reply 2 replies by lcamtuf and others 3 more comments... TopNewCommunity No posts Ready for more? [ ]Subscribe (c) 2023 lcamtuf Privacy [?] Terms [?] Collection notice Start WritingGet the app Substack is the home for great writing This site requires JavaScript to run correctly. Please turn on JavaScript or unblock scripts