Skip to content
Snippets Groups Projects
Quentin Bolsee's avatar
Quentin Bolsee authored
f54a2780
History

rp2040-ring-pio

This is a demonstration of the RP2040's PIO system, which let you run several state machines independently of the CPU. There's exactly 0 overhead and the state machines run a custom assembly language with simplified instructions.

In this example implementation of a ring oscillator, pin 1 is configured as a PIO input, and pin 2 as an output. Reading, inverting and writing is as simple as:

.program ring
    mov pins, !pins
.wrap

Results

CPU Freq Ring Freq
133 MHz 16.667 MHz
250 MHz 25 MHz

Binaries

You can find compiled binaries in build/. Simply drang and drop the .uf2 file on your raspberry pi pico's storage space after putting it in reset mode (boot button + power cycle).

Build

Navigate to build/ and generate the project using cmake:

cd build/
cmake ..

This should create a Makefile, and you can simply build the project every time you update the code by running:

make

The output is bin, elf, hex and uf2 files in build/.