This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Clocks, timers, RTC, why?

I am developing software for the nRF52. As recommended by many recent posts here in the Developer Zone, I have upgraded to SDK 11. I am working on an application for a battery-powered device which will repeat the following cycle:

  1. Sleep, for one to 10 minutes.

  2. On waking, conduct six well-timed operations, about 0.1 seconds apart. These operations will include sampling the SAADC and acting as an I2C master to communicate with a peripheral.

  3. Communicate the results of the operations in step 2. At first I will send this information to the UART, but eventually I want to transmit over BLE.

Obviously, I don't want to use a busy-wait when the CPU will be idle for 10 minutes. But there seem to be three different ways to implement hardware timers. If I look at an nrf_config_drv.h file, I see flags for CLOCK_ENABLED, TIMER0_ENABLED through TIMER4_ENABLED, and finally, RTC0_ENABLED through RTC3_ENABLED.

The tutorials (which only cover SDK 10) and example code are not helping me to understand the different types of timers, or how to choose between them. Can someone please summarize the reasons for the existence of these various approaches to timing? Thanks.

Related