Getting most out of FreeRTOS on EFM32

Mikael

Michał Kochanowski

Intern at Silicon Labs in Krakow 

My summer internship project was to port FreeRTOS with tickless idle and different sleep modes on EFM32 microcontrollers (MCUs). FreeRTOS stands for Free Real Time Operating System, which gives a possibility to control time execution and separate MCU resources based on specific tasks. I thought it was interesting to work on the FreeRTOS project, as there are more and more MCUs using RTOS and it’s especially beneficial for low power applications.

Resources

FreeRTOS supports tickless idle, which allows reducing power consumption by switching to sleep modes between tasks and waking up only when needed, either at a scheduled time or on an interrupt event. Tickless idle makes periodic tick interrupts stop during idle periods so that the MCU can remain in sleep mode longer. In order to use this benefit, I had to write code suitable for our EFM32 devices.

Total energy

My project did not seem easy at first glance. I had some problems with FreeRTOS configuration as it did not support tickless idle mode for the Cortex-M0+ platform, including the EFM32 Zero Gecko MCU. Most of IDE’s also did not provide any official support for the Cortex-M0 Zero Gecko devices, so I had to test many examples in different IDE’s and platforms. The most cumbersome part of my work was that I had to test all these different platforms and compilers one by one.

After the testing process, I finally got it right. I extended the FreeRTOS to support an ultra-low power deep sleep mode between tasks and configured tickless idle to all of the EFM32 devices, including the M0+ core. My code also enables using tickless idle task with a sleep mode from EM(Energy Mode) 1 to EM3. I could use RTC module in EM2 as a main system clock at 16384Hz and use BURTC in EM3 at 2kHz.

Implementation

In addition to the code for tickless idle, I also created demos showing how to use FreeRTOS with new features to all the EFM32 platforms for different IDE’s and compilers.

deomos

Here you can see the result of my work. The upper energy profiler shows the average current consumption of 5.5mA without using the RTOS features, while the middle one reached the current consumption of 2.10mA without tickless idle and with sleep mode for the same application. And last but not least, the profiler on the bottom gave a result of 8.51uA with tickless idle mode in EM2 with the LCD on. It could have been below 1uA without using the LCD, but the result still indicates that it is possible to reduce the average current more than 500 times by getting most out of the FreeRTOS and EFM32 MCU features.

comparison with tickless idletickless_comparison

The tickless examples will be available soon in Simplicity Studio.

4 thoughts on “Getting most out of FreeRTOS on EFM32

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s