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