filmov
tv
Intro to Raspberry Pi Pico and RP2040 - MicroPython Part 3: PIO | Digi-Key Electronics
Показать описание
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:
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:
Комментарии