Hi Team,
Is this system specific function to retrieve a timestamp (in microseconds) function directly available or we need to develop?
Hi Team,
Is this system specific function to retrieve a timestamp (in microseconds) function directly available or we need to develop?
Hello,
I must say as @awneil that I am not exactly sure what you are asking for here. 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.
If you are looking to have the peripheral device sync to the time of a central, you may for example use the Current Time Service to pass a timestamp from the central to the peripheral device - please see the CTS Example from the SDK.
If this was not what you were asking about, please elaborate.
Best regards,
Karl
Hello,
I must say as @awneil that I am not exactly sure what you are asking for here. 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.
If you are looking to have the peripheral device sync to the time of a central, you may for example use the Current Time Service to pass a timestamp from the central to the peripheral device - please see the CTS Example from the SDK.
If this was not what you were asking about, please elaborate.
Best regards,
Karl
I need k_uptime_get() , similar to this API in ncs/applications/nrf/asset_tracker.
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