Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Is nrf_rtc_counter_get interrupt safe?

Hi!

I'm not good at C and microcontrollers programming. Could somebody clarify, if nrf_rtc_counter_get interrupt safe? It just reads value from rtc register->COUNTER (24bit), how many ticks it takes?

Thanks.

Parents
  • how many ticks it takes?

    Should take much less than one RTC tick, as this register is latched in the PCLK16M clock domain.

    From the NRF52840 PS (chapter 6.22.9): "Read takes the CPU 2 cycles in addition resulting in the COUNTER register read taking a fixed five PCLK16M clock cycles."

    Note that this does not include setup instructions - you may need to put the register address into a core register first.

Reply
  • how many ticks it takes?

    Should take much less than one RTC tick, as this register is latched in the PCLK16M clock domain.

    From the NRF52840 PS (chapter 6.22.9): "Read takes the CPU 2 cycles in addition resulting in the COUNTER register read taking a fixed five PCLK16M clock cycles."

    Note that this does not include setup instructions - you may need to put the register address into a core register first.

Children
Related