Shop OBEX P1 Docs P2 Docs Learn Events
PS2 Controller-wireless again! — Parallax Forums

PS2 Controller-wireless again!

bulkheadbulkhead Posts: 405
edited 2006-08-03 03:26 in General Discussion
Ok, I got a wireless ps2 controller (pelican brand, $10 at circuirt city this week) and it's quiet nice. The problem is that it seems to use a different way of communication. The ID that is returned is not $41 or $73. I also believe it uses a different "start byte" than regular sony brand controllers. I'm wondering if it's possible that I hook my stamp up to read the clock, data, command, and attention lines WHILE the wireless controller is communicating with a playstation. If it could somehow keep up with the clock cycle of the playstation, I could then display in the debug window the individual bytes sent, and therefore figure out the correct bytes to send the wireless controller. Any ideas on whether this will work?

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-02-04 07:18
    No, the instruction load cycle for PBASIC is slower than the normal clock cycle of PSX controllers. You could use an SX to make such a "sniffer"; I've heard of others using PICs and Atmel micros to do this.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • BamseBamse Posts: 561
    edited 2006-02-04 07:20
    If you figure out how to snoop on the PS2 signals please let me know how...

    /Bamse
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-02-04 08:03
    It would be easiest with a logic analyzer, otherwise, one could drop an SX onto the controller lines and -- monitoring the clock and attn lines -- grab the bytes going back and forth, then dump them to a terminal. Have I done this? No... I don't actually have a PlayStation console, just the controller.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • bulkheadbulkhead Posts: 405
    edited 2006-02-04 20:03
    Sorry I'm new to this, but what is a logic analyzer? How come the SX can do it but the basic stamp can't? What about the Javelin?

    Wow, it must be hard to work with playstation controllers without the console! Why don't you just get a cheap playstation off ebay? You can get them for like $18 including shipping. This auction just ended at that...
    http://cgi.ebay.com/SONY-PLAYSTATION-CONSOLE-CONTROLLER-AND-GAME_W0QQitemZ8255510714QQcategoryZ62053QQrdZ1QQcmdZViewItem

    I use an old playstation (not psOne, the original) to test my controllers when I believe that they are broken (but they always work). It's strange, even the new wireless controllers for PS2 work fine with the original playstation, even though the controllers were probably designed 10 years after the console was.

    I just thought of something- playstation memory cards hook up with the same pin layout as their controllers, so they MIGHT also use serial communication to send and recieve data. What if you could use playstation memory cards to store and retrieve data?

    Post Edited (bulkhead) : 2/4/2006 8:13:22 PM GMT
  • DiablodeMorteDiablodeMorte Posts: 238
    edited 2006-02-04 23:31
    Jon Williams (Parallax) said...
    It would be easiest with a logic analyzer, otherwise, one could drop an SX onto the controller lines and -- monitoring the clock and attn lines -- grab the bytes going back and forth, then dump them to a terminal. Have I done this? No... I don't actually have a PlayStation console, just the controller.

    Even though i realize this would cost you $$$$ but why don't you just RENT a ps2 from blockbuster. I think i cost like $20 to rent(w/ a $300 security deposit which u get back)
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-02-04 23:57
    Well, I don't find it necessary to spend money renting or buying a PlayStation console when I'm able to make the PSX controller work the way I need it to. There is a lot of information flying around the Internet of PlayStation controller programming -- but that doesn't mean that it will apply to non-Sony products. My schedule is pretty hectic, and I really don't have time to fool with every controller out there. With the code·that I (and others) have written, anyone really wanting to make other controllers work should be able to by just putting in a little effort.

    I know this is all fun stuff, but there are times when we just have to knuckle down and work. wink.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-02-05 00:03
    See my post above as to why I don't find it necessary to rent or buy a PlayStation console.

    A logic analyzer is a digital recorder that can record many signals at one time.· You could, in fact, use a Parallax USB Scope as a two channel logic analyzer using the external trigger as the trigger input.· With that you could watch the Clock and Cmd lines and sus out the information being sent by the console.

    I have another USB scope that allows me to monitor up to eight channels.· With this, I could trigger on the Attn line and monitor, Clock, Cmd, and Data .... if I had a console which I've made quite clear is not going to happen.· I really don't need to, because others have -- and just a bit of Googling·will turn up those sites.

    Why the SX, and not a BASIC Stamp or Javelin Stamp?· Speed.· The clock rate from the PSX console is faster than the BASIC Stamp (even a BS2px) can keep up with.
    bulkhead said...
    Sorry I'm new to this, but what is a logic analyzer? How come the SX can do it but the basic stamp can't? What about the Javelin?

    Wow, it must be hard to work with playstation controllers without the console! Why don't you just get a cheap playstation off ebay? You can get them for like $18 including shipping. This auction just ended at that...
    http://cgi.ebay.com/SONY-PLAYSTATION-CONSOLE-CONTROLLER-AND-GAME_W0QQitemZ8255510714QQcategoryZ62053QQrdZ1QQcmdZViewItem

    I use an old playstation (not psOne, the original) to test my controllers when I believe that they are broken (but they always work). It's strange, even the new wireless controllers for PS2 work fine with the original playstation, even though the controllers were probably designed 10 years after the console was.

    I just thought of something- playstation memory cards hook up with the same pin layout as their controllers, so they MIGHT also use serial communication to send and recieve data. What if you could use playstation memory cards to store and retrieve data?
    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • bulkheadbulkhead Posts: 405
    edited 2006-02-05 00:48
    Well, since I have the time to do this kinda stuff, I may give it a try. I've already searched, but only things on using the original sony controller come up, nothing about wireless. Where can I get a logic analyzer and how much is it?
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-02-05 01:11
    If you open Nuts & Volts, Servo, Circuit Cellar, or any other electronics magazine you'll find lots of ads for logica analyzers -- this is the one I have:

    http://www.bitscope.net/store/?p=view&i=product+BS50U

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • D4rk.VadorD4rk.Vador Posts: 4
    edited 2006-02-05 18:47
    Maybee I could try to search for some kind of drivers for the controller, I have the decrypted fw dump(they are for psp, but the buttons are connected into a socket on the psp motherboard as the PlayStation 1/2) so it cud be useful.

    PSP rox hop.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Rien n'est plus proche du vrai que le faux

    Albert Einstein

    Progress in Translation Of Robotics With The Boe-Bot v2.2: Page 15 Of 364
  • TechnoRobboTechnoRobbo Posts: 323
    edited 2006-08-03 03:23
    Have fun.

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}

    psxThumbL VAR Byte ' left thumb buttons
    psxThumbR VAR Byte ' right thumb buttons
    psxJoyRX VAR Byte ' r joystick - X axis
    psxJoyRY VAR Byte ' r joystick - Y axis
    psxJoyLX VAR Byte ' l joystick - X axis
    psxJoyLY VAR Byte ' l joystick - Y axis

    idx VAR Nib
    tmpout VAR Byte

    PsxAtt PIN 9 ' PSX joystick interface
    PsxClk PIN 8
    PsxCmd PIN 10
    PsxDat PIN 11



    MAIN:
    DO
    GOSUB Get_PSX_Buttons
    DEBUG HOME, BIN8 psxThumbL," ",BIN8 psxThumbR," ",CR'HEX2 psxID," ",HEX2 psxSta,CR
    DEBUG "psxJoyRX = ",DEC3 psxJoyRX ,CR
    DEBUG "psxJoyRY = ",DEC3 psxJoyRY ,CR
    DEBUG "psxJoyLX = ",DEC3 psxJoyLX ,CR
    DEBUG "psxJoyLY = ",DEC3 psxJoyLY ,CR
    LOOP

    '
    [noparse][[/noparse] Subroutines ]


    Get_PSX_Buttons:' This routine REQUIRES inverted clock signal from
    DIR10=1
    DIR11=0

    LOW PsxClk
    LOW PsxAtt
    'GOTO test
    'request data
    tmpout=$01
    FOR idx=0 TO 7
    PsxCmd=tmpout.LOWBIT(idx)
    PULSOUT PsxClk,2
    NEXT
    PAUSE 1

    tmpout=$42
    FOR idx=0 TO 7
    PsxCmd=tmpout.LOWBIT(idx)
    PULSOUT PsxClk,2
    NEXT

    PAUSE 1

    tmpout=$00

    FOR idx=0 TO 7
    PsxCmd=tmpout.LOWBIT(idx)
    PULSOUT PsxClk,2
    NEXT

    PAUSE 1

    FOR idx=0 TO 7
    psxThumbL.LOWBIT(idx)=PsxDat
    PULSOUT PsxClk,1
    NEXT
    FOR idx=0 TO 7
    psxThumbR.LOWBIT(idx)=PsxDat
    PULSOUT PsxClk,1
    NEXT
    FOR idx=0 TO 7
    psxJoyRX.LOWBIT(idx)=PsxDat
    PULSOUT PsxClk,1
    NEXT
    FOR idx=0 TO 7
    psxJoyRY.LOWBIT(idx)=PsxDat
    PULSOUT PsxClk,1
    NEXT
    FOR idx=0 TO 7
    psxJoyLX.LOWBIT(idx)=PsxDat
    PULSOUT PsxClk,1
    NEXT
    FOR idx=0 TO 7
    psxJoyLY.LOWBIT(idx)=PsxDat
    PULSOUT PsxClk,1
    NEXT

    HIGH PsxAtt
    RETURN

    END
  • TechnoRobboTechnoRobbo Posts: 323
    edited 2006-08-03 03:26
    Its the clock timing Shiftout is too long it should be 4microsecs not 46 microsecs like the shiftout command uses forits Ti timing.
Sign In or Register to comment.