Keil Logo

Low Power RTX

The Low Power RTX extension allows using power-saving modes efficiently and building RTX applications for power constrained devices such as battery powered devices.

The operation of the OS task scheduler in Low Power mode is different than normal operation. Instead of executing periodic system tick interrupts when all active tasks are suspended, the system enters a power-down mode. It calculates how long it can stay in power-down mode and disables power for peripherals and the CPU. The wake-up timer must remain powered. The time is responsible to wake-up the system after the power-down period expires.

The following functions provide a Low Power RTX extension:

Configuration

The Low Power RTX is controlled from the idle task. The peripheral wake-up timer must be initialized before the system enters an endless loop.

The function os_suspend() calculates the timeout until the first suspended task becomes ready, and returns the timeout to the user.

  for (;;) {
    sleep = os_suspend();

The user sets-up a peripheral timer to sleep timeout and starts the timer. The timeout is measured in system ticks.

    if (sleep) {
      /* Setup the wake-up timer ... */

When the wake-up timer is set-up and running, the user puts the system in power-down mode. The wake-up timer must run also in power-down mode. All other peripherals and the CPU may power-down to reduce power.

      /* Power-down the system ... */
      SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
      __WFE();

The wake-up timer, when expired, generates the interrupt and wakes-up the system. Hence, it must run also in power-down mode. The system resumes operation and needs to call the function os_resume(). This function restores the RTX and re-enables the OS task scheduler.

      /* After Wake-up */
      sleep = (tc - LPC_WWDT->TV) / 250;
    }
    os_resume(sleep);

If, for any reason, the system does not wake up immediately after the wake-up interrupt, the actual sleep time is checked and adjusted.

RTX_LowPower demo examples configured for low power RTX:

  • Usage of the WFE instruction for entering sleep mode is demonstrated in the RTX_LowPower example located in the directory \Keil\ARM\Boards\Keil\MCBSTM32F200.
  • Usage of the WFI instruction for entering sleep mode and early wake-up mechanism is demonstrated in RTX_LowPower example located in the directory \Keil\ARM\Boards\MCB1000\MCB11U10.

Note

  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.