avr-gcc-list
[Top][All Lists]
Advanced

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

Re: [avr-gcc-list] Watchdog wakeup from sleep mode?


From: Joerg Wunsch
Subject: Re: [avr-gcc-list] Watchdog wakeup from sleep mode?
Date: Mon, 25 Aug 2003 13:59:53 +0200 (MET DST)

As Josh Pieper <address@hidden> wrote:

>I'm working on an AVR project that I need to be low power, but can't
>rely on externel interrupt wake-up events occuring to wake up the
>device from sleep.  Therefore I think the watchdog timer is my best
>bet for a low-power means of wakeing up from power-down mode.

Probably, yes.  Keep in mind that depending on your oscillator, the
AVR might take a considerable amount of time to start-up.

>However, the avr-gcc and avr-libc seem hardwired to erase the entire
>BSS space any time a watchdog reset is received.... even it was
>received in sleep mode.

Sure.  A reset is a reset.  The library does not have a generic way to
distinguish the reset source (on some AVRs, you can't distinguish them
at all), and it's beyond the scope of the library startup code anyway.

>Is there an easy way to work around this?

There's the .noinit section, see also

http://savannah.nongnu.org/download/avr-libc/doc/avr-libc-user-manual/mem_sections.html

The downside is, you need to make sure you're initializing your variables
at least /once/.  It's not like the SRAM being all 0s after powerup,
there's just (semi-)random garbage in it.

>  I'm working with an
>ATmega8535 and ATTiny26 at the moment, but I think the problem is
>applicable to most AVR devices.

For both, you can examine the reset source in MCUC[S]R, and act
accordingly.  Note that the sequence is tricky.  These bits are /not/
reset automatically, you need to reset them yourself after examining
them.
-- 
J"org Wunsch                                           Unix support engineer
address@hidden        http://www.interface-systems.de/~j/


reply via email to

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