Testing the PS2 controller V3

I thought I would talk about testing of the PS2 V3 here as to allow me to also show outputs from Logic Analyzer and the like.

I have tried it out so far on a Botboarduino (BBD) on both the standard pins as well as on pins 10-13 and so far the joystick values appear to work Ok However I am seeing some issues with the two bytes associated with buttons. In particular the Bit associated with the Select button (first bit), appears to stick on. Also it randomly turns on and off. That is with my simple PS2 test app, that simply loops printing out the buttons as well as the 4 analog values associated with the Joystick. I press the Analog button to get the Pad to talk to the receiver. Without doing anything I see stuff like:

PS2 Input: 0:128 128 128 128 PS2 Input: 0:128 128 128 128 PS2 Input: 0:128 128 128 128 PS2 Input: 1:128 128 128 128 PS2 Input: 0:128 128 128 128 PS2 Input: 1:128 128 128 128 PS2 Input: 0:128 128 128 128 PS2 Input: 0:128 128 128 128 PS2 Input: 0:128 128 128 128 PS2 Input: 1:128 128 128 128
Again this is a real simple App:

[code]#include <PS2X_lib.h>

#if defined(MK20DX128) || defined(MK20DX256)
// For my testing on Teensy
#define PS2_DAT 2
#define PS2_CMD 3
#define PS2_SEL 4
#define PS2_CLK 5
#else
// Botboarduino…
#define PS2_DAT 10 //6
#define PS2_CMD 11 //7
#define PS2_SEL 12 //8
#define PS2_CLK 13 //9
#endif

PS2X ps2x; // create PS2 Controller Class

void setup()
{
Serial.begin(57600);
delay(5000); // give time to open monitor
int error = ps2x.config_gamepad(PS2_CLK, PS2_CMD, PS2_SEL, PS2_DAT); // Setup gamepad (clock, command, attention, data) pins
Serial.print("PS2 Init: ");
Serial.println(error, DEC);
}

void loop() {
ps2x.read_gamepad(); //read controller and set large motor to spin at ‘vibrate’ speed

Serial.print("PS2 Input: ");

Serial.print(ps2x.ButtonDataByte(), HEX);
Serial.print(":");
Serial.print(ps2x.Analog(PSS_LX), DEC);
Serial.print(" “);
Serial.print(ps2x.Analog(PSS_LY), DEC);
Serial.print(” “);
Serial.print(ps2x.Analog(PSS_RX), DEC);
Serial.print(” ");
Serial.println(ps2x.Analog(PSS_RY), DEC);
delay(100);
}
[/code]
I also verified that the output I show above is consistent with what I see on the Logic Analyzer.

I also find getting the start button to register on these can be problematic. That is I have to use my fingernail to get it pressed in far enough to register. I am also seeing similar results on my Teensy 3.1 with my Carrier board. I might try it again on the Teensy without the level shifter to see if that helps

May also dig out a BB2 to see what it is doing.

Also if I get a chance I will try to find where my old Parallax software Oscilloscope is, to see if maybe it is a voltage issue of the CMD or DAT lines.

I now have a test program working on the BB2 with Bap28. Before it did not like staying in analog mode and the like. There is about 4 things I changed, so still need to figure out if you need all of the changes or not. (Changed timing, Do not check for which mode I am in, Remove some of the inits. If we are not using pressures, no need to go into these other mode settings, and finally also removed jumpers from LEDS/Buttons). That is probably all for tonight.

Kurt

P.S - I will post some updates to main Forum once I figure a little more out.

“All for tonight”… i think that’s a lot… :wink:

Thanks,

I have a test program that is working on BAP28 and I believe a version of the Phoenix code base that should work… I posted more info up on main forum.

Kurt

As you probably have seen in public forum side, I think I figured out the Botboarduino issue as well.

Awesome sauce!