FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [January 2012 Threads] Low power mode when scheduler idlePosted 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 idlePosted 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 idlePosted 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 idlePosted 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.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|