EMI and WDT reset (WDR)

Can EMI just from being near a powerful motor cause even WDT to fail.
Program got stuck don't know why, suspecting EMI from motor that is within 3 inches from the microcontroller (bare atmega328p with 220uF elec cap + 100uf cer cap right near VCC and GND.
Can there be enough EMI to stop program. AND I had WDT set up just for that purpose.. can EMI even stop WDT reset?

Also using an oscilloscope I found that TVS diodes do not have a fast enough reaction time for induced EMI ups and downs (not in line just nearby EMI ex. MOTOR)
I found that ceramic caps as close to the IC as possible do the best job for this purpose. Is this correct? Any suggestions?

Code is too long to post and it has been stable till now. Let's start with the above.
Thanks

Anything is possible! I guess the motor is running?
Quick and easy way to begin it use a metal enclosure to all your electronics and ground it all through your power supply. Ground the motor frame separate from the enclosure.
Really need to visualize your project using a block diagram, to begin.
Paul

I believe this is unlikely, TVS diodes are faster than most scopes. It could be where you have the probe leads.

  1. How do you know the WDT ever worked?
  2. How are your wired to the 328P board run? i.e. are they coming from multiple locations or in a bunch?
  3. What is connected to your 328p.

Could “getting stuck” be a continuous reset cycle? Does the built in led flash during all this? The Watchdog timer can do this with some older bootloaders (although i’m not then sure if it gets as far as flashing the led) . Also, a brown out could be another explanation, depending on power stability and fuse settings.

I found the older bootloader would not allow the WDT to boot. Something about a delay during the boot process. I had to load the optiboot loader to get WDT to work on an 328P

Yes. Look at post 12 here : Arduino Reset via Software

Of course, in this case, the application would also not work and appear to be “stuck”.

Well I see 100s of volts when powering off the motor. The motor is isolated it is just in close proximity of the micro c

Where do you see the 100's of volts? I find it very likely such voltages can result from disconnecting a running motor (i.e. turning it off).

The concept of hardware spike protection requires all the inputs and output of the board (even power) be in one "bunch" so they can be filtered.

Correct, the motor is being powered on and off independent of the microcontroller.
What I am saying is that I have had circuits in close proximity to inductive loads and disconnecting the inductive load induced voltage spikes in a PCB nearby PCB that was isolated just close within a few inches. In that case TVS (on the PCB rails) diodes did almost nothing, only ceramic caps did.

Even if my PCB has a ground plane on both sides?

WDT definitely works in any other program hang. I have wdtReset() on every loop and reset interrupt set at 2 seconds.

I understand and can see how such a thing can happen. But we can't see your board or installation so we (I) can only suggest standard options.

From what I can deduce the induction might be entering the board on clad near the processor. A solution for this condition is to put your board in a metal box. I've used Hammond Cast aluminum boxed in an automotive test setup.

WDT definitely works in any other program hang. I have wdtReset() on every loop and reset interrupt set at 2 seconds.

hmmmm.. so this program has been successfully "recovered" by the WDT but not when triggered when the motor turns off. I'm at a loss for any normal perturbation.
I don't know you situation but I would consider testing a do nothing program with the WDT running and see if it locks up as well.

  1. new bootloader
  2. MCUSR reset at the first line.
  3. Don't have this issue any other time I force a code hang WDT works every time.
  4. endless loop would reset all pins to input, here everything remains frozen in time... just WDT never kicked in.

I work with WDT timer all the time and I am very familiar with it's setup. It is set up properly, tested, works. Just hung randomly after motor turned on/off.

Is WDT timer immune to EMI or if the chip goes "bezerko" so does the WDT?

I doubt it. Without external filtering nothing on this processor is immune to EMI. I would hope once the EMI that triggered the issue clears the WDT would recover.

That is my question did anyone ever hear of a WDT lockup? WHO WATCHES THE WATCHER??

Nothing is that simple. (i.e. the WDT is locking up) There has to be more to the issue.

I still suggest the do nothing program with a WDT to see if there is more to the issue.

Bet there are traces connecting components. They are the same as if you had wires connecting the components and they can both pick up induced current as well as capacitive induced voltages.
Paul