2
votes

I'm looking for advice how to put in place a lower power management inside an embedded application. My idea is to handle WFI enabled inside the IDLE task based on the RTOS info + application constraint.

  1. have an application function to know if application allows the WFI enable

  2. based on RTOS timing (Task, Timer, Semaphore timeout, .... ) calculate the maximum sleep time.

  3. use an HW feature to wake-up the system (maybe an EXTI)

So if some one has already managed this kind of application, I'm interested to know these solutions and maybe to get some code sample

1
What are you talking about? WIFI? Or WFI? - Eugene Sh.
The WFI ARM instruction does not mean "wait for WiFi"! - too honest for this site
@Olaf I hope for the OP he didn't mean that... - Eugene Sh.
@EugeneSh.: Who knows? Even RISC CPUs add more and more instructions. And some CISC have (had?) indeed very interesting instructions. See Transputer. - too honest for this site
Since it is an assembler instruction, you should specify the architecture. It is tagged FreeRTOS but is that actually what you are using? Not referenced in the question itself. - Clifford

1 Answers

2
votes

Most RTOS implementations for architectures that support it already place WFI in the idle loop by default if no background work or user hooks are processed there - I don't think FreeRTOS is any different. The system will wake-up on any interrupt including the RTOS systick so there is nothing further to do to support low-power operation - if it is not in the idle loop, then it is doing work and not able to enter low-power.

For further power reduction, some RTOS support a tick-less mode where the RTOS systick interrupt period is variable and set to the longest active remaining timeout or delay and then the tick-counter is corrected on start-up based on the number of ticks actually spent asleep. It can still wake-up on other interrupts of course.

Tick-less operation is beneficial on systems with relatively large interrupt and timing intervals (compared to the RTOS tick rate). If you do work on every tick, it serves little purpose, because it will wake-up to do that in any case.

FreeRTOS supports tick-less operation on ARM Cortex-M using configUSE_TICKLESS_IDLE as described at Low Power RTOS For ARM Cortex-M MCUs.