I have a custom PCB that uses an ATMEGA1280 MCU. The board has a few inputs and a relay output. Inputs are mostly 4-20mA measuring temperature sensors. I also measure VSD current from a VSD mounted next to my board. My board uses LoRa to communicate to a homebase. Everything works fine until the VSD starts. Then my ATMEGA 'hangs up' / freezes. The reset button sometimes doesn't even reset the board. Then I have to remove power and apply power again. I get power from a charge controller connected to a battery and some solar panels. I get 12V in and my circuit runs on 3.3V. I use a linear voltage regulator to go from 12V to 3.3V.

My board is in a seperate steel enclosure that is grounded. What could cause my MCU to freeze? And why does it freeze? Is it in some sort of safety shutdown mode? What could I look at to prevent my MCU from freezing? EMI? Shielding? Grounding?

  • \$\begingroup\$ Draw a block/circuit diagram and show absolutely all earthing points including those that might be connected to sensors and power supplies. If you remove the sensor wiring, does the MCU still reset? Try doing things like that to see if you can narrow down the main cause. \$\endgroup\$
    – Andy aka
    Jun 29, 2020 at 13:22
  • \$\begingroup\$ Small decoupling capacitors directly across the supply pins? \$\endgroup\$
    – RoyC
    Jun 29, 2020 at 13:29

1 Answer 1


You are injecting charges into the substrate, into paths that generate pulses upsetting the internal state of the MCU.

Since even the "RESET" button fails, there is an internal LATCHUP event; this probably draws locally high current, acting like a 4-layer (SCR) diode and only releasing its (undesired) state when you cycle the power to ZERO.

SUMMARY: use TwistedPairs for your Sensing.

I'd suspect massive transients on the sensing_lines to the VSD current monitor connections.

You should have Clamp Diodes on those lines (both of the lines) to prevent voltage excursion beyond the MCU rails. Use low-voltage-turnon Schottky diodes.

To ease the energy-absorption task for the new diodes, install 1,000 ohm resistors in (both) sense lines, in series between the new diodes and the VSD.

Ohhhhh You are using a Ground plane, right? Otherwise the effective Loop Area for magnetic flux aggressors will be 100X larger area than if you had a plane.

For fast switching of the currents, on order of 50 nanoseconds, the Ground (or power) planes begin to have useful (10+dB) attenuation.

For slow switching of the currents, 1,000 nanoseconds or 1uS, the planes will have little or no effect on the magnetic field (which is really just displacement currents induced by changing electric fields).

As other answers suggest, have 0.1uF bypass caps directly at the MCU, between all VDD/GND pairs.

How bad can this get? Here is some (magnetic field) math:

  • Vinduce = [(MUo * MUr * LoopArea)/(2 * PI * Distance_Loop_to_Wire)] * dI/dT

which simplifies to (using MUo = 4 * pi * 1e-7, MUr = 1 for air, copper, FR4)

  • Vinduce = (2e-7 * Area/Distance) * dI/dT

and these variables

  • 10cm distance between the high_current spikes in the VSD, and your PCB

  • LoopArea of 10cm by 10cm on your PCB

  • dI/dT in your VSD of 100 amps in 100 nanoSeconds

The induced voltage into your PCB, or into Sense Lines, is

  • Vinduce = 2e-7 * (10cm * 10cm)/10cm * 100 amps/100nanoSeconds


  • Vinduce = 1e-7 * 1e-2 * 1e+9 = 2 volts, which can be of EITHER polarity.

So yes, this hypothesized event and variables is a viable cause.

Ahhhh the LoopArea could be the Sense+/Sense- wires, or the Sense/Return wires.

To minimize the Loop Area, and indeed have some useful cancellation of Vinduce, use a TWISTED PAIR for those 2 wires.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.