I see in teh ATMega64/128 specs that you can run the async oscillator in sleep mode to act as an RTC.
I looked on Atmel's web site, and found information on this usage, but not how to design a circuit for power-off operation.
Namely, how does one send power to the ATMEGA128 from a small coin battery to keep the RTC running, and sleep when main power is down, bringing the M128 back to life on power up?
My naive thoughts as an interrupt pin hooked to main power, with the battery and the main power attached to the ATMEGA128 via diodes to prevent battery from powering other things. Still, I doubt that's enough. Has anyone done this?
Alternatively, is there a small RTC option that folks use in lieu of using the M128 or M64 as an RTC?