nrf52, use Systick or RTC?

Hi,

After reading some questions about these topics I became a little confused.

I want to count milliseconds, so should I use Systick_Handler or use Real Time Counter Handler?

I've read that on sleep mode, Systick does not work, so this can be a pro to use RTC, but probably I will not set the NRF52 to sleep mode, so a simple and fast solution is to use Systick.

I've already tried with Systick, but the Systick_Handler never occurs, I'm not using sd_app_evt_wait(). What am I missing?

volatile uint32_t time = 0;

/* SysTick interrupt Handler. */
void SysTick_Handler(void)  {
    time++;
}


int main(void)
{
    SysTick_Config(SystemCoreClock / 1000);
    NVIC_EnableIRQ(SysTick_IRQn);

while (true) {}
}
Parents
  • Regarding "but probably I will not set the NRF52 to sleep mode"; Note that if you don't put the CPU in System ON Idle mode, the CPU will be in RUN mode all the time and consume a lot of power, and this would not be recommend if you are powering your chip from a battery. Using systick is therefore generally not recommended. The RTC as AmbystomaLabs mentioned is recommended for low-power applications.

  • Thanks Sigurd. I am expecting not to use sleep mode but of course it always better to develop a scalable solution.

Reply Children
No Data
Related