[time-nuts] ADC sample voting algorithm?

Jim Harman j99harman at gmail.com
Wed Oct 5 21:31:40 EDT 2016

On Wed, Oct 5, 2016 at 7:45 PM, Nick Sayer via time-nuts <time-nuts at febo.com
> wrote:

> I notice periodically that the phase measurements seem “noisy.” You can
> see that over the course of several seconds the value doesn’t change, then
> it jumps a bunch and then comes right back.

Hi Nick,

At one point I had a problem with noisy phase readings where the "noise"
took the form of an occasional reading that was low by up to about 50
counts. These events were quite rare - less often than once per hour on
average. After much head-scratching, it turned out that I had an interrupt
conflict that sometimes caused the PPS interrupt to be delayed, Because the
ADC was triggered inside this routine, the analog signal had drooped a
little before the ADC was triggered.

I was able to completely solve this by setting up the ADC sample/hold and
conversion to be triggered directly by the PPS signal, thus eliminating any
dependency on the interrupt latency. The PPS still generates an interrupt,
but in the interrupt routine, all I have to do is wait for the ADC to
finish, clear the Done bit, and reset the trigger.


--Jim Harman

More information about the time-nuts mailing list