# Entering Low power mode infinitely

**URL:** <https://forums.freertos.org/t/entering-low-power-mode-infinitely/10703>\
**Category:** Kernel\
**Created:** [September 18, 2020, 4:13pm UTC](https://forums.freertos.org/t/entering-low-power-mode-infinitely/10703 "2020-09-18T16:13:58Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![nami1508](https://avatars.discourse-cdn.com/v4/letter/n/b38774/32.png) [@nami1508](https://forums.freertos.org/u/nami1508)\
**Post date:** [September 18, 2020, 4:13pm UTC](https://forums.freertos.org/t/entering-low-power-mode-infinitely/10703/1 "2020-09-18T16:13:58Z")

</div>

Hi,

I’m a student and new to freeRTOS.  
I’m developing an application in which I would like MCU running freeRTOS to enter sleep infinitely till an external wake-up interrupt is asserted (without getting woken-up by systick or Watchdog interrupt).

On researching, I found the following two ways of entering sleep in freeRTOS:

1. Using vApplicationIdleHook() by setting configUSE\_IDLE\_HOOK = 1
2. Using portSUPPRESS\_TICKS\_AND\_SLEEP() by setting configUSE\_TICKLESS\_IDLE = 1

**Option 1: vApplicationIdleHook()**  
If I enter sleep in this API, I feel that the systick would still be running and would wake-up the system at next systick interrupt.

**Option 2: portSUPPRESS\_TICKS\_AND\_SLEEP**  
If I use this then it seems I would have to specify params like configEXPECTED\_IDLE\_TIME\_BEFORE\_SLEEP, xExpectedIdleTime etc. which might not be applicable for my use-case.

Please suggest how should I go about implementing this.  
Thanks.

---

<div class="post-metadata">

**Author:** ![jefftenney](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/jefftenney/32/1314_2.png) [@jefftenney](https://forums.freertos.org/u/jefftenney)\
**Post date:** [September 18, 2020, 5:11pm UTC](https://forums.freertos.org/t/entering-low-power-mode-infinitely/10703/2 "2020-09-18T17:11:34Z")

</div>

Are you using a FreeRTOS port that provides a default implementation of tickless idle? The ARM Cortex M ports do, for example.

---

<div class="post-metadata">

**Author:** ![nami1508](https://avatars.discourse-cdn.com/v4/letter/n/b38774/32.png) [@nami1508](https://forums.freertos.org/u/nami1508)\
**Post date:** [September 18, 2020, 5:15pm UTC](https://forums.freertos.org/t/entering-low-power-mode-infinitely/10703/3 "2020-09-18T17:15:43Z")

</div>

Hi Jeff  
I’m using a RISCV based MCU and dont have the default implementation of tickless idle.  
if possible, can you please share the implementation for riscv/cortex M for reference?

btw, should I go for tickless idle over vApplicationIdleHook() in this scenario?

---

<div class="post-metadata">

**Author:** ![jefftenney](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/jefftenney/32/1314_2.png) [@jefftenney](https://forums.freertos.org/u/jefftenney)\
**Post date:** [September 18, 2020, 5:21pm UTC](https://forums.freertos.org/t/entering-low-power-mode-infinitely/10703/4 "2020-09-18T17:21:14Z")

</div>

Here’s the default implementation for Cortex M4F. [https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/385e700953ad68680890cd9c4977dff384879a03/portable/GCC/ARM\_CM4F/port.c#L516](https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/385e700953ad68680890cd9c4977dff384879a03/portable/GCC/ARM_CM4F/port.c#L516)

And here’s where FreeRTOS calls the function. (Note that FreeRTOS determines on its own the expected idle time, based on delays, timers, and timeouts currently underway.) [https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/385e700953ad68680890cd9c4977dff384879a03/tasks.c#L3504](https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/385e700953ad68680890cd9c4977dff384879a03/tasks.c#L3504)

---

<div class="post-metadata">

**Author:** ![jefftenney](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/jefftenney/32/1314_2.png) [@jefftenney](https://forums.freertos.org/u/jefftenney)\
**Post date:** [September 18, 2020, 5:26pm UTC](https://forums.freertos.org/t/entering-low-power-mode-infinitely/10703/5 "2020-09-18T17:26:34Z")

</div>

> [@nami1508](#):
>
> should I go for tickless idle over vApplicationIdleHook() in this scenario?

The answer is of course “it depends” 😉 My opinion is the best way is to implement the suppress-ticks-and-sleep method, even if at first your implementation is rudimentary. That allows you to enhance the implementation later as application evolves. I’m not a fan myself of the idle-hook approach because you’ll end up duplicating some of the structure already in the FreeRTOS side of the tickless interface.

---

<div class="post-metadata">

**Author:** ![richard-damon](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/richard-damon/32/38_2.png) [@richard-damon](https://forums.freertos.org/u/richard-damon)\
**Post date:** [September 18, 2020, 5:30pm UTC](https://forums.freertos.org/t/entering-low-power-mode-infinitely/10703/6 "2020-09-18T17:30:42Z")

</div>

If you want to go to sleep for an extended time, then you really need some form of tickless idle, as otherwise the tick will keep waking you up. vApplicationIdleHood by itself can’t help with this, unless you put code like would be used in tickless idle into that hook.
