Wey MK06 without Connector Box

MMcM

18 Jun 2022, 16:34

The MK06 is a now obsolete KVM switching keyboard that can emulate a variety of trading keyboards. It is full-size, with three small LCD screens and two add-on keypads. The trading function keys tend to be garishly colored. The actual host connections, such as USB or PS2, as well as power for the keyboard, are on a separate Connector Box, of which there were several generations. As might be expected, they sometimes show up in the secondary market without a Connector Box. I happened on one like that from eBay and decided to get it working anyway.

It is built by GMK. Various technical details of the insides can be found here. By paying close attention to the manual there and to the menus in the keyboard's setup screens, it is possible to deduce the overall connection architecture.

The keyboard has 9 direct ports, implementing various hardware bit-serial protocols.
  • Port 1 TTL Clock/Data (AT/PS2)
  • Port 2 TTL Clock/Data (AT/PS2)
  • Port 3a TTL serial inverted (Sun)
  • Port 3b TTL serial inverted (Sun)
  • Port 4 RS-232
  • Port 5 RS-232
  • External Port RS-423
  • Host Port A RS-423
  • Host Port B RS-423
A Connector Box exposes the first 6 of these with appropriate connectors (mini-DIN, D-Sub).

Up to 14 virtual ports can be defined by assigning them a DLINK address using the keyboard's Setup menus. Again, a Connector Box would expose specific DLINK addresses as physical connectors (and inform what the menus call these ports). One of the 3 RS-423 ports then needs to be defined as the DLINK port, which communicates with the Connector Box to multiplex them.

16 workstations (WS) are selectable using special keys on the keyboard and assigned (not necessarily uniquely) to these various ports and then connected to the corresponding computer.

The main keyboard connector is a 36-pin mini-Centronics, also known as Half-Pitch Centronics (HPCN36) or Mini Delta Ribbon (MDR). It was once used by some HP printers and for a generation of SCSI cables. A typical cable will have 18 twisted pairs and the signals often come in pairs, as they mostly do here.

The keyboard also has:
  • 1 USB device port, implementing a CDC device (and not a keyboard)
  • 2 USB host ports, for plugging in a mouse and thumb drive
  • 1 PS2 mouse port
  • 1 headphone jack
  • 1 microphone jack
With all this in mind, one can trace out the connections.
  • 1, 19 Ground
  • 2, 20 Left Speaker
  • 3, 21 Host Port A (RXD, TXD)
  • 4, 22 Host Port B (RXD, TXD)
  • 5 Power (12VDC) 23 RES2
  • 6 RES1
  • 7 RES5 25 RES4
  • 2, 20 Right Speaker
  • 9, 27 Microphone
  • 10, 28 External Port (TXD, RXD)
  • 11 Ground
  • 12, 30 Port 1 (Clock, Data)
  • 13, 31 Port 2 (Clock, Data)
  • 14, 32 Port 3b (RXD, TXD)
  • 15, 33 Port 3a (RXD, TXD)
  • 16, 34 Port 5 (RXD, TXD)
  • 17, 35 Port 4 (RXD, TXD)
  • 18, 36 Power (12VDC)
Where RX/TX is always from the perspective of the keyboard. And RESn are settable GPIOs used for video switching by programming a per-WS bit pattern.

MMcM

18 Jun 2022, 16:36

The easiest way to interface without a Connector Box is using PS2. Get an MDR 36 male connector from AliExpress or eBay. Build a cable that gives 12VDC from a wall wart to the two ends of the connector (- 1,19, + 18,36) and wires a 6-pin mini-DIN male (cut up an old cable) to Port 1 Clock, Data, and Ground in the center (12, 30, 11). Then, if USB is required, use a dumb converter or Soarer's or TMK. Note: it is not practical to power the keyboard just from USB with a boost converter; it needs too much current.
Wey-PS2-adapter.jpg
Wey-PS2-adapter.jpg (834.57 KiB) Viewed 317 times
Wey-PS2-adapter-pieces.jpg
Wey-PS2-adapter-pieces.jpg (215.21 KiB) Viewed 317 times
Observe that this is just an adapter with appropriate connectors; there are no active components (except in the Soarer's).

Even though Port 2 is labeled on Connector Boxes for a mouse, it can also be assigned to a WS keyboard. This means that by connecting two DIN connectors to each of Port 1 and Port 2, it is possible to have two keyboards and switch between them.

If one already had a Sun converter, it could be connected to the inverted TTL serial Port 3. As might be expected, the baud rate isn't fixed to 1200 and the nominal keyboard and mouse ports can be assigned to anything.

MMcM

18 Jun 2022, 16:39

A converter specifically for the MK06 interfaces to one of the serial ports. This could be directly to Port 4 or Port 5 and so implementing a single workstation. More interesting is to implement the DLINK protocol and so work for multiple workstations, possibly with different layouts or function keys or macros. Even better is to also implement the Host Terminal protocol. DLINK multiplexes the actual keyboard / mouse data for a WS. But the Host is informed of which WS is active, allowing the converter to change layers in response, for instance.

Because of the RS-232 or RS-423 voltage levels, a transceiver like the MAX3232 is needed.

An 8-bit AVR like the Teensy 2.0 or Pro Micro is not a great choice, because it only has one UART. Also powering the MAX3232 with 5V means its driver will do ±10V, fine for RS-232, but out of spec for the RS-423 receiver chip in the keyboard, which is rated for ±7V. One of the QMK-supported 32-bit Teensies is fine: they have (at least) two UARTs, plus 3.3V power to the MAX3232 means ±6.6V. Teensy 3.2 is slightly better because it has a FIFO, which would enable running DLINK at a fast baud rate, and more program memory. But they are out of stock everywhere and NXP isn't planning to even start making the chips again until next year. So I just used a Teensy LC.

Concerns about baud rate turned out not to matter, as the External Port always runs at 9600, no matter what it is configured to, at least in the firmware I have here.
Wey-converter-open.jpg
Wey-converter-open.jpg (747.11 KiB) Viewed 315 times
Wey-converter-assembled.jpg
Wey-converter-assembled.jpg (417.83 KiB) Viewed 315 times

MMcM

18 Jun 2022, 16:44

The global chip shortage got me thinking, though, about going outside the QMK ecosystem to CircuitPython. So, here is one with an Itsy-Bitsy M4 Express using the Atmel SAMD51.
Wey-M4-converter.jpg
Wey-M4-converter.jpg (1.5 MiB) Viewed 305 times
Wey-M4-cable.jpg
Wey-M4-cable.jpg (521.86 KiB) Viewed 305 times
Wey-M4-converter-operating.jpg
Wey-M4-converter-operating.jpg (1.79 MiB) Viewed 305 times
Now suppose one actually wanted a KVM (well K+M) keyboard with multiple USB ports. It's hard to get actual USB driver chips without designing a new PCB. But there are small, cheap (under USD10), CircuitPython boards using the Atmel SAMD21, like the Seeed XIAO or Adafruit QT Py. For interfacing to these, there aren't enough additional UARTs, but there is I2C. Here one issue is that if the target chip isn't powered, because USB isn't plugged in, it kills the bus. But we've got plenty of power from the 12V line needed for the keyboard. Run it through a 7805 regulator and it can have each chip always powered. Add a 1N400x diode just in case.

Note that additionally powering the main converter MCU this way makes the Itsy-Bitsy M4 a better choice than the Feather because its BAT line is just a diode into the 3.3V regulator and not part of a charging circuit. Also #chipshortage.

Because there are a bunch of SoCs with the XIAO form factor, socket them to mix and match.
Wey-M4-KVM-empty.jpg
Wey-M4-KVM-empty.jpg (742.94 KiB) Viewed 305 times
Wey-M4-KVM.jpg
Wey-M4-KVM.jpg (691.5 KiB) Viewed 305 times
A little script on each little board forwards i2c requests from the converter to usb_hid.

Having gone this far, why not Bluetooth as well as USB to be able to interface to even more computers? I realize that BT keyboards usually have multiple profiles so one can switch between systems. But this is somewhat slow as it must disconnect and reconnect each time. And the spirit of a KVM is that the host thinks the keyboard is right there. In fact, the MK06 has a mode where it jiggles the mouse a little periodically on inactive workstations to keep the system from going to sleep.

Turns out there is no board that supports CircuitPython for both i2cperipheral (TWIS, now called "target") and BLE HID. Of boards with the necessary hardware available in this form factor, the nRF52840 lacks the peripheral support and the ESP32-S3 the GATT server support. These both should be able to have a port that auto switches between between BLE and USB when plugged in. Other possibilities requiring only CircuitPython software changes include the ESP32-C3, which lacks USB HID -- it just has Serial-to-USB, but still has BLE.

To get it working for now, and since the QT Py ESP32-S3 is out of stock, I put an Arduino sketch in an ESP32 Pico.
Wey-M4-KVM-QT-Py-ESP32-Pico.jpg
Wey-M4-KVM-QT-Py-ESP32-Pico.jpg (610.46 KiB) Viewed 305 times
Here it is in action. Green means the active port, in this case the BLE one. Yellow means connected but inactive, for one of the USB ports. The XIAO only has a yellow LED, no NeoPixel; so it only has on/off to indicate active/inactive.
Wey-MK04-KVM-operating.jpg
Wey-MK04-KVM-operating.jpg (235.96 KiB) Viewed 305 times

MMcM

18 Jun 2022, 16:45

In order to get all this working properly, the MK06 workstation needs to be configured to use the proper keycode table (KCT file). PCSIN001 is a good choice to start with: it has all the "standard" codes for the PC layout, which means that the translation to PS2 scan set 2 that happens on the TTL C/D ports will work. But it does not do add-on keys. It needs to be patched to identify the keypads (using the solder codes from §4.5 of manual) in bytes 0x023 and 0x024. And then the code mappings given in bytes 0x500-0x57F for the first add-on and 0x580-0x5FF for the second. Since it isn't possible to invent new scan codes for PS2 (neither the port mapping nor the USB converter will support them), it can be useful to have these keys defined as per-KCT macros, which start from 0xAC0 at the end of the file.

The legends on the LCD screens when a WS is active and their background colors come from the layer (LAY file). Pairs of bytes at 0x030 in the KCT give the layer index and page index within the layer. If a slot has no legend, a macro can be assigned to it using a recording feature of the setup menus.

There are still a number of features of the keyboard, mostly specific to particular emulators, such as alerts, that could be worked out.

ntv242ver2

19 Jun 2022, 00:11

Hi, just wanna pop by and say thank you for doing the work of God!! Sincerely, MK06 owner without a converter box.

User avatar
kbdfr
The Tiproman

19 Jun 2022, 08:15

I understand strictly nothing of all the technical stuff you describe, but getting those Wey keyboards to actually work is in fact a major accomplishment, congratulations.
Could you tell approximately how much money and time you invested?

User avatar
hellothere

23 Jun 2022, 04:19

kbdfr wrote:
19 Jun 2022, 08:15
I understand strictly nothing of all the technical stuff you describe, but getting those Wey keyboards to actually work is in fact a major accomplishment, congratulations.
Could you tell approximately how much money and time you invested?
+1 for interest.

Post Reply

Return to “Workshop”