Quality RTOS & Embedded Software

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




Loading

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.

http://www.freertos.org/a00016.html

Regards.

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) 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