FreeRTOS and low power modes

I’m writing an application using FreeRTOS on an Atmel ATmega640. One of the design goals is to allow the device to run off a NiMH battery pack for a couple of weeks at a time before it needs recharging. My plan is to modify the timer tick rate when running on batteries so that tasks that need to be performed regularly can still be run. I would then put the processor in one of the low power modes until the next timer tick wakes the core up again. Would this scheme work or are there points I need to watch out for? Are there any plans to put some power management facilities into the RTOS?

FreeRTOS and low power modes

A task can block either by calling a delay function, or by calling a queue function with a timeout.  When it does this the time at which the task should unblock is calculated in ticks.  If you slow down the tick rate then the time at which tasks actually unblock will be wrong because time is moving more slowly than when the wake time was specified.  This might not be a problem to your application, for example if tasks only block indefinitely, or the wake time need not be exact. Richard, this topic comes up from time to time.  It would be cool to add in a feature that allowed the tick rate to be slowed down.  All you need to do increment the tick by more than one each time if the tick rate were halved, or by four each time if the tick rate were quartered, etc.

FreeRTOS and low power modes

> Richard, this topic comes up from time to time.  It would be > cool to add in > a feature that allowed the tick rate to be slowed down.  All > you need to do > increment the tick by more than one each time if the tick > rate were halved, > or by four each time if the tick rate were quartered, etc. It would not be quite that simple, but it is a good idea.  I will put some thought into it :o) Regards.

FreeRTOS and low power modes

Well in my application it doesn’t matter too much. Once in low power mode all I need to do is wake-up from an external interrupt or after a delay of 5-10 minutes, check the status of the various sensors and go back to low power mode if all OK. I guess what I could do is to use another timer generating an interrupt every 5 minutes or so and disable the RTOS tick timer when going to sleep but enabling the aux timer interrupt. In the aux timer ISR I could then enable the RTOS tick interrupt and carry on as if nothing had happened… Ahhh so many options for doing this! Just trying to figure out which would be the better way of managing low power modes… Richard: have you any plans to offer some sort of power management API in either freeRTOS or openRTOS?