#381 How to work with a Real Time Operating System and is it any good? (FreeRTOS, ESP32)

preview_player
Показать описание
Using a real operating system to simplify programming with the Arduino IDE. Is this possible and how? Let’s have a closer look!
Operating systems were invented to simplify our lives. But, because they need a lot of resources, they only run on reasonable computers like the Raspberry Pi or a PC. Right? Wrong. Nowadays, we also get operating systems running on our small MCUs. Particularly interesting in this respect is the ESP32 because it has enough power and memory to accommodate such an additional burden. And the best: It already runs a version of FreeRTOS with all our Arduino sketches, and it is easier than you think. Is this useful?
I am a proud Patreon of @GreatScott!, @ElectroBOOM , @Electronoobs , @EEVblog , and others. No Docker, No Microsoft Teams, Zoom

Links:

The links above usually are affiliate links that support the channel (no additional cost for you).
If you want to support the channel, please use the links below to start your shopping. No additional charges for you, but I get a commission of your purchases to buy new stuff for the channel

Please do not try to email me. This communication channel is reserved for my primary job
As an Amazon Associate, I earn from qualifying purchases
#no#midroll#ads
Рекомендации по теме
Комментарии
Автор

Correction: ISR is Interrupt Service Routine, not internet service routine

AndreasSpiess
Автор

One aspect of RTOS development you somewhat glossed over is the amount of memory to assign for each task's stack. FreeRTOS has features to determine stack usage / detect stack overflow, so that the stack size for each task can be set appropriately. For development it's useful to use a processor with plenty of RAM so that task stacks can be set much larger than needed and then reduced so the application can run on a part with less RAM.

Another important FreeRTOS specific detail is enabling the RTOS features you want in the FreeRTOS config header file.

Finally, for those using STM32 processors, avoid using both STMCube HAL and FreeRTOS together. They do not play nice!

rfrisbee
Автор

Shawn did a really good series on freertos, I’m glad you reference it.

TheDefpom
Автор

I can't even begin to tell you how much I value the work you (and other educational youtubers who are truly educated and articulate) do for the comunity and Tryin to jump in with arduino and programming to make my dream projects come true would have overwhelmed me and I would have definitely given up without the resources you provide. Sometimes when your teaching yourself things the hardest part is not knowing what you don't know, and not knowing how to ask the right questions, so when you go out of your way to provide context and redundant examples along the way without delight too deep into those other topics it really elevates the content from infotainment to genuinely valuable educational material.

shiftyjesusfish
Автор

A great intro to RTOS.
I find it good practice to use it all of the time with the ESP32 and just have the OTA in the "loop" function. It's a good way to learn how to program many micro controllers in the big industry and not just hobbyist style coding.
As I've also been use RTOS on many other microcontrollers like ARM and PIC for many years in industry. This makes porting code from other microcontrollers to the ESP range very easy.

...Keep up the great work.

- Enjoying watching from the UK.

😉👌

PemboPemberton
Автор

Thanks for referencing my vid Andreas! I’m self taught so I didn’t know there are more elegant ways to do multitasking. I haven’t watched all of this video yet but I will definitely come back to it. I’m getting back into coding to make a synthesizer so this is just what I need.

TheNormalUniverse
Автор

Andreas, excellent instructional video. Your explanation of time slicing, task creation by breaking down the requirements of the program, communication queues was well explained. The analysis aspect of programming is a crucial skill that is required when incorporating the additional control of a multitasking environment into a program solution. Your big picture overview to small detail approach, embedded humour (pun) ensure your technical videos are a great learning tool and a joy to watch. Well done!

carltone
Автор

Great explanation, and thanks for the shout out!

ShawnHymel
Автор

Thank you very much! I can't even imagine all the work behind this video! Great job.

francescoreale
Автор

Excellent tutorial Andreas! I wanted to start off with RTOS and I remembered that you had a video on this. So I went straight into it as I know you would do the best job is getting me started. Thank you so much. Now I can go through the rest of documentation and other tutorials :)

vks
Автор

incredibly explained, as always, thanks!, I wish I had a teacher like you when I was studying at the university

useyourbrain
Автор

One of the best RTOS video to start with, than you so much for making these! Also, love the jokes and the metaphors!

vincentlin
Автор

Another great video Andreas.! I liked your history lesson at the beginning. In the late '80s I worked with Forth which was perfectly capable of multitasking with 8bit microprocessors like the 1802, Z80, 6809 & 8051. It used a cooperative round robin model which meant the program designer could allocate as much cpu time as was needed for each part of a task. With no interrupt and time slicing the task switching overhead was tiny. One benefit was the ability to test and alter code from the keyboard with existing tasks running in the background.

williamwatson
Автор

At first! Thank you for your great explanations on all the different topics. They are fabulous! Just a minor remark: I think that RTOS is not about "fast" responses to an event, but about guaranteed (!) response (in a specified time). How fast the RTOS has to react depends on the physical properties of the system under control.

large
Автор

I almost never critique YouTube videos simply because they are what they are, a freely given effort to inform people of something. But your videos are exceptionally good due to your intellect, consummate skills, and your meticulous presentation. So because of that, and at the risk of being perceived as overly critical I will point out that you said 'seconds' instead of 'milliseconds' at 23:07 into the video. I do so because I think that to you, it matters. You actually want to be clear, concise and correct about everything you tell us, and you work at it throughout your videos. That is the reason why I watch ALL of your videos, even on subjects in which I have little interest, because they all exhibit what few other YouTube videos do - genuine quality. I appreciate the quality, and I can guess how much mental and physical effort is involved in creating and maintaining it, video after video. Thank you Andreas.

johnwest
Автор

Great presentation ! I love RTOS, by first was VxWorks, they really make embedded coding easier in most cases. Your single writer, multiple readers comment about mutex not being needed is only true for simple variables - if you need to update many parts of a struct, for example the x and y parts of coordinate, then either both reads and writes always need a mutex (if writes are common relative to reads) or a spin lock on write is needed (faster if writes are much less common than reads), or some odd stuff might be seen ! General rule is mutex unless performance is an issue then selectively remove them with massive comments in code - better safe than sorry . Defensive coding is always the RTOS coders friend !

MrKelaher
Автор

lately every time I have an interest in a topic and search youtube you've made a video on it already. Thanks once again :)

BlueyMcPhluey
Автор

Was waiting for something like this .


Thank you

xboxgamer
Автор

great stuff Andreas, thanks a lot. But at 20:41 there was a blocked resource in the spellchecker, it seems ;) Thanks a lot for diving into such not obvious topics!

peter.stimpel
Автор

Never knew the ESP32 had a full FreeRTOS running in the background always. It is well hidden, not showing when we write simple serial Arduino programs. And not only it manages the WiFi on one core, but it gives us a really easy way to write parallel code with tasks and queues and locks. Brilliant.

quarteratom