Skip to main content
  • Products
  • Evaluate our Software
  • Downloads
  • Free Utilities
  • Purchase
  • Silicon Vendors
  • Support
  • About Us
  • Blog
  • Forum
  • Search
  • Jobs
  • Newsletter
  • Blog
  • Contact
  • Shop
  • embOS
  • Tickless Support

    Tickless support

    Energy efficient enhanced low power support.

    Contact us
    Downloads
    Documentation
    SEGGER embOS

    Overview

    The embOS tickless low power support reduces power consumption, which is particularly important for battery powered devices. Instead of having a timer interrupt for each system tick, the timer is reprogrammed in order to spend as much time as possible in low power mode.

    Tickless support can be added to any embOS start project. The embOS tickless support is based on three API functions: OS_TICKLESS_GetNumIdleTicks(), OS_TICKLESS_Start() and OS_TICKLESS_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 OS_Idle() function calculates the amount of time which may be spent in low power mode and reprograms the hardware timer accordingly. The callback function is called automatically by the scheduler when the low power period expires. It adjusts the system time and resets the hardware timer to its default tick time.

    Example implementation

    void OS_Idle(void) {
      OS_TIME IdleTicks;
    
      OS_INT_Disable();
      IdleTicks = OS_TICKLESS_GetNumIdleTicks();
      if (IdleTicks > 1u) {
        if ((OS_U32)IdleTicks > TIM2_MAX_TICKS) {
          IdleTicks = TIM2_MAX_TICKS;
        }
        OS_TICKLESS_Start(IdleTicks, &_EndTicklessMode);
        TIM2_ARR = (OS_TIMER_RELOAD * IdleTicks) - TIM2_CNT;  // Set compare reg.
      }
      OS_INT_Enable();
      while (1) {
        __asm(" wfi");
      }
    }
    
    static void _EndTicklessMode(void) {
      OS_U16 NumTicks;
      OS_U16 Cnt;
      OS_U16 IReq;
    
      if (OS_Global.TicklessExpired != 0) {
        // The timer interrupt was executed => we completed the sleep time
        OS_TICKLESS_AdjustTime(OS_Global.TicklessFactor);
      } else {
        Cnt  = TIM2_CNT;
        IReq = TIM2_SR & (1u << 0);
        if (IReq) {
        OS_TICKLESS_AdjustTime(OS_Global.TicklessFactor);
        } 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;
          OS_TICKLESS_AdjustTime(NumTicks);
        }
      }
      TIM2_ARR = OS_TIMER_RELOAD;  // Set default value for 1 tick
    }

    Example project

    SEGGER offers Tickless demos for STM32L476 and nRF52832. Please visit SEGGER Knowledge Base for detailed information on the example projects.

    • User manual
    • Online documentation
    • Knowledge Base
    • List of downloads
    • Release notes
    • Update notification
    • Pricing
    • Support
    • Silicon vendor resources

    Headquarters

    SEGGER Microcontroller GmbH

    Ecolab-Allee 5
    40789 Monheim am Rhein, Germany
    info@segger.com
    Tel.: +49-2173-99312-0
    Fax: +49-2173-99312-28

    Locations

    USA: SEGGER Microcontroller Systems LLC

    Boston area
    101 Suffolk Lane
    Gardner, MA 01440, USA
    us-east@segger.com
    Tel.: +1-978-874-0299
    Fax: +1-978-874-0599

    Silicon Valley
    Milpitas, CA 95035, USA
    us-west@segger.com
    Tel.: +1-408-767-4068

    China: SEGGER Microcontroller China Co., Ltd.

    Room 218, Block A, Dahongqiaoguoji
    No. 133 Xiulian Road
    Minhang District, Shanghai 201199, China
    china@segger.com
    Tel.: +86-133-619-907-60

    ISO 9001 certified

    ISO 9001

    30+ years of experience

    First-class embedded software tools since 1992
    • Imprint
    • Disclaimer
    • Code of Conduct
    • Privacy Policy
    © 2025 SEGGER - All rights reserved.