← Back to Blog 0.7.0 · DRIVERS · USB · PI

DWC2 HID Keyboard — Pi 3B USB Enumeration with Visual Debug

June 23, 2026 · Sigil-Docs · sigil-drivers 34ddb16
driversusbdwc2hidpi0.7.0

dwc2_hid_keyboard.sg — Pi 3B USB keyboard enumeration on the Synopsys DesignWare DWC2 OTG controller (0x3F980000). Real hardware debugging via 6 visual marker stages, each painting a color-coded marker to the framebuffer and serial output. Spinlock on stall so the Pi login boot shows exactly which stage fails.

Enumeration stages

Stage 1: Core reset
GRSTCTL soft reset, AHBIdle poll — waits for DWC2 core to acknowledge reset complete.
Stage 2: Host mode
GUSBCFG host mode + HPRT port power — configures DWC2 as USB host and powers the port.
Stage 3: Connect detect
CCS (Current Connect Status) check — polls for device presence on the port.
Stage 4: Port reset
PrtRst pulse ~50ms per USB spec — resets the connected device to known state.
Stage 5: Get descriptor
Control transfer for Device Descriptor — identifies the USB device (stub, ready for real HW feedback).
Stage 6: HID setup
Set Configuration + HID interrupt-IN endpoint setup — prepares for keyboard report polling (stub).

Debug approach

Each stage paints a color-coded marker to the framebuffer — visible on the Pi's display without needing serial. On stall, the last painted color tells you exactly which stage the hardware stopped at. Integrates with the pi_login boot image visual marker system.