N64 Controller Serial Protocol Sniffer



N64 Controller Serial Protocol Sniffer

intendo 64 Controllers


The Nintendo 64 Controller Interface is an mbed library that allows one or more Nintendo 64 controllers to be used as input devices for the mbed. With this library, one will be able to control games created for an mbed using a Nintendo 64 controller. In addition, the library can easily be used to forward N64 inputs to a computer.

  1. Can connect the N64 Controller Interface adapter to an Nintendo 64. ControllerListener: Runs on its own thread and listens the serial port for signals. Nintendo 64 controller on laptop emulator (using Arduino. For a very well explained nintendo 64 controller's protocol. Serial Communication.
  2. Free Serial Port Monitor is a RS-232 protocol analyzer that provides you with a simple and effective way to sniff the incoming data from both virtual and real serial ports. All the data captured by this RS-232 interface software can be logged to a dedicated text file for further analysis.

While I was in Pittsburgh for an extended period of time for work, I got anurge to interface an N64 controller to one of my projects. Don't ask why, I getthese weird urges sometimes. heh.

Before we get too far into this -- I am only interested in the hardware levelcontrol of the controller and devices attached to the controller. I'm not interestedin emulation of the N64 or c0py1nG y3r 31337 r0m 1m4G35, so DON'T ASK. Thefollowing links are to places with similar technical or emulation interests. Idoubt they are interested in swapping ROMs, either.

Dextrose
Steven Hans' N64 Stuff
Ken Kaarvik's Gameboy Stuff



Anyway, upon further inspection, the N64 <--> Controller protocol is relativelysimple to imitate. This page is dedicated to furthering the understanding of allaspects of the controller. Right now I can get it to return the button status,and with time I'll figure out how the RumblePak and MemPaks are talked to.

The electrical specification chosen by Nintendo seems very close to Apple'sDeskTop Bus protocol, where all data transfer takes place on a single wire,and the duty cycle of the signal determining the data. Since I'm not familiarwith the ADB protocol any more than that, I can't comment further.

However, it is important that anyone who is interested in talking to thisthing on a hardware level knows that there is a particular way in which you must interface -- DO NOT ever drive the line high! -- The N64 or thecontroller may bring the line low at any time and if you're trying to drive ithigh you may damage either the controller, the console, or whatever you're usingto talk to it! The controller has a built-in pullup resistor -- either makedamn sure that whatever you're using to play with it doesn't drive the line highor is incapable of driving it high. Open-collector outputs are handy for thiskind of thing.

Here's the first step: understanding the encoding of bits on the 1-wireinterface. It appears that all bits are 4us wide, and it's the amount of lowtime that determines the bit's value. Please note that the assignment of '1'and '0' has been done my myself; I could have them ass-backwards, but theyseem to make sense to me. :-)
Also, the communications format includes a stop bit at the end of everything.All this involves is letting go of the line and waiting 4us before doinganything else.



This is sent out to the controller upon powerup, and some games (StarFox64does this) send this every time they want to read button status as well. Why,I don't know. I don't have all the bits figured out yet, but I have 3 scopetraces that give some insight... A controller with a MemoryPak gives adifferent response from one with a RumblePak and they both give different responsesthan one without any kind of cartridge plugged in. (I'll put this up assoon as I get the scope software reinstalled.)



Sending 0x01 to the controller makes it respond with 32 bits of buttoninformation. Please note that the controller responds VERY QUICKLY -- within2 to 3us on my particular unit. Whatever you're using to talk to this thing hasto be very quick. An 8MHz PIC would have a difficult time doing this. Betterto use a 10-20MHz one and bit-bang it.

The information is in the following format:

(1 = button pressed, 0 = button released)
BitFunction
0A
1B
2Z
3Start
4Directional Up
5Directional Down
6Directional Left
7Directional Right
8unknown (always 0)
9unknown (always 0)
10L
11R
12C Up
13C Down
14C Left
15C Right

The next 16 bits are for the analog joystick.

The analog joystick is an optical module and operates very much the same asmost mice. If I recall correctly, it has 24 'positions' in each direction fromcenter, with center returning 0. If you're not interested in using the whole controller, this joystickis a seperate module and can be removed from the controller. It's easy touse... 6 pin interface, 2 for power, then the remaining 4 are for the X and YI/Q signals. Very nice. Not too bad in price, either.

The information returned in the last 16 bits from the controller is for thesigned X and Y information, respectively. i.e. the first 8 bits are the signedX position, and the last 8 are for the signed Y position. From center: up andright is positive, down and left is negative.

28 July 1999 - I finally got around to updating this page. I had made amistake in the first edition of this information -- The controller sends a stopbit which I was mistakenly including as data. The data above is now corrected.Thanks to those of you who emailled me with that correction.

The folks at the N64 Controller Interface link above have discovered how tomake the rumble pak function. That information is coming here shortly for inclusion. I am also close to having my N64 controller reconnaissance unitworking, so getting full info on the rumble and mempaks should be coming soon.:-)

N64 Controller Serial Protocol Sniffer

Right now, here is the base info on how to do it:
To Init: send 03 80 01 followed by 34(!) 80's
To Start Rumble: 03 c0 1b followed by 32 01's
To Stop Rumble: 03 c0 1b followed by 32 00's
After starting or stopping a rumble, the controller returns with 3 bytes. I havenot personally done this before, so I don't know what those three bytes are (yet).Thanks go to Ken Kaarvic for posting this info to the Gameboy development list, andfurther thanks go to Stephen Hans for providing Ken with the original information.

Ken Kaarvic has used this information here to successfully connect an N64controller to a Gameboy through the link port. Head over to his page for moreinformation on that.

N64 Controller Serial Protocol Sniffer

When I get some time I want to get a little PIC connected up inbetween thecontroller and the console and start having it do reconnaissance so I can getmore information regarding RumblePaks and MemPaks. After that I'd like to getthe services of a skilled Windows 95 VXD writer to create a nice VXD so I canuse the N64 as a gaming device, complete with functionality for RumblePaks andMemPaks. Who knows, this could be marketable. I know there are some out therenow that have adapters but AFAIK nobody can talk to RumblePaks and MemPaks.



Ideas for N64 data:

Sniffer
  • ROOMblePak - modify a standard Rumblepak to drive a small AC motor with an offsetweight and place it under your couch :-)
  • TerrorPak - Same idea, but give the user a mild electrical shock instead of rumbling
I've actually had emails regarding the latter idea! My suggestion: optically isolateand on the side where you connect to your body -- USE A BATTERY -- very important.You don't want any kind of link to AC or significant current. That keeps your masochistictendencies at least safe. :-)

N64 Controller Serial Protocol Sniffer Device

Ideas I'm using this information for:

  • N64 Controller Reconnaissance - a PIC which intercepts and echoes console <--> controller communications and spits out the data to a PC through RS-232.
  • N64-PC Interface - There are a number of people already doing it. Here is why mine'sdifferent:
    • uses VERY simple interface -- one or two ICs
    • interfaces to game port like any other joystick
    • useable by any game through DirectX style interface
    • open-source, open design model
    • works with any N64 controller. Jittery third party units will work okay
    • works with Rumble and Memory Paks through standard interface
  • N64 Macro controller?
  • N64 Keyboard?

Email me if you're interested.


N64 Controller Serial Protocol Sniffer Usb


N64 Controller Serial Protocol Sniffer Tool

Last updated: 28 July 1999