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

PPI time stamp accuracy problem

Hi all!

I've been working on a firmware to timestamp GPIO events using PPI in nRF52, and it works:

github.com/HiveTracker/firmware (more context: hivetracker.github.io)

So first off, thanks for those who participate in this great forum, it helped a lot for this project (timer sync trick + feasibility question).

...but now there's a surprising accuracy problem, and maybe some of you have suggestions.

Apparently, GPIO events are sampled at 16MHz by the PPI, so the timestamps should not have more than 62.5 ns errors.

But in the following picture, you can see an example where a pulse width is measured, the value is printed on a serial port, and there is a 200 ns error (= 0.2 ms = 21.31 us - 21.11 us). 

Would anyone happen to have a clue about why this PPI timestamp is so inaccurate?

If it can help, here is the repo that was used to do this test: github.com/HiveTracker/PPI

Thanks a lot!!

Cedric ;)

Notes:

- this measure was done at 100 MHz with a Saleae logic analyser, so it should be good

- the GPIO are not initialized in low accuracy mode (they use the same configuration as for the high_accuracy mode)

- the microseconds conversion is computed as a float so it should not be a problem

- the cables are fairly short so the electronic system should not be the problem

Parents
  • Very interesting. Can you please attach a minimalistic project to reproduce this. I cannot access the github page.

    Maybe you are doing some casting conversions to be able to print that value onto serial port and loosing some accuracy in the conversion?? This seems like a long shot, I would like to reproduce this and see.

    My other theory is that it is possible that the chain of peripherals this event goes through by the time it gets latched in the timer capture register might be long and takes more than one PPI cycle to reach there.

     

  • Hi Aryan!

    Thanks a lot for your answer!

    You'll find below another example with a 54 us error (= 3294 us - 3240 us), and the code is attached.

    Hardware: this test was done with a TS4231 photodiode, and signals generated by HTC vive base stations.

    Software: the tool chain used is on github, but it should not be very different to what you use.

    If needed, there's also a signal_generator folder to simulate fairly similar pulses.

    Thanks again!!

    Cedric :)

    6355.PPI.zip

Reply Children
Related