Why is system tick frequency so high?

Hello!

We've been doing some serious development on nRF52833 and nRF5340 machines with Zephyr, and on both of them CONFIG_SYS_CLOCK_TICKS_PER_SEC is set to 32768 by default. We've also been using similar category Cortex M4 MCUs with FreeRTOS with satisfaction set to a 1024 systick frequency.

I personally think 32768Hz generates way too much context switch overhead (32768 IRQs in a sec!) and don't really understand why this high rate is required. To be honest, we could do all timings perfectly with FreeRTOS too, which is configured to 1024Hz only, but there's always the possibility to use a MCU timer to get greater granularity if needed.

By the way, I was unable to locate the sources where Zephyr sets up systick, so at the moment I'm not sure whether Zephyr uses the MCU's SysTick peripheral or uses an alternative MCU timer/RTC to set up system tick IRQs. FreeRTOS can be configured to use either SysTick or RTC peripheral according to our taste.

I tried reducing CONFIG_SYS_CLOCK_TICKS_PER_SEC to 1024 and on a short term nothing bad was observed, but I'd need a confirmation from Nordic staff that this setting is also safe. I can keep in hand the granularity of my timings even at this lower systick frequency too.

So, any thoughts on this?

Many thanks,

Parents Reply Children
Related