Keypad from early laptop with TR plug
Posted: 20 Sep 2020, 22:03
This is an external keypad for a Toshiba T1000/T1200 8086 laptop.
So, the idea seems to be that mostly the single wire provides power, except that sometimes it switches over to bidirectional data.
Too much current is required to just drive off a GPIO like a Dallas one-wire sensor. And since signal ground needs to be kept intact, high-side switching is needed. The GPIO voltage is the same as the switched voltage and all the currents are pretty modest, so a generic (2N3906) PNP transistor should work.
There is otherwise no real question of what other signals need to be connected how. I tried a Piksey Atto for this build. The castellated vias are a little fussier, but only a few signals are really needed. An extra jumper is in lieu of a reset switch.
Start out with a loop that periodically (every 20ms) cuts power, pulls down the data line for a bit to wake up the controller, then switches to input to see what we get.
When no keypad is connected, the input pullup brings the line back up until we stop waiting. With the keypad plugged in but idle, it's pulled down again briefly, which is promising. Set up some code to filter out that idle pattern and trigger (via another temporary output pin) and indeed some real data starts to appear. The first thing that jumps out is that the number of level transitions is fixed. So this isn't a regular mark/space kind of serial encoding.
Concentrating on the bit in the middle, there are eight pairs, each in one of two patterns: long-short (around 250us low, 150us high) and short-long (around 100us low, 300us high).
7, 8, and 9 sure look like they are counting their own digit, with long-short as zero and short-long as one. In which case, they are 47, 48, and 49 for the whole scan code. And 1, 2, 3 are 4F, 50, 51. Now those codes should be familiar, since they match the XT scan codes. This is further confirmed by that fact that both / and Enter send E0. Some of the numpad keys had that prefix to distinguish from other keys in the main typewriter section.
Now a more complicated program is needed to be able to see more than one non-idle transaction. With that, Enter is confirmed as E0 1C. And we see that there are break codes with the eighth bit set, per the XT protocol. So that's nice. This borrowing of codes makes sense, since the laptop would want to merge the external keypad with the attached keyboard in the BIOS so that DOS just sees a single keyboard. And the MCS-48 has plenty of cycles to encode it.
All of this is enough for a QMK implementation.
Looking around, it appears that some late-80s / early-90s Compaq laptops also had an external keypad with a 2.5mm audio plug. I wonder whether this is the same or similar Mitsumi circuit. The keypads seem to be cheap enough on eBay that I can get one and see.
It is model PA7354E and from around 1987.
It has Mitsumi switches, so it's okay for the time, but nothing special. What is unusual is how it connected to the motherboard. It has a 2.5mm mono sub-mini audio plug. That is, there are only two wires.
Inside, the PCB is about 80% a regular keyboard, with switches and diodes in a matrix with pull-ups, connected to a microprocessor and a hex inverter.
Cols are on the DB port and rows on P1. The data line (the only one in this case) is connected to -INT and P24.
The MCU is a Toshiba TMP80C48AP, a somewhat lower-power version of an MCS-48.
Things get different around the connector and power circuits. There are some extra diodes and some pretty hefty capacitors. And a special TO-92 IC (Mitsumi T520H) for resetting when power fluctuates.So, the idea seems to be that mostly the single wire provides power, except that sometimes it switches over to bidirectional data.
Too much current is required to just drive off a GPIO like a Dallas one-wire sensor. And since signal ground needs to be kept intact, high-side switching is needed. The GPIO voltage is the same as the switched voltage and all the currents are pretty modest, so a generic (2N3906) PNP transistor should work.
There is otherwise no real question of what other signals need to be connected how. I tried a Piksey Atto for this build. The castellated vias are a little fussier, but only a few signals are really needed. An extra jumper is in lieu of a reset switch.
Start out with a loop that periodically (every 20ms) cuts power, pulls down the data line for a bit to wake up the controller, then switches to input to see what we get.
When no keypad is connected, the input pullup brings the line back up until we stop waiting. With the keypad plugged in but idle, it's pulled down again briefly, which is promising. Set up some code to filter out that idle pattern and trigger (via another temporary output pin) and indeed some real data starts to appear. The first thing that jumps out is that the number of level transitions is fixed. So this isn't a regular mark/space kind of serial encoding.
Concentrating on the bit in the middle, there are eight pairs, each in one of two patterns: long-short (around 250us low, 150us high) and short-long (around 100us low, 300us high).
7, 8, and 9 sure look like they are counting their own digit, with long-short as zero and short-long as one. In which case, they are 47, 48, and 49 for the whole scan code. And 1, 2, 3 are 4F, 50, 51. Now those codes should be familiar, since they match the XT scan codes. This is further confirmed by that fact that both / and Enter send E0. Some of the numpad keys had that prefix to distinguish from other keys in the main typewriter section.
Now a more complicated program is needed to be able to see more than one non-idle transaction. With that, Enter is confirmed as E0 1C. And we see that there are break codes with the eighth bit set, per the XT protocol. So that's nice. This borrowing of codes makes sense, since the laptop would want to merge the external keypad with the attached keyboard in the BIOS so that DOS just sees a single keyboard. And the MCS-48 has plenty of cycles to encode it.
All of this is enough for a QMK implementation.
Looking around, it appears that some late-80s / early-90s Compaq laptops also had an external keypad with a 2.5mm audio plug. I wonder whether this is the same or similar Mitsumi circuit. The keypads seem to be cheap enough on eBay that I can get one and see.