Introducing multitasking to Arduino
41–50 of 88 posts
Re: Introducing multitasking to Arduino
#42Earlier quoted context omitted.
Showing some Teensy love, crazy the 4.0 has 600MHz base speed.
Is that a Cortex-M7 or something?
I have STM32 and Beaglebone too but have not used them yet.
Re: Introducing multitasking to Arduino
#43Earlier quoted context omitted.
> move up to a larger system I'll take this one step further and suggest that beginners not start with the AVR, but instead with a Blue/Black pill (STM32) or ESP32. Leave the AVR for the more advanced people who are trying to squeeze every penny out of a project (even there, in many cases STM32 will cost less!!!). I visit the arduino.cc forums at least once every day and the things that beginners want to do these day…
I hear ya, I think we're just in a different era now. Users can wrap their head around a precooked framework that's ready to go and only needs a few API calls to make something happen. Beyond that? That's homework and homework sucks . FreeRTOS really isn't that large of a leap forward, in fact when it's done right on your target platform it's just a few API calls as well. But it means wrapping your head around a lot…
Re: Introducing multitasking to Arduino
#44Earlier quoted context omitted.
It's funny - I stepped away from electronics when I started college and in the first few years out of it just due to not having enough free time. About a 10 year period. I come back and now AVR is old and slow and ARM is hot stuff. All it took was the tooling becoming nearly free. No more $500 ISP programmers, just USB DFU boot.
yea, usb dfu, better tooling and the price is nearly interchangeable. heck, small PDIPs are sometimes more expensive and less stocked
Re: Introducing multitasking to Arduino
#45Earlier quoted context omitted.
That's exactly what's described. Arduino's framework divides main() into two functions: Setup() and loop(), but they're essentially the same as whatever comes before the while loop, and the while loop itself, in a standard embedded c main function. Then you just have interrupts setting states, and the loop responds to the change in state.
It's not quite the same as a while loop, because when you return from the loop() function, how long it takes before it gets called again isn't defined. Using arduino-pico, for example, it does some USB I/O handling (when using TinyUSB). If you write an actual while loop and don't return from the loop function often enough, you might starve the USB port implementation. This adds enough of a delay that I moved some cod…
I never ran into an issue of quasi-hidden behaviors like that, because I never pushed the thing that hard. It feels a little bit like the Arduino toolset (that is pre IDE 2.0) was designed to discourage people from pushing things that hard.
Re: Introducing multitasking to Arduino
#46I'm crappy at embedded development but isn't it pretty normal to handle "multitasking" with interrupts instead of using an event loop?
Re: Introducing multitasking to Arduino
#47Earlier quoted context omitted.
That is spiritually what their Scheduler library is doing, as mentioned in the article. Which works for a lot of things just fine until one task begins to overrun its time slice or just hangs. And then you're looking into preemption. But if you're overruning an AVR micro maybe it's time to take the training wheels off and move up to a larger system.
> move up to a larger system I'll take this one step further and suggest that beginners not start with the AVR, but instead with a Blue/Black pill (STM32) or ESP32. Leave the AVR for the more advanced people who are trying to squeeze every penny out of a project (even there, in many cases STM32 will cost less!!!). I visit the arduino.cc forums at least once every day and the things that beginners want to do these day…
Do you have any recommended resources or additional search terms to explore to learn more about hobbyist-level embedded electronics outside of the Arduino ecosystem? FreeRTOS looks interesting but it seems to add a lot of overhead versus something simple like Arduino. Similarly, I've looked at STM32 programming before but my searches were very generic and the STM ecosystem is massive. Specifically, I was trying to figure out if I could reprogram some old drone flight controllers (equipped an STM32F103CBT6 with a bunch of useful embedded sensors, running old versions of "betaflight") for personal projects but the entrypoint to STM programming (STM32Cube?) and the setup code was considerable.
Re: Introducing multitasking to Arduino
#48We've done quite a bit of experimentation with adding preemptive multitasking support to non-hard real time software running on MCUs at my current company. After a lot of head banging and dead ends, I've come to the conclusion personally that the embedded community could really use an implementation of the POSIX threading APIs or some meaningful subset thereof for various platforms. They're already standardized, well…
This is the direction a lot of RTOSs go, for example Zephyr ( https://docs.zephyrproject.org/3.0.0/guides/portability/posi... ) and FreeRTOS ( https://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_POSIX/i... ).
Re: Introducing multitasking to Arduino
#49Re: Introducing multitasking to Arduino
#50It's a strange thing to say - async/await is now built in to most major programming languages - strange that Arduino would dismiss it so easily.
They are correct in that async/await does not solve multicore utilisation, but it's the most important and easiest way to implement parallelism on a single core.