Close

Real controls and sound: USB HID and an ES8311 codec

A project log for Claude Sonnet plays DOOM on SCINTIX P4

An LLM plays real DOOM on a custom ESP32-P4 module — seeing only what a player sees on screen, through an MCP interface.

andrea-ricciAndrea Ricci 08/25/2026 at 20:580 Comments

A DOOM port isn't much fun without a keyboard and some noise. The ESP32-P4 has a USB host, so we drive input straight off it: USB keyboards (boot protocol) mapped to the usual DOOM keys and generic HID gamepads. Keyboard and gamepad coexist — whichever enumerates just works.

One gotcha worth flagging for anyone doing USB host on the P4: a full-speed device behind a high-speed hub needs a Transaction Translator, and that isn't implemented in the IDF USB host stack we used — so a FS controller plugged into a HS hub simply won't enumerate. Connected directly, it's fine.

For audio we hung an external ES8311 codec (an M5 Atomic EchoBase) off I2S. The catch: the EchoBase has no external MCLK, so the codec derives its clock from the bit clock (use_mclk = false) — at 22050 Hz / 16-bit the internal multiplier lands on the right ratio. The onboard amplifier is un-muted through a little PI4IOE I/O-expander rather than a plain GPIO pin. SFX only (music off), and DOOM has its sound back.

Discussions