Replies: 5 comments 11 replies
-
Nice! Maybe use However, there is a gotcha here. If either core tries to update the flash (we now have a full-fledged filesystem and EEPROM), the whole board will crash hard. To do this safely we need to add an interlock between both cores. Probably both listening to a high prio interrupt from the other and grabbing a mutex when they get there to be visible to the other core. Then all the flash routines need to assert that IRQ, wait for the other side to ack that they're in a safe RAM-located IRQ loop, do the flash work, then tell the other core it's free to continue. Not rocket science, but not something I've had time to hack on. Biggest issue I see is avoiding any possible deadlock if both try to write to flash at the same time. |
Beta Was this translation helpful? Give feedback.
-
Here is another multicore sketch tweaked for the Arduino environment, based on the simple example from here (with corrected typos!):
|
Beta Was this translation helpful? Give feedback.
-
Do you want to do a PR for these in the library/rp2040/examples directory as SDK multicore examples? |
Beta Was this translation helpful? Give feedback.
-
Hi all, I have been playing with this so that I can have a separate GUI thread running on one core and a DSP thread running on the other.
Would drop a block of zeros inside an array on the stack of the other setup() function. What makes it extra strange is that the stacks definitely seem to be 0x1000 bytes apart, and none of the functions seem to involve any heap operations. Does anybody have an idea where such corruption could come from? |
Beta Was this translation helpful? Give feedback.
-
IMO that multithreading syntax from the TOP is far too complicated. Instead I would appreciate simple standard C/C++ pthread or std::thread API syntax what is already available on the ESP32 (a dual core too) for multiple, arbitrary numbers of parallel pre-emptive threads which can be assigned automatically or manually to either core. Here also e.g. mutexes are available and even thread prios. |
Beta Was this translation helpful? Give feedback.
-
There is a nice video tutorial here about using the two processor cores of the Raspberry Pi Pico. The tutorial uses the laborious process of using cmake etc, but with the Arduino IDE things are much easier so you can skip that bit!
The actual code example needed relatively few changes for the Arduino environment. Cut and paste the code below and you are up and running on two cores! See the video for how it works.
Beta Was this translation helpful? Give feedback.
All reactions