How to decypher an old keyboard protocol? - Page 1
Forum section: electronics / projects

author: rodcastler
author_rank: Regular Contributor
timestamp: March 09, 2018, 06:00:01 pm
content: Hi,I want to revive this project I put to sleep after several attempts to decypher the keyboard protocol with no luck.It's an old brother WP-1 typewriter/word processor with a CRT monitor to edit text on it. It was with no keyboard around when I rescued it from the dumpster.Current behavior: Turn the unit on, and it shows "Keyboard error".Desired behavior: Plug an arduino to the serial keyboard connector and have it emulate keystrokes so the LCD screen shows activity. It's a beautiful CRT.Question: Where should I start in order to decypher the protocol?I attempted to throw standard PS/2 commands and other old serial keyb commands to it. I got the unit to beep but that's it: still keyboard error.More on the unit here:https://www.eevblog.com/forum/projects/driving-the-wide-format-crt-from-an-old-word-processor/msg723082/#msg723082

author: technix
author_rank: Super Contributor
timestamp: March 09, 2018, 06:11:58 pm
content: This is going to be a heck of a fuzz test. Maybe trace out the keyboard connector and its interface circuit first? Also disassemble the program code (if possible) to find out what it is trying to do?

author: tooki
author_rank: Super Contributor
timestamp: March 09, 2018, 11:04:57 pm
content: Quote from: rodcastler on March 09, 2018, 06:00:01 pmYikes. "Decipher" implies that you have the keyboard, and just need to figure out the encoding. But guessing it out of thin air? I'd call it nearly impossible.In the other discussion, somebody linked to a service manual. The link seems to be dead now, but maybe you can google it, or one of the people in that thread can send it to you. They said the service manual had everything, down to memory maps, so the info is probably there.

author: DC1MC
author_rank: Super Contributor
timestamp: March 09, 2018, 11:48:42 pm
content: Hi, if the unit displays "Keyboard Error" without the keyboard attached, that means there is a way for the keyboard chip to detect that it has a keyboard attached.Barring some sort of presence detector, like a signal that is pulled to ground when the keyboard is attached or something similar, that means the keyboard interface is bidirectional and the keyboard can be queried about its status and control commands can be send to turn on the LEDs on it and so on.You've said that you've traced the remains of the kb cable to two active signals, considering the above is either a standard serial interface, with tx/rx signals, and you need to see who is who, or some king of synchronous interface, with clock and data.First see for sure what kind of interface is, and then put a scope or logical analyzer on the signals to see the format of the message that the mainboard sends to the keyboard to detect it. You will get a hold of the protocol used, if it's an serial interface you will get the speed and line information ( bits per character, parity and so on) plus the signal levels, 5V TTL, RS-232 or something else.If it's a custom interface, at least you'll see which one is the clock signal and what speeds are uses, as well as the message format.Do this first, make sure that you've got ALL the signals on the keyboard cable and really you've got just 2 of them to take care off, verify the levels and record what is happening at power-up, what iti is send to the keyboard.Then and only then you can thing of a way to communicate with the unit, just blasting stuff on it with protocols that were not invented at the time (PS2) is an exercise in uselessness, as you have observed.Best of luck,DC1MC

author: TerraHertz
author_rank: Super Contributor
timestamp: March 10, 2018, 12:04:35 am
content: Plan of attack:1. Trace the circuitry relevant to the keyboard interface. From the keyboard plug, right back to the system CPU.2. From that, work out what IO address range is used for keyboard interface.3. Extract the system firmware code, to a binary file.4. Examine code in a hex editor. Is it sensible op codes for the system processor? Can you identify the reset start point and interrupt vectors? Is almost all the binary in machine code, or is there something more complicated going on, like a byte-code interpreter or encrypted/compressed sections?5. Obtain disassembler utility for the CPU type.6. First pass disassemble all the code.7. Search for any mention of the keyboard IO addresses.8. Comment and refine the disassembled code related to the keyboard, until you understand it.There will be several segments: verify present, initialize, operational protocol.If you think any of those stages are not possible for any reason, then your only other alternative is to try and find an intact system, and capture the interface activity during normal operation. Then work from that.Otherwise, give up.

author: rodcastler
author_rank: Regular Contributor
timestamp: March 10, 2018, 12:55:41 pm
content: All of you bring super interesting ideas, but I'm afraid they are beyond my current limitations of equipment, knowledge and time.I remember going as far as clearly identifying the clock line and the data line. It was most likely a bi-directional communication pretty much like PS/2. (BTW user DC1MC made me remember that I was indeed aware that this machine came before the PS/2 protocol. I tried different protocols including PS/2 just to see the effects.I think it's time to drop this effort and see if I can drive the CRT instead of the keyboard interface. User tooki brings a good point about guessing out of thin air. I did get a hold of the service manual at one point, but it had nothing on the keyboard but replacing it when facing any errors.Thank you!

author: ahbushnell
author_rank: Frequent Contributor
timestamp: March 10, 2018, 08:20:52 pm
content: Quote from: rodcastler on March 10, 2018, 12:55:41 pmBuy a key board and measure the output.

author: abyrvalg
author_rank: Frequent Contributor
timestamp: March 11, 2018, 12:41:31 am
content: Can you dump the ROM and post it?

author: james_s
author_rank: Super Contributor
timestamp: March 11, 2018, 06:19:53 am
content: Looking at a picture of the WP-1 jogged my memory, I think I might actually have one of those over at my mom's place, I remember there being an old word processor with a funky wide aspect ratio mono CRT. I'm planning to go over there tomorrow so I'll try to remember to look around for it. Shouldn't be too hard to scope the keyboard signal.

author: DBecker
author_rank: Frequent Contributor
timestamp: March 11, 2018, 09:14:57 pm
content: Google suggests that is a 1985-era machine.I expect that they used something similar to the PC-XT keyboard hardware and protocol, with different scan code for gratuitous incompatibility.What is the frequency of the data clock?

author: rodcastler
author_rank: Regular Contributor
timestamp: March 12, 2018, 03:14:19 am
content: Quote from: james_s on March 11, 2018, 06:19:53 amYou need to take the unit apart in order to access the keyboard connector. there is a metal cover on the underside. I can’t remember for sure if there was access to it from there, in which case it would indeed be easy.

author: james_s
author_rank: Super Contributor
timestamp: March 12, 2018, 03:17:38 am
content: Well shoot, I knew I was forgetting something while I was over there, I'll set a reminder to grab it next time I drop by.

author: rodcastler
author_rank: Regular Contributor
timestamp: March 13, 2018, 02:53:04 pm
content: I appreciate the intention. Please bear in mind that later models had the keyboard matrix fed into the main CPU which is not my case.WP-1 looks like this: