Start to write the PS2 controller code in ASM

Oops! :laughing:

Eddie,

As you mentioned the ACK line might be useful to generate a state machine. So far the purpose appears to be more like, I processed the last byte you sent me and ready for the next. Some of the postings I have read suggest the ack is not generated on the last byte of a packet.

Again for fun, I put the logitech version back in and tried and verified that I have a timeout:
http://i416.photobucket.com/albums/pp245/Kurts_Robots/Logitechps2timeout.png

I then put the lynxmotion one back in and here is a portion of the capture at init time:
http://i416.photobucket.com/albums/pp245/Kurts_Robots/LynxmotionPS2init.png

So now to start updating the code to retry so many times when the beginning of a packet fails to get an ack.

Now I wish I did not give away our old PS2 a year or two ago…

Kurt

something to try/test: before you de-assert the chip select line hang out and see if an ack arrives from the game controller. if it doesn’t then nothing lost but the time to test it, however if my guess is correct it will arrive and then the logitech may not time out on the next access.

oh and if you don’t post those pictures with a little higher resolution it’s going to be real rough to help much more. :wink:

I have an old one in my basement. I know the disc drive is going / gone. But from what I hear it still has a menu system that works with the controllers even if it won’t load a game. It’s yours for the asking.

I forgot to mention that the timeout happened on the 3rd configuration packet being passed to the logitech. Here is a larger portion of the screenshot showing some of the messages being properly acked and the one that timed out…

http://i416.photobucket.com/albums/pp245/Kurts_Robots/Logitechps2timeout-3.png

I have not had much time today to work on it today, but will probably update to retry maybe 5 times before aborting.

Jim, I may take you up on your offer. I am not sure yet if I will need it to fully debug. If retrying does not work, It might be nice to verify what sequences the actual PS2 sends out to the controller…

Kurt

the point behind my question/suggestion is that depending on what the controller implementation is you may be resetting the serial interface by releasing chip select before the last byte is acknowledged and effectively creating a race condition. consider a mass produced game controller may not be a full blown microcontroller like if one of us were to create one, but rather an semi-custom asic programmed with a combination of something resembling cpld code and some small microcode core.

Thanks Eddie,

It was a simple test to try not lowering the select line for awhile, to see if that helped and to see if an ACK was generated on the last byte. It appears like the one document I found the talked about the ack was correct and still no ack was generated and we still have a timeout happening. So it looks like I will go the next phase and try repeating the command a couple of times…

Hopefully I will have time later today. Right now doing a few things to prepare for possible snow, wind, …

Kurt

I have made some progress here. I now have the code such that it will attempt to repeat a command up to 5 times before it returns an error. It pauses a bit of time for it retrys the command. I now have the logitech appearing to be initialized properly into mode 0x79 (analog with 9 extra words of data after the 3 byte header). Also the mode light on the logitech is on which I believe implies analog and hitting the mode switch does not change it so it is probably locked into analog properly.

However it is not getting any live data back from the controller. It is always returning the default bytes of:
ff 79 5a ff ff 80 80 80 80 00 … 00

I have it retrurning all 21 bytes and the state of the buttons returned does not change (the two ff’s) when any of the buttons is pressed. Nor do the 80’s change when the analog sticks is move and the 00s don’t change to show the force numbers. It still works properly with the lynxmotion one. I have not tried my sector 7 one yet, but it used to work easier than my Lynxmotion one so I will assume it is OK for now.

Looking again at the site:
curiousinventor.com/guides/ps2, I see they have link to an excell spreadsheet that shows the sequence a PS2 sends out at startup for a couple of different types of controllers. One thing I noticed is they did not go in the same order as our startup code, I may extend my set up code to be closer to theirs.

    First entered config mode, set analog mode, exit config.
    do a poll or two
    Enter config mode setup to receive additional information. exit config.

I tried this and no difference. Tried extending as well to enter the 0x40 commands which count from 00 to 0B still nothing. Of course it is possible that there is something wrong with logitech controller. I may see if someone else want to try it…

That is all for now.
Kurt

I have the old PS2 game console here to ship if you decide you need it. :wink: I also have a bunch of controllers I can send you. There is a logitec one around here somewhere as well. Let me know. :slight_smile:

Thanks, I receive the care package with the PS2 console as well as several different controllers. It is sort of interesting to see how they all appear to work slightly differently. Also it appears by default that several of the controllers analog joystick positions are not near what we consider zero (80 hex). Not sure if they are simply worn out or the console compensates for it or if maybe there are ways for it to zero it out…

The spreadsheet on curiosinventor showed that the console send out many different messages at start-up time. I may next experiment emulating this and see if the controllers work differently. I extracted the following message sequence from it:

0x01,0x42,0x00,0x00,0x00 0x01,0x43,0x00,0x01,0x00 0x01,0x45,0x00,0x5A,0x5A,0x5A,0x5A,0x5A,0x5A 0x01,0x46,0x00,0x00,0x5A,0x5A,0x5A,0x5A,0x5A 0x01,0x46,0x00,0x01,0x5A,0x5A,0x5A,0x5A,0x5A 0x01,0x47,0x00,0x00,0x5A,0x5A,0x5A,0x5A,0x5A 0x01,0x4C,0x00,0x00,0x5A,0x5A,0x5A,0x5A,0x5A 0x01,0x4C,0x00,0x01,0x5A,0x5A,0x5A,0x5A,0x5A 0x01,0x4D,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF 0x01,0x41,0x00,0x5A,0x5A,0x5A,0x5A,0x5A,0x5A 0x01,0x43,0x00,0x00,0x5A,0x5A,0x5A,0x5A,0x5A 0x01,0x42,0x00,0x00,0x00,0x01,0x42,0x00,0x00 0x01,0x42,0x00,0x00,0x00 0x01,0x42,0x00,0x00,0x00 0x01,0x43,0x00,0x01,0x00 0x01,0x44,0x00,0x01,0x03,0x00,0x00,0x00,0x00 0x01,0x43,0x00,0x00,0x5A,0x5A,0x5A,0x5A,0x5A 0x01,0x42,0x00,0x00,0x00 0x01,0x42,0x00,0x00,0x00 0x01,0x43,0x00,0x01,0x00,0x00,0x00,0x00,0x00 0x01,0x45,0x00,0x5A,0x5A,0x5A,0x5A,0x5A,0x5A 0x01,0x46,0x00,0x00,0x5A,0x5A,0x5A,0x5A,0x5A 0x01,0x46,0x00,0x01,0x5A,0x5A,0x5A,0x5A,0x5A 0x01,0x47,0x00,0x00,0x5A,0x5A,0x5A,0x5A,0x5A 0x01,0x4C,0x00,0x00,0x5A,0x5A,0x5A,0x5A,0x5A 0x01,0x4C,0x00,0x01,0x5A,0x5A,0x5A,0x5A,0x5A 0x01,0x4D,0x00,0x00,0x01,0xFF,0xFF,0xFF,0xFF 0x01,0x41,0x00,0x5A,0x5A,0x5A,0x5A,0x5A,0x5A 0x01,0x43,0x00,0x00,0x5A,0x5A,0x5A,0x5A,0x5A 0x01,0x42,0x00,0x00,0x00 0x01,0x42,0x00,0x00,0x00,0x00,0x00,0x00,0x00 0x01,0x42,0x00,0x00,0x00,0x00,0x00,0x00,0x00 0x01,0x42,0x00,0x00,0x00,0x00,0x00,0x00,0x00 0x01,0x42,0x00,0x00,0x00,0x00,0x00,0x00,0x00 0x01,0x43,0x00,0x01,0x00,0x00,0x00,0x00,0x00 0x01,0x4D,0x00,0x00,0x01,0xFF,0xFF,0xFF,0xFF 0x01,0x43,0x00,0x00,0x5A,0x5A,0x5A,0x5A,0x5A 0x01,0x42,0x00,0x00,0x00,0x00,0x00,0x00,0x00 0x01,0x42,0x00,0x00,0x00,0x00,0x00,0x00,0x00 0x01,0x42,0x00,0x00,0x00,0x00,0x00,0x00,0x00 0x01,0x42,0x00,0x00,0x00,0x00,0x00,0x00,0x00 0x01,0x43,0x00,0x01,0x00,0x00,0x00,0x00,0x00 0x01,0x4F,0x00,0xFF,0xFF,0x03,0x00,0x00,0x00 0x01,0x40,0x00,0x00,0x02,0x00,0x00,0x00,0x00 0x01,0x40,0x00,0x01,0x02,0x00,0x00,0x00,0x00 0x01,0x40,0x00,0x02,0x02,0x00,0x00,0x00,0x00 0x01,0x40,0x00,0x03,0x02,0x00,0x00,0x00,0x00 0x01,0x40,0x00,0x04,0x02,0x00,0x00,0x00,0x00 0x01,0x40,0x00,0x05,0x02,0x00,0x00,0x00,0x00 0x01,0x40,0x00,0x06,0x02,0x00,0x00,0x00,0x00 0x01,0x40,0x00,0x07,0x02,0x00,0x00,0x00,0x00 0x01,0x40,0x00,0x08,0x02,0x00,0x00,0x00,0x00 0x01,0x40,0x00,0x09,0x02,0x00,0x00,0x00,0x00 0x01,0x40,0x00,0x0A,0x02,0x00,0x00,0x00,0x00 0x01,0x40,0x00,0x0B,0x02,0x00,0x00,0x00,0x00 0x01,0x43,0x00,0x00,0x5A,0x5A,0x5A,0x5A,0x5A 0x01,0x42,0x00,0x00,0x00,0x00,0x00,0x00,0x00 0x01,0x42,0x00,0x00,0x00 0x01,0x43,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 0x01,0x45,0x00,0x5A,0x5A,0x5A,0x5A,0x5A,0x5A 0x01,0x46,0x00,0x00,0x5A,0x5A,0x5A,0x5A,0x5A 0x01,0x46,0x00,0x01,0x5A,0x5A,0x5A,0x5A,0x5A 0x01,0x47,0x00,0x00,0x5A,0x5A,0x5A,0x5A,0x5A 0x01,0x4C,0x00,0x00,0x5A,0x5A,0x5A,0x5A,0x5A 0x01,0x4C,0x00,0x01,0x5A,0x5A,0x5A,0x5A,0x5A 0x01,0x4D,0x00,0x00,0x01,0xFF,0xFF,0xFF,0xFF 0x01,0x41,0x00,0x5A,0x5A,0x5A,0x5A,0x5A,0x5A 0x01,0x43,0x00,0x00,0x5A,0x5A,0x5A,0x5A,0x5A 0x01,0x42,0x00,0x00,0x00 0x01,0x42,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 0x01,0x42,0x00,0x00,0x00,0x00,0x00,0x00
Note the first byte of each message is always a 1 and the next byte is the actual message type. It will be interesting to see how the dfferent controllers process these messages.

Kurt

On the original sony dualshock controller the analog sticks had a lot of slop. On third party controllers this was not ussually the case.