Thanks for the info... Funny note: I was watching full screen and you had scrolled down some in your demo and I grabbed my mouse and tried to scroll back to the top! Hahaha...obviously it didn't work...it took me a few seconds to figure out WTF...
Thank you so much for the great video. This was a very clear intro for me to a lot of different functions that I've been having trouble teaching myself, i.e. data structures. I can't wait to try this out. How is the run speed compared to the normal Arduino program?
Great toturial, I learned alots. keep watching over and over. I have question, what criteria do you use to determine ram size allocated to a single thread?
if it breaks add more ram. otherwise dont touch it haha. For real though - It's generally based on how many/how large the variables are in a given thread. Small loop that only has a couple of ints... maybe 512k - large task with many branching functions and stored text, etc, 4096k.
Not a lame question at all! Multi-threading is a tool used by OSes to allow multiple "programs" to run on a single (or multiple) processors. Essentially the Arduino (or any other computer for that matter) can only do one thing at a time on a given processor. One of the jobs of an OS is to allow many programs to run "at the same time". This is done through sectioning programs out into their own threads and then scheduling them to run when needed and sleep when they're not needed. The processor really is just doing one thing at a time but it's so fast at switching between tasks that humans cant tell. A quad core computer can run 4 things at the same time (and with other optimizations can do more than that) but modern computers can have hundreds or thousands of threads running (at the time of writing this my computer has ~2400 threads active across 8 cores) so the OS still has to schedule when applications can do their work. This is the exact same thing that the RTOS ChibiOS does on the arduino, it keeps track of threads and schedules when they can run. So the Arduino cant technically do more than one thing at a time but it can switch between many tasks very rapidly which gives the illusion of doing many things simultaneously and makes writing the software for those individual tasks much easier.
Okay okay I get it! My confusion is gone now and I totally understand and get what you are saying . Thanks a lot for a quick clear and descriptive answer. I can now sleep in peace today!
So how do you assign a deadline to a task? I understand each thread represent a task, but how do you make sure the task execute within a specified time as is required by the definition of a real-time task.
Couldn't you just not write the void loop in the code since it is not used? I know in arduino IDE you can bypass the setup and loop functions in favor of a standard C structure with main
Hello, I see in your video you used ARM.h for header files for Arduino, how so? I tried running a blink code that came with the first github link (by Greiman) you shared on Arduino IDE 1.8.5 but compilation fails. I tried running on Arduino 1.6.7 compilation is unsuccessful again. Now when I went thru the code from github, the author says he compiled with Arduino 1.6.5, so i want to try that next. I also think your video is the most pronounced on CZcams so far on Arduino + ChibiOS, and I really think that it could be much more helpful if you could give specific tips on how to go about a successful compilation and loading to an Arduino board. Cheers.
He uses teensy board which contains arm chip on its board. I did not try this library bcs it failes too. Find new version of the library chibios_rt by Greiman
Well one example that you probably interact with everyday that runs an RTOS most likely is your car. The computer that manages the engine and monitors timing/temps/speed/etc. is usually a micro running an RTOS of some sort. An example project where it might be useful to have an RTOS running in some form might be an interactive home monitor with a screen that the user can use to control various things in the house. The UI might be one thread, networking in another thread, home state management (keeping track of home thermostat, lights, etc) could all be in individual threads as well. The idea is that rather than having one large program where you have to do a lot of effort to keep things straight, and RTOS splits tasks up into different threads so it's easier to make things more modular.
so ChbiOS is basically RTOS running on Arduino framework right? if so this is big - theoretically would allow to port all Arduino projects to ChibiOS solutions!
Sure, you could totally port just about any Arduino project to a ChibiOS RTOS program. I've ported many of my old projects over to an RTOS just because it makes things easier to separate and create smaller sub-programs for simple tasks.
I stumbled upon this wonderful tutorial 2 days ago, and I've been working on porting some of my old projects as well. Thanks for making such a clear video on this brilliant topic
I tried this with Teensy 3.6 and your library from github.com/ItKindaWorks/sketc... As the instruction in readme.txt, to install the libraries and run the ChibiOS/RT examples, I copyed all included libraries to installed arduino libraries folder. And I tested some examples and this code also. But, it doesn't work. It always makes compile error. One of errors is below. #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" Arduino version was 1.8.2.
In 3.2 Teensy it makes a warning message like 'WARNING: library ChibiOS_ARM claims to run on (sam) architecture(s) and may be incompatible with your current board which runs on (avr) architecture(s).' But, It works! Awesome. Thank you so much!
I am so sorry! What font shall I use next video? For me it's a toss up between this one (which is called Hack - specially made mono-spaced typeface for programming github.com/chrissimpkins/Hack) and comic sans. But if there is another one that would make your eyes feel better, I am all ears (or eyes in this case?)
I'm late to the party but i'm pretty sure the font isn't the problem, the text just too small when not viewed in full screen at full resolution. (annoying for mobile and small screen users)
Very straightforward video, thanks
Clever stuff. Thanks for sharing your knowledge.
whats the differentes bewteen ChibiOS and FreeRTOS ?
Thanks for the info... Funny note: I was watching full screen and you had scrolled down some in your demo and I grabbed my mouse and tried to scroll back to the top! Hahaha...obviously it didn't work...it took me a few seconds to figure out WTF...
LoL 😂
Very much like my first FreeRTOS code. I've heard that ChibiOS/RT is better though.
Thank you so much for the great video. This was a very clear intro for me to a lot of different functions that I've been having trouble teaching myself, i.e. data structures. I can't wait to try this out. How is the run speed compared to the normal Arduino program?
Great toturial, I learned alots. keep watching over and over.
I have question, what criteria do you use to determine ram size allocated to a single thread?
if it breaks add more ram. otherwise dont touch it haha. For real though - It's generally based on how many/how large the variables are in a given thread. Small loop that only has a couple of ints... maybe 512k - large task with many branching functions and stored text, etc, 4096k.
Sorry if my question sounds very lame
Arduino has a single core so how are we doing multithreading here?
Not a lame question at all! Multi-threading is a tool used by OSes to allow multiple "programs" to run on a single (or multiple) processors. Essentially the Arduino (or any other computer for that matter) can only do one thing at a time on a given processor. One of the jobs of an OS is to allow many programs to run "at the same time". This is done through sectioning programs out into their own threads and then scheduling them to run when needed and sleep when they're not needed. The processor really is just doing one thing at a time but it's so fast at switching between tasks that humans cant tell. A quad core computer can run 4 things at the same time (and with other optimizations can do more than that) but modern computers can have hundreds or thousands of threads running (at the time of writing this my computer has ~2400 threads active across 8 cores) so the OS still has to schedule when applications can do their work. This is the exact same thing that the RTOS ChibiOS does on the arduino, it keeps track of threads and schedules when they can run. So the Arduino cant technically do more than one thing at a time but it can switch between many tasks very rapidly which gives the illusion of doing many things simultaneously and makes writing the software for those individual tasks much easier.
Okay okay I get it!
My confusion is gone now and I totally understand and get what you are saying . Thanks a lot for a quick clear and descriptive answer.
I can now sleep in peace today!
Can you make another video, its very interesting.. go in more tehnics, show more of this if you have the time to make it
I can't include library in arduino its saying no library found should i add any link in pref?
So how do you assign a deadline to a task? I understand each thread represent a task, but how do you make sure the task execute within a specified time as is required by the definition of a real-time task.
How much overhead should I expect from ChibiOS? Arduinos are quite limited when it comes to processing power and memory, specially the AVR ones.
Couldn't you just not write the void loop in the code since it is not used? I know in arduino IDE you can bypass the setup and loop functions in favor of a standard C structure with main
And how can i download it ? please help
Hello, I see in your video you used ARM.h for header files for Arduino, how so? I tried running a blink code that came with the first github link (by Greiman) you shared on Arduino IDE 1.8.5 but compilation fails. I tried running on Arduino 1.6.7 compilation is unsuccessful again. Now when I went thru the code from github, the author says he compiled with Arduino 1.6.5, so i want to try that next.
I also think your video is the most pronounced on CZcams so far on Arduino + ChibiOS, and I really think that it could be much more helpful if you could give specific tips on how to go about a successful compilation and loading to an Arduino board. Cheers.
He uses teensy board which contains arm chip on its board. I did not try this library bcs it failes too. Find new version of the library chibios_rt by Greiman
Please can this work on windows 7 computers
Everything works with windows. Except for those pesky linux and mac programs. But that wouldnt be a problem here.
So, what would an application for this be?
Well one example that you probably interact with everyday that runs an RTOS most likely is your car. The computer that manages the engine and monitors timing/temps/speed/etc. is usually a micro running an RTOS of some sort.
An example project where it might be useful to have an RTOS running in some form might be an interactive home monitor with a screen that the user can use to control various things in the house. The UI might be one thread, networking in another thread, home state management (keeping track of home thermostat, lights, etc) could all be in individual threads as well.
The idea is that rather than having one large program where you have to do a lot of effort to keep things straight, and RTOS splits tasks up into different threads so it's easier to make things more modular.
so ChbiOS is basically RTOS running on Arduino framework right?
if so this is big - theoretically would allow to port all Arduino projects to ChibiOS solutions!
Sure, you could totally port just about any Arduino project to a ChibiOS RTOS program. I've ported many of my old projects over to an RTOS just because it makes things easier to separate and create smaller sub-programs for simple tasks.
I stumbled upon this wonderful tutorial 2 days ago, and I've been working on porting some of my old projects as well. Thanks for making such a clear video on this brilliant topic
I tried this with Teensy 3.6 and your library from github.com/ItKindaWorks/sketc...
As the instruction in readme.txt, to install the libraries and run the ChibiOS/RT examples, I copyed all included libraries to installed arduino libraries folder.
And I tested some examples and this code also.
But, it doesn't work.
It always makes compile error.
One of errors is below.
#error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)"
Arduino version was 1.8.2.
The ChibiOS library is not currently compatible with the 3.6. AFAIK it is only compatible with the the teensy 1 or 2 and 3.0-3.2
I'll try with Teensy 3.2, again. Thank you so much.
In 3.2 Teensy it makes a warning message like 'WARNING: library ChibiOS_ARM claims to run on (sam) architecture(s) and may be incompatible with your current board which runs on (avr) architecture(s).'
But, It works! Awesome. Thank you so much!
That font is horrible
I am so sorry! What font shall I use next video? For me it's a toss up between this one (which is called Hack - specially made mono-spaced typeface for programming github.com/chrissimpkins/Hack) and comic sans. But if there is another one that would make your eyes feel better, I am all ears (or eyes in this case?)
Courier , Andale Mono , Consolas. Adjust things using Cleartype adjustments.
I'm late to the party but i'm pretty sure the font isn't the problem, the text just too small when not viewed in full screen at full resolution. (annoying for mobile and small screen users)
@@UltimatePwnageNL Why the fuck would anyone watch this on phone?
Int lvl 10
"Fred"?
Thread