Protocol decoder:nes_gamepad

From sigrok
Jump to navigation Jump to search
Sigrok logo no text transparent 512.png
Name NES gamepad
Description NES gamepad button states.
Status supported
License GPLv2+
Source code decoders/nes_gamepad
Input spi
Probes CLK, MOSI
Optional probes
Options variant

Please note: This page is a work in progress, more to come.

This decoder stacks on top of the spi PD and decodes the button states of an NES gamepad. Currently only the standard controller is supported. This might be extended by special controllers like the Nintendo Zapper light gun.

The SPI decoder needs to be configured as follows:

 Clock polarity = 1
 Clock phase    = 0
 Bit order      = msb-first
 Word size      = 8

Chip-select is not used and must not be assigned to any channel.

Hardware setup is as follows:

  GND |o  \
  CUP |o o| VCC
OUT 0 |o o| D3
   D1 |o o| D4
 NES Gamepad Connector
 VCC   - Power 5V
 GND   - Ground
 CUP   - Shift register clock (CLK)
 OUT 0 - Shift register latch (optional)
 D1    - Gamepad data (MOSI)
 D3    - Data (unused)
 D4    - Data (unused)

Data pins D3 and D4 are not used by the standard gamepad but by special controllers like the Nintento Zapper light gun.


The NES gamepad consists of a single 4021 shift register:

4021 shift register pinout::

PI-8 1-   O -16 VCC
Q6 2- -15 PI-7
Q8 3- -14 PI-6
PI-4 4- -13 PI-5
PI-3 5- -12 Q7
PI-2 6- -11 Serial In
PI-1 7- -10 Clock
GND 8- -9 Parallel/Serial control