How to get timestamp with nrf52840 using RTC

Hi all,

In my project i want to get the timestamp with help of RTC. but when i am printing timestamp it is giving timestamp after power on of the device but i want epoch time for current date and time. how i can get that?

Thanks,

Revati

Parents
  • Hi,

    The RTC peripheral in the nRF52840 is a real time counter only, and the counter is reset on every reset. If you need to keep the current date and time after powering the device off and on again you need something else, like a dedicated calendar RTC IC. Alternatively, if you don't always need a date and time after reset, you could for instance connect to a phone with the current time service (CTS), to get the time and keep the current time in firwmare. But it will be loest upon the next reset.

Reply
  • Hi,

    The RTC peripheral in the nRF52840 is a real time counter only, and the counter is reset on every reset. If you need to keep the current date and time after powering the device off and on again you need something else, like a dedicated calendar RTC IC. Alternatively, if you don't always need a date and time after reset, you could for instance connect to a phone with the current time service (CTS), to get the time and keep the current time in firwmare. But it will be loest upon the next reset.

Children
Related