Electronic – Mysterious ~1Hz oscillation in audio output

avr

I'm trying to create a simple audio circuit that is able to output a sine wave at an audible frequency. I'm using an atmega328p for this because I'd like the frequency pattern to be programmable in software. It is working mostly correctly except for a mysterious ~1Hz oscillation on top of whatever frequency is being played, and I'd like to get rid of the ~1Hz noise. The code is pretty simple, just containing one interrupt to set the PWM value that is called about 30,000/s and there are no other interrupts or loop events. The circuit is simple as well containing the MCU, icsp header, reset pushbutton, audio jack and a low pass filter to get rid of high frequency noise. Here is a picture:

enter image description here

Originally I was using a breadboard but I found some suggestions that capacitative coupling in the breadboard could be causing this, so I moved it to the soldered protoboard above without success. Also, I've tried battery, wall and USB power with no success.

Any suggestions on things to try?
Could it be related to ground loops?

thanks.

Best Answer

This is a long shot as I'm a PIC guy and don't have experience with Atmega. However, what about the watchdog timer? Could it be accidentally on and resetting the processor every second or so?

Show a capture of the waveform showing what happens around this one second anomaly. That might give a hint to the cause.