[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-libc-dev] Possibly incorrect wdt implementation for xmega

From: Omar Choudary
Subject: [avr-libc-dev] Possibly incorrect wdt implementation for xmega
Date: Fri, 6 Apr 2012 14:03:02 +0100


I was trying to compile a program that used the WDTO_4S value with an
xmega (ATXMEGA256A3U) and I got a compilation error (value not

Looking at the source (avr/include/avr/wdt.h) it seems that indeed the
values above 2S are not defined for the xmega family:

/** \ingroup avr_watchdog
    See \c WDT0_15MS
    Note: This is only available on the
    ATtiny24, ATtiny44, ATtiny84, ATtiny84A,
    ATtiny25, ATtiny45, ATtiny85,
    ATtiny261, ATtiny461, ATtiny861,
    ATmega48, ATmega88, ATmega168,
    ATmega48P, ATmega88P, ATmega168P, ATmega328P,
    ATmega164P, ATmega324P, ATmega644P, ATmega644,
    ATmega640, ATmega1280, ATmega1281, ATmega2560, ATmega2561,
    ATmega8HVA, ATmega16HVA, ATmega32HVB,
    ATmega406, ATmega1284P,
    AT90PWM1, AT90PWM2, AT90PWM2B, AT90PWM3, AT90PWM3B, AT90PWM216, AT90PWM316,
    AT90USB82, AT90USB162,
    AT90USB646, AT90USB647, AT90USB1286, AT90USB1287,
    ATtiny48, ATtiny88.
#define WDTO_4S     8

That is strange, since the XMEGA supports 11 different timeouts, from 8ms to 8s.

Even worst perhaps, the values are incorrect and most probably the
registers used as well.
That is, for the xmega (from the datasheet) the encodings are
different than for the previous AVRs.
For example 2S is encoded as "1000" (i.e. 8) while for an AT90USB1287
the value is "0111" (i.e. 7).

Also, for xmega the "time out period" value is in bits 2-5 of the WDT
control register, while for other AVRs
as the AT90USB1287 this value is spread in bits 5, 2-0. The code for
wdt_enable doesn't seem to make
a difference so I wonder if it even works at all.

If that code is actually in some other file please let me know.


reply via email to

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