FreeRtos Power Consumption

I am doing some data logging of power consumption on the ATSAM4LS4A chip by basing my project off of CORTEXM4ATSAM4LAtmelStudio in low power mode. My test is comprised of having an interrupt waking up the system then the system going straight back to sleep. After some data I noticed that the power consumption is higher than what we calculated (about 100-200 microamp more). We ran the same test setup without freertos and got the calculated power consumption we were expecting. Right now my assumption is that freertos is doing some overhead process of checking the scheduler when it wakes up. My question is that is freertos known to consume more power, when running a single task that wakes up through an interrupt, than one without freertos?

FreeRtos Power Consumption

Where are you measuring the power consumption from and to? If it is from the point it wakes up to the point it goes back to sleep, then yes I would expect it to use more power than when not using an RTOS purely because it will run more code between the two events. Without the RTOS you can do something like sleepwalking on the SAM4L, or just process the interrupt then return directly to the sleep mode. When you are using the RTOS it sleeps in the idle task, so it must correct the RTOS tick count, re-start the tick interrupt, potentially switch to another task (if the interrupt that woke the CPU from sleep mode also caused a task to unblock), do whatever processing needs to be done, potentially switch back to the idle task if it switched away from it after waking, stop the tick interrupt again, then go back to sleep. Plus you may also have tick interrupts to process in that time. Regards.

FreeRtos Power Consumption

I am measuring the overall system power. You mentioned this case of having the rtos sleep and an interrupt wakes up the cpu from sleep mode that causes a task to unblock. In this case the rtos goes through these steps of processing the tasks and switching back to the idle task. Say our system is awoken from an interrupt to resume a task and then there are no more tasks to process so it goes into the idle task and then that idle task puts the cpu back to sleep. About how many instruction does freertos take to wake up and look at the task list until it runs the actual task? And then on the other side of that After the task is complete how many instructions does it take to go back to the idle task to sleep?

FreeRtos Power Consumption

About how many instruction does freertos take to wake up and look at the task list until it runs the actual task?
That is dependent on a lot of different factors, not least of which is the compiler you are using and the compiler optimisation level, then what sort of pre and post sleep processing you have added in, plus the configuration of FreeRTOSConfig.h, etc. etc.. As you have your system in front of you I think you are in a better position to answer that than me. You might be able to shave some off by inlining code where library functions are called, etc. Regards.