How should I decide appropriate Tick time configTICK_RATE_HZ in RTOS project?

In STM32F4 project, I am using FreeRTOS. I am at initial phase of defining firmware design, I figured out there will be approximately 20-25 RTOS tasks running. FreeRTOS comes with default 1ms tick time which can be configured. So, on what basis should I decide appropriate Tick time for my system.
Solution
As @Marvee Amasi and @techielew mentioned, you can consider so many things like the required level of real-time precision, power consumption, context switching overhead, and so on. But in most of the system, all tasks do not need a high level of time precision, and even its not just depend on tick but on overall firmware design, So I will suggest you to consider below things for your tick calculation and overall design.

  • Calculate approximate execution time of each task in milliseconds. If you have one/two time wise lengthy tasks with respect to execution time, please ignore them for Tick calculation.
  • Determine maximum acceptable latency for each task.
  • Trade off Tick time between least acceptable latency and the execution time of maximum number of tasks.
  • Try to keep high priority task’s execution time short. wherever possible use event based blocking. So the CPU will have more idle time. It increases responsiveness.
  • I assume pre-emption is enabled as it is in FreeRTOS default configurations .
If you don’t want to do this all, keep Tick of 10 ms, and observe your system for responsiveness and performance. As per my experience 10 ms is a well balanced tick for most of the RTOS applications.
Was this page helpful?