[Top][All Lists]

[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: Tue, 28 Jan 2003 17:34:24 -0500

=================== BUG #2419: FULL BUG SNAPSHOT ===================

Submitted by: None                    Project: AVR C Runtime Library        
Submitted on: 2003-Jan-28 17:34
Category:  Library                    Severity:  5 - Major                  
Bug Group:  None                      Resolution:  None                     
Assigned to:  None                    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__
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:


No Followups Have Been Posted

CC list is empty

No files currently attached

For detailed info, follow this link:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]