bugAVR C Runtime Library - Bugs: bug #2419, Disabling the Watchdog

 
 

bug #2419: Disabling the Watchdog

Submitted by:  None
Submitted on:  Tue 28 Jan 2003 10:34:23 PM UTC  
 
Category: LibrarySeverity: 3 - Normal
Priority: 5 - NormalItem Group: None
Status: InvalidPercent Complete: 0%
Assigned to: Joerg Wunsch <joerg_wunsch>Originator Email: -unavailable-
Open/Closed: ClosedRelease: None
Fixed Release: None

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Thu 30 Jan 2003 05:19:02 PM UTC, comment #2:

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

Joerg Wunsch <joerg_wunsch>
Project AdministratorIn charge of this item.
Wed 29 Jan 2003 10:02:06 AM UTC, comment #1:

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.

Joerg Wunsch <joerg_wunsch>
Project AdministratorIn charge of this item.
Tue 28 Jan 2003 10:34:23 PM UTC, 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();
--

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

Please enter the title of George Orwell's famous dystopian book (it's a date):

 

 

Follow 3 latest changes.

Date Changed By Updated Field Previous Value => Replaced By
Thu 30 Jan 2003 05:19:02 PM UTCjoerg_wunschStatusNone=>(Error - Not Found)
  Open/ClosedOpen=>(Error - Not Found)
Wed 29 Jan 2003 10:02:06 AM UTCjoerg_wunschAssigned toNone=>NA

Back to the top


Powered by Savane 3.1-cleanup1