Dual Core Programming for the Raspberry Pi Pico, ESP32, and ESP32-S3 Using the Arduino IDE

preview_player
Показать описание
The RP2040 (found in the Raspberry Pi Pico), the ESP32, and the ESP32-S3 are all dual-core microcontrollers, with two CPU cores. All three can be programmed using the Arduino IDE. Here is a look at how to program both cores on those chips using the Arduino IDE, including a unified sketch that will work on RP2040 based boards and on ESP32/ESP32-S3 boards.

---

#garyexplains
Рекомендации по теме
Комментарии
Автор

I remember back then Lord Gary mostly explain Android, now he explain every technology! Respect for this guy :)

KangJangkrik
Автор

I use the two cores of ESP32 for robotics, one for communication with the host and another for closed loop control. This way I get a very low latency in the control loop and I still can change the target position and sample current positions at relatively high frequencies.

pau
Автор

Good timing! I'm starting a project for a digital audio synthesizer, and I'm planning to use dual cores, and a little later, RTOS, so very useful!

TomLeg
Автор

Coming from MicroPython on the Pi Pico this is so simple to implement it hurts, thank you for the video.

rossmyers
Автор

This code saved me learning a lot about C++!! Thanks a lot :)

sethmitchell
Автор

Thanks Gary. watched this videos 4 times for sharp understanding.
and read all the below comments. now I'm handson. cheers😁

murugesh
Автор

*GARY!!!*
Good afternoon Professor!
Good afternoon fellow classmates!
Stay safe out there everyone!

MarkKeller
Автор

Just to clarify to anyone interested in parallel programing (since I didn't know this when I bought the esp32) the esp32 can run more than 2 tasks at once thanks to freeRTOS(I don't know about the pico) that is why the code for the esp32 is a bit more complicated, some people say they got around 50 tasks running without any problems
Ps core 0 is responsible for wifi and Bluetooth so if you are using those don't overload it with complex tasks

youssubernfissi
Автор

Great video as always
Love the theme
Thanks for sharing your expirence with all of us 👍 😀

avejst
Автор

Reads will correct themselves and will not inherently corrupt the data; however, if multiple reads are required (e.g. long on 8b processor or double on 32b), then you might read some bytes before the value changed and the rest after the value changed. In this case this particular value is corrupt. If you don't lock your reads, be careful how you use the result. This corrupt value might otherwise cause the code to branch incorrectly or to perform incorrect calculations and/or to store incorrect values.

byronwatkins
Автор

Always interesting and informative! Please do a video on semaphores etc. can’t wait 👍

markmaker
Автор

Your code also works on ESP32-C3 - without any modifications, it just runs both loops on same core. It's useful if you want the same code to run on various platforms, even single core, but make use of both cores if you have it...

bjarke.gotfredsen
Автор

Looking forward for ypur explanations of mutex, semaphores and synchronizations. Thanks in advance

arfjreyes
Автор

This info will be very useful. Thank you.

bertblankenstein
Автор

Great vid with a cool explanation that can, as you said, be a template for other codings (simple or complex). Please keep the technical threads coming on multi-thread processing with all their nuances and your videos on other programming languages.

muddyexport
Автор

¹1¹st;

I've been in computers over a half century, and I find Gary's presentations particularly relevant with extraordinary clarity.

rcstann
Автор

Reads can absolutely become corrupted if you're reading a multi-word structure. Unless you're absolutely sure your read operation is atomic you should definitely lock the mutex on reading.

Also for the locking/unlocking problem with mutexes, and easy way to solve the problem is to create a MutexLocker class that takes a mutex reference and locks it in the constructor, and unlocks it in the destructor. That way you can be guarenteed that any way you exit out of a function (even if an exception is thrown up the stack) the mutex when be unlocked when the MutexLocker goes out of scope.

MD-vsff
Автор

Really good content. Post more of these videos.👍

cprashanthreddy
Автор

Hey gary: "while". That was a fancy for(;;) though.

OMNI_INFINITY
Автор

Are any objects inherently thread-safe in this arduino/pico "land"? In some other languages you have objects e.g. queues that are thread-safe amongst others. Meaning that the standard library handle the locking for you. Would be nice to get an overview of that. I'm glad however that you touched upon this because two threads working seperatly without communicating with each other is rearly usefull in my experience.

retroandgaming