#381

  Переглядів 225,690

Andreas Spiess

Andreas Spiess

День тому

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:
FreeRTOS deep dive: • Introduction to RTOS P...
Parallel tasks without RTOS: • ✔ Multitask Arduino wi...
Code (for reference only): github.com/SensorsIot/Morse-T...
ESP32 Dev. Board used for Prototyping: s.click.aliexpress.com/e/_ANHrBc
ESP32 Prog: s.click.aliexpress.com/e/_AougSs or amzn.to/3tjrsL4
Logic Analyzer 16ch (clone) : s.click.aliexpress.com/e/_9R3ZMZ
Logic Analyzer 8ch (clone) : s.click.aliexpress.com/e/_APm5bP
The links above usually are affiliate links that support the channel (no additional cost for you).
Supporting Material and Blog Page: www.sensorsiot.org
Github: www.github.com/sensorsiot
My Patreon Page: / andreasspiess
Discord: / discord
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
My Amazon.com shop: www.amazon.com/shop/andreassp...
For Banggood bit.ly/2jAQEf4
For AliExpress: bit.ly/2B0yTLL
For Amazon.de: amzn.to/2r0ZCYI
For Amazon UK: amzn.to/2mxBaJf
For ebay.com: ebay.to/2DuYXBp
profile.php?...
/ spiessa
www.instructables.com/member/...
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

КОМЕНТАРІ: 591
@AndreasSpiess
@AndreasSpiess 3 роки тому
Correction: ISR is Interrupt Service Routine, not internet service routine
@varunkoganti9067
@varunkoganti9067 3 роки тому
This must be an April fools joke.
@AndreasSpiess
@AndreasSpiess 3 роки тому
I already posted a pinned correction comment ;-)
@markmaker2488
@markmaker2488 3 роки тому
Another great tutorial and reason to love the esp32 even more, thanks!
@sunuk1915
@sunuk1915 3 роки тому
ukposts.info/have/v-deo/hJGKjKibeImDmYE.html
@TheDefpom
@TheDefpom 3 роки тому
Shawn did a really good series on freertos, I’m glad you reference it.
@AndreasSpiess
@AndreasSpiess 3 роки тому
Agreed. Probably a little "oversophisticated" versus the end...
@tonyfremont
@tonyfremont 3 роки тому
He has put out a bunch of good STM32 CubeMX videos too.
@iSuperMC
@iSuperMC 2 роки тому
Who’s Shawn ? Could you send a link please
@marcdraco2189
@marcdraco2189 Рік тому
@@iSuperMC Shawn Hymell (Digi-Key). He does a lot of instructional videos but he's a bit of an egg-head for most of us.
@rfrisbee1
@rfrisbee1 3 роки тому
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!
@AndreasSpiess
@AndreasSpiess 3 роки тому
Thank you for your additional info. Indeed, I did not know how much stack is enough. Fortunately, the ESP32 has enough RAM for my application. So I did not need to answer the question...
@yagizhanugur
@yagizhanugur 2 роки тому
Hello what problems did you observ with rtos and HAL library. Please Share your experiences.
@maxstripeGaming
@maxstripeGaming 2 роки тому
@@yagizhanugur cant be used together as they both try to play the OS part and do scheduling and shit like that they are flat out incompatible
@tahunus3148
@tahunus3148 Рік тому
@@AndreasSpiess I found this on the ESP-IDF docs that might produce an answer: - At runtime, call the function uxTaskGetStackHighWaterMark() with the handle of any task where you think there is unused stack memory. This function returns the minimum lifetime free stack memory in bytes. The easiest time to call this is from the task itself: call uxTaskGetStackHighWaterMark(NULL) to get the current task’s high water mark after the time that the task has achieved its peak stack usage (i.e. if there is a main loop, execute the main loop a number of times with all possible states and then call uxTaskGetStackHighWaterMark()). Often, it’s possible to subtract almost the entire value returned here from the total stack size of a task, but allow some safety margin to account for unexpected small increases in stack usage at runtime. - Call uxTaskGetSystemState() at runtime to get a summary of all tasks in the system. This includes their individual stack “high watermark” values. It's in the RAM Usage section: docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/performance/ram-usage.html Thanks for your wonderfully informative and well made videos!
@ShawnHymel
@ShawnHymel 3 роки тому
Great explanation, and thanks for the shout out!
@AndreasSpiess
@AndreasSpiess 3 роки тому
You are welcome!
@francescoreale
@francescoreale 3 роки тому
Thank you very much! I can't even imagine all the work behind this video! Great job.
@AndreasSpiess
@AndreasSpiess 3 роки тому
You are welcome! You are right, this one was not easy. Also because I had to concentrate very much on the important things. The script took many iterations...
@shiftyjesusfish
@shiftyjesusfish 3 роки тому
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 myself..... 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.
@AndreasSpiess
@AndreasSpiess 3 роки тому
Thank you for the nice words! I became a UKpostsr because I learned a lot when I started with the Arduino myself...
@carltone
@carltone 3 роки тому
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!
@AndreasSpiess
@AndreasSpiess 3 роки тому
Thank you for your nice words!
@useyourbrain2022
@useyourbrain2022 3 роки тому
incredibly explained, as always, thanks!, I wish I had a teacher like you when I was studying at the university
@AndreasSpiess
@AndreasSpiess 3 роки тому
Happy to help! And thank you for your nice words.
@TheNormalUniverse
@TheNormalUniverse 2 роки тому
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.
@AndreasSpiess
@AndreasSpiess 2 роки тому
You are welcome. You will see, RTOS is a different world because most things are "under the hood" and your code is easy to read.
@PemboPemberton
@PemboPemberton 2 роки тому
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. 😉👌
@AndreasSpiess
@AndreasSpiess 2 роки тому
Thank you for your feedback. For sure it makes a lot simpler...
@vks002
@vks002 2 роки тому
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 :)
@AndreasSpiess
@AndreasSpiess 2 роки тому
Glad to read that. A good start is all I wanted to provide ;-)
@xboxgamer9216
@xboxgamer9216 3 роки тому
Was waiting for something like this . Thank you
@AndreasSpiess
@AndreasSpiess 3 роки тому
:-)
@n-elia
@n-elia 3 роки тому
Thank you for taking time to recurd such an instructive video. Keep up your wonderful work!
@AndreasSpiess
@AndreasSpiess 3 роки тому
My pleasure! And thank you for your nice words!
@Alex000113
@Alex000113 2 роки тому
Theres a lot of really informative material in this video THANKS ! I didnt realize it was so straightforward to run freeRTOS on an ESP32. My first freeRTOS app was running within 15mins of completing this video. Really encouraged now to delve deeper.
@AndreasSpiess
@AndreasSpiess 2 роки тому
I think a deep dive will be rewarding. Enjoy!
@klassichd10
@klassichd10 3 роки тому
Thanks a lot for this compact introduction in such an important topic as FreeRTos on ESP32!
@AndreasSpiess
@AndreasSpiess 3 роки тому
You are welcome! Like hardware debugging, this is game changing for me...
@williamwatson1532
@williamwatson1532 3 роки тому
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.
@AndreasSpiess
@AndreasSpiess 3 роки тому
You are right. We currently re-discover things we had in the 80s like inline debugging. But of course, today it is much easier because of the resources an ESP32 offers. It has nearly no limitations for an average project. Which makes things much easier. No optimization needed, just straight programming...
@sarahjanegray
@sarahjanegray 3 роки тому
Excellent video, as always, Andreas. I found myself working through and learning how RTOS worked when working through and debugging the code for the ESP32 Internet radio project that you discussed previously. However this cleared up a few things I was not able to get my head around from the Free RTOS documentation. Thanks again.
@AndreasSpiess
@AndreasSpiess 2 роки тому
You are welcome! I forgot that the internet radio also used RTOS. I am getting old...
@aeljandro2
@aeljandro2 3 роки тому
Thanks for taking the time on making these videos. You are a great great teacher! I've learned a lot from you. Thanks for all!
@AndreasSpiess
@AndreasSpiess 3 роки тому
You're welcome!
@BlueyMcPhluey
@BlueyMcPhluey 2 роки тому
lately every time I have an interest in a topic and search youtube you've made a video on it already. Thanks once again :)
@AndreasSpiess
@AndreasSpiess 2 роки тому
Happy to hear that!
@kwinzman
@kwinzman 3 роки тому
Thank you for this amazing video! I like to believe that me commenting about FreeRTOS in your "The All-New Arduino IDE 2.0: Introduction and Test " video had a small role it its creation. 😊
@AndreasSpiess
@AndreasSpiess 3 роки тому
:-)
@avejst
@avejst 3 роки тому
Impressive video as always 👍 Thanks for sharing your experience with all of us 👍😀
@AndreasSpiess
@AndreasSpiess 3 роки тому
Thank you! This one was not too simple to understand, I think...
@kroojohn
@kroojohn 3 роки тому
Once again a very detailed and useful video, including a wealth of information and tips ... Thank you :)
@AndreasSpiess
@AndreasSpiess 3 роки тому
My pleasure!
@ThomasDwyer187
@ThomasDwyer187 3 роки тому
Great stuff, Andreas! I appreciate your high-quality information~
@AndreasSpiess
@AndreasSpiess 3 роки тому
My pleasure!
@wm6h
@wm6h 3 роки тому
Thank you Andreas. I learn something from every video of yours. Today, I learned QLF 😀. Also, that debugging hook up @ 12:35 caught my interest and maybe suggests a future video. See you next Sunday.
@AndreasSpiess
@AndreasSpiess 3 роки тому
When I listen to the bands I hear a lot of QLF... I already made a video about hardware debugging with PlatformIO.
@bm830810
@bm830810 3 роки тому
20:25 I think the mutex is used when you can have concurrent access and not just multiple writes, assume one task is reading a struct, and in the middle of reading, the other task modifies the struct.
@arnodej9590
@arnodej9590 3 роки тому
If the processor can read/write 32 bit variables atomically you don't need to protect them (if you have only one writer). If your processor cannot access the data in one instruction, you indeed need protect read and write.
@haves_
@haves_ 3 роки тому
yes, when the display task needs to print the variable onto the screen, the writing task should not change it until the display task finished printing.
@vatterger
@vatterger 3 роки тому
Exactly, you may have single-writer-multi-reader-configs when the shared resource can be written atomically, like 32-bit words on a 32-bit processor, but most other things require some protection even when only one thread is writing. Atomic operations (Compare and Swap etc) are also a useful thing to look into. They can help avoid mutexes and therefore overhead when building queues or counters.
@AndreasSpiess
@AndreasSpiess 3 роки тому
Thank you for the discussion. I would like to add another aspect: Because the ESP32 is so fast, none of my tasks needed more than a fraction of 1ms and I was always able to actively pass the control back to the scheduler. Is a mutex still needed?
@bm830810
@bm830810 3 роки тому
​@@AndreasSpiess and thanks again to you dear Andreas for your great contents. Hadnt thought about it this way, your assuming since there is no preemption in your case, the mutex is not needed, which I think is right. although I would always add them as good practice since you don't know what future holds...
@Chris-ib8lw
@Chris-ib8lw 3 роки тому
"If you are good, you get more work!" Not going to lie, that line gave me flash backs to my Air Force days. haha As always, love the videos and I always learn a lot from you!
@AndreasSpiess
@AndreasSpiess 3 роки тому
:-))
@AlexGoris
@AlexGoris 3 роки тому
Thanks for another great video, Andreas! I have a project which is sitting around for over a year now, which is built on ESP32 and needs to perform several tasks separate from eachother. I got some great ideas on how to accomplish this in a better when than it is managed now.
@AndreasSpiess
@AndreasSpiess 3 роки тому
You will see that, if you get the design of the different modules right, things get much simpler than with standard programming.
@alastorgdl
@alastorgdl 2 роки тому
@@AndreasSpiess Is VERY surprising the level of resistance people have against using a RTOS, specially in camps like CubeIDE. It's like they prefer DOS than Windows
@DannyBackx
@DannyBackx 3 роки тому
Nice and sufficiently accurate description of a difficult subject. Note that shared resources also include your display.
@AndreasSpiess
@AndreasSpiess 3 роки тому
You are right. I thought, the display was on the list of shared resources...
@large65
@large65 3 роки тому
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.
@AndreasSpiess
@AndreasSpiess 3 роки тому
Good point!
@jodeling35
@jodeling35 Рік тому
As always: Great Work, Andreas! Thx!
@AndreasSpiess
@AndreasSpiess Рік тому
You are welcome!
@mysomervda
@mysomervda 3 роки тому
Thanks. Great as usual, that was a nice introduction and overview of RTOS for me.
@AndreasSpiess
@AndreasSpiess 3 роки тому
Glad it was helpful!
@becauseican2607
@becauseican2607 3 роки тому
Grüezi Andreas 🇨🇭 I have to give this a try. Thanks for sharing ✌️
@AndreasSpiess
@AndreasSpiess 3 роки тому
Hope you enjoy
@tonysfun
@tonysfun 3 роки тому
Amazing! Thank you so much Andreas! And you have great humor also!
@AndreasSpiess
@AndreasSpiess 3 роки тому
I try my best to keep the humor in those times ;-)
@DougCooperTech
@DougCooperTech 3 роки тому
That was a great introduction. It would be great to see other FreeRTOS videos. Thanks
@AndreasSpiess
@AndreasSpiess 3 роки тому
We will see. Maybe as a part of a project.
@dariuszruminski8549
@dariuszruminski8549 3 роки тому
Thank you for the lesson!
@AndreasSpiess
@AndreasSpiess 3 роки тому
You are welcome!
@robertobrenes5283
@robertobrenes5283 3 роки тому
nice video! today i saw a little Tensorflow on an ESP32cam and then this video! So much to learn!
@AndreasSpiess
@AndreasSpiess 3 роки тому
True. But a lot of opportunities!
@peter.stimpel
@peter.stimpel 3 роки тому
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!
@AndreasSpiess
@AndreasSpiess 3 роки тому
:-)) You are right. Unfortunately here the problem was between my ears...
@guntherjordan7177
@guntherjordan7177 2 роки тому
Ein Video an meinem Geburtstag über eines meiner aktuellen Lieblings-Bauelemente. Das ist ein extrem interessantes Thema, -werde mich da demnächst mehr mit beschäftigen. Danke für's zeigen!
@AndreasSpiess
@AndreasSpiess 2 роки тому
Bitte, gern geschehen, Und herzliche Glückwünsche!
@Robotsreloaded
@Robotsreloaded 2 роки тому
Love your videos! I've heard the word RTOS many times and thought it's something very complicated. Your explanation gives a very good intro to it. Now there is so many use cases coming in my mind 😁
@AndreasSpiess
@AndreasSpiess 2 роки тому
Glad it was helpful!
@alastorgdl
@alastorgdl 2 роки тому
@RobotsReloaded You don't even think on using a PC as baremetal. An embedded system is basically the same case even if the level of complexity is lower
@BillXT11
@BillXT11 3 роки тому
Thanks for starting with RTOS, always wanted to learn it!
@AndreasSpiess
@AndreasSpiess 3 роки тому
Go for it. It is worthwhile.
@TonoNamnum
@TonoNamnum 3 роки тому
I believe this video should be fundamental for every maker! Thanks Andreas!
@AndreasSpiess
@AndreasSpiess 3 роки тому
Glad you think so!
@caseykoons
@caseykoons 2 роки тому
Very nicely made video of the project. Good scope. I like the design of the deck too.
@AndreasSpiess
@AndreasSpiess 2 роки тому
Thank you!
@nickp3837
@nickp3837 3 роки тому
Great video, much to learn as always. After you last video on ESP32 using two cores I have built several multi tasking systems but I wasn't aware of this level of detail. After this I switched from std:: mutex to xSemaphoreCreateMutex() which saves some memory. FYI If you are porting existing code there is no need to go back and change the calls to delay(); In the framework delay(ms) simply calls vTaskDelay(ms / portTICK_PERIOD_MS);
@AndreasSpiess
@AndreasSpiess 3 роки тому
Thank you for the tip about delay(). I was not sure.
@MaqsoodAlamShafiq
@MaqsoodAlamShafiq 2 роки тому
Excellent video. The secret of arduino setup() & loop() being RTOS task is very helpful. Learning such tips earlier help a lot. @12:27 the schema and explanation gave a great deal of insight on project design and state machine concept. 👍 There is another saying "He won't get a break if he learns his lesson". I think it is a universal fact that good people are kept busy 🤣
@AndreasSpiess
@AndreasSpiess 2 роки тому
Thank you. Glad it was helpful!
@eduardo9626
@eduardo9626 3 роки тому
I want more videos like this! Thanks for this video
@AndreasSpiess
@AndreasSpiess 2 роки тому
You are welcome! We will see...
@MauroMaccarone
@MauroMaccarone 2 роки тому
Never die my hero! a lot of love from Argentina
@AndreasSpiess
@AndreasSpiess 2 роки тому
:-)
@quarteratom
@quarteratom 6 місяців тому
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.
@AndreasSpiess
@AndreasSpiess 6 місяців тому
I agree!
@ChristopherHeald
@ChristopherHeald 3 роки тому
This is so much more elegant than the mess of millis(). Thank you for the clear explanations, as always.
@AndreasSpiess
@AndreasSpiess 3 роки тому
Indeed! Much easier to read.
@johnwest7993
@johnwest7993 2 роки тому
I almost never critique UKposts 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 UKposts 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.
@AndreasSpiess
@AndreasSpiess 2 роки тому
Thank you for the info about my slip of the tongue . And thank you for your nice words. Glad you like the content of the channel.
@chaniapellet
@chaniapellet 3 роки тому
Very nice! Thank you for this video.
@AndreasSpiess
@AndreasSpiess 3 роки тому
Glad you liked it!
@marlb64
@marlb64 3 роки тому
Thanks Andreas, for yet another great educational video !!
@AndreasSpiess
@AndreasSpiess 3 роки тому
Glad you liked it!
@peut
@peut 3 роки тому
Thanks Andreas. Great summary of the extra power and features FreeRTOS provides! Further: In principle, mutexes should be used for all shared resources, no exceptions. However, if the resource is simple, e.g. a boolean variable, chances of corruption due to concurrent access are negligable or maybe even non-existent, depending on the code and the compiler. The same applies for a mutex with only one writer and one or more readers. However, taking the risk of corruption should be a conscious one and taken with a lot of care. Small tip: Taking and giving mutexes is "expensive" in terms of performance. In a time critical loop it may be help to use xSemaphoreGetMutexHolder( nameOfSemaphore ) to check if a Mutex has been taken. Apparently, this generates less overhead than the xSemaphoreTake function. An example would be a mutex set by a task to stop a tight loop in another task.
@AndreasSpiess
@AndreasSpiess 3 роки тому
Thank you for the additional info! You are right with the Mutex because we do not know when the millisecond is over (maybe in the middle of an update statement). However, the ESP32 is mindboggling fast. I checked how long my tasks run. Even the longest one (searching for the next letter) only needed a fraction of the 1ms slot. So I always know when I pass the control to the scheduler. I think, with such a fast processor we can avoid many situations a slower CPU could generate. I also proposed to only use one priority based on this fact. Also here we reduce the chance for problematic situations without any harm.
@StarkRG
@StarkRG 3 роки тому
The first time I heard about the concept of an RTOS was from someone I used to hang out with online who was part of the development team for the RTOS on some fighter jet (the F22, I think), then seeing RTOS as an option when compiling the Linux kernel, and, finally, FreeRTOS on the ESP32.
@AndreasSpiess
@AndreasSpiess 3 роки тому
The concept is old (I used one in the 80s). But now with the abundance resources it is very easy to use...
@antoniojesusarquillosalvar4342
@antoniojesusarquillosalvar4342 3 роки тому
Really impressive! The best channel on this subject in Internet.
@insanemainstream3633
@insanemainstream3633 3 роки тому
I wish my brain could multitask his knowledge without all the deadlocks! Great content as usual Andreas liked vid.
@AndreasSpiess
@AndreasSpiess 3 роки тому
Wow, thanks!
@zyghom
@zyghom 3 роки тому
not only I was in the army but also I learned there Morse code as it was still a time to send all the communication over it - what a time it was!!! ;-)
@AndreasSpiess
@AndreasSpiess 3 роки тому
I learned Morse in military, too!
@Palominostudio
@Palominostudio 3 роки тому
Very nice Andreas, greetings to you and the laboratory manager fur (Feline) from South Africa. We are also concerned with speed, and is why we have parallax flip boards in our possession, 8 cogs to do multi tasking. And then I noticed the Teensy 4 boards, faaaaast. And the the 4.1 can store data to a sd card for recording. This is more industrial type applications for us, so we are not bothered about the 100mA of current to run these mcu's. So much nice stuff, a solution looking for a problem. I enjoyed the video, something to look forward to on a Sunday. See you next week, Kind regards, Duncan
@AndreasSpiess
@AndreasSpiess 3 роки тому
Greetings back to SA. Yes, those boards are very fast. For my applications often much too fast. For this one, I checked and found that none of the tasks needed more than a few percent of one time slot. BTW: Next week there is no video from me. Only 3 per 4 weeks...
@ed.puckett
@ed.puckett 3 роки тому
Thank you, you are very inspiring!
@AndreasSpiess
@AndreasSpiess 3 роки тому
You are welcome!
@facundofarall7716
@facundofarall7716 2 роки тому
Very useful and well explained video, thank you so much!
@AndreasSpiess
@AndreasSpiess 2 роки тому
Glad it was helpful!
@stevesfascinations1516
@stevesfascinations1516 2 роки тому
Really well explained, thank you very much! Thumbs up!
@AndreasSpiess
@AndreasSpiess 2 роки тому
Glad you enjoyed it!
@dennisp6337
@dennisp6337 2 роки тому
excellent video. Multitasking is finally a reality in my projects!
@AndreasSpiess
@AndreasSpiess 2 роки тому
Fantastic!
@ericwebster6911
@ericwebster6911 3 роки тому
Great information. Thanks for the video.
@AndreasSpiess
@AndreasSpiess 3 роки тому
You are welcome!
@henrybecker2842
@henrybecker2842 3 роки тому
This is a great session. Thank you very much :-)
@AndreasSpiess
@AndreasSpiess 3 роки тому
Glad you enjoyed it!
@ailijic
@ailijic 3 роки тому
Thank you for making this video.
@AndreasSpiess
@AndreasSpiess 3 роки тому
You are welcome!
@NextLevelCode
@NextLevelCode 3 роки тому
You sir are a gentleman and a scholar. Well done as usual.
@AndreasSpiess
@AndreasSpiess 3 роки тому
Thank you!
@fgaviator
@fgaviator 3 роки тому
Great video! Never knew the ESP32 already hat an RTOS. This will be really useful. Minor correction: do the spinlock functions at 21:14 really expect a parameter - the documentation in your next shot suggests they are "void void" functions.
@AndreasSpiess
@AndreasSpiess 3 роки тому
In the ESP32 implementation they expect (or allow?) a parameter. But I am no specialist.
@dickesf8525
@dickesf8525 3 роки тому
This video is super usefull! Thanks a lot!
@AndreasSpiess
@AndreasSpiess 3 роки тому
Glad it was helpful!
@christiancarassai9540
@christiancarassai9540 2 роки тому
Right? Wrong!!! hahahaha. Andreas, your videos are excellent, and a great source of information. Congratulations, one of the best channels on microcontrollers and iot!!!
@AndreasSpiess
@AndreasSpiess 2 роки тому
Thank you for your nice words!
@santopino2546
@santopino2546 3 роки тому
Interesting as usual. Thanks Pity I don't have time now to test this out.
@AndreasSpiess
@AndreasSpiess 3 роки тому
It takes some time to get acquainted... At least for me.
@davidstonier-gibson5852
@davidstonier-gibson5852 3 роки тому
Danke schön, noch einmal. I managed to get through a whole career in embedded controls without ever using a true RTOS. I started with bare-metal assembler in the early 70s, and retired the same way. I did during that time make many very simple superloop systems, and never wrote blocking code. As I have just transitioned from Arduino to ESP32, and in retirement started learning C++, I found this very interesting. One day I may just have to give it a spin.
@AndreasSpiess
@AndreasSpiess 3 роки тому
As you write, you can do without it. But it is much easier to do it with one. We already used RTOS in the 80s for räsonable complex products. I am curious what your verdict would be after trying it...
@noweare1
@noweare1 2 роки тому
I feel the same i.e. Is it worth the time to learn it and how much time to be fully understood? I think if you are into robotics where there are a lot of things going on it could be helpful. Most of my projects are pretty simple though.
@waltsteinchen
@waltsteinchen 3 роки тому
Amazing interesting video! Thanks a lot Andreas!
@AndreasSpiess
@AndreasSpiess 3 роки тому
Glad you liked it! So it was worth the effort.
@baconsledge
@baconsledge 3 роки тому
Excellent...thank you!
@AndreasSpiess
@AndreasSpiess 3 роки тому
You are welcome!
@warperone
@warperone 3 роки тому
Well explained as usual Andreas.
@AndreasSpiess
@AndreasSpiess 3 роки тому
Thank you!
@noweare1
@noweare1 3 роки тому
I am not a big fan of interrupts and when writing more involved programs I am always trying to keep the loop time a low as possible. I need to do this project and just play around with the few commands that you used. Thanks for trimming down a very large amount of info into something we can use.
@AndreasSpiess
@AndreasSpiess 3 роки тому
I also did not need interrupts (with the exception of the PS/2 library. 1ms was fast enough.
@CraigHollabaugh
@CraigHollabaugh 3 роки тому
Excellent comprehensive example with code examination. I've used FreeRTOS on 10 or so projects. What you've covered here is probably 90% of FreeRTOS projects. If users can get through your example understanding these concepts, their spaghetti code will become readable, understandable and maintainable. One last thing, do NOT use arduino delay. It affects the scheduler and your code will stop working. Search your code and change delay to vTaskDelay. Thanks from Colorado.
@AndreasSpiess
@AndreasSpiess 3 роки тому
Thanks for sharing your experience! One question: What does the Arduino delay() harm? I thought, it just takes up all the time in the task's slot (which is, of course, not ideal).
@CraigHollabaugh
@CraigHollabaugh 3 роки тому
​@@AndreasSpiess I looked at the ESP32 FreeRTOS delay code. It implements Arduino delay with vTaskDelay, so on the ESP32 using delay should work fine. I believe my comment above deals the smaller Atmel parts, 328P, with limited timers. Seems like I remember using Arduino delay changes TIMER2 (may be incorrect here), that's the same timer used by FreeRTOS's scheduler. It may be different now, but back then Arduino's delay affected the scheduler. If this is incorrect or has changed, please comment below. I've switched to using STM32's for my designs which runs FreeRTOS just fine. Thanks again for the video, I'm always interested in what your doing (keeps me from having to figure things out), you do a wonderful and complete exploration.
@CraigHollabaugh
@CraigHollabaugh 3 роки тому
On Linux Arduino 1.8.13, ESP32 delay implementation is here. ~/.arduino15/packages/esp32/hardware/esp32/1.0.6/cores/esp32/esp32-hal-misc.c void delay(uint32_t ms) { vTaskDelay(ms / portTICK_PERIOD_MS); }
@edivollgas719
@edivollgas719 3 роки тому
just in time for my new project. Thanks ! trying to create a minimalist ignition for combustion engine. trigger input and timed coil charge and ignite signal of almost constant lenght. timed between input signals depending on frequency/rpm. started with arduino because of ease 5v hallsensor and 5v trigger for coil with integral driver. Should also work for kick/handstarting which needs an extra thought for 0hz ignition timing. May be I should move to esp32 bite the 3.3 and include a display for rpm and advance .....😊
@AndreasSpiess
@AndreasSpiess 3 роки тому
The ESP32 is much faster if this helps. If you need interrupts it might be better to go STM32...
@hypnotourist
@hypnotourist 3 роки тому
Wow ! That was really an eye opener for me. I had no idea we could use that. Thank you weird accent guy !
@AndreasSpiess
@AndreasSpiess 3 роки тому
Glad you liked it!
@MrKelaher
@MrKelaher 3 роки тому
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 !
@AndreasSpiess
@AndreasSpiess 3 роки тому
Thank you for the addition about mutexes. I did not think about those cases because all my tasks only use a fraction of a slot and I always actively pass control back to the scheduler. But I agree: Better safe than sorry...
@joska9744
@joska9744 2 роки тому
Very, very interesting! Thansks!!
@AndreasSpiess
@AndreasSpiess 2 роки тому
Glad you liked it!
@dd0356
@dd0356 3 роки тому
Interesting topic. i will have to watch it again when i am more fit.. Just came out of covid fever, feeling weak..
@adilcoelho
@adilcoelho 3 роки тому
been there a month ago.. take care and get an oxymeter to check on your saturation. If it goes lower than 90% please go to a doctor.. Even if you dont feel bad breathing, trust me
@AndreasSpiess
@AndreasSpiess 3 роки тому
Glad to read that both of you survived! So far I had no problems and now, I go my first shot and some hope that I can avoid your experiences.
@haroldfinz4863
@haroldfinz4863 3 роки тому
Good to know you're coming out of it, and to have enough strength to post about it.
@adilcoelho
@adilcoelho 3 роки тому
@@AndreasSpiess the shot will surely help.. Glad youre getting it! Your videos are awesome
@dd0356
@dd0356 3 роки тому
@@adilcoelho thanks for your tips. luckily my oxygen level was within safe limits. but i had fever for a very long time and consequently weakness..Here in India, this thing has taken worst direction, almost every fourth person is affected and hospitals are unable to cope up due to sudden increase especially in the last 2 weeks. Last year situation was better.
@Richardincancale
@Richardincancale 3 роки тому
I used to do real-time programming 40 years ago using RSX-11 on PDP-11s. I can confirm that debugging can be challenging! One case I remember well - a multithreaded spooler sending output across a network to line printers all over the place. Once in a while a line for one would show up in the middle of output for another! Had to sit and watch for hours until spotting it happening - and send a message across the network to freeze the program so I could arrive in time to get a memory dump! Got it in the end!
@AndreasSpiess
@AndreasSpiess 3 роки тому
Thank you for telling us the nice story! It shows exactly what I wanted to say.
@-highvoltage4685
@-highvoltage4685 3 роки тому
thank you for talking about the hidden esp32 secrets and wonders :)
@AndreasSpiess
@AndreasSpiess 3 роки тому
You are welcome!
@santiagovelezflorez1634
@santiagovelezflorez1634 3 роки тому
Thank you very much Professor Andreas super interesting the RTOS, I imagine many examples in which I can simplify the code design.
@AndreasSpiess
@AndreasSpiess 3 роки тому
Very good. You will love it, I am sure.
@Giblet535
@Giblet535 3 роки тому
Great presentation, as usual Mr. S! Interesting trivia: Back in the 80's, there were multiuser OSes like MPM (a multi-user version of CPM) that didn't time slice. It's true! Each user had a dedicated CPU/RAM card, and the OS managed authentication, physical board allocation, and the shared permanent storage (SMD disks, mag tapes, and even 12-inch laserdiscs). Their 15MB disks were tiny miracles of miniaturization: usually 16 inches wide, 20 inches long, and 10 inches high.
@AndreasSpiess
@AndreasSpiess 2 роки тому
You are right. We even had RTOS systems for one CPU back then. I never heard of such a concept where you had different CPUs managed by one operating system. For me this came later with the VAX/VMS multi-processor systems.
@d.hughredelmeier1960
@d.hughredelmeier1960 2 роки тому
MP/m really did use time slicing on a single CPU. At least in most configurations. MP/m 8-16 seems to have supported multiple processors (typically one 8-bit and one 16-bit). I'd guess it also supported premption and time slicing. Multi-user without premption and time slicing is not really workable in general, but if you really dedicated one core per user it could work. What was the name of the computer system that you used.
@d.hughredelmeier1960
@d.hughredelmeier1960 2 роки тому
@@AndreasSpiess commercial mainframes multiprocessors were available by the early 1960s. For example, the Burroughs D825. As far as I remember, the first multiprocessor VAXes were home-made at Purdue University and ran UNIX.
@lawrencedoliveiro9104
@lawrencedoliveiro9104 3 роки тому
21:08 Spinlocks are commonly used for multiprocessor synchronization. The Linux kernel has them.
@Bianchi77
@Bianchi77 3 роки тому
Cool video, thanks for the info :)
@AndreasSpiess
@AndreasSpiess 3 роки тому
You are welcome!
@RP6conrad
@RP6conrad 3 роки тому
I use RTOS on the ESP32 for a gps-logger with a e-paper screen (GPS-speedsurfing). As the display routine was blocking (>0.5s), I was stucked... Then I discovered RTOS, and this was a fantastic tool to fix this problem ! Now the esp32 can receive, parse and store the gps data @ 10 Hz on a sd-card ! The display gives me the actual speed and distance. I still work with a lot of global variables, works fine for me !
@AndreasSpiess
@AndreasSpiess 3 роки тому
A good application for an RTOS, indeed!
@lawrencedoliveiro9104
@lawrencedoliveiro9104 3 роки тому
20:37 Have you looked at the Ada programming language? That dates from the 1980s, and has many built-in constructs for concurrency and synchronization. It was designed to work well for safety-critical applications. How safety-critical? The life support system on the International Space Station is implemented in Ada.
@rene-jeanmercier6517
@rene-jeanmercier6517 3 роки тому
Excellent !
@AndreasSpiess
@AndreasSpiess 3 роки тому
Glad you like it!
@rinokentie8653
@rinokentie8653 3 роки тому
Great stuff!
@AndreasSpiess
@AndreasSpiess 3 роки тому
Glad you think so!
@somedude5414
@somedude5414 3 роки тому
"The '60's of the last century" - That hurt.
@AndreasSpiess
@AndreasSpiess 3 роки тому
Why do you think?
@joeysustello
@joeysustello 3 роки тому
The tuesday of last week was the last Tuesday ever in this mindset...until tomorrow
@StarkRG
@StarkRG 3 роки тому
How about the fact that the 60s seems like it should be only 40 years ago rather than 60 and that I, born in 1982, am closer to middle age (45) than I am to my 20s (7 vs 8 years)?
@garyfry7292
@garyfry7292 3 роки тому
Life goes on, Dude! Would the 50's of the last century hurt you more?!
@Adrzah
@Adrzah 2 роки тому
Awesome stuff
@AndreasSpiess
@AndreasSpiess 2 роки тому
Thank you!
@alexanderm6862
@alexanderm6862 3 роки тому
Great content, thanks
@AndreasSpiess
@AndreasSpiess 3 роки тому
Glad you liked it!
@anthonvanderneut
@anthonvanderneut 3 роки тому
Another video with a swiss accent, it must be Sunday! Thanks for providing a regular time reference in COVID induced "days without much distinction" otherwise.
@AndreasSpiess
@AndreasSpiess 3 роки тому
You are welcome! Indeed it sometimes in not easy to distinguish weekends and weekdays with all this Home Office...
@kjyhh
@kjyhh 2 роки тому
Thank you so much. This is a great video. Your chanel is perfect for sharing this. Multi task MCUs is the future in like robot, iOTs. its useful!
@AndreasSpiess
@AndreasSpiess 2 роки тому
I agree.
@TB-jl9fr
@TB-jl9fr 9 місяців тому
Thank you Andreas, i love the way how you explaining things :) How can one start creating this kind of bubble diagram you showed ? With the tasks and queues... Is there some kind of systematic way or maybe even a graphical software?
@AndreasSpiess
@AndreasSpiess 9 місяців тому
I use Visio for it. But I am sure you can use any graphic program. The content is the crucial thing...
@mindyabiznarc
@mindyabiznarc 2 роки тому
Invaluable tips
@AndreasSpiess
@AndreasSpiess 2 роки тому
Glad you think so!
@inlywang8157
@inlywang8157 3 роки тому
Great job
@AndreasSpiess
@AndreasSpiess 3 роки тому
Thank you!
@KirillStolyarov
@KirillStolyarov 3 роки тому
Thank you. Long time i did not work with real timeOS. Critical section should be used for cores separately, exept special cases, which are rare.
@AndreasSpiess
@AndreasSpiess 3 роки тому
I am not sure why they block interrupts for both cores, but I assume it is less complex.
@berndeckenfels
@berndeckenfels 3 роки тому
Great summary.
@AndreasSpiess
@AndreasSpiess 3 роки тому
Thank you!
@qcsupport2594
@qcsupport2594 3 роки тому
I didn't realize it is such a short jump from ESP32+Arduino IDE to using an RTOS! It was right there all along. Anything that lets us keep our design complexity lower is potentially a huge win.
@AndreasSpiess
@AndreasSpiess 3 роки тому
Indeed it is a short jump for a start. Maybe it needs some practice...
#425 GitHub Tutorial without using the Command Line
16:04
Andreas Spiess
Переглядів 40 тис.
Real Time Operating Systems (RTOS) - Nate Graff
35:02
White Hat Cal Poly
Переглядів 46 тис.
Мэр Орска вывез семью в Дубай
11:10
Навальный LIVE
Переглядів 2,1 млн
451 Which Processor can kill the ESP32?
11:24
Andreas Spiess
Переглядів 328 тис.
#372 How to use the two Cores of the Pi Pico? And how fast are Interrupts?
14:25
Neil deGrasse Tyson Explains The Three-Body Problem
11:45
StarTalk
Переглядів 2,1 млн
#363 Which ESP32 pins are safe to use?
11:53
Andreas Spiess
Переглядів 123 тис.
Getting Started with the ESP32 Development Board  |  Programming an ESP32 in C/C++
15:23
How does NB-IOT and CAT-M1 / LTE-M compare to LoRaWAN (Tutorial)?
21:58
Andreas Spiess
Переглядів 52 тис.
Use the very attractive new ATTINY chips for your projects
14:34
Andreas Spiess
Переглядів 186 тис.
#328 ESP32 Secrets: Interrupts, and Deep-Sleep under the Hood
18:57
Andreas Spiess
Переглядів 171 тис.
#149 ESP32 Dual Core Programming + Speed 💨Test vs Arduino UNO (fast!)
31:18
БИТВА ЗУМЕРОВ. iPhone 15 Pro / Samsung S23 Ultra / Realme 12 Pro Plus
13:58
БИТВА ЗУМЕРОВ. iPhone 15 Pro / Samsung S23 Ultra / Realme 12 Pro Plus
13:58