The Pico 2 Laboratory
A Raspberry Pi Pico 2 in the browser: write a program in RISC-V assembly or in a subset of C, run it on a simulated RP2350 with its Hazard3 cores, and watch the instructions, the clock cycles and the pins.
About the laboratory
The Raspberry Pi Pico 2 is a small board built around the RP2350, a microcontroller from Raspberry Pi Ltd. The RP2350 has two processor cores, and each can run either as an Arm Cortex-M33 or as a Hazard3, an open-source RISC-V core; the choice is made at boot (RP2350 Datasheet §3.8, §3.9). The laboratory simulates the RISC-V side: two Hazard3 cores, the RP2350's address map (§2.2) and the devices listed under The chip's devices.
It is a teaching tool. A program runs one instruction at a time or at the speed of the real chip; every instruction takes the clock cycles the datasheet gives for Hazard3, and the Core view shows why. Programs are written in Hazard3 assembly language or in MAVILERA C, a teaching subset of C compiled in the page. What the model leaves out is listed under Limits of the model, and how it was checked under How the models were checked.
Getting started
- Open a sample project from Sample projects in the toolbar, for example Hello over UART. Its first lines say what it shows and what to try.
- Choose Assemble (Compile for C), or press Ctrl+Enter. Errors are underlined in the editor and listed in the console.
- Step (F10) runs one instruction; Step back (Shift+F10) undoes it. Run (F5) runs on and pauses.
- Open the Pins tab of the bottom pane to see GP25, the board's LED, and the other 29 GPIOs.
A path through the templates: A tour of Hazard3's extensions; Hello over UART and Blink GP25 with the SIO and TIMER0; Blink in C and Hello in C; A button on GP15 counts presses and Echo over UART in capitals; then the pipeline, sound, two cores, the buses and PIO. The practice exercises follow the same order.
The workspace
| Part | What it shows |
|---|---|
| Editor | The program, with a second tab for its .pio file when it has one. |
| Listing | Each instruction with its address and encoding; the marked row runs next. Click the circle before an address to set a breakpoint. |
| Registers | x0 to x31 and the machine CSRs; a register the last step changed is marked. Tick a register to stop when it is written. With two cores running, the Core 1 registers too. |
| Bottom pane | Tabs: Memory, Pins, and one per device (PWM, DMA, ADC, SPI, I2C, PIO). |
| Console | What the program sends on UART0, messages of the laboratory, and Send to UART0. |
| Toolbar | Sample projects, Assemble or Compile, Run, Step, Step back, Reset, the Speed menu, the Sound button and clk_sys. |
Panes can be resized, folded and opened from their dividers; View in the header has Focus, Full screen, Zoom, Projector mode and the theme. Keys in the header lists the keyboard shortcuts.
Assembly language
The assembler takes Hazard3's instruction set: RV32IMAC with the bit-manipulation and code-size extensions, and
Hazard3's own extensions, among them its interrupt controller (RP2350 Datasheet §3.8, §3.8.6). A program begins at its
first instruction in .text; its data go in .data; it ends at ebreak when no
trap handler is set. Without a bootrom (see Limits) the program itself starts the chip: it
starts the 12 MHz crystal, chooses the clocks and takes the devices it uses out of reset, as the device
templates do.
clk_sys in the toolbar chooses 1, 4 or 12 MHz. The assembler defines symbols for that choice, so that a program works at every clock:
| Symbol | Meaning |
|---|---|
CLK_SYS_DIV | The value for CLK_SYS_DIV that divides the 12 MHz reference to clk_sys (§8.1). |
CLK_SYS_HZ | clk_sys in hertz. |
UART_IBRD, UART_FBRD | The UART's baud-rate divisors for this clock (§12.1). |
TICK_CYCLES | The tick generator's count for a 1 µs timer tick (§8.5). |
A .pio file in the second tab (File, then Add PIO file) is assembled with the program; a PIO program
named blink gives the symbols blink_program (its words), blink_length,
blink_wrap and blink_wrap_target.
MAVILERA C
MAVILERA C is the teaching subset of C of the MAVILERA laboratories, compiled in the page into Hazard3 assembly that
you can read and step through. Its start-up starts the crystal, sets clk_sys to the chosen clock, starts UART0 for
putchar and the timer, then calls main; main's return value is the program's exit code
(in a0 at the end). Step line and Back line run one C line.
#include <rp2350.h> gives the registers by name and these helpers:
| Helpers | What they do |
|---|---|
pin_output, pin_input, pin_write, pin_read | A GPIO as a single-cycle IO output or input. |
delay_us, delay_ms, sleep_ms, time_us | Waiting and time from TIMER0 (sleep_ms waits asleep, for programs without interrupt handlers). |
pwm_start(pin, top, div), pwm_level(pin, level) | A pin's PWM slice: a period of top + 1 counts of clk_sys / div, high for level counts. |
dma_copy(dst, src, words) | A copy by DMA channel 0, waiting until it is done. |
adc_read(input) | A conversion of input 0 to 3 (GP26 to GP29) or 4 (the temperature sensor): 0 to 4095. |
i2c_setup, i2c_write, i2c_read | I2C0 on GP4 (SDA) and GP5 (SCL), the lab kit's bus. |
spi_setup, spi_select, spi_transfer | SPI0 on GP16 to GP19, chip select on GP17. |
core1_start, fifo_push, fifo_pop, core_id | Core 1 runs the program's core1_main; words pass through the inter-core FIFOs. |
pio_load(words, n) | PIO0's instruction memory filled from address 0. |
CLK_SYS_HZ, UART_BAUD | The chosen clock and UART0's baud rate. |
MAVILERA C has no interrupt handlers; the interrupt templates are in assembly.
The chip's devices
Each device is modelled at the level of its registers, at the RP2350's addresses, and takes its time in clock cycles of its own clock. The tabs of the bottom pane show each one's state in words.
| Device | Datasheet | In the laboratory |
|---|---|---|
| Clocks, crystal, PLLs, resets | chapter 8, §7.4 | The 12 MHz crystal, the clock generators and their dividers, the resets of each block; clk_sys from 1 to 150 MHz. |
| GPIO and pads | chapter 9 | 30 pins, each with its function, pad settings and level; the Pins panel drives a pin from outside. |
| Single-cycle IO (SIO) | §3.1 | GPIO registers, the inter-core FIFOs, doorbells, each core's identity and timer compare. |
| Interrupts | §3.8.6 | Hazard3's external interrupt controller (Xh3irq) and the devices' interrupt lines. |
| Timers | §12.8, §8.5 | TIMER0 and TIMER1 with a 1 µs tick, their alarms and interrupts. |
| UART | §12.1 | UART0 and UART1: FIFOs, baud rate, interrupts; UART0 is the console. |
| PWM | §12.5 | 12 slices: divider, wrap, phase-correct mode, input modes, interrupts and DMA requests. |
| DMA | §12.6 | 16 channels: chaining, address rings, pacing timers, the sniffer. |
| ADC | §12.4 | One-shot and free-running conversion, round robin, the FIFO, the temperature sensor; ideal converter. |
| SPI | §12.3 | SPI0 and SPI1 as masters, with loopback. |
| I2C | §12.2 | I2C0 and I2C1 as masters: start, repeated start, aborts. |
| PIO | chapter 11 | See PIO. |
A program that uses a block or a feature that is not modelled gets a message in the console; the list is under Limits of the model.
The lab kit and analogue inputs
Parts, in the Pins panel, connects a kit of simulated parts to the Pico 2's default buses, as on a breadboard:
| Part | Bus and address | Gives |
|---|---|---|
| BMP280 | I2C0, 0x76 | temperature and pressure |
| MPU-6050 | I2C0, 0x68 | acceleration, rotation, temperature |
| MCP9808 | I2C0, 0x18 | temperature |
| 16 x 2 character display | I2C0, 0x27 | two lines of text |
| 24C02 EEPROM | I2C0, 0x50 | 256 bytes |
| BME280 | SPI0, chip select GP17 | temperature, pressure, humidity |
The panel sets the environment the sensors read and the voltages on GP26 to GP29, the ADC's inputs (§12.4); the temperature is also the chip's own, read by its temperature sensor. Every change is an input of the run, given at the clock cycle you make it. The parts answer their buses byte by byte; their measuring times, filters, interrupt pins and the EEPROM's write time are not modelled.
The Core view
Hazard3 has three pipeline stages: F (fetch), X (execute) and M (memory). The view shows them cycle by cycle: which
instruction is in each stage, the drawing of the stages, the cycles each instruction cost and the cause of every extra
cycle (a load whose result is used at once, a taken branch, a divide, a multi-cycle push or pop), and the branch
predictor's single entry. The counts are the datasheet's (RP2350 Datasheet §3.8.7). Where Hazard3's hardware design
files take a different count (divide and remainder, mret, cm.popretz with one register),
the laboratory keeps the datasheet's and says so in the view's help. The bus is perfect: every access completes
without wait states.
PIO
The RP2350 has three PIO blocks of four state machines each (RP2350 Datasheet chapter 11). A state machine runs a
program of up to 32 instructions that drives and reads pins with exact timing, with its own clock divider, FIFOs to
and from the cores, and side-set. In the laboratory a PIO program is written in a .pio file in the Pico
SDK's notation; programs that use the RP2350's additions start with .pio_version 1. The PIO tab shows
each state machine's program counter, scratch registers, shift registers, FIFOs and divider.
All three blocks run exact to the clock cycle, with the RP2350's additions. Simulating a state machine that executes an instruction on every cycle of a fast clock is slow (at 150 MHz about 1 to 2 % of real time); one that waits on its divider, a FIFO or a pin runs close to real time.
Sound
Choose a pin as the Speaker in the Pins panel and turn Sound on (the speaker button in the toolbar): you hear that pin's level as a small loudspeaker on it would play it. The Converter is Pin-accurate by default (the pin's exact high and low times, filtered to 20 kHz); Ideal DAC plays a PWM output's duty cycle at each period, without its carrier. Sound plays in Real time; Render and play, in the Speed menu, runs up to 60 seconds of the chip's time as fast as it can and then plays them, for programs too fast for real time.
Two cores
After reset core 1 waits in the bootrom for core 0 to send it a short sequence of words through the inter-core FIFO
(RP2350 Datasheet §5.3, §3.1). The laboratory models that wait without running the bootrom. In C,
core1_start() sends the sequence and core 1 runs core1_main on a stack of its own. Both
cores then run at once, interleaved by their clock cycles; Step steps core 0 while core 1 runs alongside, and the
Core 1 registers show the other core.
Real time, speed and replay
| Speed | What it does |
|---|---|
| Real time (the default) | One second of the chip's time per second, so that blinks, tones and UART lines come as on the board. If this computer cannot keep up, the status says how much of real time it reaches. |
| Full speed | As fast as this computer can. |
| Animated | One step after another, slowly enough to follow. |
A pin you drive, a line you send to UART0 and a change of the lab kit are the run's inputs, each given at a clock cycle. Replay in the Pins panel starts the program again and gives the same inputs at the same cycles: the run repeats exactly. A share link and a settings file carry the inputs with the program.
Circuits on the Board
The Board view draws the circuit around the board: at first the demo circuit (a push button on GP15, a knob on GP26 with its 3.3 V and ground), the board's own LED on GP25, and, when chosen in the Pins panel, the lab kit's modules and a speaker. All of them except the board's LED are parts you can move, re-wire, change or delete, and add to. The circuit is simulated with the program: each pin's voltage is solved from the parts on its net whenever something changes, at that clock cycle, and the chip reads its input from that voltage. Capacitors charge and discharge exactly to the cycle.
Editing. Turn on Edit circuit in the Board's heading (the program cannot run while it is on). Choose a part from the tray (its picture is its symbol; its name is in the tooltip) and click the sheet, or press A. Click a pin to start a wire and click again to bend it; end it on a pin, a pad, a junction or another wire. The tools above the tray select and move, draw wires, delete parts or wires, pan, turn, mirror, undo and redo. Everything can be done from the keyboard: arrow keys move a cursor on the grid, Enter selects, W starts a wire, F2 changes a value in Inspect, and ? lists every key. The Circuit tab lists the same circuit as a table with a menu for each pin's connection; there a part of your own can also be defined from the simple parts (Define a part).
Where the values come from. 5 mm LEDs: Kingbright WP7113 series (red ID, yellow YD, green GD, blue QBC/D, white QWC/D); diodes: Vishay 1N4148 and the 1N5819 Schottky diode; transistor: onsemi BC547B; light sensor: Advanced Photonix PDV-P8001; thermistor: Vishay NTCLE100E3103 (10 kΩ, B 3977 K); 7-segment display: Kingbright SC56-11SRWA and SA56-11SRWA; RGB LED: Kingbright WP154A4SUREQBFZGW. An LED's knee voltage and resistance are read from two points of its datasheet's curve (2 mA and 10 mA, the currents a pin gives). Chosen where no datasheet gives them: a switch's 0.05 Ω, the light sensor's resistance at 10 lux (5.74 kΩ, the middle of the datasheet's 3-11 kΩ) and its 1 MΩ in the dark, the resistances of the 7-segment and the RGB LED's red. The board's own LED keeps generic values, since the board's documentation does not name its part.
Light and temperature for the light sensor and the thermistor are the Pins panel's Environment values (Light in lux, Temperature in °C), inputs of the run that Replay repeats.
Sample projects
Sample projects, in the toolbar, are grouped by topic. Each begins with what it shows and what to try. Pico Lite lists the samples in assembly and MAVILERA C; Pico Full lists those in assembly and in Pico SDK C, which also run on a real Pico 2 (the Hardware tab). The laboratory's tests run every one of them and check what its comment says.
| Group | Sample project | Language |
|---|---|---|
| Getting started | Hello in C | MAVILERA C |
| Getting started | Blink in C | MAVILERA C |
| Getting started | Blink GP25 with the SIO and TIMER0 | Assembly |
| Getting started | Hello with printf (Pico SDK) | Pico SDK C (Full) |
| Getting started | Blink the LED (Pico SDK) | Pico SDK C (Full) |
| A complete project | SOS in Morse code, with meters on the LCD and a button (Pico SDK) | Pico SDK C (Full) |
| Digital input and output | A button on GP15 counts presses | MAVILERA C |
| Digital input and output | An LED and its resistor | MAVILERA C + circuit |
| Digital input and output | A traffic light | MAVILERA C + circuit |
| Digital input and output | A transistor switches an LED | MAVILERA C + circuit |
| Digital input and output | A bouncing button and a capacitor | MAVILERA C + circuit |
| Digital input and output | A button by interrupt (Pico SDK) | Pico SDK C (Full) |
| Timers and interrupts | Measuring time with time_us | MAVILERA C |
| Timers and interrupts | A timer alarm interrupt (Xh3irq) | Assembly |
| Timers and interrupts | A repeating timer (Pico SDK) | Pico SDK C (Full) |
| Serial: UART | Hello over UART | Assembly |
| Serial: UART | Echo over UART in capitals | Assembly |
| Serial: UART | Echo in capitals (Pico SDK) | Pico SDK C (Full) |
| Analogue input: ADC | Read a knob with the ADC | MAVILERA C |
| Analogue input: ADC | The chip's temperature sensor | MAVILERA C |
| Analogue input: ADC | A voltage divider into the ADC | MAVILERA C + circuit |
| Analogue input: ADC | A night light with a light sensor | MAVILERA C + circuit |
| Analogue input: ADC | A thermometer with a thermistor | MAVILERA C + circuit |
| Analogue input: ADC | Read a knob with the ADC (Pico SDK) | Pico SDK C (Full) |
| Analogue input: ADC | The chip's temperature sensor (Pico SDK) | Pico SDK C (Full) |
| PWM and sound | Fade the LED with PWM | Assembly |
| PWM and sound | A voltage from PWM and an RC filter | MAVILERA C + circuit |
| PWM and sound | A tone from PWM | MAVILERA C |
| PWM and sound | Twinkle, Twinkle, Little Star (in a loop) | MAVILERA C |
| PWM and sound | Fade the LED with PWM (Pico SDK) | Pico SDK C (Full) |
| PWM and sound | A tone from PWM (Pico SDK) | Pico SDK C (Full) |
| I2C | An I2C temperature sensor (MCP9808) | MAVILERA C |
| I2C | Text on an I2C LCD | MAVILERA C |
| I2C | An I2C temperature sensor (Pico SDK) | Pico SDK C (Full) |
| I2C | Text on an I2C LCD (Pico SDK) | Pico SDK C (Full) |
| SPI | SPI in loopback | Assembly |
| SPI | SPI in loopback (Pico SDK) | Pico SDK C (Full) |
| DMA | Copy memory with DMA | Assembly |
| DMA | A sine from DMA and PWM | MAVILERA C |
| DMA | Copy memory with DMA (Pico SDK) | Pico SDK C (Full) |
| PIO | PIO blinks the LED | Assembly + .pio |
| PIO | A square wave from PIO with side-set | Assembly + .pio |
| PIO | PIO counts the 1 bits of a word | MAVILERA C + .pio |
| PIO | PIO drives the LED (Pico SDK) | Pico SDK C (Full) + .pio |
| Two cores | Two cores, two LEDs | MAVILERA C |
| Two cores | A message through the FIFO | Assembly |
| Two cores | Two cores share the work (Pico SDK) | Pico SDK C (Full) |
| Inside Hazard3 | A tour of Hazard3's extensions | Assembly |
| Inside Hazard3 | Sum of an array | MAVILERA C |
| Inside Hazard3 | Load-use stalls and branch costs | Assembly |
| Inside Hazard3 | A function with cm.push and cm.popret | Assembly |
Exercises
File, then Exercise…, lists the practice exercises. Each gives a task and a starter program;
Run the tests runs your program once per test, from reset at full speed, with the test's inputs (a
pin driven at a given time, text sent to UART0) given when the chip's clock reaches them, and shows expected against
actual: memory, registers, the exit code, the console, pin levels, and the number, period and high time of a pin's
changes within a stated tolerance. No solutions are included. An exercise file from a teacher (format
risc-vista-exercise, with "arch": "pico2") opens the same way.
| Exercise | Language | Tests |
|---|---|---|
| The sum of a table of words | Assembly | 6 |
| Count the 1 bits of a word, fast | Assembly | 7 |
| Print a number over UART | MAVILERA C | 7 |
| Blink with a given rhythm | MAVILERA C | 1 |
| Count the presses of a button | MAVILERA C | 5 |
| A PWM wave with a given duty | MAVILERA C | 1 |
| A sum on core 1 | MAVILERA C | 4 |
| Pulses from PIO | Assembly + .pio | 1 |
Files and sharing
- Your work is kept in this browser: after a refresh or a closed tab the program, its .pio file and the settings come back.
- File, then Copy share link, puts the program, the view, the settings and the run's inputs into a link. They travel in the part after #, which the browser never sends to a server.
- File, then Save program and settings…, writes a .json file; File, then Open, reads it back, and also program files.
- Exports: traces of a run (JSON lines, CSV) with each instruction's clock cycles.
Lite and Full
The stable laboratory holds one program in assembly language or in MAVILERA C (Pico Lite). A second
edition, Pico Full, has projects of several files, C written for the Raspberry Pi Pico SDK and built in
the browser by the SDK's own compiler (a download of about 25 MB, asked for at the first build and then kept), the import
of SDK-built UF2 and ELF files, and loading onto a real Pico 2. Pico Full is offered in the beta release
(MAVILERA 1.7.0-beta.2, at sajidlab.org/mavilera/beta/) and is not yet part of the stable release. Where it is
offered, the switch beside the laboratory's name changes the edition; each edition keeps its own program.
- Sample projects in Pico Full are the assembly ones and those marked (Pico SDK); the tabs C and Assembly sort them. The last, SOS in Morse code, with meters on the LCD and a button, uses the GPIOs, a timer interrupt, PWM sound, the ADC, the lab kit's I2C LCD, UART and a button together.
- SDK headers. Under the project's files, Pico SDK headers (read-only) lists each header your
files include from the SDK or the C library (
pico/stdlib.h,hardware/adc.h,stdio.h…), found where the build finds it. Open one to read it; they come with the compiler, not with the project. - Output, in the Project menu: UART (the default), or UART and USB, so that a program on a real board also prints over its USB cable.
A real Pico 2: the Hardware tab (beta)
Status, MAVILERA 1.7.0-beta.2: loading onto a board has been tested with simulated USB devices only, not yet with a real Pico 2. If a load fails, Download .uf2 and copying the file to the RP2350 drive always works. Please report what happened on GitHub.
In Pico Full the Hardware tab at the top holds everything about a real board, apart from the simulator (which keeps running). It needs Chrome or Edge on a computer (WebUSB); the UART monitor also works in Firefox 151 or later (Web Serial). Each card has a ? button with its explanation.
| Card | What it does |
|---|---|
| Board | Probe board reads what a Pico 2 in BOOTSEL mode reports: chip, ROM version, USB serial number, boot partition. The line under it says which build this browser last wrote to the board. |
| Program | Load to Pico (also in the toolbar) builds the project if it changed, asks you to confirm the board and the build, then erases, writes and reads back each sector and restarts the board. Steps and a progress bar show how far it is. Check reads the board back and compares; Download .uf2 and Copy to the Pico's drive give the file. |
| Debug (without a probe) | Run restarts a board in BOOTSEL mode so that it runs its flash; Save flash reads the flash into a .bin file. Neither writes. Stepping and breakpoints on the board itself need a Raspberry Pi Debug Probe: planned. |
| UART monitor | The board's serial output over its USB cable (Pico 2 USB…) or a 3.3 V USB-UART adapter on GP0, GP1 and GND (Port…), 115200 bit/s by default; Send, Time, Hex, Read aloud; Compare checks the board's lines against the simulated console's. |
- Hold BOOTSEL on the Pico 2 while you plug its USB cable in, then let go: a drive named RP2350 appears.
- Press Load to Pico and choose RP2350 Boot in the browser's list.
- Check the question (it names the board's serial number and the build) and press Enter.
- After the restart, connect the UART monitor to see the program's output.
A load that stops leaves the board in BOOTSEL mode: the part that marks the program as runnable is written last. The laboratory never changes the board's one-time-programmable memory or a partition table. On Linux the browser needs a udev rule for the USB IDs 2e8a:000f and 2e8a:0009.
Offline use and privacy
Every computation runs in your browser. MAVILERA has no account, sends no telemetry and uploads nothing. After a first visit the hosted version also opens without a network connection, and a single-file version can be downloaded for computers that have none.
How the models were checked
Against other simulators, test suites and Hazard3's hardware design files, not against a Pico 2 board:
| What | Checked against | Result |
|---|---|---|
| The core's instructions | riscv-arch-test, the RISC-V architecture tests, with the Sail reference model | 245 of 255 tests pass; the failures were examined: each is a point where Hazard3's own design differs from the reference model, except one that is not yet explained. |
| Instruction timing | 135 timing cases measured on Hazard3's hardware design (the RP2350 version), simulated with Verilator and with Icarus Verilog | The laboratory gives the hardware design's count in every case, except 18 where the design and the datasheet differ: there it gives the datasheet's (see The Core view). |
| The machine and its devices | The Pico SDK's example programs built for RISC-V and run on rp2350js (an open-source RP2350 emulator, patched where it lacked features) | Identical UART text and pin sequences, and pin timing within 1 % or 2 µs: 4 of 4 programs on the timers, UART and GPIO; 4 of 6 on PWM and DMA, 3 of 4 on two cores and 9 of 10 on ADC, SPI and I2C, each difference traced to a feature the emulator lacks; 13 of 13 PIO programs. |
| PIO, a second time | rp2040-pio-emulator, an independent PIO emulator, on PIO-only tests | 21 of 22 tests identical cycle by cycle; the one difference is a feature that emulator lacks (refilling the output register between OUT instructions, RP2350 Datasheet §11.5.4.2). |
| The PIO assembler | pioasm, the Pico SDK's assembler, on 38 programs | The same words for every program. |
| Real time | A program at 1 MHz for 30 seconds in Chrome, Edge and Firefox on a 2021 laptop processor (AMD Ryzen 9 5900HS) | Within 0.1 % of real time. At 12 MHz the same laptop reached 55 to 78 %. Slower computers were not measured. |
The laboratory's own tests run every template and every exercise, and its browser tests run in Chrome, Edge and Firefox. Safari was not tested.
Limits of the model
Not modelled
- The Arm Cortex-M33 cores: only the RISC-V cores run.
- The bootrom: a program starts directly at its first instruction. Of the bootrom's functions only the lookup that the Pico SDK's start-up uses is answered; a call of another one, or a jump into the bootrom, ends the run with a message. Core 1's wait for its launch is modelled without it.
- Blocks whose registers read as zero or as last written, with a message: HSTX_CTRL, HSTX_FIFO, TRNG, SHA256, OTP, OTP_DATA, OTP_DATA_RAW, GLITCH_DETECTOR, TBMAN, USB_DEVICE_DPRAM, XIP_AUX, CORESIGHT_TRACE: HSTX, the random number generator, SHA-256, the one-time-programmable memory, the glitch detector, the testbench manager, USB's buffer memory, the flash cache's auxiliary port and trace.
- Blocks whose registers only hold what was written: SYSCFG, IO_QSPI, PADS_QSPI, ACCESSCTRL, BUSCTRL, XIP_CTRL, QMI, ROSC, POWMAN, USB: the flash interface, the ring oscillator, power management, bus priority, access control and the USB controller.
- The SIO interpolators and the TMDS encoder; the watchdog's countdown.
- The security features (secure and non-secure states, the access controls' checks).
- SPI and I2C as slaves; I2C 10-bit addresses, general calls and START bytes (the low 7 bits of the address are sent).
- PIO's INLINE_OUT_EN, OUT_STICKY and GPIOBASE (the registers keep what was written).
- A GPIO function without a model (for example HSTX or USB): the pin is not driven. DMA requests from blocks without a model never come.
Modelled with simplifications
- A perfect bus: every fetch, load and store takes no wait states, so code in flash, the APB peripherals and bus conflicts cost less than on the chip.
- Instruction timing from the datasheet where Hazard3's hardware design differs (18 cases; see The Core view).
- DMA's security and memory-protection settings are stored, not enforced.
- The ADC is an ideal converter; the lab kit's parts are ideal and answer at once.
- Sound: the converters are models of a loudspeaker's hearing of the pin, not of an audio circuit.
The circuit outside the chip
- A teaching model, not a circuit simulator such as SPICE: resistors, switches and potentiometers are linear; LEDs, diodes and the NPN transistor are piecewise linear (off, or a fixed voltage behind a resistance; the transistor cut off, active or saturated); there are no inductors, no reverse breakdown, and temperature changes only the thermistor.
- A pin's output is a source behind its datasheet's typical resistance at each drive strength; the drive does not weaken further under a heavy load, and the pads' protection diodes are not modelled. Pins read their input through the typical switching points.
- I2C and SPI modules are models at the level of bytes on their bus: their wires carry no edges, their pull-ups only decide whether they answer.
- The speaker and the piezo buzzer listen to their pin and draw no current; the buzzer's capacitance is not modelled.
- Part values come from named parts' datasheets (see Circuits on the Board); a few that no datasheet gives are chosen, and graph readings are about ±0.02 V.
Speed and browsers
- A PIO state machine that executes on every cycle of a fast clock runs far slower than real time.
- Real time at 12 MHz may not be reached; the status says how much is.
- Measured on one laptop only (see How the models were checked); Safari was not tested.
What a simulation shows
The models were checked against emulators, test suites and the core's hardware design, not against a Pico 2 board. A simulation shows what the model does; it is not evidence of how a hardware build behaves.
Sources
Section numbers in this documentation and in the help are those of RP2350 Datasheet, Raspberry Pi Ltd, Release 8 (build 80d627281ed5), 1 October 2026, pip.raspberrypi.com/documents/RP-008373-DS, licensed CC BY-ND 4.0.
Licence and notices
© 2026 Sajid Muhaimin Choudhury. MAVILERA and its content (drawings, help texts, this documentation, templates and exercises) are licensed under the Apache License, Version 2.0. The names and the logo are not licensed as trademarks.
The table of the RP2350's register names, addresses and reset values is generated from the RP2350 description file of the Raspberry Pi Pico SDK (BSD-3-Clause licence; see THIRD_PARTY.md in the source repository). MAVILERA reproduces no text, figure or table of the RP2350 Datasheet; its simulator, drawings, help and programs are its own. rp2350js, rp2040-pio-emulator, riscv-arch-test, Verilator and Icarus Verilog were used for checking only; nothing of them is included. MAVILERA is not affiliated with or endorsed by Raspberry Pi Ltd. Raspberry Pi is a trademark of Raspberry Pi Ltd; Pico and RP2350 are names of its products.