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 Reply Children
  • Hi Tushar,

    There is no timer with that resolution in Zephyr (you could get CPU cycles, but that will most likely not work as I assume you don't intend to let the CPU run always, wasting power(?)).

    Moreover, there is no low power clock source that will give you that resolution, so if you want that you will have to use a TIMER peripheral. You would need to handle wrap arounds though (perhaps simplest by using a 64 bit offset that you update whenever it wraps around), and normally when you read the time take the current timer value + the accumulated offset (+ whatever you got from syncing with the phone).

    Note that this can never be low power, and there is physically no way to get better resolution than maximum 32.768 kHz with low power, as that is the frequency of the low power oscillator on the hardware. If you need low power (this is a key question!), then the only option to also give you better time resolution is to use an external RTC that can give a compromise between resolution, accuracy and power consumption that fits you requirements.

  • Hi Einar Thorsrud,

    In RTC which api can i use to get the value in microsecond 

    can u please tell me 

    Regards

    Tushar

  • It is not possible. The frequency of the RTC is 32.768 kHz.

Related