RP2040 emulator for the testing and debugging of PIO programs
Project description
Introduction
This repository contains an emulator for the Programmable Input/Output (PIO) blocks that are present within the Raspberry Pi Foundation’s RP2040 Microcontroller. It is designed to assist in the analysis of PIO programs and to help you by:
Enabling unit tests to be written.
Answering questions such as: How many clock cycles are being consumed?
Supporting the visualization of GPIO outputs over time.
Providing alternatives to debugging on real hardware, which can be time consuming.
Examples
Pimoroni Blinkt! with Unit Test
An annotated example which demonstrates one approach to writing unit tests for PIO programs by using an emulator. The PIO program itself is very primitive and sets all eight LEDs of a Pimoroni Blink! to a single hard-coded colour. Perhaps you would to like to try re-factoring it? Don’t forget to check that the unit-test still passes!
Jupyter Notebook
The emulator can also be used from within Jupyter Notebooks. The screenshot below is taken from the examples/jupyter-notebook/square_wave_example.ipynb notebook that is included within this repository.
Limitations
This software is under development and currently has limitations - the notable ones are:
Only supports a sub-set of the available instructions:
JMP (PIN and !OSRE variants not implemented)
MOV (some variants and operations not implemented)
OUT (PC, ISR and EXEC destinations not implemented)
PULL (IfEmpty not implemented)
SET
WAIT (IRQ variant not implemented)
No support for OUT, SET or IN pin-sets; all pin numbers are with respect to Pin 0.
Pin-sets do not wrap after GPIO 31.
No direct support for the concurrent running of multiple PIO programs; a single State Machine is emulated and not an entire PIO block.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for rp2040-pio-emulator-0.16.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ff98cc83cd9ab5247b1b5f4ea5ec20acd0048929e7438056fc4508965bcbb46 |
|
MD5 | be68d5baa4ef07c85c4eb3203fb8bf93 |
|
BLAKE2b-256 | 15dde267545e13883bd5fa552f4f15b2c7e0ca71555769e87950175c4c55065d |
Hashes for rp2040_pio_emulator-0.16.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d4cc6e50cb0c35f815e0f5fd7a871a90d5419e920c02633cc7d51030bdf2b0f |
|
MD5 | 9e5bbbc11f77e73b11916f0775396b8d |
|
BLAKE2b-256 | fb22861fffa9511b2c5f47a9a162cb85c288dd1c4a4c5834b58438ee66c6c61a |