This power supply used to power itself off

Everything started with a phone call, one of my clients had just got a complaint from one of his retail buyers, this device had been freezing and remaining unresponsive, having to be power cycled to recover. Since these appliances were directly attached to the mains power when installed, this required operating on the switch breaker for that part of the house, also affecting other appliances in that area.

At that time we already had several thousand of these controller boards in the field; since this one was the only one with such a failure, and this customer was located at a country place, life went on and I thought my customer had somehow solved it. A watchdog failure was something very unlikely, so it should have been something related to the power supply or some thermal issue, those places are either too cold or too hot….

Months later, a rather similar failure shows up again on another location, also relatively far away from a city, but this time the end user was a strategic customer living on a private neighborhood; as it always happens, hard to solve failures happen in places where damages can be most harmful, Murphy…

The company selling this appliance had sent several technicians, who had changed controller boards at will, but the problem still persisted, so we decided to pay a visit to this customer and run some measurements there. Surprisingly enough, we could not only confirm that this customer was right, but we also observed huge fluctuations on the mains voltage, sometimes getting over 250V (we have 220V mains here). The oscilloscope confirmed that the controller board built-in power supply stopped working, starting again after a power cycle; something looking like a safety protection or a self power-off feature…

After confirming there were no temperature issues involved (this chip also included some thermal protection features), I went back to my lab carrying this board with me, with the intention to reproduce this issue there and meditate on what could be causing it. The first one in a series of profound revelations I found by playing with the variable autotransformer (variac) knob. Even though the power supply was working correctly at such a high voltage, sometimes I could reproduce this issue by simulating sharp changes in mains voltage. Then, the use of a mains voltage stabilizer that has been modified for manual switching, allowed me to almost reproduce this issue at will.

The second revelation I found in the datasheet: one of the controller pins had this functionality associated to an internal finite state machine whose description was a very good match to what we’ve been observing, but that pin was correctly decoupled by a capacitor connected to ground, as the datasheet stated.

A view of the PCB design, showing the decoupling capacitor

After reading the pin descriptions for each and every controller pin dozens of times, I came to a conclusion: “something”, “somehow”, was causing voltage in that pin to raise. Something strange was happening around that capacitor in the figure…

The third revelation happened once I could observe the voltage at that pin with great detail: it barely raised at times when “mains voltage” sharply changed when above 240V. Then, the power supply stopped working until it was power cycled. We had found what was going on, now we only had to find what was causing it…

Satori came when observing the PCB design, while analyzing (once again) current loops, but this time deeply focusing on the path to ground for this decoupling capacitor.

Current loops in detail, we omitted the snubber current for simplicity

The light mustard trace depicts the power supply switching current, intentionally having a reduced area to avoid generating excessive noise that could interfere with the rest of the circuit. The dark mustard trace shows the input current coming from the mains power… shared with circuitry serving other features for the appliance operation, but also, and mainly, shared to a great extent with the light red trace, which belongs to this very decoupling capacitor’s ground return path.

Though we can trust that thick trace on both layers doubling also as a heatsink, let’s pay attention to that “unrolled inductor” running horizontally in the screen. We can see that both the switching power supply current pulses, that are stronger when higher currents come into play, and the filter capacitor charging pulses, that are stronger when there are mains instabilities, circulate on a long path that is shared with the decoupling capacitor connecting path to ground. We can think of this as if that capacitor is connected to ground via an RL series circuit (the PCB track impedance), and in that node we also connect other circuitry to carry their currents to ground… Technically speaking, we have a sensitive circuit requiring a low impedance path to ground and we are using an inadequate impedance path that also, and for worse, carries strong currents with a high di/dt, and we all know what happens when high di/dt circulates through -L, isn’t it?.

To solve it, we replaced that capacitor for a through-hole component, connecting its ground return path straight through using a different, star-shaped path, to the chip reference ground; away from the switching circuit and the input current, as good practices and datasheet state…

The modified PCB design, with the new capacitor

The figure shows this new path. Though we also share this SOT-323 double diode path to ground, its current is low enough to be dismissed.

La fuente de alimentación que se apagaba sola

Todo empezó con un llamado telefónico, mi cliente había recibido una queja de un usuario final que había comprado el producto y decía que se quedaba congelado, que no respondía a los controles, que debía desconectarlo y volverlo a conectar. Siendo un producto empotrado y directamente conectado a la red domiciliaria de 220V, esto significaba cortar el suministro eléctrico en esa zona de su casa.

Dado que había ya algunos miles de placas controladoras de este producto en servicio, ésta era la única con esa falla, y además se trataba de un lugar alejado en el interior del país, quedó como una anécdota que de algún modo resolvió mi cliente y retomé mis actividades habituales. Era raro que fallara el watchdog, debía tratarse de algo relacionado con la fuente o algún problema térmico, en esos lugares hace mucho frío o mucho calor…

Meses después, la falla se repite en un lugar también relativamente alejado, pero esta vez el usuario final era un cliente estratégico en un barrio cerrado; como siempre sucede, las fallas difíciles de encontrar se manifiestan en el lugar donde más daño causan, Murphy…

Los técnicos de la empresa que vendía el producto se cansaron de reemplazar placas y el problema persistía, a lo cual fuimos hasta el lugar e hicimos mediciones. Para nuestra sorpresa pudimos observar que el cliente tenía toda la razón y un poquito más, pero también observamos que la tensión de la red eléctrica fluctuaba considerablemente, ascendiendo por momentos a más de 250V. Colocamos un osciloscopio y pudimos confirmar que la fuente switching que alimentaba a la electrónica del aparato dejaba de funcionar, y retomaba sus actividades al retirarle la alimentación y volverla a aplicar; algo así como una auto-protección o un auto-apagado…

Luego de comprobar que no era un problema de temperatura (el chip tenía además un protección contra eso), con esa placa en la mano me retiré a mi laboratorio a reproducir el problema y meditar sobre sus posibles causas. La primera revelación la encontré ejercitando la perilla del autotransformador variable (variac). Si bien la fuente funcionaba correctamente a altas tensiones, con cambios bruscos a veces lograba reproducir la falla. Conectando un estabilizador de tensión modificado y forzándolo a cambiar repetidas veces, logré reproducirla casi a voluntad.

La segunda revelación la encontré en la hoja de datos, uno de los pines del controlador desarrollaba una función con una máquina de estados interna cuya descripción coincidía notablemente con lo que estábamos observando, pero ese pin estaba correctamente desacoplado con un capacitor a masa como indicaba la hoja de datos.

Vista del diseño de la PCB, con el capacitor de desacople

Luego de leer la descripción de todos los pines del controlador decenas de veces, llegué a la conclusión que “algo” tendría que “de algún modo” hacer que la tensión en ese pin se elevara. Algo extraño estaba sucediendo en torno a ese capacitor indicado en la figura anterior…

La tercera revelación ocurrió cuando pude observar con el osciloscopio que la tensión en dicho pin ascendía levemente durante un instante coincidente con los cambios bruscos de “la tensión de red” cuando ésta estaba en valores por encima de los 240V, momento a partir del cual la fuente de alimentación dejaba de operar hasta que se la reiniciaba. Habíamos encontrado qué era lo que sucedía, ahora sólo restaba encontrar por qué era que eso ocurría…

El satori se produjo al observar el diseño de la placa y analizar (una vez más) los lazos de corriente, pero esta vez prestando mucha atención al camino de retorno a masa del capacitor de desacople.

Detalle de los lazos de corriente, omitimos la corriente por el snubber por simplicidad

El trazo en color mostaza claro es el lazo de la corriente de conmutación de la fuente, intencionalmente de área reducida para evitar generar excesivo ruido que pudiera interferir con la operación del resto del circuito. El trazo en mostaza oscuro, corresponde al lazo de la corriente de entrada de la fuente desde la red… compartido con otras funciones de la circuitería del aparato en sí, pero además, y fundamentalmente, compartido en una extensión importante con el trazo rojo brillante, que corresponde al retorno a masa del capacitor de desacople…

Si bien podríamos confiar en la pista gruesa y en ambas caras que oficia a la vez de disipador; prestemos atención a ese “inductor desenrrollado” que corre horizontal. Es evidente que tanto los impulsos de operación de la fuente, que resultan más intensos cuando hay altas corrientes en juego, como los impulsos de carga del capacitor de filtro, que resultan más intensos cuando hay transitorios en la red, circulan por un tramo considerable compartido con la conexión del capacitor de desacople a masa. Esto lo podemos pensar como que ese capacitor tiene un circuito RL serie a masa (la impedancia de las pistas de la PCB), y en el punto de unión con ese circuito conectamos las otras corrientes para llevarlas a masa… Hablando con propiedad, tenemos un circuito sensible que requiere un camino de retorno a masa de baja impedancia y lo estamos llevando por un camino de una impedancia inadecuada que para peor transporta corrientes variables elevadas, con alto di/dt, y todos sabemos lo que sucede cuando alto di/dt circula por -L, ¿no?.

La solución fue reemplazar ese capacitor por uno de inserción, conectando el retorno a masa directamente por un camino diferente, “en estrella”, a la referencia del chip; lejos del circuito de conmutación y de la corriente de entrada, como recomiendan las buenas prácticas y la hoja de datos…

Vista del diseño corregido de PCB, con el nuevo capacitor

En la figura podemos observar el nuevo camino. Si bien tenemos además la conexión a masa de un doble diodo en SOT-323, la misma no transporta corriente significativa.