EzHID N64 Gamepad Firmware

Introduction

The n64pad module is a firmware package for the EZ-USB device that manages up to four N64 gamepads. It makes them available as generic gamepads to any computer system that supports the HID class of the USB standard. Modern computer systems should be able to recognize this bundle and to attach it seamlessly to the set of input devices for game control. There should be even no need for specific drivers as the HUT gamepad characteristics are well-defined inside the HID specification. The generic driver of any operating system should do the job.
It has been tested with Linux 2.4.22 so far, which implements joystick handling within the joydev module. In case this module is not loaded automatically, consult the documentation of your distribution on how to activate this module.

Restrictions

Some restrictions apply when using this module. Not everything has been tested yet and some flaws are already known.
The firmware is known to play well with older and newer clones. As there is the controller from MadCaz and a no-name one with a translucent case. Unfortunately, I haven't had the chance to test an original Nintendo controller.
Although these controllers work basically, they all have an issue with the C-RIGHT button. Whenever the analog joystick is moved out of its neutral position, the C-RIGHT button is reported as active. It is currently not known whether this is an issue with the firmware or the controllers send exactly this information.

Compilation and Installing

A more or less recent version of the firmware can be obtained from the CVS repository. The sources are located there as well in case you want to compile them on your own or simply look at them. For compilation you need the SDCC compiler suite. It is a good idea to use a recent version of SDCC so look on the website for snapshots or check-out directly from the SDCC CVS repository. Once it is installed, issue

make

The hex-file can be downloaded directly to the EZ-USB device using your preferred method. The firmware supports both downloading into the device RAM or being bootloaded from a programmed serial I2C EEPROM on the board. In the latter case, you'll have to set the variable ROM_FW accordingly in Makefile. After having compiled the source code to suit the needs of the bootloading, run create_ezhid_e2.pl on the compiled hex-file. The output of create_ezhid_e2.pl has the correct format for the onbaord I2C EEPROM.
The benefit of having the firmware permanently in the EEPROM is that you do not have to set up a firmware downloader for every operating system you happen to use on your computer.

Adapter Hardware

The N64 controller connector is quite straight forward. It uses two pins for power supply (+3.6V and GND) and one pin for the data signal. Here's a schematic how to connect the controllers:


Wiring diagram for the N64 controller adapter (n64pad.png)


The assignment to the EZ-USB ports is arbitrary. It can be changed by modifying the #define statements in pad_port.h.
Although all references for the N64 controller mention the supply voltage to be 3.6V it seems not to be mandatory to stick exactly to this voltage. I use the 3.3V on-board supply which works well with my controllers.
If you are lucky you can find a matching connector and wire this to the EZ-USB device. Alternatively, a standard male  connector can be attatched to an existing cable (either the controller cable or an extension cable). The matching female connector is then connected to the EZ-USB according to the above schematic. 5-Pin DIN connectors are well suited, cheap and provide compatibility with extension cables for old keyboards. See Stephan's page where I picked up this idea.

Once the firmware is downloaded and installed, the HID subsystem should report four new gamepad devices. Each gamepad has four axes (analog joystick and digital pad) and 10 buttons. The buttons are assigned in the following way:

N64 Button
Gamepad Button
A
0
B
1
Z
2
Start
3
L
4
R
5
C-Left
6
C-Right
7
C-Up
8
C-Down
9

Additional Resources


Back to main


Get EZ-USB HID Firmware at SourceForge.net. Fast, secure and Free Open Source software downloads