#149 ESP32 Dual Core Programming + Speed 💨Test vs Arduino UNO (fast!)

preview_player
Показать описание
An absolute beginners' introduction to dual-core processing using the keenly-priced ESP32 processor boards from Espressif.

They want to share some goodies with you so visit
PCB Prototype the Easy Way - Full feature custom PCB prototype service.

All this and more on my GitHub:

Boards entry: File -- Preferences
then click right down the bottom of the page to Additional Boards Manager URLs, to add this line:

Wemos D1 Mini32 ESP32 as used in the demo.
Note, UK warehouse price same as China price but get it in two days!

An Arduino-sized ESP32 board (TTGO ESP32) with all the relevant pins marked up, I have one myself:

There are various TTGO ESP32 boards available, different formats, different prices, worth browsing before buying.

Other ESP32-related links:

Nothing to do with this video, but I bought a dual solder reel holder, works like a charm and very solid. I'll show you this in a future video on SMD soldering:

All this and more on my GitHub:

If you like this video please give it a thumbs up, share it and if you're not already subscribed please consider doing so and joining me on my Arduinite journey

My channel and blog are here:
------------------------------------------------------------------
------------------------------------------------------------------
Рекомендации по теме
Комментарии
Автор

Instead of doing delay(1) in your main Arduino loop, you can use taskYIELD() to let the scheduler know to go do other more important work (Ready tasks with a priority equal to or greater than your task). Because, as you mentioned, in Arduino the main loop is just called repeated from an outer method, the scheduler does not stop running that task unless we allow it (unless we are running the preemptive scheduler). So that will work for core 0, but not core 1. Now since the Arduino loop is running on core 1 with priority 1, calling yield will not work if your task is on core 1 with priority 0, as that is less than the current priority. So to make the task run on core 1, change the priority to 1 or greater. Then calling taksYIELD() will run the task on core 1. And this also takes me back to why delay(1) works. Delay is going to pause the current task (Arduino loop) and yield control to the scheduler. This will put the Arduino loop task into a blocked state (ie not Ready), so the scheduler will then run lower priority tasks (ie your core 1 priority 0 task). Hope that helps explain what you were seeing...

libertywool
Автор

Oh yes, ESP32 is a great great platform ! We would all love to see inter-task communication ... passing arguments and data.

John_Smith__
Автор

Thank you, Ralph. Not only the contents but also the effects of your video are excellent. Please continue.

hmba
Автор

Another worthwhile video. Count me in for more esp32 vids. As far as the speed difference ... that's just mind boggling.

noweare
Автор

Nice Video, thank you.
I would be happy if you do another video an go more into detail. - like how to get variables from on core to the other.

tomwatzek
Автор

Ralph, AWESOME video. The ESP32 is the processor to use today. how about a video on the sharing of variables between the two processors, going both ways.

michaelbyron
Автор

i love the esp. i avoided arduino wherever i could. just used it to flash my printer 😂 great video with onpoint informations thx👍

JohnTinic
Автор

I plan to use both cores in the ESP for a project I am working on. I want to use core 0 to read wav file data from an SD card and play it using I2S, and provide the audio frame that is being played to core 1. To keep a program running some code from the SD card to move some servos in syvn with the audio. So I have been looking on information how to get this all working. When I read your comments “To be honest, I would not use two cores to do this. Use two tasks instead, of equal priority (ie keep them at 1) on core 1. That way you won't upset either the BT, Wi-Fi or other system function running on Core 0. “
and
“It is true - to an extent. Putting some simple tasks on Core 0 won't make it unstable as long as you "yield()" control back to the other tasks fairly frequently. That said, putting an intensive task on Core 0 is not a good idea - keep those for Core 1 (which is where your "loop()" runs) “
After reading some of your comments, I thought the ESP32 will not work for my project so I looked around and I found information that said if you do not enable the WIFI or the Bluetooth the code will not be running?
Some comments said if you do not include it in your code it will not run,
“This is nuts. Don't initialise it. There's nothing to stop. “
I think this might be right, but I will have to look into it more. But it makes sense If you do not include WIFI in your sketch why would the code run?

tedmoga
Автор

This is cool....I have like 3 of these boards...late night aliexpress shopping..lol and needed lots of help to really understand what in the heck I got into and how to use Spiess is good but a little to advanced for my newbie abilities....Thanks

sortofsmarter
Автор

Excellent video. Keep them coming. Much appreciated.

GRPZ
Автор

i think the main loop has the highest priority, you need the delay(1) so put a hold on it so the other loops can run

emmanuelsheshi
Автор

Well presented esp (pun) ially for a newbie like myself

Graham
Автор

Could you make a video showing how to pass parameters to those tasks? or maybe just point me to a resource, been struggling with it

nullptr.
Автор

Can i use hardware interrupts and dual core mode at the same time? When i tried it, i got a lot of errors in runtime.
For example, structure in my project:
0 core for attach Interrupts, and some of algorithms.
1 core for Wi-fi communication and updates tft display using i2c.
Is it possible?

GoodAllDay
Автор

Please tell how to make a non blocking wifi program on esp32
I have a serial display to update at the same time MQTT data upload .if it looses MQTT broker it hangs ...

gvsh
Автор

Good stuff Ralph but Node Red on esp32... is this possible?

icecaper
Автор

But the blue led doesn't give the semaphore until it is off, so why doesn't the red led turn on as the blue led turns off? (Or is LOW 'on' on an Esp32? )

pintokitkat
Автор

Hello Ralph I down loaded your programme okay but it had a stack over flow error when I tried to run it, did you have this error when developing the programme? I have a lot more to learn about the ESP32.

robertmurton
Автор

The code does'nt seem to calculate prime numbers, it includes a loop with float numbers, floats are very slow on Arduino. It's estimated speed on a mixed 50% calculation with long and 50% with float.

pascalmathieu
Автор

The github link is missing. At least I can't find it anywhere

germandkdev
welcome to shbcf.ru