USB Adapter for Sega Genesis Controller

April 2009

IMG_3300

The Genesis (Mega Drive) controllers use a standard 9-pin connector, and their communications protocol is fairly simple, so I built a little adapter that turns my Genesis controller into a USB gamepad that works with any emulator!

Total cost was about $10.

Uses an ATmega48 with Objective Development's V-USB driver. The circuit is basically the bare-bones V-USB reference design with a couple small modifications.

I threw in a green LED because everyone loves LEDs.

The Genesis controller uses 6 lines (D0...D5) for data communication and a seventh (SELECT) to determine which button states get put on those lines. The select line (SEL) is normally high. To read the state of the controller, the first step is to read the data lines with SEL high. The data lines will indicate the status of the D-pad and the B and C buttons:

Pin  Button (SEL=5V)
---  ---------------
D0   D-pad up
D1   D-pad down
D2   D-pad left
D3   D-pad right
D4   B button
D5   C button

If a data line is LOW, the corresponding button is pressed.

Next, pull SEL low and read the data pins again. They will now indicate the status of the A and Start buttons, as well as up and down on the D-pad.

Pin  Button (SEL=0V)
---  ---------------
D0   up
D1   down
D2   GND
D3   GND
D4   A button
D5   Start button
Set SEL high after you read the data pins. If you're reading a 3-button controller, this is all you have to do. Most Genesis read the controller state at between 30 and 60 Hz and pulse the SEL line low for 20 microseconds.

If you're reading a 6-button controller, however, you have a little more work to do to get the state of the remaining buttons. Pulse the SEL line low two more times: (clear SEL; wait 20µs; set SEL; wait 20µs; clear SEL; wait 20µs; set SEL) Now, with SEL high, after the third low pulse, the controller responds with the state of the X, Y, Z, and Mode buttons.

Pin  Button (SEL=5V after 3rd pulse)
---  -------------------------------
D0   Z button
D1   Y button
D2   X button
D3   Mode button

Lastly, pulse SEL low then high again to finish the read operation.

code

Click here to download the source code; it includes a Makefile for compilation with AVR-GCC. It's essentially the V-USB HID example code. Note that I have only tested it with a 6-button controller.

links/resources

photos

Photo gallery is on Flickr.

schematic


(click to enlarge)

Download gEDA schematic: gen2usb.sch
May require custom symbols from my symbols directory.