[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-libc-dev] [Bug #2419] Disabling the Watchdog
From: |
nobody |
Subject: |
[avr-libc-dev] [Bug #2419] Disabling the Watchdog |
Date: |
Wed, 29 Jan 2003 05:02:06 -0500 |
=================== BUG #2419: LATEST MODIFICATIONS ==================
http://savannah.nongnu.org/bugs/?func=detailbug&bug_id=2419&group_id=2140
Changes by: Joerg Wunsch <address@hidden>
Date: 2003-Jan-29 11:02 (Europe/Berlin)
What | Removed | Added
---------------------------------------------------------------------------
Assigned to | None | joerg_wunsch
------------------ Additional Follow-up Comments ----------------------------
I can't seem to find how this should happen at all.
avr/wdt.h only contains inline asm that doesn't know
whether it's going to be compiled inside an interrupt
context or not.
Should this be a real bug, i'll handle it anyway.
=================== BUG #2419: FULL BUG SNAPSHOT ===================
Submitted by: None Project: AVR C Runtime Library
Submitted on: 2003-Jan-28 23:34
Category: Library Severity: 5 - Major
Bug Group: None Resolution: None
Assigned to: joerg_wunsch Originator Email: address@hidden
Status: Open
Summary: Disabling the Watchdog
Original Submission: The latest (and prior versions?) compiler generates the
following code to disable the watchdog --- wdt_disable()---:
Outside interrupt routines:
in __tmp_reg__,__SREG__
cli
wdr
out 33,r24
out __SREG__,__tmp_reg__
out 33,r18
// 33 is the WDTCR
Inside interrupt routines:
ldi r24,lo8(24)
ldi r25,hi8(24)
out 33, r24
out 33, __zero_reg__
If the user is using any watchdog timeout other than 17ms, the interrupt
version of the watchdog disable may actually cause a watchdog reset! To prevent
this, the WDR instruction should be added in front of the interrupt code as in
the non-interrupt code, or the prescaler bits should be preserved during the
disable operation. In 'C' the user can avoid the problem by issuing a
wdt_reset() instruction just before the wdt_disable() instruction.
In other words, any time you wish to disable the watchdog inside an interrupt
routine use the following:
wdt_reset();
wdt_disable();
--
Follow-up Comments
*******************
-------------------------------------------------------
Date: 2003-Jan-29 11:02 By: joerg_wunsch
I can't seem to find how this should happen at all.
avr/wdt.h only contains inline asm that doesn't know
whether it's going to be compiled inside an interrupt
context or not.
Should this be a real bug, i'll handle it anyway.
CC list is empty
No files currently attached
For detailed info, follow this link:
http://savannah.nongnu.org/bugs/?func=detailbug&bug_id=2419&group_id=2140