Controller

From N64brew Wiki
(Redirected from NUS-005)
Jump to navigation Jump to search

The N64 controller, with it's tri-wing design, featured 14 button inputs, and an optical encoder based analog stick. The controller connects to the console over three wires, power, data, and ground. On the bottom, it also had a 32 pin edge board connector for additional accessory Paks, such as the Controller Pak and Rumble Pak.

Design

The controller's design was unique in that it had three handles, which allowed the player to hold the controller in multiple ways. However, typically the right hand would be on the right-most handle, and the left would alternate between the middle or left depending on whether the game utilized the D-pad or analog stick. The standard controller used rubber-like contacts underneath plastic button caps. When pressed, these contacts would close a circuit printed onto the PCB inside the controller; this is different from a clicky push button, but not uncommon for game controllers.

Operation

The controller is managed by a single IC chip that works as an interface between the console and the other hardware components. The chip is proprietary and has a generic label "Nintendo NUS-CNT" plus a model number. There are three small PCBs connected via wires for the L, R, and Z buttons. Eleven pads on the main PCB are used for the other buttons. The analog stick is a self contained module that is connected via a 6-pin, JST-PH compatible connector. A 32-pin port connector is used to interface with different accessories.

Analog Stick

The analog stick uses a pair of optical encoding disks to determine its relative position. This works similar to linear encoders found in printers, except that instead of being a strip of tape/film, the N64 uses a rotating disk for each axis. Each disk has small holes along the circumference of the disk. These holes allow light to pass through to an optical sensor on the opposite side.

When the stick is moved, there are two signals generated per axis, for a total of four, which are slightly offset from each other. One of the two signals is used as the interrupt signal (XA and YA for the x-axis and y-axis respectively), and the other (XB and YB) is compared with the state of the first in order to determine which direction (positive or negative) that analog stick is moving for that axis.

If the stick is moving in the positive direction at a constant speed, the two signals will look similar to this:

If the stick is moving in the negative direction, they will look similar to this:

Analog stick connector pinout
To determine the direction along a particular axis and how far the stick has moved, the NUS-CNT chip will listen for any changing edge of that axis' interrupt signal (e.g. XA for the x-axis). A changing edge means any time the signal goes from LOW to HIGH, or HIGH to LOW. When an edge change is detected, the state of XA is compared against XB. If input, then the stick has moved +1 units. If input, then the stick has moved -1 units. While the analog stick reports relative movement whenever it moves, the N64 console requires the current position, not relative. In order to provide that, the NUS-CNT chip keeps track of these movements. The initial values for each axis is zero.

Although not tested/quantified, it may be possible to extrapolate the speed at which the user is moving the stick. The signals produced vary in length between each edge change. The time between edge changes may be able to be used to indicate speed. While speed isn't needed by the console, this could still offer some additional data in a custom controller or interface.

The analog stick has a 6-pin connector:
VCC is 3.3V.
GND is common ground.
XA and XB are the signal pins for the x-axis.
YA and YB are for the y-axis.

Accessory Port

Pinout of the accessory port connector with respect to the pak's orientation
Pak devices could be plugged into this port to expand the console's capabilities or to enhance the player's experience. The console communicates with these devices via the Joybus Protocol, however a microchip is used on the controller to interpret the Joybus commands and interface with the paks.

Pak Detection

If the DETECT pin is pulled HIGH, then a pak is inserted in the connector. Paks do this by directly connecting the pin to 3.3V. When the console sends the 0x00 Joybus command, the controller will return its hardware ID and then one additional byte that tells the console whether a pak is inserted (0x01) or not (0x02).

If a game chooses to do so, it is possible to detect what kind of pak is inserted. *WIP Section*

Homebrew Controllers

While most of the official controller uses fairly common connectors and buttons, the port connector and the NUS-CNT chips are proprietary and hard to source. The vast majority of custom controllers use a salvaged NUS-CNT IC chip as the brain, to interface with the console. However, Bigbass has developed an open source alternative that utilizes a PIC microcontroller as the brain, and other modern components. More details are on the project's Github page. The TAStm32 is another alternative designed as a replay device for Tool-Assisted Speedruns.

The port connector uses an extremely uncommon pitch of 1.5mm, with a board thickness of 1.2mm. No sources are known at this time for purchasing these connectors.