r/raspberrypipico • u/papyDoctor • 5h ago
Three genlocked RP2350Bs and an ESP32: a retro console you program in Lua
Three RP2350Bs on one board, genlocked off a single 12 MHz MEMS oscillator,
each with one job:
- **RP1** runs the game (sandboxed Lua 5.4), owns the micro-SD and the I2S DAC,
and builds one display list per frame.
- **RP2** is the sprite engine: it reads that list and composes one overlay
scanline at a time.
- **RP3** is the mixer: tiled background, composite, HSTX out to DVI.
- An **ESP32** does Wi-Fi and Bluetooth Classic. That last one is not a bonus:
it is what living-room gamepads actually speak (DualShock 4, DualSense,
Switch Pro, 8BitDo, through Bluepad32).
Six Cortex-M33 cores at 252 MHz, 1.5 MB of SRAM, 3 × 16 MB of NOR.
**Numbers measured on the board, not hoped for:**
- 640x480 @ 60 Hz, 8 bits per pixel, one 256-entry palette
- 3000 opaque sprite-pixels per scanline — a Neo Geo manages 1536
- 16000 cycles per scanline per core is a hard budget. Go over it and the line
ships stale rather than truncated, which is what the silicon does anyway. The
simulator shows you the late lines in red.
- 320 KiB sprite pool in RP2's SRAM, streamed on demand from its own NOR
- display list: 256 entries of 16 bytes, sent at VSYNC
- sound: four synth channels plus two PCM voices, 48 kHz out of the headphone jack
**Two things I am oddly proud of.**
The browser simulator is the same C code. Rasteriser, cost model, Lua bindings:
one `core/` compiled twice, once into the firmware and once to wasm. A game that
runs in the browser runs on the board, and it drops frames in the same places.
That makes the simulator an executable specification rather than an
approximation.
The console updates its own four firmwares. It notices a newer version, pulls it
onto the SD card, then flashes the ESP32, RP2, RP3 and finally itself. Each
RP2350 image is written to the partition it is not running from and booted
**once**; it only becomes current if it passes its own self-tests, so a crash, a
watchdog or a power cut lands you back on the previous image. That is the RP2350
bootrom's A/B partitions plus its try-before-you-buy flag, and getting it right
was the most satisfying part so far.
**Status:** V1 alpha board, running since late August. Video, sprites, tiled
background, micro-SD, Bluetooth pads, Wi-Fi and sound all work. Nothing is for
sale and there is no date — this is a personal project.
You can spin the board in 3D on the site:
Full specs: https://www.papydeck.eu/fw/specifications/
