NRF54L15 GRTC SYSCOUNTER

Hi Dev,

Development platform: NRF54L15 + NCS 3.2.3.
We are using the GRTC SYSCOUNTER as a system timestamp. Under normal conditions, a software reset does not clear the GRTC counter value.

However, after long-term operation, we occasionally observe that the SYSCONTER becomes zero after a reset, causing the system timestamp to roll back.

Could you please clarify:

1. Under which reset conditions is the SYSCONTER cleared, and under which conditions is it preserved?

2. How can we prevent the SYSCOUNTER from being cleared across resets (or recover the timestamp reliably if clearing is unavoidable)?

Thanks,
Chen

  • It seems possible that the nrfx_grtc_timer has an issue in how it handles the soft reset (CTRL-AP reset)

    sys_reboot->sys_clock_disable()->nrf_grtc_timer.c:sys_clock_disable()->nrfx_grtc_uninit->

    #if NRFY_GRTC_HAS_EXTENDED && NRFX_IS_ENABLED(NRFX_GRTC_CONFIG_AUTOSTART)
        nrfy_grtc_sys_counter_auto_mode_set(NRF_GRTC, false);
        nrfy_grtc_sys_counter_set(NRF_GRTC, false);
        nrf_grtc_task_trigger(NRF_GRTC, NRF_GRTC_TASK_STOP);
        nrf_grtc_task_trigger(NRF_GRTC, NRF_GRTC_TASK_CLEAR);
    #endif // NRFY_GRTC_HAS_EXTENDED && NRFX_IS_ENABLED(NRFX_GRTC_CONFIG_AUTOSTART)

    It looks like NRFX_GRTC_CONFIG_AUTOSTART is the reason here as if it is set to 1 then nrfx_grtc stops and clears the GRTC counters

    try setting CONFIG_NRF_GRTC_START_SYSCOUNTER=n in your prj.conf and make sure you start the syscounter in app and see if your issue goes away.

  • Thanks for the analysis.

    Instead of modifying the Kconfig, I'm considering using NVIC_SystemReset() directly. This bypasses sys_clock_disable() and should preserve the GRTC counter.

    Two quick questions:

    1. Is NVIC_SystemReset() safe for preserving GRTC without affecting other AON registers?

    2. Any known issues on nRF54L15 with skipping de-init for peripherals like Radio/DMA, assuming we re-init them after reset?

    Thanks,
    Chen

  • Chen, I think NVIC_SystemReset() is a valid workaround for preserving GRTC, because on our chips that is the same final path Zephyr uses anyways.

Related