bugAVR C Runtime Library - Bugs: bug #8119, _wdt_write macro in wdt.h doesn't...

 
 

bug #8119: _wdt_write macro in wdt.h doesn't work with ATmega169

Submitted by:  None
Submitted on:  Thu 11 Mar 2004 07:34:50 PM UTC  
 
Category: HeaderSeverity: 3 - Normal
Priority: 5 - NormalItem Group: None
Status: FixedPercent 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.

 

Tue 13 Apr 2004 09:29:18 PM UTC, comment #2:

Suggested fix applied to <avr/wdt.h>.

Thanks for your contribution!

Joerg Wunsch <joerg_wunsch>
Project AdministratorIn charge of this item.
Fri 02 Apr 2004 07:09:51 AM UTC, comment #1:

SOLUTION:

The macro _wdt_write has to be changed for the ATmega169 in the following manner:

#define _wdt_write(value) \
_asm_ __volatile__ ( \
"in _tmp_reg_,__SREG__" "\n\t" \
"cli" "\n\t" \
"wdr" "\n\t" \
"sts %0,%1" "\n\t" \
"out _SREG_,__tmp_reg__" "\n\t" \
"sts %0,%2" \
: /* no outputs */ \
: "M" (_SFR_MEM_ADDR(WDTCR)), \
"r" (0x18),/* _BV(WDCE) | _BV(WDE) */ \
"r" ((unsigned char)(value)) \
: "r0" \
)

The proposed code example form sfr_defs.h uses the _SFR_IO_REG_P() macro to distinguish between I/O and memory addresses, but this does not work for the 169.

Anonymous
Thu 11 Mar 2004 07:34:50 PM UTC, original submission:

The _wdt_write(value) macro in wdt.h doesn't work with the ATmega169. The problem is that Atmel moved the WDTCR register to location 0x60, which is outside the range of an OUT instruction.

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
Tue 13 Apr 2004 09:29:18 PM UTCjoerg_wunschStatusNone=>Fixed
  Assigned toNone=>joerg_wunsch
  Open/ClosedOpen=>Closed

Back to the top


Powered by Savane 3.1-cleanup1