Hi,Team,
I'm currently using the nrf54l15-dk. I want to set the rtc of the nrf54l15-dk to obtain the timestamp. How should I configure the rtc? Which examples should I refer to?
My ncs version is v2.8.0.
Thanks.
Hi,Team,
I'm currently using the nrf54l15-dk. I want to set the rtc of the nrf54l15-dk to obtain the timestamp. How should I configure the rtc? Which examples should I refer to?
My ncs version is v2.8.0.
Thanks.
Hello,
Peripheral_cts_client sample can be a good start if you want to apply calendar timestamps via BLE. It shows connect/bond, read the Current Time characteristic, parse and print the time, and handle notifications, matching your “set/read timestamp” flow with a CTS-capable peer device.
Hi,
I think this example doesn't quite meet my requirements. I want to directly call API to set and read the timestamp. How should I do it?
Thanks.
I agree with you.
In this example GRTC was even not enabled.
If possible, could you provide us with an example?Kazi Afroza Sultana
Thank you.
Hello,
You can use UNIX timestamp (using Date time+ k_uptme_get. UNIX timestamp requires that the data time library has obtained a valid time first (e.g., via data_time_update_async or data_time_set), then coverts uptime UNIX time. source: date_time group; date_time.h
In the prj.conf file you need to set the following config to enable GRTC SYSCOUNTER :
# Ensure GRTC SYSCOUNTER is started by the driver on boot (nRF54L15) CONFIG_NRF_GRTC_START_SYSCOUNTER=y
Now in the app code, you can follow the following steps:
a. Initializing Date Time library and setting valid time
An example code
int64_t uptime = k_uptime_get();
date_time_uptime_to_unix_time_ms(&uptime);
// At this point `uptime` contains the unix timestamp in milliseconds.