Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    utime.ticks_us() accuracy

    Scheduled Pinned Locked Moved Discussion
    utimelopyaccuracy
    3 Posts 2 Posters 1.1k Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P Offline
      p.lupascu
      last edited by

      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-hhR 1 Reply Last reply Reply Quote 0
      • robert-hhR Offline
        robert-hh @p.lupascu
        last edited by robert-hh

        @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.
        https://forum.pycom.io/topic/936/pin-interrupt-latency/14
        And: ticks_us returns a 30 bit quantity, which means, that the longest period you can determine is about 1000 seconds.

        P 1 Reply Last reply Reply Quote 1
        • P Offline
          p.lupascu @robert-hh
          last edited by

          @robert-hh Thanks!

          1 Reply Last reply Reply Quote 0

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          • 1 / 1
          • First post
            Last post

          Pycom on Twitter

          Pycom