I think my initial guess that the watchdog condition remains active after
reset is true, but only on newer devices.

http://www.nongnu.org/avr-libc/user-manual/FAQ.html#faq_softreset

Also from page 55 of the 324P datasheet:

'Note: 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.'

So, it seems I must clear WDRF in the MCUSR and WDE in WDTCSR before
amforth boots to make this work. I can't do it in Forth because it resets
before the initial startup message has completed. i.e.:

> wdt!reset

ok

> amforth 5.1 ATmegamforth 5.1 ATmegamforth 5.1 ATmegamforth 5.1
ATmegamforth 5.1 ATmegamforth 5.1 ATmegamforth 5.1 ATmegamforth 5.1
ATmegamforth 5.1 ATmegamforth 5.1 ATmegamforth 5.1 ATmegamforth 5.1


Any suggestions on how I do this? I'm not comfortable with assembler or the
innards of amforth I'm afraid.


Any help much appreciated. My devices are a week overdue for the project
I'm working on and HAVE to be finished tomorrow! (Sense of panic here...)


I'm trying to get the watchdog running because I have some inexplicable
problem that I've been trying to fix since Monday. My application reads
from a GPS module and then transmits the GPS string over an XBee radio. It
then goes to sleep and at the moment wakes every 8 seconds from a watchdog
interrupt. It then increments a variable and if it hits 50 it does another
read/transmit else goes straight back to sleep again. My problem is that it
works for a few hours and then goes silent. I was thinking of replacing the
isr with a reset so it boots up from scratch every 8 seconds, or waking on
timer 2 and having the watchdog for security. I have checked the stack - it
isn't increasing over time.


It all works fine for a while (up to 3 hours, sometimes only 10 mins)  and
then goes dead. Same result on several boards.


Thanks for any help offered.


David.
------------------------------------------------------------------------------
Android is increasing in popularity, but the open development platform that
developers love is also attractive to malware creators. Download this white
paper to learn more about secure code signing practices that can help keep
Android apps secure.
http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk
_______________________________________________
Amforth-devel mailing list for http://amforth.sf.net/
Amforth-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amforth-devel

Reply via email to