jotego / jtbin

Binary files for MiSTerFPGA, Pocket and other platforms
https://patreon.com/jotego
249 stars 70 forks source link

USB controllers aren’t mapped in order in SiDi #268

Closed kounch closed 2 years ago

kounch commented 2 years ago

On a SiDi FPGA, at least with cores jtpcs1 and jtcps15 (Cadillacs and Dinosaurs, The King of Dragons, etc.), only the first two USB detected controllers work:

But, when having tree controllers plugged in, although the firmware sees them, the joystick test pass all ok, etc. the third controller (whichever is detected as third), does not work at all.

kounch commented 2 years ago

Tried also with several firmware versions between 200614 and 211121, and the issue persists

jotego commented 2 years ago

I have reviewed the connections and the third and fourth joysticks are connected all the way from the serial interface that links the FPGA and the MCU together to the core logic. I wonder if the firmware is communicating in the expected way. Do you know of a core in SiDi where three joysticks work?

kounch commented 2 years ago

You are right. After asking for some advice, i have tried with other cores (Dynablaster with minimig and Bomberman with tgfx16) some of them work ok with three controllers, and some do not.

kounch commented 2 years ago

After doing some more test with 5 controllers at the same time, i see that, what the jtcps cores are using, does not match what the firmware shows on the test screen.

USB controller 1 on test screen -> controller 1 in core USB controller 2 on test screen -> controller 2 in core USB controller 4 on test screen -> controller 3 in core USB controller 5 on test screen -> controller 4 in core

This way, having three controllers attached will never work with a three player game

kounch commented 2 years ago

When using the PC-Engine / SuperGrafx Core, the numbers match, when using 3, 4 or 5 players with Bomberman

USB controller 1 on firmware -> controller 1 in core USB controller 2 on firmware -> controller 2 in core USB controller 3 on firmware -> controller 3 in core USB controller 4 on firmware -> controller 4 in core USB controller 5 on firmware -> controller 5 in core

kounch commented 2 years ago

Changed issue text according to latest info

jotego commented 2 years ago

I have asked for help to the MiST firmware developers. That's the firmware used in SiDi.

gyurco commented 2 years ago

USB controller 1 on test screen -> controller 1 in core USB controller 2 on test screen -> controller 2 in core USB controller 4 on test screen -> controller 3 in core USB controller 5 on test screen -> controller 4 in core

Where is controller 3? Is it empty?

gyurco commented 2 years ago

It would be helpful to set up ARM debug logging: https://github.com/mist-devel/mist-board/wiki/Troubleshooting#usb Then it can be seen what happens when the controllers are enumerated.

gyurco commented 2 years ago

Actually I could reproduce it in Cadillacs & Dinosaurs input test screen: Controller 3 is ignored, and 3P is Controller 4. I check if it is a firmware or core error.

gyurco commented 2 years ago

The problem is in JTframe: https://github.com/jotego/jtframe/blob/master/target/mist/jtframe_mist_base.v#L212 You're using user_io signals joystick_0,_1,_3,_4, but they should be _0,_1,_2,_3

jotego commented 2 years ago

Blast! It was in front of me all the time. I've fixed it here: https://github.com/jotego/jtframe/commit/c059a6623a8f914eb8ec7d19b62a3d56a3e2fd45

Thank you, Gyurco!

gyurco commented 2 years ago

It happens to all of us :)