auto update of epoch time

Hi all,

I'am sending  epoch time from nrf_connect(mobile) to nrf52840dk only once,

then i need to update epoch time  continuosly with nanosecond frequency

how can i do it

Regards

Tushar

Parents
  • Hi Tushar,

    Which exact resolution do you need? If you really need close to nanosecond resolution, then you will have to use a timer which is based on the HF clock. This is only 16 MHz though, and there are no higher frequency clocks available. Also, this will force the HF clock always on, so your device will not be low power.

    If you don't need as high resolution and needs the device to be low power, then it makes more sense to use an RTC based approach. The RTC is 32.768 kHz and the accuracy will be identical to the accuracy of the 32.768 kHz crystal you use on your board.

    In the latter case, if using the nRF5 SDK, the simplest way to do this is to use the app_timer library which is almost always used, and change it slightly so that the you can use the get_now() function from outside (see this post). This will then give you an always increasing 64 bit timer value. With this, just compare that with the time you got when you synced with a mobile phone, and you will effectively have the epoch time. If using nRF Connect SDK, you already have support for epoch time.

    Einar

Reply
  • Hi Tushar,

    Which exact resolution do you need? If you really need close to nanosecond resolution, then you will have to use a timer which is based on the HF clock. This is only 16 MHz though, and there are no higher frequency clocks available. Also, this will force the HF clock always on, so your device will not be low power.

    If you don't need as high resolution and needs the device to be low power, then it makes more sense to use an RTC based approach. The RTC is 32.768 kHz and the accuracy will be identical to the accuracy of the 32.768 kHz crystal you use on your board.

    In the latter case, if using the nRF5 SDK, the simplest way to do this is to use the app_timer library which is almost always used, and change it slightly so that the you can use the get_now() function from outside (see this post). This will then give you an always increasing 64 bit timer value. With this, just compare that with the time you got when you synced with a mobile phone, and you will effectively have the epoch time. If using nRF Connect SDK, you already have support for epoch time.

    Einar

Children
Related