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.
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.
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.
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.
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.