Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

As with nearly every RTOS, µC/OS-III-based systems usually rely the presence of a time source called the clock tick or system tick to keep track of time delays, timeouts, and timers. µC/OS-III’s clock tick handling is encapsulated in the file os_tick.c.

There are three possible configurations for µC/OS-III which determine how it keeps time.

Tickless Mode

A common misconception is that a system tick is always needed with µC/OS-III. In fact, many low-power applications may not implement the system tick because of the power required to maintain the tick list. In other words, it may not be reasonable to continuously power down and power up the product just to maintain the system tick. Since µC/OS-III is a preemptive kernel, an event other than the tick interrupt can wake up a system placed in low power mode by either a keystroke from a keypad or other means. However, not having a system tick means that the user is not allowed to use time delays and timeouts on system calls. This is a decision required to be made by the designer of the low-power product.

Periodic Tick Mode

The simplest method for enabling the kernel's timekeeping services is Periodic Tick Mode. It requires only that an interrupt be triggered at a fixed frequency. However, the consequence of this approach is that the system needs to service the tick interrupt even when there are no tasks ready to run. Periodic Tick Mode is often unsuitable for low-power applications as a result. This is the only mode to properly support Round-robin scheduling.

Dynamic Tick Mode

A more advanced method of enabling timekeeping services is to use a hardware timer which can be reconfigured to interrupt when the next delay or timeout occurs. It is a compromise between the other two modes which provides the timekeeping services without periodically waking the target. This approach, called "Dynamic Tick", is natively supported by µC/OS-III but requires additional BSP code to function correctly. 

Choosing the Tick Mode

Selecting the tick mode is done by configuring two compile-time parameters in os_cfg.hOS_CFG_TICK_EN and OS_CFG_DYN_TICK_EN. There are 4 possible configurations of these booleans, three of which are valid.

  • No labels