Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT


Wake and Sleep Using FreeRTOS on STM32F4/Cortex-M4

Posted by groger57 on September 19, 2017

Hello: I'm using an STM32F4 and have FreeRTOS 9.0.0 implemented. There's now a requirement to sleep (then wake) the device for short intervals to save battery power. Are there some examples using FreeRTOS on how this could be implemented?

Thank you for any guidance on this.

Wake and Sleep Using FreeRTOS on STM32F4/Cortex-M4

Posted by xz8987f on September 19, 2017

Hello, there are two basic things you can use: - tickless idle mode (reducing the amount of tick interrupts) - going into low power mode in the IDLE hook See http://www.freertos.org/low-power-tickless-rtos.html and http://www.freertos.org/RTOS-idle-task.html

You might have a read at https://mcuoneclipse.com/2013/07/06/low-power-with-freertos-tickless-idle-mode/ and https://mcuoneclipse.com/2014/02/09/iot-freertos-down-to-the-micro-amps/.

I hope this helps, Erich

Wake and Sleep Using FreeRTOS on STM32F4/Cortex-M4

Posted by heinbali01 on September 19, 2017

There's now a requirement to sleep the device for short intervals

Often it is more beneficial to sleep for longer intervals like 30 seconds or more. It is necessary to use tickless idle for that.

Can you tell which situations ( = i.e. which interrupts ) should wake-up your device? When that situation occurs, should it wake-up immediately?

Beside those great references mentioned by Erich, don't forget to read AN4365 and RM0090 about the STM32F4 Power Controller.

Also think about each GPIO : pins that are defined as outputs, and/or pins that have an internal pull enabled, may consume power, depending on the circuit. When their actual output during sleep is not important, consider making them "inputs". Floating ( undefined ) inputs may also increase consumption: when a level is around VCC / 2, the input logic may be unstable ( on/ off/ on). In those cases an internal pull may be useful.

Good luck.

Wake and Sleep Using FreeRTOS on STM32F4/Cortex-M4

Posted by groger57 on September 19, 2017

Thank you for the references, I'll be sure to read them.

The sleep duration will be only 2 seconds, then it will self-wake. I was plannng on using the RTC to accomplish this. In my case, I have no external oscillator, but have already configured and tested the LSI for the RTC and it appears to be "ticking". For what I would like to do, it's accuracy should be OK.

The reason for doing so is to save power - the controller can be sleeping for up to 2 seconds, self-wake, check for the presence of a signal, and if there is a signal, execure the tasks. If not, back to sleep. I'm hoping to save at least 50% of the overall power consumption, provided there's not a penalty for sleep/wake itself.

Yes - I already have all unused pins set as inputs and pulled high.

[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]

Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS