Gamecube Controller on N64

Includes but not limited to: SNES, Genesis, Sega CD, PlayStation 1, Nintendo 64, Dreamcast, Game Gear and I guess the Virtual Boy.

Moderator: Moderators

goodie
Posts: 824
Joined: Mon Oct 11, 2004 1:02 pm

Post by goodie »

Does that mean it won't work with the PIC12F629? :?
mnbvcxzlkjhgfdsapoiuytrewq
dudasquid
Posts: 22
Joined: Sun Jun 19, 2005 5:00 am
Location: Australia

Post by dudasquid »

The file previously posted will not work for the PIC12F629. I've compiled both versions of the Cube64's firmware and placed them on some free webspace where I will keep them indefinitely. Please ignore the link S q u e e ! posted and use the ones below.

Right-click and choose 'Save As' (unless you like viewing hexadecimal code in your browser):
HEX for PIC16F84A (Cube64 Basic)
HEX for PIC12F623 (Cube64 Mini)
"He just spends all day shooting off his powerbands to supervillans..."
goodie
Posts: 824
Joined: Mon Oct 11, 2004 1:02 pm

Post by goodie »

Thanks! :) Construction of the adapter will begin soon. :D
mnbvcxzlkjhgfdsapoiuytrewq
goodie
Posts: 824
Joined: Mon Oct 11, 2004 1:02 pm

Post by goodie »

:cry: I finished it, but it doesn't work. The N64 acts as if there is no controller attached. Any ideas?
mnbvcxzlkjhgfdsapoiuytrewq
SpongeBuell
Senior Member
Posts: 5190
Joined: Wed Apr 07, 2004 10:52 am
Location: Colorado
Contact:

Post by SpongeBuell »

check to make sure the 5 volt and ground lines are connected, I suppose. Oh yeah, check data, too.
Life of Brian wrote:
RYW wrote:RYW:

Rare
Yellow
Weasel
I'll be honest with you - I would have never guessed that.
dudasquid
Posts: 22
Joined: Sun Jun 19, 2005 5:00 am
Location: Australia

Post by dudasquid »

It shouldn't matter if the 5v is connected to ground or not, the controller should still be read as 'connected', since the 5v is just for the rumble. After building mine I had a few problems too... Below are the tips I received from Micah (note that they are for the Cube64 Basic, not the Mini, so the pin numbers will most likely be wrong).
Have you tested it with an official Gamecube controller? I never
tested it with 3rd party controllers, and I have reports from another
user that the Wavebird doesn't work.

Are you using a low-voltage-friendly PIC? The N64's supply voltage is
a little low for a garden variety '84, you might need to use the
PIC16LF84A. Also make sure you're using one rated for 20MHz, that your
crystal is really 20MHz, and that your load capacitance is appropriate
for that crystal. This is easy to check if you have the data sheet for
the crystal, or if you have an oscilloscope. Otherwise, you might just
have to assume it's right.

Double-check that the firmware compiled and programmed correctly, and
that you built the 16F84 version.

There are a few simple things to check if you have a voltmeter:

1. Check the voltage coming out of your N64 (pins 1 and 3 on its
plug). This should be close to 3.3v, but it won't be exact. I seem to
recall it actually being 3.6v or so. Remember this voltage, use it for
reference in the steps below.

2. Make sure the voltage between pins 4 and 5 on the PIC is the same
as the supply voltage above.

3. Likewise, make sure the voltage between pins 14 and 5 is the same.

4. Connect it to the N64 with the console on, but leave the Gamecube
controller disconnected. The voltage between pins 7 and 5 on the PIC
should be equal to the above supply voltage.

5. Still with the N64 on, check the voltage between pins 6 and 5 on
the PIC. It should be close to the supply voltage, but a little lower
and possibly fluctuating. Just make sure it isn't zero or close to
zero.

You can go even farther if you have a logic probe, frequency counter,
oscilloscope, or some other high-impedance way of measuring high
frequency signals:

6. Check for a signal at pin 15, using pin 5 as your ground. If you're
using a logic probe, touch pin 15 and you should see oscillation. If
you have a frequency counter or an oscilloscope, this should be a 20
MHz sine wave.

7. Check the signal at pin 6, coming from the N64. It should be
normally high, but with bursts of data showing up around 60 times a
second. The actual controller polling rate varies depending on the
game. If you have a scope, you should be able to see the signal change
when you plug in a gamecube controller and again when you fidget with
the controller's buttons and analog sticks.
I'd also suggest that you double-check that you've wired the N64 extension cable correctly, if you used a third-party extension cable like I did you might find that the standard red = power, white = data, black = ground has not been followed. On mine it was red = data, white = power, black = ground.
"He just spends all day shooting off his powerbands to supervillans..."
goodie
Posts: 824
Joined: Mon Oct 11, 2004 1:02 pm

Post by goodie »

I did some checking around, and the 5v pin on the GC controller is just a tad over 5v, so I know the MAX682 is working properly. I checked the GC controller's 3.3v line and it looked like it wasn't really recieving any power at all. Looking at the circuit, I noticed that it wasn't connected to the 3.3v from the N64. I tried temporarily connecting it to 3.3v, but it didn't do anything.

EDIT: :oops: I just noticed that the 3.3v line and everything connected to it weren't even connected to Pin 1 on the PIC. I'll try connecting it, and see if it works.
mnbvcxzlkjhgfdsapoiuytrewq
goodie
Posts: 824
Joined: Mon Oct 11, 2004 1:02 pm

Post by goodie »

YES!!!!!!! It works! There's only one minor problem. When I tried it with Mario 64, it doesn't detect it. But if you start it up with a regular controller plugged in, and then swap it out, then it works fine. All the other games work perfectly with it, though. Now I just need to put it in a case and it'll be done. :D

EDIT: All Done! :) I'll try and get some pictures up sometime.
mnbvcxzlkjhgfdsapoiuytrewq
dudasquid
Posts: 22
Joined: Sun Jun 19, 2005 5:00 am
Location: Australia

Post by dudasquid »

Glad you got it working, I'm interested to see the pics - exactly how small were you able to make this? I figure that since mine was about the size of the N64's plug yours must be tiny! How much did you end up spending on this project?

I've never had that problem you specified on Super Mario 64, but happens occasionally with Star Wars: Shadows of the Empire... After hitting restart it usually works again.
"He just spends all day shooting off his powerbands to supervillans..."
goodie
Posts: 824
Joined: Mon Oct 11, 2004 1:02 pm

Post by goodie »

I put the guts in a Radioshack project box. It's about 3"x2"x1". Not exactly tiny, but it's good enough. I think I paid around $40-$50, most of that being for the PIC programmer.
mnbvcxzlkjhgfdsapoiuytrewq
Electric Rain
Senior Member
Posts: 1911
Joined: Tue Mar 29, 2005 12:39 pm
PSN Username: Denki_no_Ame
Location: What's it to you? Stalker...

Re: Setting the facts straight

Post by Electric Rain »

micah wrote:Hi Everybody,

This is Micah- I designed the Cube64, and did most of the reverse engineering to make it possible. It's great to see so many people interested in it- I built it just for my own use, not really expecting anyone to stumble upon it and try it.

It's also cool to see dudasquid's photos. If anyone's interested in seeing my prototypes and such, I have my original photo gallery on a server with a bit more bandwidth now: http://zero.navi.cx/gallery/cube64

Anyway, I have a few things to add...

Cost: Cheap PIC programmers are good. I do a lot of microcontroller development so I have the $200 whiz-bang PICstart Plus programmer, but the $10 programmers mentioned above will work fine if you just want to build the cube64. I designed the Cube64 Basic to use the extremely popular PIC16F84A processor mostly so that it would be accessible to people without fancy hardware. One thing to note is that you can get free samples of the PICs themselves from Microchip. Just head over to their web site (microchip.com) and hit the 'request samples' link on the products you need. Lots of semiconductor companies do this as a way of encouraging folks to create designs with their chips, assuming that later on these designs will be mass-produced.

Power: The Cube64 Mini uses a tiny but still fairly efficient charge pump. Check out its data sheet if you really care, but it seems to power a rumble motor nicely. It helps that there aren't any sensitive electronics powered by it, so you don't have to worry about ripple. Charge pumps are just one form of DC-DC converter. Most DC-DC converters you hear about are buck/boost converters, which store energy in inductors. Charge pumps are much simpler- they store energy in multiple capacitors, then connect those capacitors in series to get the sum of each capacitor's voltage. This happens very rapidly, so it appears that you get a steady high (or negative) voltage out. Charge pumps are mostly used for low-current applications, like generating the high voltages necessary for an RS-232 serial port or an LCD. A portable console would be better off with a buck/boost converter. You can buy pre-made DC-DC converters if you have money to burn (or you're good at shopping around at surplus stores) but you can also build your own pretty easily using chips from Maxim or Linear Tech.

And I think this is what people have been waiting for...
An explanation of the N64's memory pak support, and how the Cube64 relates to it.

1. Yes, it would be possible to create a cube64 adaptor that lets you plug in memory paks.

2. No, it wouldn't be as easy as you think. I had to reverse engineer the CRC algorithm that's used by the N64 and the controller to ensure reads and writes to the memory pak bus happened successfully. I didn't discover exactly how the N64 hardware generates the CRC, I just discovered an equivalent algorithm that produces compatible results. This equivalent algorithm isn't quite efficient enough to run at the required speed on a PIC microcontroller.

3. With either a much faster microcontroller or some dedicated hardware (on an FPGA) it would be possible to perform the CRC in real-time and provide a memory pak interface along with the existing controller emulation.

4. It would be possible to use parts from an N64 controller as the memory pak interface, but this would require some software changes. Remember that the Cube64 emulates a rumble pak, and the rumble pak attaches to the memory pak interface. The Cube64 *does* emulate the memory pak interface, it just takes some very serious shortcuts that make the emulation good enough for rumble but unsuitable for a real memory-pak. This is why it can avoid using a version of the CRC algorithm that would run too slowly. You would need to modify the firmware to remove all memory pak emulation, and pass through memory-pak related commands to a "slave" N64 controller. The timing on this would be tricky. You'd have to buffer some data, because by the time you know a memory pak command has arrived it's too late to get a response out immediately.

Hopefully this clears up a few things. My email is micah at navi dot cx if you have other questions, or want a better explanation of the controller's internals. Also, the source code includes a directory full of reverse engineering notes- this includes the process I used to emulate the CRC, and some proof-of-concept Python code that implements it.

--Micah
You are friggin' awesome. 8) I wanted to do something like this as well, but I don't have any experience in microcontroller programming. :( So, I was just going to hack up an N64 controller and a GC controller, and wire the buttons together. That much I know would work, so I never tested that. What I did try, however, is taking the joystick unit out of a MadCatz GC controller, and wiring it up to a "Super Pad 64" controller. Worked flawlessly, since they both used a pot of the same value, which escapes me ATM. :P

But, your idea is much better than mine. :cry: Do me a favor, will you? Thank your parents for me... you know... for conceiving you.
Image
S q u e e !
Posts: 835
Joined: Wed Feb 16, 2005 11:31 am
Location: Lost. Are you my mommy?

Post by S q u e e ! »

Why did you drag this thread from the depths?
"I like my coffee like I like my women. In a plastic cup."

~Eddie Izzard
Electric Rain
Senior Member
Posts: 1911
Joined: Tue Mar 29, 2005 12:39 pm
PSN Username: Denki_no_Ame
Location: What's it to you? Stalker...

Post by Electric Rain »

... :shock: Crap... I'm sorry... I was so caught up in its complete awesomeness, that I forgot I found it on page 4. :( Forgive me... I really didn't mean too!
Image
Post Reply