|
| 1 | +# Logitech G25 / G27 Shifter {#logitech_shifter_g25} |
| 2 | + |
| 3 | +The [Logitech G25](https://en.wikipedia.org/wiki/Logitech_G25) and [Logitech G27](https://en.wikipedia.org/wiki/Logitech_G27) shifters are implemented using the SimRacing::LogitechShifterG25 and SimRacing::LogitechShifterG27 classes, respectively. The G25 and G27 shifters function identically, except for the lack of sequential mode on the G27. |
| 4 | + |
| 5 | +These notes are based off of disassembling my own G25 shifter, with the internal PCB marked "202339-0000 REV. A1". |
| 6 | + |
| 7 | +## Connector |
| 8 | + |
| 9 | +|  |  | |
| 10 | +| :-----------------------: | :---------------------------: | |
| 11 | +| DE-9 Male Connector | DE-9 Female connector | |
| 12 | + |
| 13 | +<sup>DE-9 graphic from [Aeroid](https://commons.wikimedia.org/wiki/User:Aeroid) @ [Wikimedia Commons](https://commons.wikimedia.org/wiki/File:DE9_Diagram.svg#/media/File:DE-9_Female.svg), modified for scale, colors, and creation of a complementary male version. These graphics are licensed under [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/).</sup> |
| 14 | + |
| 15 | +Both the G25 and G27 Logitech shifters connect to the wheel base units using [a female DE-9 connector](https://en.wikipedia.org/wiki/D-subminiature). Note that most jumper wires with [DuPont headers](https://en.wikipedia.org/wiki/Jump_wire) will not fit snugly into a DE-9 connector. For reliability and ease of use it's recommended to use a mating male DE-9 connector when interfacing with the shifter. |
| 16 | + |
| 17 | +Note that the DE-9 connector is often erroneously referred to as DB-9. These are the same thing. |
| 18 | + |
| 19 | +## Pinout |
| 20 | + |
| 21 | +| Function | DE-9 Pin | Internal J11 Pin | Data Direction | Wire Color | Necessary | Recommended Pin | |
| 22 | +|---------------------------|----------|------------------|----------------|------------------|-----------|-----------------| |
| 23 | +| Power | 1 | 1 | - | Black | | | |
| 24 | +| Data Output (SDO) | 2 | 7 | Out | Gray | X | 7 | |
| 25 | +| Latch / Chip Select | 3 | 5 | In | Yellow | X | 5 | |
| 26 | +| X Axis Wiper | 4 | 3 | Out | Orange | X | A0 | |
| 27 | +| Data In (SDI) / Power LED | 5 | 2 | In | Red | | | |
| 28 | +| Ground | 6 | 8 | - | Black (Sheathed) | X | GND | |
| 29 | +| Clock (SCLK) | 7 | 6 | In | Purple | X | 6 | |
| 30 | +| Y Axis Wiper | 8 | 4 | Out | Green | X | A2 | |
| 31 | +| Power | 9 | 1 | - | Black | X | VCC | |
| 32 | + |
| 33 | +Pin #2 (Data Output) is connected directly to the output of the EEPROM, and connected to the output of the shift registers through a 1000 Ohm resistor. |
| 34 | + |
| 35 | +Pin #3 (Latch / Chip Select) is shared between the onboard EEPROM and the shift registers. It is normally HIGH. It must be pulsed once (HIGH / LOW / HIGH) to latch the data into the shift registers. Holding it low instructs the EEPROM to listen for commands. |
| 36 | + |
| 37 | +Pin #5 (Data In) is used exclusively by the EEPROM. It is also connected to the "Power" LED through a 330 Ohm resistor. Driving this pin LOW will turn on the LED. As the "Sequential Mode" LED is connected using a 470 Ohm resistor, I would recommend using a 100-120 Ohm resistor in series so that the pair are closer in brightness. |
| 38 | + |
| 39 | +Pin #7 (Clock) is connected to the clock inputs of both the EEPROM and the shift registers. It is normally LOW and must be pulsed HIGH to send or receive data. Be wary of driving this pin to ground without protection, as this pin is also used as a joint power input for the [Logitech Driving Force Shifter](@ref logitech_shifter). |
| 40 | + |
| 41 | +The power pins (#1 / #9) are connected together within the DE-9 connector. Either one can be used, but it is recommended to use #9 for better forwards-compatibility with the [Logitech Driving Force Shifter](@ref logitech_shifter). |
| 42 | + |
| 43 | +The shifter's electronics are theoretically compatibile with both 3.3V and 5V logic. Be sure to use the appropriate voltage for the logic level of your microcontroller. |
| 44 | + |
| 45 | +## Buttons |
| 46 | + |
| 47 | +The shifter includes 12 user-facing buttons: |
| 48 | + |
| 49 | +* Four black buttons in a diamond pattern |
| 50 | +* One directional pad (D-Pad) |
| 51 | +* Four red buttons in a straight line |
| 52 | + |
| 53 | +The shifter also contains two internal buttons: a button on the bottom of the shifter to indicate that it's in reverse, and a button on the sequential mode dial to indicate that it's in sequential mode. These buttons are implemented as part of the SimRacing::LogitechShifterButtons class. |
| 54 | + |
| 55 | +### Shift Registers |
| 56 | + |
| 57 | +These buttons are connected to the external DE-9 connector through a series of NXP 74HC165D parallel-to-serial shift registers. |
| 58 | + |
| 59 | +| Button | Register | Bit | Offset | Enum | |
| 60 | +|-----------------------|----------|-----|--------|--------------------------------------------------| |
| 61 | +| (Unused) | Bottom | D7 | 15 | SimRacing::LogitechShifterG27::BUTTON_UNUSED1 | |
| 62 | +| Reverse | Bottom | D6 | 14 | SimRacing::LogitechShifterG27::BUTTON_REVERSE | |
| 63 | +| (Unused) | Bottom | D5 | 13 | SimRacing::LogitechShifterG27::BUTTON_UNUSED2 | |
| 64 | +| Sequential Mode | Bottom | D4 | 12 | SimRacing::LogitechShifterG27::BUTTON_SEQUENTIAL | |
| 65 | +| Red #3 | Bottom | D3 | 11 | SimRacing::LogitechShifterG27::BUTTON_3 | |
| 66 | +| Red #2 | Bottom | D2 | 10 | SimRacing::LogitechShifterG27::BUTTON_2 | |
| 67 | +| Red #4 | Bottom | D1 | 9 | SimRacing::LogitechShifterG27::BUTTON_4 | |
| 68 | +| Red #1 | Bottom | D0 | 8 | SimRacing::LogitechShifterG27::BUTTON_1 | |
| 69 | +| Black Up | Top | D7 | 7 | SimRacing::LogitechShifterG27::BUTTON_NORTH | |
| 70 | +| Black Right | Top | D6 | 6 | SimRacing::LogitechShifterG27::BUTTON_EAST | |
| 71 | +| Black Left | Top | D5 | 5 | SimRacing::LogitechShifterG27::BUTTON_WEST | |
| 72 | +| Black Down | Top | D4 | 4 | SimRacing::LogitechShifterG27::BUTTON_SOUTH | |
| 73 | +| Directional Pad Right | Top | D3 | 3 | SimRacing::LogitechShifterG27::DPAD_RIGHT | |
| 74 | +| Directional Pad Left | Top | D2 | 2 | SimRacing::LogitechShifterG27::DPAD_LEFT | |
| 75 | +| Directional Pad Down | Top | D1 | 1 | SimRacing::LogitechShifterG27::DPAD_DOWN | |
| 76 | +| Directional Pad Up | Top | D0 | 0 | SimRacing::LogitechShifterG27::DPAD_UP | |
| 77 | + |
| 78 | +Data from the shift registers can be read using the Data Output (DE-9 #2), Latch (DE-9 #3), and Clock (DE-9 #7) pins. The latch must be pulsed LOW (HIGH / LOW / HIGH), then data read out via the data output pin while the clock is pulsed repeatedly from LOW to HIGH. |
| 79 | + |
| 80 | +All buttons will report a '1' state if they are pressed, and a '0' state if they are unpressed. Internally, all of these buttons are held to ground with 10k pull-downs. |
| 81 | + |
| 82 | +The red buttons are numbered from left to right, 1-4. The black buttons use cardinal directions. |
| 83 | + |
| 84 | +## EEPROM Storage |
| 85 | + |
| 86 | +The Logitech shifter has an internal EEPROM chip, presumably for storing settings and calibration data. In my shifter this is an [ST Microelectronics M95010-W](https://www.st.com/resource/en/datasheet/m95010-w.pdf) in an SO8 package. It has 1 Kbit of memory and can be read and written to via the DE-9 connector. The EERPOM does not need to be used in order to retrieve the control surface data from the shifter. |
| 87 | + |
| 88 | +This library does not implement EEPROM support, either for reading from the EEPROM or utilizing its data. |
0 commit comments