Getting Started with Multicore Programming on the Raspberry Pi Pico

preview_player
Показать описание
This video covers how to create a simple multicore program which uses both cores on the Raspberry Pi Pico. We use a Visual Studio Code project to program the brand-new Raspberry Pi Pico microcontroller board. We created a program where one core uses the analogue to digital converter in the Pico to read the internal temperature of the RP2040 and sends this data to another core to output the temperature of the chip to a windows machine over a USB serial interface.

This video provides a conceptual overview of multicore (dual core) operation on the Raspberry Pi Pico. It also explains how to configure interrupts to correctly handle the sending and receiving of data between cores. We briefly discuss how to set up the analogue to digital converter (ADC) to read the onboard temperature of the RP2040 chip.

Timestamps
00:00 - Introduction
00:33 - Why use a Multicore Program?
01:46 - How do Multicore Programs Work?
03:40 - Creating a Visual Studio Code Project
04:29 - Writing CMakeLists File
05:30 - Writing C File
09:45 - Conclusion

If this video helped you, please consider leaving a like and subscribing, thank you!

-- Equipment I use regularly --
The following links are affiliate links where I may make a small percentage on qualifying sales through these links. Use the respective UK or US links listed.

All videos and tutorials on this channel and mentioned websites are for educational purposes only.
Рекомендации по теме
Комментарии
Автор

Thanks for doing this in C/C++. There are copious amounts of micropython examples out there for the Pico, but very few useful ones in C/C++. Nice pacing, editing and focus.

jugshangar
Автор

Hands down the BEST coding video I've ever seen. Your narrative keeps up perfectly with your coding, you explain everything perfectly and you don't have any time-wasting moments in the video where EVERYONE ELSE DOES because they think that we want to sit here and watch them correct their mistakes while they mumble to themselves. NOT YOU! You NAILED IT! NICE WORK!

MikeSims
Автор

Short, straightforward, to-the-point. I like it. Thanks! 👍

McTroyd
Автор

Great video. It would be helpful if you used a larger font on VS Code or encoded the video at a higher bit rate so the text was more readable. Thanks.

spotterinc.engineering
Автор

Thanks. In 25 years of firmware coding I always assumed I'd need multithreading at some point but it just hasn't happened; PC software's a different matter of course. So I come to the Pico wondering what scenarios justify the overhead. Most multicore MCUs have cores specialized for different purposes - eg M0/M4 - which makes sense. I'm thinking it's gonna need some careful design to get the most out of two symmetrical cores. But they're welcome!

lumpyfishgravy
Автор

Interesting illustration, but normally you’d want to do the bare minimum in an interrupt handler, and defer calculations and printing to a foreground task on the same core.

Hacker-at-Large
Автор

This is exactly what I was looking for

willitmicrowave
Автор

I'm surprised you didn't get a watchdog exception for doing so much during an interrupt, unless the Pico SDK doesn't check for that.
For the ESP32, if you spend too much time in an interrupt, you'll get a panic and crash. That happened to me trying to use an interrupt handler in ESP32 to process data when available from an external ADC that calculates AC RMS from a current sensor.

A better method of handling data transfer signaled by an interrupt is to tell the main program in core1 through a flag that there's data available, or have the interrupt populate a buffer defined in the core1 code.
But I realize this is just to get our feet wet using multi-core, FIFO, and interrupt.

danman
Автор

Another great video. I did have to add sleep_ms(1000); after stdio_init_all(); in main to get the program to function correctly. I am looking forward to seeing multi core with the freeRTOS. Thanks!

edwardvidal
Автор

It would have been helpful if you also show how your temperature sensor was connected to the Pico

taiwo
Автор

Super interesting! Nice to see the whole project being created too rather than just opening Arduino IDE. Although I’m guilty of that I suppose as I just let CubeMX do all the setup 😝
How have you found the discoverability with the pi pico? Is all of this based on examples they provide and is it easy to dig into the HAL files and find what you need or is it provided as a compiled library that you can’t view?

Kefford
Автор

Is there a race condition between checking queue status and clearing the queue interrupt?

villehallivuori
Автор

Great video!! Very informative with how cores work and how to get things working. Nice work!

ethanspitips
Автор

Dear sir. Congratulations for the amazing video. But, in spite of I set out my video on the highest resolution, some "=" sign apears like "-" sign. If I don't mention about the whole text. Is it a way to improve the image, before to record in high resolution? Regards.

JorgeSilva-empf
Автор

In my experience one should never do blocking calls directly in interrupt handlers.

fabiusIII
Автор

Wow, what a nice channel, I'm glad I found it! This video was super helpful

lusiaa_
Автор

Excellent video, thanks I will keep following

bern
Автор

I have a question. How can you send the value of a variable that has been defined in the core1 back to core0? I've been trying to send the temp variable calculated in the core1 back to the core0 with the function but it doesn't appear to be working.

eminberkunal
Автор

Thanks for the video. What is the size of the FIFO buffer?

adamreynolds
Автор

Hello, I do not understand the conversion factor : const float conversion_factor = 3.3f/(1<<12);. Why there is a shift left?

mohdrais