STM32F407VG based Dualshock 1 Controller

Started by darkgiuseppe, February 19, 2021, 11:13:45 AM

Previous topic - Next topic

darkgiuseppe

Hello! I never knew about this site before but it has like everything I want to know about, especially the Controller Technic section. This link drew me here: https://nfggames.com/forum2/index.php?topic=5001.0

I am in the middle of a project in emulating a PSX controller, Dualshock 1. I believe I am really, really close, though I am seeing kinda weird results. I know that some people use the SPI module in a uC, but I already made a PCB and had no idea that was an option, so now instead I am bit banging it.

I snooped with my logic analyzer on a Dualshock 1 controller. When I first plugged it in, there is a period where the 5 bytes are exchanged from and to the console (10 bytes total). It does this a few times and then there is a period of the console sends 1 byte to send a transmission and then it stops. It does this for 20 - 60 times and I think it depends on the game. After the console stops terminating the transmission early, it goes back to the 5 byte exchange frame forever.

I wrote up my program and managed to send the data back to the console in the beginning, and reacted accordingly during this 1 byte period, but when it polls forever thereafter, I can only do a 3 byte frame. It is quite weird as I have never seen that documented anywhere. I think maybe either this 1 byte period is some sort of check from the game but I believe to be following the bus specs okay. Only think I can think of is perhaps maybe the console isn't seeing my data? Though my uC is running 168MHz and not using HAL libraries for speed and I can react to a falling edge within 560ns so I think I am fast enough. It surely is before the rising edge which is when the console will sample the data.

I have attached the strange 3 byte sequence against a 5 byte sequence. Anyone see this kind of behavior before?

NFG

I never dove into this, but I knew a guy who worked at Sony, in charge of ...  compliance and certification, maybe?  I forget his role, but management.  He told me that the console does a handshake during connection with a controller and the latter details its available buttons and other parameters. 

And so it's a blind guess, or worse, but maybe something during this exchange tells the console that there are fewer inputs to collect and so it doesn't?

darkgiuseppe

It certainly seems so. I have tinkered quite a bit and am not getting anywhere. I think I will change my plan try to use the SPI module built in and act as SPI slave device.