Quality RTOS & Embedded Software

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


Low power mode when scheduler idle

Posted by https://www.google.com/accounts on January 26, 2012
I would like to be able to switch my dsPIC33F into a low power mode when there are no tasks running (or all are suspended or blocking). The idea is to use the core doze mode to reduce power to 1/4 normal operation when idle by underclocking the CPU (but peripherals and timers run on the main clock, so it still keeps time.)

The simplest way of implementing this, I thought, would be to look for a vGetNumRunningTasks function; but there doesn't seem to be one. I'd need to access the internal RTOS data structures to get the task list, which is probably a bad idea.

Any ideas?

Thanks for a great RTOS!

RE: Low power mode when scheduler idle

Posted by Richard on January 26, 2012
The normal way of doing this is to use the idle hook. Assuming your application tasks run at a priority above the idle priority, the idle task will only run when no application tasks can run. Set configUSE_IDLE_HOOK to 1 in FreeRTOSConfig.h, then define a function called vApplicationIdleHook(), and put your sleep code in that.



RE: Low power mode when scheduler idle

Posted by https://www.google.com/accounts on January 26, 2012
Hi Richard

That looks useful - thanks. I would need to enter and exit low power mode several times a second though (at least); is there some function (aside from any of my tasks) that would run a callback when tasks are started so I can exit the low power mode I entered in the idle hook?

RE: Low power mode when scheduler idle

Posted by Richard Damon on January 26, 2012
I tend to just execute an Idle instruction in the idle hook to stop the processor when there is nothing to be done.

If you want to actually a clock change for lower power, you could add that code before the idle, then define a handler for
traceTASK_SWITCH_IN() that checks if you are in that low power mode, and are switching to a task besides the idle task, switches back into full speed mode.

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

Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.

Free TCP/IP and file system demos for the RTOS

Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists