SukkoPera / PsxNewLib

Playstation controller interface library for Arduino
GNU General Public License v3.0
128 stars 27 forks source link

PS1 Densha de Go controller one-handle version TCPP-20001 support #9

Closed tylau0 closed 3 years ago

tylau0 commented 3 years ago

I confirm that the PS1 original two-handle version SLPH-00051 works with the current PsxNewLib code. However the same code doesn't work with the one-handle version TCPP-20001. May I know what one could do to help sort out what root cause? Thanks. (FYI, the PsxLibrary at https://playground.arduino.cc/Main/PSXLibrary/ does work with both controller versions.)

SukkoPera commented 3 years ago

Thanks for your report, I will add the two-handle version to the compatibility list.

I know there are other libraries around but they all have issues with one controller or the other. The most famous one doesn't support non-DualShock controllers, for instance. On the contrary, the one you posted doesn't seem to support Analog Sticks/Buttons as available on DualShock and DualShock 2 controllers, at a quick glance. This is one of the reasons why I set to write the one library to rule them all. As stated in the README, I am interested in supporting all the controllers out there, but I can't get my hands on them all, I need help from other people.

In this case, there are a few things you can do for the single-handle version:

SukkoPera commented 3 years ago

(Just for my own reference, this issue is a follow-up from here.)

tylau0 commented 3 years ago

Test setup: The densha de Go controller is cabled to an Arduino Lenoardo according to https://github.com/tylau0/DenGo/blob/main/PSX2USB_mod3.ino, which is modified from the PSX2USB.ino example in this library. The USB output of the Arduino is cabled to a PC. I use the "Set up USB Controllers" on Windows 10 to test the functioning of the controller. With the one-handle one, all key presses are not detected. In contrast, with the two-handle one, the buttons are detected pressed as expected. If I change to use the PsXLibrary, the one-handle controller works.

1) I set the HOLD_TIME to 0. It doesn't change the situation. My setup isn't set with SPI so the SPI test is skipped for the time being.

2) It doesn't work with INTER_CMD_BYTE_DELAY set to 50. For ATTN_DELAY, I don't call the PsxControllerHwSpi.sh and it seems to be related to the use of SPI. Since I am not setting it up. Anyway I try the case with changing ATTN_DELAY and both, but both cases don't improve anything.

3) Output Repetition of the following: ... <-- 01 42 00 --> FF FF FF <-- 01 42 00 --> FF FF FF <-- 01 42 00 --> FF FF FF <-- 01 42 00 --> FF FF FF ...

Hope this helps.

SukkoPera commented 3 years ago

Thanks a lot for your tests. I just wanted to point out that there's an ATTN_DELAY setting for the BitBanging backend too, can you please try changing that one.

The only other thing that comes to mind is trying to put external pull-ups (1k) on the CMD and DATA lines. I know it's a bit cumbersome though, would it help if I sent you one of my PsxControllerShields?

tylau0 commented 3 years ago

SukkoPera, thanks for the prompt response. Further working on the test, I find out that to get the newly loaded library running, I need to unplug and then replug the USB connection from the Arduino after loading the new library. With this I confirm that changing INTER_CMD_BYTE_DELAY to 50 or ATTN_DELAY to 100 in the places that you suggest could get the Densha de Go one-handle controller TCPP-20001. Making both changes would also make it to work too. The two-handle version SLPH-00051 and the typical dual shock controller SCPH-1200 are also working with all these new settings.

SukkoPera commented 3 years ago

Sorry for the delay, I am working on definitely too many things at once :(.

Anyway, I was going to make similar changes for #8 so I took the plunge and tried to fix both issues at once.

Could you please checkout the guncon_support branch and test if it works with both DDG controllers now?

tylau0 commented 3 years ago

SukkoPera, I confirm that the new code works with both DDG controllers. Thanks for moving this forward indeed!

SukkoPera commented 3 years ago

Glad to hear that! I'll make a new release soon, thanks for your help!

SukkoPera commented 3 years ago

One more thing: I can add your code among the library examples, is that ok with you?

tylau0 commented 3 years ago

You're welcome. Yes you could add my code as an library example. You may wish to use https://github.com/tylau0/DenGo/blob/main/PSX2USB_mod.ino as this one doesn't involve other optional parts other than the Densha de Go controller.

SukkoPera commented 3 years ago

All changes merged and example added to master in 632e8939ce156eede6a044e3ef43664084bd8ed1, thanks a lot for your help.

Going to release a new version including everything in a couple of minutes.

putnam commented 1 year ago

Commenting on an old closed issue here, but looking for clarity: the README for this project says that you need 1k pullup resistors, but @tylau0 's blog post is not using them and it seems that they were only a (ultimately unneeded) suggestion in this issue. As someone without a ton of experience with these controllers (yet?) I'm wondering whether they're necessary here to get the DDG controllers going, and if not, why not?

SukkoPera commented 1 year ago

IMHO they are required. The original PS has them, and that's enough of a reason for me. Besides it's not much of an effort nor cost. Otherwise signal analysis would be necessary in order to make sure they they rise quickly enough compared to the original PS.

putnam commented 1 year ago

Yeah, tonight I tested with a PS2 controller and it absolutely did not work without the pullups. I guess now the question is how exactly the Densha de Go controller was working for @tylau0 without them. Is it possible the controller has them built-in?

SukkoPera commented 1 year ago

Yes, it is possible. Not all controllers require them, other controllers will work with higher pull-ups, but relying on that means trying your luck. Even worse, if everybody starts doing whatever they like, deviating from the specs, it all just becomes a support nightmare for me. Actually it already is, thanks to the widespread false information that PS controllers can safely be used at 5V and that the ACK signal is unnecessary, sigh.