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
296 stars 61 forks source link

Inline adapter to add Atari 7800 support #17

Closed 0x15e closed 3 years ago

0x15e commented 3 years ago

With Atari 7800 support for MiSTer maturing, I picked up an Atari Proline controller to use with it. Unfortunately, since the 7800 controller is kind of an odd bird due to its backwards compatibility with the 2600, it can't be used with any of the DE9 controller adapters (e.g., the Sega ones) as-is.

With most of the controllers, input is held high and pulled low by the input. The 7800 controller, however, keeps the individual button inputs held low by resistors in the controller and pressing them pulls them high (to 5V). The pins also don't line up 100% with other 2-button controllers like the Master System.

So, in an attempt to solve the problem, I'm going to try building an inline adapter to go between the 7800 controller and my Sega Daemonbite adapter. The plan is to use an inverting buffer (the CD4049 specifically) to invert the logic levels on the two fire buttons while passing the rest of the pins through such that the 7800 controller behaves like a Master System controller (with the common 1-button fire functionality disabled).

The CD4049 is supposed to draw very little current so I don't think this will ruin the Arduino but I'd appreciate a second set of eyes on this to tell me if I'm on the right track.

Here's the schematic for the as-yet unbuilt and untested adapter (the male side connects to the 7800 controller, female side to the Daemonbite Sega adapter):

Atari 7800 to Sega Master System controller adapter schematic

0x15e commented 3 years ago

OK I can say for sure that this circuit does not work as intended. It doesn't damage anything and does manage to invert the logic correctly but it doesn't allow the buttons to operate separately (pressing either button triggers both outputs). So back to the drawing board.

Edit: and the more research I've done on 7800 adapters, the more I realize the inverting buffer is probably the wrong solution and I should probably do it with open collector outputs. That may not solve the button triggering problem but it would be a cheaper / simpler design and would operate more like a real controller.

0x15e commented 3 years ago

I'm definitely stuck now. I rebuilt the adapter using transistors. It works in Spice. It works on the breadboard. But when I plug it into the Sega adapter, it still sees both buttons being triggered when I only press one.

It seems I'm missing something fundamental here but I can't figure out what. Anyway, this is probably off-topic for this project at this point so I'm going to close the issue.

0x15e commented 3 years ago

Just one more comment. It turns out the problem was with my 2x Sega adapter. On the 1p port, everything works great. On the 2p port, an SMS controller (even a real one) triggers both buttons when either is pressed, and a Genesis controller triggers A+Start when either A or Start is pressed and B+C when either of B or C is pressed (X, Y, Z, and Mode are fine).

So maybe that first circuit (with the CD4049) did fry something after all, but the good news is that the second version with transistors works beautifully. Just gotta rebuild my 2x Sega adapter now ... :(

0x15e commented 3 years ago

Last comment, I swear. It turns out the problem was shoddy workmanship on my part. There was a short between pins 14 and 15 (i.e., the pins that would connect to the problematic buttons) on the Arduino. Talk about making me feel like an idiot. Maybe I should've tested both ports on my Sega adapter when I built it. :D

Anyway, regarding the two 7800 adapter approaches, the CD4049 approach is probably fine but also overkill. The 7800-to-SMS adapter can be done with 2 NPN transistors, 2 1.8KΩ resistors, and 2 270Ω resistors. I'll probably whip something up in KiCad in the near future that can be used to build it and fits inside a standard DE9 gender changer hood, and post it on OSHPark.