0
Offline
Jr. Member
Karma: 0
Posts: 63
Arduino rocks
|
 |
« on: December 28, 2009, 01:06:55 am » |
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
Sr. Member
Karma: 0
Posts: 417
Arduino rocks
|
 |
« Reply #1 on: December 28, 2009, 02:12:49 am » |
I believe you can... but im still learning and dont take my word on it. BUMPY 
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 0
Posts: 63
Arduino rocks
|
 |
« Reply #2 on: December 28, 2009, 02:28:23 am » |
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
Sr. Member
Karma: 0
Posts: 417
Arduino rocks
|
 |
« Reply #3 on: December 28, 2009, 02:47:41 am » |
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
Jr. Member
Karma: 0
Posts: 63
Arduino rocks
|
 |
« Reply #4 on: December 28, 2009, 03:23:15 am » |
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. 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 avrdude: stk500_getsync(): not in sync: resp=0x00 avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 0
Posts: 63
Arduino rocks
|
 |
« Reply #5 on: December 28, 2009, 01:43:33 pm » |
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 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
Sr. Member
Karma: 0
Posts: 417
Arduino rocks
|
 |
« Reply #6 on: December 28, 2009, 04:34:08 pm » |
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
Jr. Member
Karma: 0
Posts: 63
Arduino rocks
|
 |
« Reply #7 on: December 29, 2009, 06:06:27 pm » |
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.htmlI 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
Faraday Member
Karma: 33
Posts: 3625
@ssh0le
|
 |
« Reply #8 on: December 29, 2009, 09:37:49 pm » |
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.htmmight provide some clarification
|
|
|
|
|
Logged
|
http://arduino.cc/forum/index.php?action=unread;boards=2,3,4,5,67,6,7,8,9,10,11,66,12,13,15,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,86,87,89,1;ALL
|
|
|
|
Spokane, Washington
Offline
God Member
Karma: 0
Posts: 686
My name is Bob, and I'm an addict.
|
 |
« Reply #9 on: December 30, 2009, 02:59:43 am » |
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
Jr. Member
Karma: 0
Posts: 63
Arduino rocks
|
 |
« Reply #10 on: December 30, 2009, 06:56:41 pm » |
i sure did captain obvious
|
|
|
|
|
Logged
|
|
|
|
|
Spokane, Washington
Offline
God Member
Karma: 0
Posts: 686
My name is Bob, and I'm an addict.
|
 |
« Reply #11 on: December 31, 2009, 12:01:02 am » |
 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/DelayMicrosecondsI'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-WireNot 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
Jr. Member
Karma: 0
Posts: 63
Arduino rocks
|
 |
« Reply #12 on: December 31, 2009, 04:35:39 pm » |
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
Jr. Member
Karma: 0
Posts: 63
Arduino rocks
|
 |
« Reply #13 on: January 01, 2010, 03:39:57 pm » |
|
|
|
|
|
Logged
|
|
|
|
|
Los Angeles, CA
Offline
Newbie
Karma: 0
Posts: 37
mater artium necessitas
|
 |
« Reply #14 on: January 01, 2010, 11:15:53 pm » |
|
|
|
|
|
Logged
|
|
|
|
|
|