Hello. I'm developing a project where the timing precision is a must. I use a PPS signal from a GPS to restart a counter of two Arduino Due. Moreover, the ADC of each device converts the output of a piezoelectric membrane at its highest conversion frequency (close to 1MHz). Whenever that output gets higher than a threshold, the Due gets the value of the counter and prints it. This is the simplest software I developed to tests the accuracy between two different Arduino's, which share the same PPS signal and the same input to the ADC peripheral. They also run the same exact software. The thing that is driving me crazy is that the printed values of both devices have a usual difference of 200 to 4000 timer counts (usually), being the counter configured at 42Mcps. For my project this is unacceptable, as they should be much more accurate, not even say that in the real project there is more hardware and much more lines in the main loop.
any idea why this happens? I was trying to relate it with the inaccuracy of the Main Clock but I don't think that can make that big difference.