16
\$\begingroup\$

I am re-purposing the metal case of old industrial laptop, it would be nice to keep current touchpad, because it's glued to the case AND because I'm having fun trying to convert it to my purpose.

Here is a photo of the chip, there are no datasheets online or anywhere so I have no idea on how to talk to it:

The chips receives 5 V, GND and the 2 data wires from both the touch sensor and the 2 rx and lx buttons, then outputs other 2 signal lines The chips receives 5 V, GND and the 2 wires from the 2 rx and lx buttons, then outputs other 2 signal lines

Don't mind the disconnected GND on the logic analyzer, I have connected it before reading the signals Don't mind the disconnected GND on the logic analyzer, I have connected it before reading the signals

As you can see from the black wires in the 2nd pic, there's a total of 4 pins connecting the device to the mainboard, two are 5 V and GND, the other two outputs some kind of signal, which you can see in the screenshots below:

In these images, I am moving my finger on the touchpad from right to left at a slightly increasing speed, I did not screenshot the whole signal In these images, I am moving my finger on the touchpad from right to left at a slightly increasing speed, I did not screenshot the whole signal

More detailed image of a couple of signals More detailed image of a couple of signals

My first step to find a way to talk to this device is figuring out which protocol it uses, I have already excluded the mainstream options:

  • SPI, cannot be because it has only 4 pins and no apparent CLK anyway
  • I2C, it has no apparent CLK
  • PS2, it has no apparent CLK
  • UART, it has 2 communication lines that output different signals

The actual function of the D1 signal puzzles me, while the data on D0 changes accordingly to what I do to send the proper signal to the main board, D1 always displays the same exact pattern:

  • From pulse 0 to 1, their length is 37 μs, while pulse 2 is 30 μs, the same pattern applies for a-b-c and d-e-f pulses
  • Pulse 3 always varies between 98 μs, 117.5 μs and 121 μs
  • Pulse 4 always varies between 120.5 μs, 119.5 μs and 122 μs
  • When pulse 3 is 98 μs, pulse 4 is always 120.5 μs, when pulse 3 is 117.5 μs pulse 4 is always 119.5 μs etc.

I think the last 3 points are due to some tolerance of accepted values, probably pulses 3 and 4 should have a fixed length but my sampling rate alters them even if it's objectively higher than any possible signal frequency.

Marks on D1 signal Marks on D1 signal

My idea is that D1 is some kind of counter coming from either the touchpad chip or the mainboard, how can I verify the source of the signal? Would a diode placed in series to the line let the signal pass only if oriented properly? This could allow me to figure out it's direction.

As a last resort, if this communication protocol is something unique to this chip then I'll just do a ton of tests and find patterns that'll allow me to translate what the touchpad is saying, knowing the baud rate will then be essential but it's impossible to find it without knowing if the smallest pulse I read is actually the smallest possible.

\$\endgroup\$
4
  • \$\begingroup\$ Do you know which chipset the touch pad connected to on the mainboard? That might give some clues. \$\endgroup\$ Commented Sep 29, 2024 at 16:54
  • 13
    \$\begingroup\$ May I ask why you ruled out PS/2 for not having an apparent clock? It is pretty apparent to me. \$\endgroup\$ Commented Sep 29, 2024 at 17:20
  • 3
    \$\begingroup\$ If your "pulse length" measurements are half-periods, then the clock frequency comes out at 12.5kHz, which would match PS/2 \$\endgroup\$ Commented Sep 30, 2024 at 12:25
  • \$\begingroup\$ Not an exact dupe, but similar: electronics.stackexchange.com/questions/80730/… ; seems to suggest that it's PS/2. \$\endgroup\$ Commented Sep 30, 2024 at 19:17

2 Answers 2

24
\$\begingroup\$

This is definitely the PS/2 mouse protocol. PS/2 transmits mouse motions as a series of 3-byte packets sent over a serial protocol with one start bit, eight data bits (LSB first), one odd parity bit, and one stop bit.

Either the host or device can pull the data (D0) or clock (D1) lines low. The host pulls the clock line low to inhibit communication (which might be happening on each stop bit). The device pulls the clock line low to transmit a bit.

In the zoomed-in picture you showed of a single 3-byte burst, you have:

  • First byte: start bit 0, data bits 00010000, parity bit 0, stop bit 1
  • Second byte: start bit 0, data bits 10000000, parity bit 0, stop bit 1
  • Third byte: start bit 0, data bits 00000000, parity bit 1, stop bit 1

Note that the data bits are written with LSB first, and the odd-parity bit is a 1 when there are an even number of data bits set, and a 0 otherwise.

Per this page describing the PS/2 mouse protocol, the first byte conveys flags: left/middle/right buttons (bits 0-2), always-1 bit (bit 3), x/y sign bits (bits 4-5), x/y overflow bits (bits 6-7). The second byte conveys the x delta (here, +1), and the third byte conveys the y delta (here, 0).

\$\endgroup\$
2
  • \$\begingroup\$ Let's see if I've understood correctly: the falling edge before mark "0" is the START bit. The first 8 falling edges after "0" are DATA bits. The falling edge after "1" is the PARITY bit and the next one is the STOP bit. The pulse marked "3" is a bit longer but that doesn't matter because it's only needed to prepare for the next byte after the next falling edge indicates the second START bit. So, did I understand everything correctly? \$\endgroup\$ Commented Oct 14, 2024 at 19:33
  • 1
    \$\begingroup\$ Yup, you’ve got it exactly. Data is latched on the falling edge. \$\endgroup\$ Commented Oct 15, 2024 at 2:59
28
\$\begingroup\$

As it is a touchpad mouse, one of the most popular protocol supported by those is the PS/2 mouse protocol. It does have an apparent clock.

It looks like there are 3-byte packets, each byte being transmitted from the touchpad as 11 clock pulses, with low start bit, 8 data bits, one parity bit, and a stop bit, which gets lengthened by the host to prevent sending of the next byte until it is ready for another byte.

\$\endgroup\$
11
  • 1
    \$\begingroup\$ I2C and SPI are used on touchpads. This started around the Intel Haswell generation (~2013) from what I've seen. \$\endgroup\$ Commented Sep 30, 2024 at 21:01
  • \$\begingroup\$ @user71659 I don't say they are impossible, just that many touchpads still support PS/2 even if other buses are supported. And that's not I2C or SPI in the logic analyzer picture. \$\endgroup\$ Commented Oct 1, 2024 at 4:18
  • 4
    \$\begingroup\$ @user71659 Who says you have to use that protocol on a 5V bus, you can use it on any voltage bus like UART. The protocol is a separate concept of used voltage. The protocol is still PS/2 regardless of voltage. I recently checked a few touchpads for a product and PS/2 was stll there among other protocols. \$\endgroup\$ Commented Oct 1, 2024 at 4:32
  • 3
    \$\begingroup\$ @user71659 But same applies for other interfacs too. PS/2, I2C and SPI are different logical protocols how to trasfer data, regardless of voltage. Like you said, for many years, the chips have not supported 5V directly so there have been level shifters used if you wanted to make e.g. an external 5V PS/2 interface. Anyway, the protocol in the logic capture is PS/2, regardless of what modern devices use the most, so my answer is correct. \$\endgroup\$ Commented Oct 1, 2024 at 6:14
  • 1
    \$\begingroup\$ @Wandering The keyboard controller has many things to do after receiving data from keyboard/mouse. Keyboard controller keeps the clock pulled low until it is ready for next byte. It can be something else too. If you write your own MCU code to receive it and have hundreds of MHz speed to move data around, your MCU can be as fast as you want. \$\endgroup\$ Commented Oct 19, 2024 at 10:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.