[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: Thu, 30 Jan 2003 12:19:02 -0500

=================== BUG #2419: LATEST MODIFICATIONS ==================

Changes by: Joerg Wunsch <address@hidden>
Date: 2003-Jan-30 18:19 (Europe/Berlin)

            What     | Removed                   | Added
          Resolution | None                      | Invalid
              Status | Open                      | Closed

------------------ Additional Follow-up Comments ----------------------------
Problem was caused by a redefined wdt_disable() macro.
Strange only that gcc didn't warn about the redefinition.

=================== 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:  Invalid                  
Assigned to:  joerg_wunsch            Originator Email:  address@hidden   
Status:  Closed                       

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:


Follow-up Comments

Date: 2003-Jan-30 18:19             By: joerg_wunsch
Problem was caused by a redefined wdt_disable() macro.
Strange only that gcc didn't warn about the redefinition.

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:

reply via email to

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