Skip to main content
  • 产品
  • Software evaluation
  • 下载
  • Free utilities
  • 购买
  • 芯片厂商
  • 支持
  • 关于我们
  • Search
  • 工作机会
  • 新闻简报
  • 联系我们
  • 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

    全球总部

    德国: SEGGER Microcontroller GmbH

    地址: Ecolab-Allee 5
    40789 Monheim am Rhein, Germany
    电邮: info@segger.com
    电话: +49-2173-99312-0
    传真: +49-2173-99312-28

    网点分布

    中国:哲戈微系统科技(上海)有限公司

    地址: 中国上海市闵行区秀涟路133号
    大虹桥国际A 栋218室
    邮编201199
    电邮: china@segger.com
    电话: +86-133-619-907-60


    简易信息聚合

    通过ISO 9001认证

    ISO 9001

    30多年的嵌入式行业经验

    First-class embedded software tools since 1992
    • 版本说明
    • 免责声明
    • 行为准则
    • 隐私策略
    • 沪ICP备2022005181号
    • 沪公网安备 31011202014525号
    © 2026 SEGGER - 版权所有.

    您即将离开 segger.cn 而访问境外网站,是否继续?