Tickless Mode

If the system tick is disabled, µC/OS-III is said to be configured for Tickless Mode. The application may still take advantage of priority-based scheduling by pending on kernel objects and suspending or resuming tasks.

Benefits

  • The application has full control over timing in the system. This allows more flexibility in optimizing power consumption.
  • A number of global variables, functions, and OS_TCB member variables are compiled out, reducing the overall memory consumption.

Implications

  • Time services are disabled.
    • A build error will occur if the Timer feature is enabled.
    • Any attempt to perform a task delay or Get/Set the system time returns with the error message OS_ERR_TICK_DISABLED.
    • Any attempt to specify a timeout when pending on a kernel object returns with the error message OS_ERR_TICK_DISABLED. Pending without timeouts is unaffected.
  • Round-Robin scheduling will not function correctly in this mode.

System Behavior

Here is an example of how a low-power tickless system might operate. The peripheral in question could represent almost any hardware which generates an interrupt, e.g. a GPIO pin which monitors when a switch is pressed.

Figure - Tickless Mode

(1) The task waits for a signal from the ISR by pending on a kernel object (e.g. a semaphore or queue). Since we have no time services, the task may only perform an indefinite pend (timeout = 0).

(2) Since the only task in our system is now pending, the kernel switches to the idle task until a scheduling event occurs. We can also take advantage of low-power modes during this time by placing the appropriate code into OSIdleTaskHook().

(3) When the peripheral interrupt finally occurs, our system leaves any low-power state it may have entered in order to service it.

(4) After servicing the interrupt, the ISR signals our task by posting to the kernel object.

(5) When OSIntExit() is called, the scheduler is implicitly invoked to see if any new tasks were readied by the ISR. Our task is selected to run next because of the post in step #4. It may now execute the application logic associated with this particular event.

Using a Hardware Timer

This example demonstrates how to provide time services from the application level in a tickless configuration. The generic peripheral from Example 1 is replaced by a configurable hardware timer. Notice that the kernel's time services are never used to achieve the delay.

Figure - Tickless Mode w/ HW Timer

(1) Our task wishes to delay for 1 minute. Before pending on a kernel object, it configures the Hardware Timer to fire an interrupt in one minute and starts the timer's countdown.

(2) It immediately pends on the kernel object.

(3) The kernel switches to the idle task and may possibly enter a low-power state.

(4) Once the minute has expired, the timer interrupt will power-up the system and wake our task by posting to the kernel object.