After reading how good the new direct drive wheels are for sim racing, I decided to build one.  I planned to use my existing Logitech G25/G27 pedals and shifter.  Martin Ascher has written a tutorial for the open sim wheel, and there is also Beano’s guide for an idea of how to setup a Granite Devices Ioni as the servo drive.  It’s very exciting, and I’m building a timber enclosure for the servo drive unit.  I’m using an STElectronics STM32F4-Discovery board as the USB HID controller, loaded with the MMOS firmware.  I’m coming from a G27 setup, and I plan to keep using the same pedals and shifter.

There’s not a great deal of information about how to connect a G27 shifter and pedals to the disco board, running MMOS firmware.  The pedals are easy enough, follow the diagram at the MMOS firmware page which is contained in Anschluss.zip at [DIY] USB Force Feedback Controller.  The aforementioned zip also has a diagram for how to connect the shifter x and y axis to the MMOS disco board.  However, it doesn’t explicitly tell you how to connect all the buttons on the G27 shifter console.  The G27/G25 uses a standard SPI (serial peripheral interface) for the buttons, provided by a HCF4021 parallel/serial controller chip.  I spent quite a while trying to get this to work, and it wasn’t obvious that the shifter connects to a combination of CS, SCK and MISO on the disco.  It doesn’t have MOSI connected at all.

connector male female

Connect the pedals to the Disco as follows (pedals have a male DB9 plug):

+5V       Disco 5V        G27 DB9 Pin 1
Gas        Disco PB0     G27 DB9 Pin 2
Brake     Disco PB1      G27 DB9 Pin 3
Clutch    Disco PC4     G27 DB9 Pin 4
Ground  Disco Gnd     G27 DB9 Pin 6

Connect the shifter to the Disco board as follows, to use the Disco SPI1 serial interface (shifter has a female DB9 plug):

SCK     Disco PA5     G27 DB9 Pin 1 (Pin 7 on G25)
MISO  Disco PA6     G27 DB9 Pin 2
CS        Disco PA4     G27 DB9 Pin 3
PotX    Disco PC2     G27 DB9 Pin 4
GND    Disco GND   G27 DB9 Pin 6
Vcc       Disco 5V       G27 DB9 Pin 7 (Pin 1 on G25)
PotY     Disco PC1     G27 Pin 8
STM32F4 Discovery with SPI pinout wiring

I would recommend using the 5V pin on the disco for the shifter and pedals.  I found the 3V supply was a bit weak in my setup with a d-sub 9 extension cable, and the shifter wasn’t entirely reliable.

After it’s all connected with a db9 male adaptor and dupont connectors to your Disco board, you can run the MMosFFBTool, go into Device Setup.  Set shifter to G25 shifter, and also set Buttons 17-32 to G25 Shifter.  Analog axes should be set to three axes for the pedals.

MMOS setup g25 g27 shifter

In order to get the Reverse gear working, you also need to go into the “Shifter” screen, and tick “Reverse Y”.  It’s also worth adjusting the x and y values so that the shifter is picked up in the middle of the zone for each gear shift.

G27 Shifter with STM32F4 Discovery MMOS Reverse gear

I have also built a handbrake and a sequential shifter which I’m going to connect to the disco board.  If you’re looking for additional inputs, there is an extra analog input (PB2) supported by MMOS firmware which would be ideal for a load cell handbrake.  I connected my sequential shifter to two of the buttons inside the G27 shifter.  I ended up building a hand brake with a simple momentary switch, because I figure rally drivers don’t use varying amounts of handbrake.

Thank you very much to MMos over at VirtualRacing.org for all his hard work on the Discovery firmware for the OpenSimWheel.

If you are already working on your G27 shifter, there are a couple of useful mods.   chillicoke has a couple I’d recommend.  Quietening the shifter with adhesive velcro works well.  The increased shift stiffness mod is great as well, but for the G27 I found I only needed the spacer under the spring to be about 1/16″ long (and 3/8″ diameter).  I used a short piece I cut off the threaded end of a m5 bolt.  It is a bit of an undertaking to unscrew the housing on the G27 shifter, so make sure you set aside some time.

Update: I built some great new hydraulic + load cell pedals, and I wired them up to use the same db9 wiring as the g27 pedals.  That way they plug straight into my OSW servo drive unit.  Here is my new pedal build log.

Advertisements

3 thoughts on “Connect Logitech G27 Shifter and Pedals to STM32F4 Discovery board with MMOS firmware

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s