RTC peripheral and system clock

Hi,

Is there any relationship between RTC peripheral and the system clock (which from DTC it looks like attached to rtc0)?

I'm trying to use PPI to generate a radio task based on system clock compare (i.e. send packet at day:mont:year:hour:minute:second:msec:usec type of event)

The RTC in the peripheral section is too short to contain long enough time span between overflow and I can't find in the documentation a way to invoke PPI from system clock.

Is that possible at all?

Thanks,

Guy.

  • Hi Guy,

    I'm taking over the ticket from Jared. 

    Please give us some more information about the time sync requirement you have. What's the accuracy level you want to achieve ? 

    Can you tell a little bit more about the device connected to the cloud. Is it a nRF device ? or it's a phone ? 
    As far as I know the kernel use RTC1 for keeping time. 

    config NRF_RTC_TIMER
    	bool "nRF Real Time Counter (NRF_RTC1) Timer"
    	depends on CLOCK_CONTROL
    	depends on SOC_COMPATIBLE_NRF
    	select TICKLESS_CAPABLE
    	select NRF_HW_RTC1_RESERVED
    	help
    	  This module implements a kernel device driver for the nRF Real Time
    	  Counter NRF_RTC1 and provides the standard "system clock driver"
    	  interfaces.

    RTC0 is also reserved if you use BLE (MPSL module). 

    What left is available for you to use for time sync (RTC or TIMERs). Jared has sent you the blog on how to do time sync between 2 device. 

    From what you described earlier, you want to sync them with wall clock time / epoch time. I would suggest to use the synchronized timer to count time instead of using the uptime from Zephyr (depends on the accuracy you are looking at). You can use the CC event as the tick to count time. This way you don't have to deal with the drift on the uptime/RTC1. 




  • Hi Hung,

    My requirement is to send timestamped messages from the non-cloud connected device to the cloud connected device. These messages convey sensor data that is affected by the system connected to the cloud connected device. So for the cloud connected device to be able to associate the configurations applied to the system and the sensor readings, the time needs to be synced.

    I've neglected the idea of using the wall clock. A free running timer should be good enough for this purpose.

    The accuracy should be sub 1 ms (shooting for 500us).

    My question was basically what you described: RTC1 and RTC0 and being used by the kernel.

    So, if I call NRF_RTC1->TASKS_STOP it will affect the kernel uptime.

    Is that a correct statement?

    Thanks,

    Guy.

  • Hi Guy,

    GuyYaniv said:

    So, if I call NRF_RTC1->TASKS_STOP it will affect the kernel uptime.

    Yes, you are correct. 

Related