RTOS current consumption
Hi,
I think of using FreeRtos on my board but I want to supply the via batteries and so I would like to know how the FreeRTOS effects the current consuption. Is there any rule of thumb how the current consuption increases?
Maybe someone knows?
Thanks!
RTOS current consumption
Using FreeRTOS shouldn’t affect your current consumption by much (unless you fall into the trap of making your program do more now that it is easy to do.) It may even let you save power if you can put a sleep instruction in the idle loop. The biggest key is to make sure that the "tick" period for FreeRTOS is appropriate, if you need to do things 50 time a second, use a 20 ms (50Hz) timer, not a 1ms (1000Hz) one.
RTOS current consumption
Using an RTOS can save current because you can design the system to be completely event driven – removing any CPU cycles that would otherwise be wasted by polling. When an event is not being processed the idle task will run and immediately put the processor into a power down state.
Using an RTOS can cost current because it needs a periodic tick to work. Lots of aps have a periodic interrupt anyway so if that is the case then it makes no difference.
As richard_damon says, setting the tick to the slowest possible is key. We have in the past played around with slowing the clock down before placing the processor into sleep mode too. To do this you have to increment more than one tick each time the tick interrupt occurs. For example, if you half the clock speed then increment the tick twice on each tick interrupt (while the clock remains slower). If you quarter the clock speed then increment the tick four times on each tick interrupt (while the clock remains slower). Etc. Once an event occurs and there is processing to do set the clock back to its full speed, assuming the processing needs to be done quickly that is.
Regards.