Re: [Amforth] Watchdog Timer on AVR8s

2019-06-01 Thread Martin Nicholas via Amforth-devel
This snippet is a bit more like it (I think):
lds temp0, WDTCSR
ori temp0, (1

[Amforth] Watchdog Timer on AVR8s

2019-06-01 Thread Martin Nicholas via Amforth-devel
Looking into a crashing ATmega2560, I found this clause in the docs:

"If the Watchdog is accidentally enabled, for example by a runaway
pointer or brown-out condition, the device will be
reset and the Watchdog Timer will stay enabled. If the code is not set
up to handle the Watchdog, this might lead to an eternal loop of
time-out resets. To avoid this situation, the application software
should always clear the Watchdog System Reset Flag (WDRF) and the WDE
control bit in the initialisation routine, even if the Watchdog is not
in use."

This suggests that both the MCUSR and the WDTSR should be cleared on
reset.

I've added a line:
out_ WDTCSR, zerol
to COLD which covers it.

The minimum requirement is to clear both MCUSR.WDRF and WDTCSR.WDE.

Cheers!

-- 
Regards,

Martin Nicholas.

E-mail: reply-2...@mgn.org.uk (Address will be valid throughout 2019).


___
Amforth-devel mailing list for http://amforth.sf.net/
Amforth-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amforth-devel