Skip to the content
2 layers29.3 × 73 mmGamepad pmod, the printed circuit board in 3D

CH32V003-based 2xSNES controller interface PMOD

Size
29.3 × 73 mm
Copper layers
2
Thickness
1.6 mm
Parts
93
Nets
22
Pads
164
Tracks, vias
256, 47
Pours
1
Routed
Yes
KiCad
KiCad 10.0 (file 20260206)
Created
20 Jan 2025
Updated
7 Sep 2026

Overview

Gamepad pmod is an open-source printed circuit board by psychogenic, from the psychogenic/gamepad-pmod repository on GitHub, published under the GPL-3.0 licence. It is a 2-layer board of 29.3 × 73 mm with 93 parts on 22 nets, routed with 256 tracks and 47 vias.

It is built around the CH32V003F4U6, CL21A106KOQNNNE and 10129382-912001BLF, with the APT1608SURCK and RC0402FR-0710KL among its other parts. Its parts include 8 capacitors, 5 connectors, 3 resistors, 1 IC and 1 diode. It belongs with the keyboards and input boards and the RISC-V boards of this library.

Main components

5

README

README.md

Gamepad PMOD

CH32V003-based 2xSNES-compatible controller interface PMOD

Copyright (C) 2025 Pat Deegan, psychogenic.com

Released as free and open source software under the terms of the GPL (see LICENSE)

Overview

This simple module allows 1 or 2 SNES controllers to report their state over 3 pins, and is used with my SNES PMOD. Here's the first prototype:

snes pmod

It is a variation on the SNES controller protocol that automatically polls the controllers and reports back values. The main differences are that the data may be sampled on the rising edge of the clock and the latch happens at the end so it acts like a SIPO (serial in, parallel out) shift register and you can just save the values whenever you see the pulse.

This allows for using the controllers as read-only devices (i.e. using only input pins on your side) and will send all values in a single transaction (e.g. 24 bits of data in one burst for two controllers).

It may be easily configured (by editing the config definitions file) to specify:

  • whether to report continuously, only on change and/or with a maximum interval between reports (e.g. only on change but at least every 2 seconds, as is the default configuration);

  • the number of controllers (1 or 2);

  • the PMOD pins to report back on;

  • the bitrate at which these reports are sent;

Using the gamepad in projects

A verilog module is provided that makes inclusion in projects simple. Include the gamepad_pmod.v source file in your build and, somewhere in your project, instantiate one of

text
* gamepad_pmod_dual -- to support two controllers, or

* gamepad_pmod_single -- to only support a single controller

You then feed the gamepad module the input data, clock and latch from the outside world and from there you receive information about which buttons are pressed at any time.

More information and basic samples are in the verilog directory.

A nice example of an implementation using this module is Uri's 2048 game.

Reading the gamepad from micropython

Though it is designed for use with FPGA/ASIC projects, the reports from controller(s) may also be read on an RP2040 (e.g. the Tiny Tapeout demoboard) using code like the sample in gamepad_reader.py.

Hardware

This code all runs on a simple PMOD that's little more than a CH32V003 and headers to connect to the controllers and PMOD.

schematic

The CH32V polls the controllers as per the standard method for these controllers and, on change or timeout, shoots data out through the peripheral PMOD header, as described in "protocol" below.

It also includes:

  • a PMOD host header, so you could in theory leverage the 5 unused input pins using another PMOD

  • an extra 2x3 100 mil header that allows you to jumper the PMOD IO4 into the SWDIO pin, to allow for programming through the PMOD header.

The complete project is available under hardware/GamepadPMOD.

Protocol

Reports are sent in the following manner, by default over 3 pins:

  • latch;

  • clock; and

  • data

Sample waveform, one controller disconnected, the other holding 3 buttons:

report waveform

A disconnected controller reports all 1s, which includes impossible combinations (e.g. up and down at the same time), and lets us detect controller presence.

Data will be asserted on the data line prior to the clock going high and remain valid past when the clock goes low. After all bits are sent, latch pulses high.

Each bit will be sent in turn, for each controller, in the following order:

  1. B

  2. Y

  3. select

  4. start

  5. up

  6. down

  7. left

  8. right

  9. A

  10. X

  11. L

  12. R

With a HIGH value indicating the relevant button is pressed.

Default TT Configuration

The default setup we'll use for Tiny Tapeout is:

  • 100kHz clock rate, so that even slowish projects can leverage the input;

  • Latch on PMOD IO5 (ui_in[4] on the demoboards, PMODs aren't 0-indexed);

  • Clock on PMOD IO6 (ui_in[5]);

  • Data on PMOD IO7 (ui_in[6]);

  • 2 controllers, i.e. 24 bits of data before the latch pulses; and

  • report-on-change but with a maximum interval between bursts of 1 second (minimum interval is about 1.66ms, or a 600Hz rate for reports, like the SNES console)

Note on latency and clock domains

Though the SNES consoles only polled at 60Hz, nicely sync'ed to the framerate, if you're a speedrunner you could hit some issues if we do the same, as the PMOD isn't synchronized with the system clock.

After discussion with the community and tests with both el-cheapo chinese controllers and an old famicom thing from the 90s, I'm 10x-ing the controller polling rate to 600Hz. This doesn't actually impact the rate at which the controllers are clocked, it's just that it happens more often and doesn't seem to cause issue.

From the actual SNES controller perspective, the interaction looks like this:

snes controller polling

You can see that, on that side, the latch signal comes before the burst of clocking and it's being polled at just around 600Hz.

Since the clocks in projects are independent from the moment at which reports can arrive, its best to do some cleaning for clock domain crossing to ensure stability.

Best and easiest thing is just to use the gaming_pmod sample module, which handles this.

If you're looking to roll your own, in verilog this would look like classic synchronizer patterns, e.g.

text
reg [1:0] pmod_data_sync;
always @(posedge clk) begin
  if (~rst_n) begin
    pmod_data_sync  <= 2'b0;
  end else begin
    pmod_data_sync  <= {pmod_data_sync[0], pmod_data};
  end
end

Whereas with Amaranth, it's little more than using the FFSynchronizer

text
FFSynchronizer(i=pmod_data, o=pmod_data_sync)

Building

A selection of pre-compiled firmware is available in firmware, but you may want to build yourself...

To do so, you'll need the awesome ch32v003fun SDK, by cnlohr, which is already included here as a submodule. To ensure you have that, you can do

text
git submodule update --init --recursive

from the top level directory.

Then simply (optionally) hook-up a supported programmed to the target module and

text
cd src
make

That should be it.

Updating firmware

The CH32V firmware may be updated using a suitable programmer. However, to assist the production run and to make future updates easy I updated the pico_ch32v003_prog to use less memory and burn firmware.

The fork and a sample using it is available on gamepad-update.

Adding a jumper between the two top pins on the 6-pin header, between PRJ and SWIO:

programming header

will connect PMOD IO4 to the programming pin and allow the RP2040 on the demoboard to write new firmware.

Assembly

These controller connectors aren't actually meant to be used this way. In order to provide a bit of stability, we 3D print little feet:

stabilizer foot

The STL file for this is hardware/gamepad-footstabv1p0-tol2.stl

Parts

93
QtyValueFootprintReferences
64StitchingVia-0.4mmDrillflyingcarsfootprints:StitchingVia-0.4mmDrillSTITCH10, STITCH10, STITCH10, STITCH10, STITCH10, STITCH10, STITCH10, STITCH10, STITCH10, STITCH10, STITCH10, STITCH10, STITCH11, STITCH11, STITCH12, STITCH12 +48
4C_10u_0805_35VCapacitor_SMD:C_0805_2012MetricC1, C4, C5, C6
3FiducialFiducial:Fiducial_1mm_Mask2mmFID1, FID2, FID3
2C_100n_0402_50VCapacitor_SMD:C_0402_1005MetricC3, C8
2C_1u_0603_50VCapacitor_SMD:C_0603_1608MetricC2, C7
2SFC connector VERTpsychogenic:snes_connectorJ1, J2
110129382-912001BLFTinyTapeout:PinHeader_2x06_P2.54mm_PMODPeriph2BJ3
1200RResistor_SMD:R_0402_1005MetricR3
1434121025816TinyTapeout:434121025816SW1
1613012243121TinyTapeout:PinSocket_2x06_P2.54mm_PMODHost1AJ4
1CH32V003F4U6Package_DFN_QFN:QFN-20-1EP_3x3mm_P0.4mm_EP1.65x1.65mmU1
1Conn_02x03_Odd_EvenConnector_PinHeader_2.54mm:PinHeader_2x03_P2.54mm_VerticalJ5
1LEDLED_SMD:LED_0603_1608MetricD1
1MountingHole_PadMountingHole:MountingHole_3.2mm_M3_ISO7380_PadH1
1PMOD_LOGOTinyTapeout_PMOD:TT_PMOD_Logo_7mmLOGO1
1PSYLOGOflyingcarsfootprints:PsychoLogoSmall{$REFERENCE}
1PsychoLogoMiniflyingcarsfootprints:PsychologoMiniG***
1R_10k_0402Resistor_SMD:R_0402_1005MetricR1
1R_1k_0402Resistor_SMD:R_0402_1005MetricR2
1StitchingVia-0.3mmflyingcarsfootprints:StitchingVia-0.3mmSTITCH1
1TT_PMOD_Logo_5mmTinyTapeout_PMOD:TT_PMOD_Logo_5mmTTPMODLOGO

The 92 most common of 93 parts.

Similar boards

  • 2 layers45.7 × 20.3 mmTt audio pmod, the printed circuit board in 3D

    Tt audio pmod

    MichaelBell/tt-audio-pmod

    Tiny Tapeout Audio Pmod

    18 parts6Apache-2.0
  • 2 layers68.7 × 58.5 mmTt vga clock pmod, the printed circuit board in 3D

    Tt vga clock pmod

    TinyTapeout/tt-vga-clock-pmod

    VGA Clock PMOD

    21 parts1Apache-2.0
  • 2 layersEthernet10T1S, the printed circuit board in 3D

    Ethernet10T1S

    BryanGaladyne/KicadDesignBlocks

    design blocks for kicad

    36 parts
  • 2 layers85.6 × 54 mmSnakeBusinessCard, the printed circuit board in 3D

    SnakeBusinessCard

    alex1324575/snake-pcb-business-card

    STM32-powered PCB business card with a 10x9 LED Snake game, USB-C power, and passive NFC. KiCad hardware, C firmware, and verification reports.

    136 parts
  • 6 layers450 × 235 mmBaseline, the printed circuit board in 3D

    Baseline

    DeadlySIn777/Controller

    Unfinished CNC controller motherboard: native KiCad sources, rules, DSN and global routing review

    2,723 parts
  • 4 layers100 × 120 mmMicromouse pcb, the printed circuit board in 3D

    Micromouse pcb

    MukeshSethy/micromouse-runner

    This is my repo for the first version of full size micromouse development.

    184 parts
  • 6 layers62 × 44 mmBioZ muscle monitor, the printed circuit board in 3D

    BioZ muscle monitor

    ricknoboa137/BioZ-muscle-monitor

    A portable, battery-powered bioimpedance spectroscopy (BIS) device that measures biceps muscle impedance during and after exercise, to track fatigue and fluid shift.

    92 parts
  • 4 layers65 × 56 mmCanary hat, the printed circuit board in 3D

    Canary hat

    danbrunski/canary

    Four 25 F cells in series for CANary-PWR's LTC3350 hold-up, on a lead (design record: docs/CANary-PWR-Spec.md §P4). The board has no active parts: four cells, an NTC, two Kelvin net ties and a Micro-Fit 2 × 5 header.

    66 parts

Questions

How big is the Gamepad pmod PCB?

It measures 29.3 × 73 mm and has 2 copper layers, 1.6 mm thick.

What parts does the Gamepad pmod use?

93 parts, built around the CH32V003F4U6, CL21A106KOQNNNE, 10129382-912001BLF and APT1608SURCK. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the Gamepad pmod KiCad files?

From the psychogenic/gamepad-pmod repository on GitHub, at the commit this page was made from: the board is hardware/GamepadPMOD/GamepadPMOD.kicad_pcb and its schematic hardware/GamepadPMOD/GamepadPMOD.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the Gamepad pmod design in my own project?

Its repository publishes it under the GPL-3.0 licence: you may reuse it on that licence's terms (keep the author's notice, and for a copyleft licence share your changes alike).