Intro to Raspberry Pi Pico and RP2040 - C/C++ Part 3: How to Use PIO | Digi-Key Electronics

Programmable Input/Output (PIO) is a unique feature in the RP2040. It allows users to create custom communication peripherals and drivers that run independently of the main program on the CPU. In this video, we’ll show you how to create a simple PIO program that toggles the LED on the Raspberry Pi Pico. You will need to configure the Pico build system as shown in the first part of this series: https://www.digikey.com/en/maker/proj... Setting up debugging is not necessary, but it is recommended: https://www.digikey.com/en/maker/proj.... Note that you cannot use step-through debugging on PIO programs. A written form of this tutorial can be found here: https://www.digikey.com/en/maker/proj... We write a simple blink program in PIO assembly language that toggles the onboard LED and waits for a set number of cycles. We also construct a C helper function in the same PIO file that can be called from the main C program in order to configure the PIO instance and state machine. Information about the PIO and assembly instructions can be found in Chapter 3 of the RP2040 datasheet: https://datasheets.raspberrypi.org/rp... In the main C program, we configure the LED pin and set the clock divider for the PIO instance. We then call the helper function found in the PIO program file. We sleep the main CPU so that it does nothing while the PIO program runs independently to toggle the LED. The PIO can be used to emulate a number of different communication protocols, including UART, I2C, I2S, SPI, PWM, WS2812b driver, SDIO, CAN bus, DVI (with overclocking), etc. We recommend looking at the Raspberry Pi pico-examples repository to see additional examples of PIO programs: https://github.com/raspberrypi/pico-e... Product Links: https://www.digikey.com/en/products/d... Related Videos: Intro to MicroPython – Maker.io Tutorial -    • Intro to MicroPython – Maker.io Tutorial |...   Intro to Raspberry Pi Pico and RP2040: Part 1: VS Code and Blink -    • Intro to Raspberry Pi Pico and RP2040 - C/...   Part 2: Debug with Picoprobe -    • Intro to Raspberry Pi Pico and RP2040 - C/...   Part 3: How to Use PIO -    • Intro to Raspberry Pi Pico and RP2040 - C/...   Related Project Links: https://www.digikey.com/en/maker/proj... Related Articles: Introduction to MicroPython - https://www.digikey.com/en/maker/blog... Raspberry Pi Pico and RP2040 - MicroPython Part 1 - https://www.digikey.com/en/maker/proj... Learn more: Maker.io - https://www.digikey.com/en/maker Digi-Key’s Blog – TheCircuit https://www.digikey.com/en/blog Connect with Digi-Key on Facebook   / digikey.electronics   And follow us on Twitter   / digikey  

Intro to Raspberry Pi Pico and RP2040 - MicroPython Part 1: Blink | Digi-Key Electronics
▶︎

Intro to Raspberry Pi Pico and RP2040 - MicroPython Part 1: Blink | Digi-Key Electronics

Intro to Raspberry Pi Pico and RP2040 - C/C++ Part 1: VS Code and Blink | Digi-Key Electronics
▶︎

Intro to Raspberry Pi Pico and RP2040 - C/C++ Part 1: VS Code and Blink | Digi-Key Electronics

Hardware Design with the RP2040: Custom PCB Based on the Raspberry Pi Pico | Digi-Key Electronics
▶︎

Hardware Design with the RP2040: Custom PCB Based on the Raspberry Pi Pico | Digi-Key Electronics

Raspberry Pi  Pico PIO  - 8 Little Processors You Can Program
▶︎

Raspberry Pi Pico PIO - 8 Little Processors You Can Program

Intro to Raspberry Pi Pico and RP2040 - C/C++ Part 2: Debug with Picoprobe | Digi-Key Electronics
▶︎

Intro to Raspberry Pi Pico and RP2040 - C/C++ Part 2: Debug with Picoprobe | Digi-Key Electronics

#220 PICO and PIO: First Look - far easier than you might 💭 think
▶︎

#220 PICO and PIO: First Look - far easier than you might 💭 think

Write Fast C/C++ Code for the Raspberry Pi Pico 2 using Visual Studio Code - Best RISC-V Compiler
▶︎

Write Fast C/C++ Code for the Raspberry Pi Pico 2 using Visual Studio Code - Best RISC-V Compiler

Raspberry Pi Pico - PIO explained
▶︎

Raspberry Pi Pico - PIO explained

#372 How to use the two Cores of the Pi Pico? And how fast are Interrupts?
▶︎

#372 How to use the two Cores of the Pi Pico? And how fast are Interrupts?

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

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

Raspberry Pi Pico PIO - Ep. 8 - Introduction to DMA
▶︎

Raspberry Pi Pico PIO - Ep. 8 - Introduction to DMA

Turn your Pico into a 400MHz 24 Channel Logic Analyser
▶︎

Turn your Pico into a 400MHz 24 Channel Logic Analyser

How to Use Asyncio in MicroPython (Raspberry Pi Pico) | Digi-Key Electronics
▶︎

How to Use Asyncio in MicroPython (Raspberry Pi Pico) | Digi-Key Electronics

Raspberry Pi Pico W LESSON 36: Control a Servo With MicroPython
▶︎

Raspberry Pi Pico W LESSON 36: Control a Servo With MicroPython

Generating PWM Signals Using the Raspberry Pi Pico | STOP BIT BANGING on the RP2040!
▶︎

Generating PWM Signals Using the Raspberry Pi Pico | STOP BIT BANGING on the RP2040!

Building a GPS Mechanical Clock: Getting Started With The Raspberry Pi Pico
▶︎

Building a GPS Mechanical Clock: Getting Started With The Raspberry Pi Pico

Programming a Raspberry Pi Pico with C or C++
▶︎

Programming a Raspberry Pi Pico with C or C++

Raspberry Pi Pico Lecture 13 (2025): Simple PIO examples
▶︎

Raspberry Pi Pico Lecture 13 (2025): Simple PIO examples

Sinclair BASIC vs BBC BASIC - How to fit an entire devkit inside 64K
▶︎

Sinclair BASIC vs BBC BASIC - How to fit an entire devkit inside 64K