Need help with wireles PS2 controller and Bot Board w/ Atom

Wondering if anyone has any insight into this…

I am using the PS2 cable from LynxMotion with a Bot Board and Basic Atom 28. I’ve tried both a Logitech and a MadCatz (but doesn’t say “Lynx”) wireless controller and get the same results.

Everything boots up fine, but the receiver acts as though it can’t find the controller, and the test programs show mode $79, but no control movement or button pushes are detected.

When I connect an old PS controller, the mode is $73, but the test programs can read the buttons, etc.

Thanks in advance,

Mike

Hi, I’m actually trying to hook up a wireless PS playstation to an HC11 microcontroller. I have the same symptoms as you: controller doesn’t read any data (seemingly), and older (non-analog) controllers DO work.

I hooked up the data line to an oscilloscope and saw that the data waveform does NOT change upon button presses.

I tried two analog controllers, one wireless, and one wired. Both had similar results. The wired digital PS controller worked fine.

I’ll post up what i find! =)

okay, here’s what i got:

In my code, I do a check for the controller type. Since the digital controller only transmits 2 bytes, there’s a BEQ in the asm code to skip the rest of the bytes. It worked fine with digital controllers…

Enter my 2.4Ghz Pelican “Predator Street” wireless ps2 controller…
I would never get data at the receiver end. An o-scope actually DID show data that changed, so I figured it was a code problem.

I tried commenting out the controller type check, and now i can recieve data, even if it’s not the data I expect. =/ but at least things are changing when i press buttons.

Hope this helps, and good luck!

More info:

Last night as I ran down a set of 7.2 volt batteries, the “serouts” began to briefly register inputs from the wireless controller.

I should add that right now I am running four hacked servos as a drivetrain, in pairs as two “channels.”

Any help with this would be greatly appreciated!

Thanks!

Mike
teamcollateraldamage.com

Don’t forget that you need a pullup resistor on the Data Line. Use a 1k ohm as it is a fast signal you’re wanting to read. On some controllers, a pullup will also be required on the Clock line.

I am aware of problems with the Logitech one. I have used Madcatz and Hitek wireless ones with great results. Don’t use the BS2 port as the inverter (required by the BS2 shiftin and shiftout command) is too slow for the Atom, and not required. Can you follow this tutorial and tell us what you are getting? lynxmotion.com/images/html/build034.htm Hope this helps…

That’s the tutorial I used. (One of them, anyway :slight_smile:)

I found that by changing:

low SEL
shiftout CMD,CLK,FASTLSBPRE,$1\8,$43\8,$0\8,$1\8,$0\8] ;Config Enable
high SEL

low SEL
shiftout CMD,CLK,FASTLSBPRE,$01\8,$44\8,$00\8,$01\8,$03\8,$00\8,$00\8,$00\8,$00\8] ;Set Mode and Fix(Analog
high SEL

pause 100

To:

low SEL
shiftout CMD,CLK,FASTLSBPRE,$1\8,$43\8,$0\8,$1\8,$0\8] ;Config Enable
high SEL

PAUSE 1

low SEL
shiftout CMD,CLK,FASTLSBPRE,$01\8,$44\8,$00\8,$01\8,$03\8,$00\8,$00\8,$00\8,$00\8] ;Set Mode and Fix(Analog
high SEL

’pause 100 (commented-out)

I was able to get the mode set to $73.

With the cordless controllers I get no change of the values reported in the terminal window, but the corded analog controller works fine.

Last night as the voltage dropped almost to the point exhausting the battery, I seemed to get some reaction from the controller before the mode went to “FF,” the error condition and the battery expired.

Let me know if I can expand on any of that! :slight_smile:

Mike

Ok. Here’s some insight into the PS2 controllers and the coding. I’ve used a number of different ones (True Sony, Lynx Madcatz, Logitech etc).

A) Start with a 1K pullup on the data line and to be safe one on the CLK line.

B) If you are getting NO communications add large pauses between each shiftout. Every controller I’ve used has been picky about some commands while others were fine so I ussually start out by adding pause 100 between everyone of them. Once I have it working I go back and tweak to the shortest pauses/no pauses I can get.

C) Don’t try getting a new controller working with a bunch of servos and other stuff hooked up. Start with a clean setup. Servos are very noisy and can(and will) cause communications to fail when you are first trying to get everything just right.

D) Start just with digital buttons till you get some communications. In other words use code like this:

[code]ps2index var byte
ps2data var byte(3)
main
low SEL
shiftout CMD,CLK,spi_outmode,$1\8,$42\8]
for ps2index = 0 to 2
shiftin DAT,CLK,spi_inmode,[ps2data(ps2index)\8]
next
high SEL

for ps2index = 0 to 2
     serout S_OUT,i57600,[hex2 ps2data(ps2index)\2," "]
next
     serout S_OUT,i57600,[13]

goto main[/code]To read the digital values of buttons on any PS2/Compatible controller you don't need to configure anything.

If you still can’t get anything check your votage levels. I hooked up an AtomPro once and forgot that P6 and P7 are 3.3v lines. This was fine with a madcatz but with a TRUE Sony no data.

Nathan

Thanks!

Here’s where I may be asking a stupid question. How is the pullup resistor wired?

Is it simply in line? I.E. Place a resistor in-line between the pin and the controller, or is it more complex than that?

According to the docs, the BotBoard already has a pullup on pin 4 (Dat) but not pin 7.

Mike

New to electronics? :slight_smile:

A pullup resistor is wired from the I/O in parallel to the singal wire. And then to Vcc(5v). I’ll try to make a little diagram here in the code box:

I/O-------------------PS2 data line | | 1K ohm ------/\/\/\-------Vcc

Nathan

Electronics no, microcontrollers, yes :slight_smile:

Thanks for the info, I’ll give that a shot this evening!

Mike

Update:

I added a pullup resistor to CLK - no difference.

I checked the voltages at the pins - all are ~ 5 volts.

I disconnected the servos and ran the stripped-down code above, checking for button pushes only. Tested the code with a wired controller. That works fine, but no results are returned with any of the three wireless controllers.

The only other thing I can think of is that when I measured the voltage that was available as VS was less than 7.2 volts - I’m not sure the exact figure now - this is the voltage I’m applying to the “green wire” on the PS2 cable.

Mike

I should add:

The results above are being attained with a PS2 interface cable from Jim.

However, I first started by making my own using the plug from an old Playstation that I dissected - same results.

I have gone so far as to shut down my 2.4GHz wireless router just to make sure it wasn’t RF intefering.

My eventual goal with this, besides wireless control of my rovers and such is to use the combination in one of my beetle-weight RFL-rules bots. I think it’s a real possibility as an economical alternative to 4-channel RC.

Mike
teamcollateraldamage.com

Try using a digital pad just to test your code.

My problem was that, FOR SOME REASON, all 8 bits weren’t getting shifted in on each byte from the PS2 pad. It works great for digital pads though, but i had to manually shift in the last bit and set it to the default value of one. I lose the select button, but the controller works fine enough for now.

and yes, i had pullups on both the recommended lines. I still haven’t figured out why all 8 bits weren’t shifted in =/ prob a lline of asm code i overlooked =/

Well, I’ve made a discovery.

It now works, using an older used contoller I found at Gamestop.

It’s a Pelican, and I can’t find any markings on it WRT to what frequency it operates on. However, it has a manual channel selection switch on transceiver and controller.

Anyone offer any thoughts as to why 2.4GHz doesn’t work? Was there perhaps a change in the controller architecture?

Mike

The problem seems to be with the speed the controllers are operating at. Some problems can be fixed with a single pause command. I went to the local department store and bought 4 different PS2 controllers…
Intec 2.4ghz
Madcatz 2.4ghz
Nyko 2.4ghz
Pelican 2.4ghz
Laurent, Beth, and I will compile a tutorial on all of them early next year. The goal is to provide a programming example that will work for all, or at least what needs to be changed for each one to work well. At the same time we will be adding information to make the Atom Pro work with the Bot Board… Help is on the way…

In that case, Let me add something that I forgot to add earlier.

I did discover that the Logitech controller was receiving the “turn on the rumble motor” commands while the code was looping in “read the controller” mode. I was able to repeatedly turn vibrate on and off, and tested this with good and bad values in the shiftout.

I think you are right - it’s probably primarily a timing problem of some sort. I did briefly get communications (I think - I haven’t been able to get a repro since then) with one of the controllers when the batteries on the 'bot were running out. I first assumed that this was a voltage issue, but I suppose it could have just as logically been a change in timing either in the board or the xceiver as the voltage dropped.

BTW, please let me know if I can help you guys out with the testing in any way. I’ve had as much fun chipping away at this as I will driving the thing around. :smiley:

I rely on people like Laurent (RIOS, SEQ, lots of other awesome programs) and Nathan (Basic Micro) for the code on these. Both of them had bad experiences with the Logitec controller, so I’m not even attempting to support them. :stuck_out_tongue: I appreciate the offer to help. We’ll let you know. Thanks!

Hi there,
i have found something interresting !

Don’t use :

[code]low SEL
shiftout CMD,CLK,FASTLSBPRE,$1\8,$42\8]

for Index = 0 to 6
shiftin DAT,CLK,FASTLSBPOST,[DualShock(Index)\8]
next

high SEL
pause 1[/code]

to read PS2 data

because it’s too slow to read some wireless controllers…

but use rather :

[code]low SEL
shiftout CMD,CLK,FASTLSBPRE,$1\8,$42\8]

shiftin DAT,CLK,FASTLSBPOST,[DualShock(0)\8, DualShock(1)\8, DualShock(2)\8, DualShock(3)\8, |
DualShock(4)\8, DualShock(5)\8, DualShock(6)\8]

high SEL
pause 1[/code]

it’s not so nice, but it’s the only way to use some controllers without errors

the first code with a Madcatz MicroCON 2.4ghz Wireless Controller result in errors reading analog joystick (wrong values > 10% errors)
the second code give 100% good values for analog joystick.

it’s just a part of the code, but it’s just to demonstrate the way you must use the ‘shiftin’ command with this controller…and i bet with most of the ‘non working’ others !

i hope it will help !

Good catch. I should have mentioned that. The For Next loop is a very slow command(relatively speaking). The multi read functionality of any command(ie [arg,arg,arg,arg] type commands) will always be much faster because theya re running in strait machine code unlike the for next which is running on basic tokens.

Basically what is probably happening is some controllers have a timeout. When they receive the command to send out the button states if they don’t dump all the data in some unspecified time they stop sending data.

Technically this shouldn’t happen since the controller is supposed to be a slave device. It should wait indefinitely for the master clock(ie the Atom).

Nathan