InBuilt RTC Implementation for nrf54l15 nordic MCU

My task is to implement inbuilt RTC for nordic MCU nrf54l15 series.

When i use the below API nrfx_grtc_init, it is throwing a error and returning a error code which is saying Zephyr already initialized GRTC internally.

is it true ? if not, how i can use the API for initialising the RTC , any other API we need to use?
provide inputs in going forward.



//Initialize GRTC
// nrfx_err_t err = nrfx_grtc_init(GRTC_IRQ_PRIORITY);
// if (err != NRFX_SUCCESS)
// {
// printk("nrfx_grtc_init() failed with code: %d\n", err);
// // prints NRFX_ERROR_ALREADY =195887116 error code
// // Zephyr already initialized GRTC internally
// return;
// }

Parents
  • Hi,

    May I ask what you will use the GRTC for? As you write, it is used by the Zephyr RTOS, and the typical way of using it is via Zephyr kernel timer APIs. Unless there is a need to use the GRTC directly, I advice against it.

    You cannot stop/start or change "global" configurations of the GRTC, as it is used by the system. In principle you can use available CC channels and interrupts as long as you don't touch anything used by the Zephyr kernel or MPSL, though. For MPSL it is documented that it used GRTC_3_IRQn for interrupt and GRTC channels 7 to 11 (so you cannot use the IRQ you have selected).

    From your code snippets I see you use interrupts and then I do not see major with using it that way instead of using Zephyr timer APIs (if you had a need to use it with PPI, that could have been different).

Reply
  • Hi,

    May I ask what you will use the GRTC for? As you write, it is used by the Zephyr RTOS, and the typical way of using it is via Zephyr kernel timer APIs. Unless there is a need to use the GRTC directly, I advice against it.

    You cannot stop/start or change "global" configurations of the GRTC, as it is used by the system. In principle you can use available CC channels and interrupts as long as you don't touch anything used by the Zephyr kernel or MPSL, though. For MPSL it is documented that it used GRTC_3_IRQn for interrupt and GRTC channels 7 to 11 (so you cannot use the IRQ you have selected).

    From your code snippets I see you use interrupts and then I do not see major with using it that way instead of using Zephyr timer APIs (if you had a need to use it with PPI, that could have been different).

Children
Related