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

System specific function to retrieve a timestamp (in microseconds)

Hi Team,

Is this system specific function to retrieve a timestamp (in microseconds) function directly available or we need to develop?

Parents Reply Children
  • Karl Ylvisaker said:
    Are you looking to create a timer or use the RTC to keep track of how long time in microseconds that has passed since a certain event, for example? If so, that is possible with the app_timer library or the RTC/TIMER peripheral directly, for example.

    You can either use the app_timer library for this, or the TIMER peripheral directly. The TIMER peripheral approach is demonstrated in the Timer peripheral example in the SDK. You can read more about the app_timer in the app_timer library documentation. The app_timer is also used in most of the BLE examples peripheral examples, so you could take a look there to see how it can be used.
    Since you only specify that you need microsecond accuracy, you might be able to use the Real Time Counter to reduce power consumption, but since I dont know your exact application requirements its hard to say if this is applicable.
    Depending on how long your device will be running each time it is booted and what solution you choose to proceed with, you might have to implement logic to catch any buffer overflows, so that you dont loose track of how much time has passed.

    Best regards,
    Karl

Related