utime.ticks_us() accuracy

  • Hello everyone,
    I am working on a project for which I need time measurements as accurate as possible, is utime.ticks_us() reliable in terms of accuracy ?

  • @robert-hh Thanks!

  • @p.lupascu ticks_us() is derived from the CPU clock, which is pretty accurate. So you can expect a good long term precision. The short term precision is affected by the uncertainty, about when you ask for the time. Between an event, you want to time, and the response from ticks_us() may an interrupt happen (scheduler, network, etc.). Even if you put the event noticing and the time taking into an ISR, the ISR's response to the actual event may have an substantial latency. There was a post about that in the past, and I have taken some figures. The latency was between 30 µs and about 750 µs.
    And: ticks_us returns a 30 bit quantity, which means, that the longest period you can determine is about 1000 seconds.

Log in to reply

Pycom on Twitter