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,
The error shows that one variable you have declared or defined (grtc_channel), but you have not actually used it anywhere in your code. This is a common warning or error in C/C++ development, especially when using strict compiler flags.
To resolve this, ensure that you use the variable in your code, for example by passing it to a function. Otherwise, you have to remove this.
Can you please share your application folder?
Hello,
The error shows that one variable you have declared or defined (grtc_channel), but you have not actually used it anywhere in your code. This is a common warning or error in C/C++ development, especially when using strict compiler flags.
To resolve this, ensure that you use the variable in your code, for example by passing it to a function. Otherwise, you have to remove this.
Can you please share your application folder?
Kazi Afroza Sultana The unused var won't cause build error.
The main reason is the header not exits.
I don't want talk more. just show your code which is a complete project.
It won't be difficult for your verder, but cost much time for us costumers.
Thanks.
Hello,
I understand that you don't want to talk more. That's why I asked you in my previous reply to share your application code so I can look at from my side and also can try to reproduce the issue on nRF54L15 DK.
You can look at this previous case (18) Nordic DevZone to understand my previous reply.
Besides this, I would like to explain a bit more about two functions k_cycle_get_32() and k_cycle_get_64() which are used to read the current value of the hardware clock (system timer) in zephyr. To set the GRTC for obtaining the timestamp these functions are needed. These return the number of hardware cycles since boot, which we can use as timestamp for relative timing or real time clock.
To obtain a timestamp on the nRF54L15-DK, you generally use the system timer or RTC (Real-Time Counter/Clock) functionality provided by the hardware and the Zephyr OS. On nRF54L15, the GRTC (General Real-Time Counter) is the relevant hardware peripheral.
#include <zephyr/kernel.h> uint32_t timestamp_32 = k_cycle_get_32(); uint64_t timestamp_64 = k_cycle_get_64();
These functions are defined to "read the hardware clock" and are available in Zephyr's kernel API. The value returned is in hardware cycles, not seconds or milliseconds, so you may need to convert it using your system's clock frequency if you need standard time units. For nRF54L15, the system clock frequency is typically derived from the LFCLK (often 32.768 kHz) or HFCLK, depending on configuration. You have to check your board and project setting for the accurate frequency.
For direct hardware control of the nRF54L15's real-time counter and clock output features, you need to use nrfy_grtc_clkout_set() function. This case (18) nRF54L15 clock output - Nordic Q&A - Nordic DevZone - Nordic DevZone has shown how to use it.
#include <haly/nrfy_grtc.h>
nrfy_grtc_clkout_set(NRF_GRTC, NRF_GRTC_CLKOUT_32K, true);
There is no specific RTC samples for nrf54L15, but you can look at Zephyr's timer and counter driver samples (zephyr/samples/drivers/counter/alarm, for general usage patterns.
So, based on all the directions mentioned above, you can modify your code and send me the project file. I will help accordingly.
Thanks.
BR
Kazi
Hi,
Currently, I still haven't been able to implement the function of using grtc as the real-time clock for the nrf54l15-dk. Could you please provide some reference engineering examples?
Thanks.
To set the time, you can save the difference between GRTC and the timestamp (epoch microseconds) in memory. To get the time, you add the same difference to the GRTC. If you save the difference in a retained memory region, it will survive soft reboots.
Hi
I can understand what you mean. But I don't know how to do it. Could you please provide an example of a code engineering project?
Thanks.