MickGyver / DaemonBite-Retro-Controllers-USB

A collection of retro controller USB adapters (SNES, NES, Mega Drive/Genesis, Master System, Atari, Commodore, Amiga and Amiga CD32)
GNU General Public License v3.0
303 stars 65 forks source link

2 controller limit fix #3

Closed jroth closed 4 years ago

jroth commented 4 years ago

I looked into the 2 controller limit issue.

Reference to the hardware limitation here: https://github.com/NicoHood/HID/wiki/API-Documentation

"The CDC Serial uses 3 endpoints. This means you can add up to 3 devices for the 32u4 and 1 for the 8/16/32u2. If you add more, some will be ignored."

I found a fix, that others have used when creating usb keyboards. It disables the CDC to free up resources. https://github.com/gdsports/usb-metamorph/tree/master/USBSerPassThruLine

If we disable CDC like they did, all 4 gamepads work again with the rest of the code unchanged. I just dropped the modified libraries into my project to avoid any system wide issues with other projects.

Then to upload new code, I just plug in the device, and toggle gnd+reset and the bootloader will accept new code.

MickGyver commented 4 years ago

Good find!