Playstation controller
I remember reading a Nuts & Volts article on interfacing with a Playstation 2 controller, and was wondering if anyone has tried this with one of the newer 2.4Ghz wireless PS2 controllers?
Kinda curious if there are any gotchas with this. Like, do the receivers run strickly off of the 5v line, and what the current draw is?
Kinda curious if there are any gotchas with this. Like, do the receivers run strickly off of the 5v line, and what the current draw is?
Comments
Figured I'd post the results here in case anyone else was interested.
I first purchased a wired controller, to use as reference, and got it working on a Basic Stamp 2 with the code published by Jon in the Nuts & Volts column.
Used the same circuit as described in the column to invert the clock signal.
Emboldened by this, I went back and purchased a cheap wireless controller. The first one did not work.
Purchased a second controller, this one of a different brand. This one also did not work, but by hacking around with the code a little bit, I could tell that it was *trying* to work. The status byte was responding to the mode button, so I new I had connectivity, the problem had to be in the handshaking between the stamp and the wireless dongle. I replaced some of the remaining bit banging code with shiftout/shiftin (at the expense of loosing some of the status byte when sending the commands to the controller). This worked, but was very glitchy.
Long story short, apparently both wireless controllers are much more timing sensitive than the wired controller. This is kind of aggravating, as it is supposed to be a synchronous protocol! Thinking that the problem was that the BS2 was not quite fast enough, I tried again with a 2p. This mostly works, all of the buttons can be read reliably, but still having problems with the analog sticks (with both of the wireless controllers). I *think* this is because those four bytes are read last, and by that time the microcontroller inside the wireless dongle is too far out of sync with the stamp. The behavior exhibits itself as bits being shifted one or more positions. My only other theory is that there may be some timing dependency on the ACK line, which is not attached in the schematic Jon published, nor in my prototype board. This ACK line is from the controller to the playstation, so the only way I can imagine that it would be needed is if the wireless dongle requires a pause of some sort between each byte, and is not ACKing until it is ready to send the next byte.
May try with an SX soon, if I acheive any success I will post the result if anyone is interested.
I'd still love to hear from anyone who has done this (successfully or not). It would be *very* useful if some could tell me what the normal data rate is for one of these things. None of the sites that I have found that discuss the PS2 controller talk about the normal transfer rate. Unfortunately, since I don't have a Playstation (or even the necessary equipment to test it), I have no way of telling what the normal data rate is. I've only gotten this far through trial and error.
If you had a scope you might be able to pick up on the output of the transmitter and determine the timing that way.
Might there be a checksum sent and is expected on return?· Again, would be nice if you could scope it out.
How is the "dongle" arranged?· Got pics?· Could you determine where the signals enter the 'front-end' of the transmitter section?· might be able to scope those singles to better determine what's going on....actually, just picking off the data with a stamp might be all that's needed!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·
Steve
http://members.rogers.com/steve.brady
http://www.geocities.com/paulsopenstage
"Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."
I dont think you could depend on the controller -> dongle or RF reciever -> host interface chip to be clocked the same as the dongle -> host (playstation). In fact, I would be genuinely surprised if they were even remotely related. Not sure if thats what you meant by "output of the transmitter"....
If you're talking about the output of the dongle -> host (ps2) yeah, that would work, except I don't have a playstation. And, if you check the specs, you'll see that the host generates the clock. So I'm generating the clock with the BS2/2p, using SHIFTOUT/SHIFTIN (but presumably at the wrong rate).
Even if I had a scope or frequency counter, without a PS2 to use as a reference, there would be nothing useful to test.
As I mentioned the protocol appears to be designed to be designed to be completely synchronous. However, based on the results so far, I'm guessing that whatever chip is inside the dongle that is supposed to talk to the host is apparently depending on a certain speed to work properly. It's still synchronous (sort of), but it apparently has some thing that expects the clock to run at a certain speed, and probably overflows if the clock doesnt occur in the right time frame. Or there is some other timing issue. This is not a problem if it's hooked up to a PS2, because I'm guessing that the speed is always the same, even between revisions of the system. Of course, this is all just my theory at this point....
As for pictures, there really isn't much to see. I havent opened or modified the dongle at all. I simply purchased a PS2 extention cable, cut one end off, and wired it up to a prototype board with something pretty close to what is described in Jon's article.
Note, the wire colors vary between manufacturers, so you can't necessarily use the colors listed in his schematic literally.
See Jon's article for more information:
http://www.parallax.com/dl/docs/cols/nv/vol4/col/nv101.pdf
If you google around you can find pretty detailed explanations of the protcol, like this one:
http://www.gamesx.com/controldata/psxcont/psxcont.htm
That page also describes a controller emulator, but that's kind of the reverse of what I need: I need to know how to accurately emulate the host.