Intro to Raspberry Pi Pico and RP2040 - MicroPython Part 3: PIO | Digi-Key Electronics

preview_player
Показать описание
In the previous videos, we showed you how to get started using MicroPython on the Raspberry Pi Pico. In this tutorial, we’ll examine the new PIO peripheral inside the RP2040.

PIO stands for “Programmable Input/Output,” and it’s a unique peripheral added to the Raspberry Pi RP2040 microcontroller. It is like a set of tiny, limited processors that allow us to construct complex communication protocols, such as CAN, USB, Ethernet, etc. by bitbanging them independently of the main CPU.

Each RP2040 comes with 2 PIO instances, and each PIO contains 4 state machines. A “state machine” (in this case) refers to the tiny processor-like hardware pieces in the PIO that can execute sequential logic from a limited instruction set. We can program each state machine using this special assembly instruction set to do things like PWM and communicate with various external devices.

While we need to use assembly language for PIO, Raspberry Pi has wrapped up the various instructions into a C/C++ library as well as a MicroPython library (known as rp2). In this video, we will focus on using rp2 in MicroPython to create custom PIO programs. We start with a simple blink program that flashes the onboard LED at 10 Hz. After that, we show you how to use someone else’s PIO program as a MicroPython library in the Raspberry Pi Pico to fade the LED with PWM.

If you would like to dive deeper into PIO, we recommend checking out the following documentation:

Product Links:

Related Videos:

Related Project Links:

Related Articles:

Learn more:
Рекомендации по теме
Комментарии
Автор

Helpful introduction to PIO, starting from the basics.

jchidley
Автор

Thank you Shawn, very awesome intro to PIO, super easy to understand. Looking forward to your next video...

narwodev
Автор

Amazing Thanks! I learn about PIO om pico

Emanavas
Автор

Thanks for analyzing a small PIO program clearly and completely. Too many 'tutorials' consist of "copy this code." WS2812 tutorials are specially bad in this respect leading one to suspect that the author didn't understand either.

tonytenbreock
Автор

Do you have a NeoPixel example of that PWM fade?

mytechnotalent
Автор

I am getting the following errors using this PIO example.
>>> %Run -c $EDITOR_CONTENT
Traceback (most recent call last):
File "<stdin>", line 9, in <module>
File "rp2.py", line 258, in dec
File "<stdin>", line 14, in blink
TypeError: 'bound_method' object isn't subscriptable
>>>

prestonknodelliii
Автор

How about an ESP32 + I2S mic +bla bla blah + ESP NOW = Esp32 walkie-talkie project?
This pico thing is a weakling.

objection_your_honor