I'm using an ATmega645PA. I have a 32.768 KHz crystal as the input clock for timer2 so I can keep track of time while in sleep mode.
I have a button connected to a PCINT pin, and I need the AVR to wake up when the button is pressed. I also need the AVR to wake up briefly when timer2 overflows.
I want to use the internal pull-up resistors on my buttons, to save on components.
I've read the datasheet but I can't determine whether or not the internal pull-up resistors will be active during power-save mode. Can anybody answer this? Also will there be any unexpected current consumption in this case? (I've seen the internal circuit diagrams in the datasheet, and read the electrical characteristics section, neither will tell me)
Should I implement external pull-down resistors on my buttons instead?
I've read the datasheet but I can't determine whether or not the internal pull-up resistors will be active during power-save mode. Can anybody answer this?
Yes. The internal pull-ups remain active.
Also will there be any unexpected current consumption in this case?
Only if the human holds a button down.
Some power saving advice: Do not leave any pins floating. Make certain all of the analog circuitry is powered off.
On various processors, my multimeter shows 0.2 microamps with or without ALL pull-ups enabled. I assume there is a very very tiny amount of current needed to keep those things energized but I do not have the equipment necessary to measure that current.
It is very likely that running timer 2, even on a 32.768 KHz crystal, is going to consume orders of magnitude more power than the pull-up circuitry.
In other words, if you are concerned about the very very tiny amount of power needed to keep the internal pull-ups energized then you need to first consider using a real-time clock instead of timer 2.
In Atmel's "picoPower Basics" they recommend setting all unused IO pins to input, with pull-up resistors enabled. I suspect a larger amount of power saving is achieved by turning off the modules that aren't used, such as SPI and I2C serial communications.
In case people wonder why unused pins must not be left floating, you need to be aware that CMOS inputs only draw current if roughly half-way between supply rails, but that this current draw can be several milliamps. Compared to the rest of the chip in a powered-down state (200nA allegedly), this is 5 orders of magnitude greater....
The 328 if I remember rightly has a little bit of hysterysis in order to help prevent this issue, but its not really a reliable solution in a noisy environment.
Another thing that can happen with floating inputs is oscillation - this will again consume orders of magnitude more power than the rest of the processor when powered down.