I'm trying to use nrf_delay_ms function inside rtc_handler.
I was wondering if using delay function stops rtc from counting up, so it disrupts rtc interval time.
I'm trying to use nrf_delay_ms function inside rtc_handler.
I was wondering if using delay function stops rtc from counting up, so it disrupts rtc interval time.
Hello,
I was wondering if using delay function stops rtc from counting up, so it disrupts rtc interval time.
No, nrf_delay does not stop the RTC peripheral - it only estimates how many NOP instructions the CPU will need to execute to delay for the specified time.
Using nrf_delay is thus quite wasteful, since the CPU will be executing NOP instructions rather than sleeping, so it is not recommended to use in a finished application.
What might be happening in your case is that you perhaps call the nrf_delay function from a higher or equal priority level as the RTC, which means that the RTC interrupt will not be able to interrupt the nrf_delay function before it finishes. Could this be the case?
Best regards,
Karl