I implemented an RTC using a 32.768 Khz crystal on Tosc1/2.
It works great, but the power impact is very large in my application. Normally, the procesor sleeps 99.9%. With the RTC code, the processor wakes up every second to increase the second count, then resumes sleeping.
That means the battery has to be recharged on Saturday night in a typical, two day event. For some (most?) customers, they'd rather loose the functionality the RTC provides than have to remember to put the device on charge Saturday night.
So.. I'm probably going to add an external DS1307 at some point to get lower power. Meanwhile, I'd like to keep the hardware as is (RTC in atmega firmware) so those who don't mind putting the device on charge daily get the RTC functionality. So, So, I think this means I need to "sleep" timer2 in async mode.
The spec says this about the PRR bit 6:
• Bit 6 – PRTIM2: Power Reduction Timer/Counter2
Writing a logic one to this bit shuts down the Timer/Counter2 module in synchronous mode (AS2 is 0). When the
Timer/Counter2 is enabled, operation will continue like before the shutdown.
So, does this mean I have to put the timer in synchronous mode to stop it? Does this just stop the timer, but an oscillator keeps running?
Without RTC, the device sleeps all the time except for one or two seconds every several minutes. I only need to awake from sleep on UART incoming activity and pin change interrupts. How can I put everything else to sleep, (optionally) including the 32.768 oscillator and downstream timer circuitry?