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

Описание к видео 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 Tutor...  
Intro to Raspberry Pi Pico and RP2040:
Part 1: VS Code and Blink -    • Intro to Raspberry Pi Pico and RP2040...  
Part 2: Debug with Picoprobe -    • Intro to Raspberry Pi Pico and RP2040...  
Part 3: How to Use PIO -    • Intro to Raspberry Pi Pico and RP2040...  

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  

Комментарии

Информация по комментариям в разработке