Skip to content

Fix G27 shifter buttons and add SPI3 support for wheel rim#182

Open
OrlandoEduardo101 wants to merge 1 commit intoUltrawipf:developmentfrom
OrlandoEduardo101:feature/g27-support
Open

Fix G27 shifter buttons and add SPI3 support for wheel rim#182
OrlandoEduardo101 wants to merge 1 commit intoUltrawipf:developmentfrom
OrlandoEduardo101:feature/g27-support

Conversation

@OrlandoEduardo101
Copy link
Copy Markdown

Summary

This PR fixes G27 shifter buttons not working in ShifterAnalog G27 mode and adds SPI3 support for connecting the G27 wheel rim buttons on a separate SPI bus.

Problem

  1. G27 Shifter buttons didn't work in ShifterAnalog G27-H mode - only analog gear detection worked
  2. G27 Wheel rim buttons conflicted with shifter when both connected to SPI2 (74HC165 lacks tri-state output)

Solution

ShifterAnalog Fixes

  • Fixed SPI clock configuration (CLKPhase, CLKPolarity) for 74HC165
  • Added CS polarity configuration
  • Changed to synchronous SPI read for reliable data
  • Fixed CS pin index off-by-one error

SPI3 Support (SPI_Buttons_3)

  • Added new button source class using SPI3 peripheral
  • Allows wheel rim (SPI3) and shifter (SPI2) to work simultaneously
  • Pins: PC10 (SCK), PC11 (MISO), PA15 (CS1)

Testing

Tested on STM32F407VET6 board with:

  • G27 Shifter: All 6 gears + reverse + 12 buttons ✅
  • G27 Wheel Rim: All 8 buttons ✅
  • Both working simultaneously ✅

Documentation

Added doc/logitech g27/ folder with:

  • Complete wiring guide
  • Technical reports explaining the bugs and solutions
  • Bilingual (EN/PT)

Checklist

  • Code compiles without warnings
  • Tested on hardware
  • No breaking changes to existing functionality
  • Documentation included

## ShifterAnalog G27 Mode Fix
- Fix SPI clock configuration for 74HC165 (CLKPhase, CLKPolarity)
- Add CS polarity configuration for active-low operation
- Change to synchronous SPI read for reliable button reading
- Fix CS pin index off-by-one error in setMode() and setCSPin()
- Add startRead() method to trigger SPI before processing data

## SPI Buttons 3 (SPI3 Support)
- Add SPI_Buttons_3 class using SPI3 peripheral for separate button source
- Required because 74HC165 lacks tri-state output (cannot share MISO)
- Allows G27 shifter (SPI2) and wheel rim (SPI3) to work simultaneously
- SPI3 pins: PC10 (SCK), PC11 (MISO), PA15 (CS1)

## Hardware Configuration (F407VG)
- Reduce SPI3 baud rate for reliable 74HC165 communication
- Initialize SPI CS pins HIGH (inactive) to prevent bus contention
- Enable SPIBUTTONS3 feature flag

## Documentation
- Add complete wiring guide for all G27 components
- Add technical reports documenting bugs and solutions
- Bilingual documentation (English/Portuguese)

Tested with Logitech G27 on STM32F407VET6 board.

Made-with: Cursor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant