Pages: [1] 2 3 ... 5   Go Down
Author Topic: N64 Controller: Done reasearch, need a pros help  (Read 5817 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 63
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Okay so how i understand it from this page:
http://www.mixdown.ca/n64dev/

The n64 controller is 3 cables, 1  grnd, one input (i dont know what for) and a "1 wire interface" that handles almost all of the I/O mentioned in the analysis.

Sending 00000001 (ie 0x01) to this data port returns the overall button status in a 32 bit string, the first 16 are for each of the 14 button positions (ie 0 for off 1 for on) and 2 empty spaces, and the last 16 are for controller position, 8 for L/R and 8 for U/D.

My general question is can i plug this data port into any of the digital ports on my arduino board and write 0x01 to serial and then listen for the button stats? because if so that would make this whole thing extremely easy.

OR do i need to get a little more nitty gritty? it talks at the beginning of the article about how you need to make sure the computer doesnt "up" the signal or you can blow out hardware since the controller has a signal "pullup" installed in it already, is that something i need to be weary of?
Logged

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 417
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I believe you can... but im still learning and dont take my word on it. BUMPY smiley
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 63
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

yeah it seems that you are able to read and write serial data quite easily except for im not quite sure how the difference between the 1wire system of the nintendo controller (1grnd, 1pwr, 1 data) translates to the tx/rx system of normal serial communication.
Logged

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 417
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Should be able to just wire tx/rx respectively and serial.print the data from the pin to see what you're getting... correct? least how my gps shield works from serial data...
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 63
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

yes except for that i believe the n64 might not exactly follow normal serial baud rates, it sends about 31250 bytes per second (4us per bit, 3us down 1 up for 0, 3us up 1 down for 1), which is not consistant with any type of baud rate, also i tried a some simple code after plugging the controller in and plugging both tx/rx both into the single data wire, i set the baud rate to 38400 since that was the closest rate to the controller but it doesnt seem to work.

Code:
int incomingByte=0;
void setup(){
  Serial.begin(38400);
}
void loop(){
 Serial.print(01,HEX);
 if (Serial.available() > 0) {
    incomingByte = Serial.read();
    
    }
  delay(1000);
}

but i get

Code:
avrdude: stk500_getsync(): not in sync: resp=0x00
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 63
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

is there a way to manually read serial high and low signals? if each signal comes at 1us intervals i should be able to send 0x01 as a raw signal with
Code:
void loop(){
//then a for loop to send 7 sequential zeros
  for(i=0;i<7;i++){
    digitalWrite(TX,LOW);
    delay(.003);
    digitalWrite(TX,HIGH);
    delay(.001);
  }
digitalWrite(TX,LOW);  //then write the 1
delay(.001);
digitalWrite(TX,HIGH);
delay(.003);
digitalWrite(TX,LOW);  //then wait for response for 32us
delay(.032);


and then plug an LED in to see if there is any kind of response, then i could work with creating a way to recieve the raw bits.
« Last Edit: December 28, 2009, 01:53:00 pm by dashdanw » Logged

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 417
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

what are you making with this btw?
have you tried different baud rates and testing besides 38400?
« Last Edit: December 28, 2009, 04:39:11 pm by frostin » Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 63
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

yes, i figured since its 4us per bit, that makes 32us per byte, and 1s/32us=31250 then baud rate might be 31250, also tried the standard 4 settings but i think this is going to take a little bit more in-depth bit banging.

http://courses.cit.cornell.edu/ee476/FinalProjects/s2002/jew17/lld.html
I was reading on another page where someone managed to interface it with ps/2 and they did this by sending 7 zeros and 2 ones, im assuming that the first zero needs to be proceeded by a one since it mentions on the same page that the zeros are initiated by a falling edge.

the thing that is peculiar (ie that i dont understand) is that he did this by setting setting it to input for 1 and output for 0 instead of high and low and he uses the 5v ps/2 connection wheras ive been using the 3.3v (which the controller should respond to based on the other article), why is that?
Logged

SE USA
Offline Offline
Faraday Member
**
Karma: 41
Posts: 3783
@ssh0le
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

here is a detailed page on the gamecube controller, which is nearly the same, just add another analog stick

http://www.int03.co.uk/crema/hardware/gamecube/gc-control.htm

might provide some clarification
Logged


Spokane, Washington
Offline Offline
God Member
*****
Karma: 1
Posts: 686
My name is Bob, and I'm an addict.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Also, just curious.. I know it's overlooked quite often, but did you connect the Ground from the controller to the ground of the Arduino?
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 63
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i sure did captain obvious
Logged

Spokane, Washington
Offline Offline
God Member
*****
Karma: 1
Posts: 686
My name is Bob, and I'm an addict.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

 smiley-grin you never know!

I'm kinda lost on this, lol haven't worked with a 1-wire interface of any kind yet. But one thing you could also try, instead of using the regular delay, try using delayMicroseconds.
delayMicroseconds(3);
http://www.arduino.cc/en/Reference/DelayMicroseconds

I'm not sure if it will work.. but it does compile, you might be able to use Serial.begin(31250);

The only 1-wire interface I'm aware of is:
http://en.wikipedia.org/wiki/1-Wire
Not sure if that will be any help.. I went looking for my old n64 stuff but turns out my brother took it, lol. :/
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 63
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ill try it out, also i need to work out the wiring of the whole thing because iwas thinking of maybe using a tx and rx and using diodes to seperate the two data lines and then use diodes to descriminate the connection. would that work?
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 63
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

jackpot!
http://www.arduino.cc/playground/Learning/OneWire
Logged

Los Angeles, CA
Offline Offline
Newbie
*
Karma: 0
Posts: 37
mater artium necessitas
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This is probably the key to your solution:

http://www.instructables.com/id/Use-an-Arduino-with-an-N64-controller/
Logged

Pages: [1] 2 3 ... 5   Go Up
Jump to: