FreeRTOS – Resources, Learning and Understanding
I had been meaning to get to grips with FreeRTOS for some time and I was reminded of this fact by a member’s recent post that referenced difficulties being experienced with his project using FreeRTOS - I have finally got around to it!
I still have much to learn, but, in my excitement (yes, I can get excited even at my ripe old age!), I wanted to put this post up to signpost anyone who wishes to similarly explore FreeRTOS.
My post concerns a couple of very helpful resources created by the FreeRTOS group that describe:
- the specifications of FreeRTOS functions/macros, and
- a hands on and tutorial guide that deals with the ins and outs of the use of FreeRTOS (this is really, really good).
Of course, if you already know about these resources or do not have an interest then this post is not for you. Anyway, these are two resources that are essential to the FreeRTOS developer, as far as I am concerned, and can be found at the following:
The main link to the FreeRTOS web site is: FreeRTOS and also contains more nuggets to be explored. (If the two pdf links above do not work then access them via the FreeRTOS web site: FreeRTOS Documentation.)
I spent a few days reading (they are length tomes) and decided to try out a few basic concepts. The hands-on guide, particularly, is excellent and has helped me craft an application using two different FreeRTOS methods. I used the Arduino IDE and the Richard Barry FreeRTOS libraries for AVR boards, version 10.4.6-6 downloaded via the Library Manager.
My test application involves the reading and processing of multiple switches (6 in my example, but any number may be supported) with each being treated as distinct and separate tasks – a division of labours, so to speak. The aim was therefore to ensure that each task could operate independently of each other whilst sharing the same resources.
In one version of the application I used an approach that suspended the scheduler to provide task separation and independence and, in another version, I used a method of message queues. Both versions worked like a charm and I was pleasantly surprised how quickly I got these two applications up and working, both on Arduino Uno and Arduino Mega 2560 – FreeRTOS seems to have a surprisingly small foot print on Arduino.
Of the two approaches I lean towards the use of message queues as this is less impactive and lets the scheduler get on with its work. Suspending the scheduler is a bit of a big stick, but does also work.
I could have also designed things around a host of other FreeRTOS methods and capabilities and I may well do this also but, for now, a little more reading and research I think.
Hope the FreeRTOS resources prove useful to you if you do not already have these to hand.
Happy to post my example applications if there is an interest.
I finished reading the
The ISR/semaphores part was particularly insightful.
Thanks for pointing this doc out.