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 8 Next »

In order to provide time services, such as time delays, timeouts, and timers, µC/OS-III-based systems rely the presence of a time source called the clock tick or system tick. µ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, or if, it provides time services..

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

In the section Interrupt Management, it was established that µC/OS-III generally requires (as do most kernels) that the user provide a periodic interrupt to keep track of time delays and timeouts. This periodic time source is called a clock tick and should occur between 10 and 1000 times per second, or Hertz (see OS_CFG_TICK_RATE_HZ in os_cfg_app.h). The actual frequency of the clock tick depends on the desired tick resolution of the application. However, the higher the frequency of the ticker, the higher the overhead. We call this setup Periodic Tick Mode. It is the simplest method for enabling the kernel's timekeeping services However, the consequence of this approach is that the system needs to service the tick interrupt frequently, 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