Your "One-Stop-Shop" for your next Embedded Project

Stacks Image p10690_n10686

SEGGER embOS Tickless support

The embOS tickless low power support reduces the power consumption for e.g. battery powered devices. Instead of having a timer interrupt for each system tick the timer is reprogrammed to be able to spend as much time as possible in low power mode.

How to use it

Tickless support can be added to any embOS start project. The embOS tickless support is based on the three new API functions OS_GetNumIdleTicks(),  OS_StartTicklessMode and OS_AdjustTime().

In order to use the tickless support the OS_Idle() function has to be modified and a callback function has to be implemented. The tickless OS_Idle() function calculates the amount of time which should be spent in low power mode and reprograms the timer accordingly. The callback function is called automatically from the scheduler when the low power period ended. It adjusts the system time and resets the timer to it's default tick time.

Sample implementation for ST STM32F103

void OS_Idle(void) {
  OS_TIME IdleTicks;
  IdleTicks = OS_GetNumIdleTicks();
  if (IdleTicks > 1) {
    if ((OS_U32)IdleTicks > TIM2_MAX_TICKS) {
      IdleTicks = TIM2_MAX_TICKS;
    OS_StartTicklessMode(IdleTicks, &_EndTicklessMode);
    TIM2_ARR = (OS_TIMER_RELOAD * IdleTicks) - TIM2_CNT; // Set compare reg.
  while (1) {
    __asm(" wfi");
static void _EndTicklessMode(void) {
  OS_U16 NumTicks;
  OS_U16 Cnt;
  OS_U16 IReq;
  if (OS_Global.TicklessExpired) {
    // The timer interrupt was executed => we completed the sleep time
  } else {
    Cnt  = TIM2_CNT;
    IReq = TIM2_SR & (1uL << 0u);
    if (IReq) {
    } else {
      // We assume OS_TIMER_RELOAD Counts per tick and hardware timer
      // which counts up.
      NumTicks = Cnt / OS_TIMER_RELOAD;
      Cnt     -= (NumTicks * OS_TIMER_RELOAD);
      TIM2_CNT = Cnt;
  TIM2_ARR = OS_TIMER_RELOAD; // Set default value for 1 tick

Frequently Asked Questions


Where can I find more information about tickless support for a specific CPU?

A: Segger provides Application Notes for tickless support for different CPUs.
Q: Can I use embOS without tickless support?
A: Yes, you can use embOS without tickless support. There is no change required in your project.
Q: What hardware depending functions has to be implemented and where?
A: OS_Idle() has to be modified and the callback function has to be implemented.  OS_Idle() is part of the RTOSInit.c file. We suppose to implement the callback  function in the same file. 
Q: What triggers the callback function?
A: The callback function is executed once from the scheduler when the tickless operation ends and normal operation resumes.

Learn more about embOS Tickless Support