This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Drift between HFCLK TIMERs over time

I have two TIMER instances, TIMER1 and TIMER2, both setup to Clear Mask on timeout (aka restart).  I use TIMER1 and PPI to trigger ADC measurements every 5msec.  In the ADC handler I add measurements to a queue of size 100.  I used TIMER2 to trigger burst reading a sensor every 500msec.  I added GPIO toggling once I reach 100 ADC samples (500msec) as well as on the TIMER2 handler.  In theory 100 TIMER1 timeouts should align to a single TIMER2 timeout.  However I see considerable drift between them over time. ~148msec after 528sec.  If these timing windows get too out of synch I can no longer align my ADC data to my sensor data.  This drift is ~280ppm which seems way out of spec of the timers.  Also note this test was run without the Softdevice enabled to eliminate the Radio as a cause of jitter.  I also request the hfclk at the start of the test to reduce any HFCLK start-up times.  

Is it just CPU cycles that are causing this kind of drift?  Is there a was I can buffer up to 100samples of ADC data in DMA (no CPU usage)?  Otherwise I'm going to need to find an inventive way to periodically realign these timers.

Thanks for your help guys,

Parents Reply Children
No Data
Related