I have a mega169 project that uses th4e async clock for real time. It spends most of the time in sleep mode, and just wakes up every second to update the clock. This has been working flawlessly for me. However - the client wanted an added function that required a minor change to the system startup process. I added the code, and to my surprise, the 32KHz clock will not start after a power-on reset OR if I start the emulator (AVR Dragon) using the "Start debugging and break" option. I can see that TCNT2 never increments. But, if I halt the execution of the emulator, then click run, everything works just fine.
If the board is running standalone, powering up does not result in proper operation (and yes, I DO have brownout reset enabled). However, if I press the hardware reset button, then the system works as expected. The Timer 2 code and the sleep mode code is the same for both setups. It seems that, for some reason, the 32KHz clock does not want to start from certain reset conditions with this additional code (which, BTW, isn't even called until the counter starts!), and I'm clueless as to why.
If I figure out what's going on, I'll post back here, but in the meantime, I'm open to suggestions.