I have a ATmega328p design that has a 32.768 Khz oscillator on the XTAl1 and XTAL2 pins. This was for an internal RTC implementation.
I have compile flags that conditionally configure the oscillator for 32.768. When I want maximum battery life, functionality that needs the RTC is disabled.
I saw some quirky behavior after reprogramming a part. I was getting a mis-compare on the same addresses as a part on a completely different board.
When I when ahead without verifying, the code didn't run properly. It's like the the program would get to a certain spot, then restart. Like maybe a WDT reset.
I went in debug mode an saw that was what was happening. The program would step along and then, back to the beginning.
But, after I closed debug mode, and cycled power, everything seems to be working ok. I did a flash verify.
No mis-compares. Maybe programming via debugWire worked when ISP didn't?
Do I need to remove the oscillator from the OSC pins if I want to run with an internal oscillator? Could this explain the spurious execution and flash mis-compare?
Two boards had the same address mis-compare, but only one had the spurious execution issue. But, now I can't reproduce the execution issue--it's running ok now.
Both the "quirky" boards are about 10 years old. But, probably less than 500 hours total power on time.