Fri Jan 26, 2018 6:19 pm
Hi
can any body help me
I need to know what is the best time resolution I can get with the raspberry pi to measure the time difference between two events on GPIO pins
can I get a nanosecond resolution or that is impossiable with the raspberry
can I use the CPU clock to measure the time difference
I have raspberry pi 3 model B
joanPosts: 16079Joined: Thu Jul 05, 2012 5:09 pm
Location:UK
Fri Jan 26, 2018 8:31 pm
If you program in bare metal (that is without an operating system) you might be able to get into the tens of nanoseconds region. You would need to ask on the bare metal forum for details of how it might be done, and if it is actually feasible.
Under Linux (unless you write a kernel driver) you are looking at the hundreds of nanoseconds region.
If you do busy spin polling of the GPIO you might be able to resolve down to 250 nanoseconds or so.
If you use (my) pigpio you should be able to get to within +/- 5 µs fairly easily.
If you use interrupts you will probably be in the +/- 50 µs region.