Hello Ben,
I know you have a lot of experience and will hope you can help me.
Long time I have problems in a project in there I use the ATmega2560
Use the COM0 for RS485, baud 38400, 1 master and <= 35 slaves. Works perfectly in the laboratory
during a lot of months 24 hours a day.
The actual application run in a noisy environment where we have AC motor and frequency inverter that controls
the movement of the motor. Without apparent reason from time to time, the ATmega2560 resets by Watchdog.
Use the Bascom 2.0.7.7 and RS485 communication with the RX0 and "INPUTBIN". As I read, the InputBin waits until
it receives all expected bytes, thought the electric noise the InputBin would be frozen, waiting for the data and
Reset the micro. I have a 1024 Watchdog.
So, I modified the program to "INKEY" that get byte by byte and as such according to the Bascom Help
it should not be frozen. In the laboratory continues to work very well. with this version. I placed a Reset Watchdog in
the Main Loop, why should not stay frozen for RS485 communication. To my amazement, the test of this Inkey version was horrible in the noisy environments, almost nothing works, it always reset the micro. It should be not, because it
was changed to InputBin inkey.
Another strange thing is that the INPUTBIN version required on pin RX0 a resistor of 1K to GND. Without the resistor,
the micro is doing constantly Reset by Watchdog.
The version with "INKEY" not need the 1k resistor, communication works without it. This leads me to believe that Bascom
treats differently both forms of communication.
I read that in some Atmegas http://www.avrfreaks.net/index.php?name=PNphpBB2&file=printview&t=107115&start=0
RX0 may cause the crash. I added a filter with resistor 10k and 100pF between the RX0 and remove the 1k resistor on the INPUTBIN version, in hope that work without the resistor, but the micro continue Reset by Watchdog.
If someone has an idea and can help I am grateful. Now I started to draw a new multilayer pcb to see if it solves the
problem.
Best regards
toto
↧