Hello,
I'm trying to reverse engineering the Logitech G29 to make a custom steering wheel. I was able to identify the pinout as following:
Pin 1: Ground
Pin 2: Data from the 165
Pin 3: Data to the 595
Pin 4: Clock to both the 165 and 595.
Pin 5: Reset Clock to the 595
Pin 6: Parallel Load to the 165
Pin 7: VCC
As well I've mapped the bits using the controller and an arduino board.
However I'm stuck on how actually send those bytes to the base.
I've tried something similar to the code in Hacking a Thrustmaster TX RW wheelbase with Arduino Uno – part 2 | My techy life but it doesn't work.
Has any one tried the same? Thanks a lot!!!
Here's the code from the blog (as reference only).
/* This sketch provided "AS IS" under the BSD New license.
http://opensource.org/licenses/BSD-3-Clause
April 2015 © blog@rr-m.org
Full version with comments can be downloaded above -
tx_rw_ferrari_458_wheel_emu_16buttons.ino */
byte wheelState [8];
volatile byte pos;
void setup (void) {
DDRB |= B00001011; // pins 8,9,11 - inputs with a pull-up to +VCC
PORTB |= B00001011;
DDRC |= B00111111; // pins 14-19 (A0 - A5) also inputs
PORTC |= B00111111; // pulled-up to +VCC via internal resistors
DDRD |= B11111011; // digital pins 0,1,3,4,5,6,7 used as inputs
PORTD |= B11111011; // pulled-up to +VCC via internal resistors
wheelState[0] = B11000001; // 458 Italia Wheel first data byte
wheelState[1] = B11111111; // second data byte - buttons
wheelState[2] = B11111111; // third data byte - buttons
wheelState[3] = B11111111; // this and below
wheelState[4] = B11111111; // are not used
wheelState[5] = B11111111; // but wheelbase reads all 8 bytes...
wheelState[6] = B11111111;
wheelState[7] = B11111111;
pinMode(MISO, OUTPUT); // arduino is a slave device
SPCR |= _BV(SPE); // turn on SPI in slave mode
SPCR |= _BV(SPIE); // turn on interrupts
// interrupt for SS rising edge.
// Arduino Uno Pin10 must be also connected to Pin2!!!
attachInterrupt(0, ss_rising, RISING);
}
// Interrupt0 (external, pin 2) - prepare to start the transfer
void ss_rising () {
SPDR = wheelState[0]; // load first byte into SPI data register
pos = 1;
}
// SPI interrupt routine
ISR (SPI_STC_vect) {
SPDR = wheelState[pos++]; // load the next byte to SPI register
}
void loop() {
// scan the button presses and save that to wheelState array.
// Data transfer to wheelbase is interrupt-driven above.
// take bit 0 from PORTB - TX RW byte1
wheelState[0] = (PINB & B00000001) | B11000000;
// take bit 1 from PORTB + the rest from PORTD B11111x11
wheelState[1] = ((PINB & B00000010) << 1) | (PIND & B11111011);
// take bit 3 from PORTB + bits 0-5 from PORTC
wheelState[2] = ((PINB & B00001000) << 3) | (PINC & B00111111) | B10000000;
}
I’ve also tried to implement the logic by hand by following the 74hc165 datasheet below, no success. It doesn’t seem to follow this pattern or not sure what I’m missing:
