geekhack Projects > Making Stuff Together!

TMK IBM PC Keyboard Converter

(1/56) > >>

hasu:
IBM PC Keyboard Converter

The converter translates IBM PC keyboard protocols into USB to use classic keyboards with modern computer. It supports both IBM XT and AT protocols(including PS/2 and Terminal), and all of scan code set 1, 2 and 3 with one firmware.

Pin configuration is compatible for Soarer's, this firmaware works on existent Soarer's converter hardwares.

This project is intended to integrate and supersede existent TMK XT, PS/2 and Terminal converters.
- IBM XT converter: https://geekhack.org/index.php?topic=94649.0
- PS/2 converter: https://geekhack.org/index.php?topic=14618.0
- IBM Terminal converter: http://geekhack.org/index.php?topic=27272.0

You can buy  preassembled TMK converter here to support this project.

Thanks



Trouble Shoot
Check these first if you have a problem.

- Check your wiring 100 times if you are using your own DIY converter
- Pull-up resistors
- Reset pin(for XT keyboards)
- Use TMK 'Default Prebuilt Firmware'



Update
2023-10-27 Add support for hot keys of Silitek SK-7100P
2023-06-16 Add support for 'TERM FUNC' key on Siemens F500 in AT protocol
2023-02-17 Fix for XT startup problem
2022-09-08 Add support for SIEMENS PCD 2 Keyboard. Make 'Magic commands' enabled again.
2022-08-20  Fix keymap editor layout for Full-key: All hidden keys of IBM Model-M are supported now
2022-07-22 Confirm support and fix for IBM 5576-002
2021-11-08 Add support for AX keyboard
2021-11-06 Add support for Televideo DEC style keyboard
2021-10-28 Update: Add AT/XT auto-switching support, parity error detection, ConnectPro KVM support
2021-08-17 Fix XT keymap for ISO key.
2021-07-07 Add support for secondary interface and PS/2 Mouse(IntelliMouse, ExplorerMouse and Logitech PS/2++ too)
2021-06-03 Add support for Zenith Z-150 AT, IBM 5576-001(ID:AB92) and IBM 1394204(ID:7F7F)
2020-11-22 Add adhoc Z-150 AT support(Let me know your result)
2020-11-22 Fix Pause key for enhanced XT keyboard
2020-07-05 Fix for Timeout error(ERR:20)
2020-07-02 Add support for hidden keys of IBM AT 84-key to Editor
2020-06-03 Improvement for XT protocol and keyboard error recovery
2020-05-11 Add handler for keyboard buffer full to prevent key stuck
2020-05-11 Add adhoc start bit error recovery for XT keyboards
2020-04-28 Add support G80-2551 and possibly other terminal keyboards(whose id is AB86)
2020-04-11 Keymap Editor is available
2020-03-02 firmware update for XT protocol handling and many other fixes



REQUEST FOR HELP
Test in the field and feedback from users are needed to improve this converter.
Please report your result and your keyboard model number.
Also debug outputs on hid_listen would be helpful to know how keyboard is recognized.

The converter needs to be tested especially with these keyboards:
- IBM 5576-002/003 - Please report your result. Also check this and Code Set 2 table.
- Copam K-430 (supported now)
- IBM 5576-001 Supported now!  2021-06-01
- Zenith Z-150 AT (supported now)
- Zenith Z-150 XT black label (supported now)
- IBM PC XT 83-key (supported now)
- IBM PC AT 84-key (supported now)
- IBM RT to add LED support
(Let me know if you still have any issue)



Keyboard support
- PC XT (keyboard of IBM 5150 5160)
  - 83-key: 1501100 1501105
- PC AT (keyboard of IBM 5170)
  - 84-key: 6450200 6450225
- PC Terminal (keyboard of IBM 5271/3270 PC)
  - 122-key: 6110344 6110345 1397000
  - 102-key: 1390680 1395764 1392595
- Other compatible keyboards (see below)

Confirmed Keyboards
Let me know if you find any issue with these keyboards using the latest firmware.

XT Keyboards
- IBM PC XT 83-key: 4584656, 2020-06-02, 2023-02-17
- Leading Edge DC-2014
- KeyTronic E03600 XT/AT (after Timeout error Fix)
- Zenith Z-150 XT, black label, Heath(92-803)
- Chicony KB-5191 in XT mode
- Focus FK-2001
- Siemens F500 XT(2020-11)
- Sanyo N860-2905
- Commodore G80-0560/e (PC-5/PC-10)

AT(PS/2) Keyboards
- IBM PC AT 84-key,
- DS-2001,
- Northgate Omnikey
- KeyTronic E03600 XT/AT
- DTK SPK 101
- FK-8000
- Focus FK-2001
- Siemens S26381-K257-L120 (Some keys may be not useful.)
- SIEMENS PCD 2 Keyboard (Weirdness)
- APC-H410E
- Toshiba JIS AT101
- Dell AT101 - GYI3PVAT101
- Wang 724
- Unicomp Model M
- IBM P70 Keyboard
- Zenith Z-150 AT #661 OK
- Focus FK-2002
- AX keyboard (Refer to mapping)
- Tandberg TDV 5020 (Refer to mapping)
- IBM 5576-002
- Siemens F500 AT(2023-06)
- Unknown DEC compatible with MiniDIN-6P
-  Silitek SK-7100P

Terminal Keyboards
- IBM 122-key Terminal: 6110345, 6111070, 6110344, 1390702(Model M)
- Cherry G80-2551
- IBM 5576-001
- IBM 1394204 101-key (Use 122-key layout on Keymap Editor and see this for mapping.)
- Televideo DEC style (Use Full-key layout on Keymap Editor and see this for mapping.)
- IBM RT should work. (Use 122-key layout on Keymap Editor and see this for mapping.) - No LED support yet. See 'REQUEST FOR HELP' above and help me.

AT/XT Keyboards
- RT8255c+
- RT-101+
- C260 Enhanced Keyboard (Deyi foam and foil)
- Northgate Omnikey 101
- Zenith ZKB-2
- BTC-5161 - Part number: BTC5339  (AT/XT Auto-Switch, works as AT)
- NTC KB-6252EA
- Copam K-430 (AT/XT Auto-Switch, works as AT)








Keymap Editor
You can edit keymap on web browser and download the latest prebuilt firmware here.

http://www.tmk-kbd.com/tmk_keyboard/editor/#ibmpc_usb



Flash
Check this about how to flash firmware.
https://github.com/tmk/tmk_keyboard/wiki#flash-firmware



Firmware
Source code: https://github.com/tmk/tmk_keyboard/tree/master
See project README also. https://github.com/tmk/tmk_keyboard/tree/master/converter/ibmpc_usb

Default Prebuilt Firmware
You can download the latest prebuilt firmware with default keymap here.
https://github.com/tmk/tmk_keyboard/tree/master/converter/ibmpc_usb/binary

Build Firmware
If you are not familiar to these things use Keymap Editor.

--- Code: ---git clone https://github.com/tmk/tmk_keyboard.git
cd converter/ibmpc_usb
make -f Makefile.<variant> clean
make -f Makefile.<variant>

--- End code ---
where <variant> is atmega32u2, atmega32u4 or at90usb1286.
You will see firmware hex file in the directory.
Check this page as well. https://github.com/tmk/tmk_keyboard/wiki#build-firmware

Build Options:
These options in Makefile makes firmware size lager and you can disable these to reduce its size.
- `IBMPC_SECONDARY` - enables secondary interface for converter with PS/2 Mini-DIN-6 connector
- `IBMPC_MOUSE_ENABLE` - enables PS/2 mouse support




Converter Hardware
The firmware supports ATmega32u4, ATmega32u2, AT90USB1286 by default, Teensy2/2++ or Pro Micro can be used.

Wiring
Wire controller pins below to keyboard signals, besides VCC and GND. This pin configuration is compatible for Soarer's converter.

Pull-up resistors of 1-4.7K Ohm on both Data and Clock line are needed absolutely, without them it won't work in some cases.

- Data    PD0
- Clock   PD1
- Reset   PB7(or PB6 for Pro Micro)

Optional secondary interface for PS/2 connector uses these pins.
- Data2    PD2
- Clock2   PD3

See this wiki for pull-up resistor.


AT/XT DIN-5P(180-deg)

Female socket from the front:
     .---. .---.
    /    |_|    \
   /             \    1: Clock
  | 3           1 |   2: Data
  | o  5     4  o |   3: Reset
   \  o   2   o  /    4: GND
    \     o     /     5: 5V
     `--.___,--'


For XT keyboards connect the Reset pin. AT keyboards don't require the Reset pin. But it won't harm for AT keyboards so you can make your converter compatible with all of AT and XT keyboards by wiring the Reset pin.
Old Type-1 IBM XT keyboards need Reset pin to initialize its controller on startup. Also some clones such as Zenith Z-150 XT and  Leading Edge DC-2014 are known to need it. Type-2 IBM XT keyboard and other XT clones can work without the Reset, though.

- https://web.archive.org/web/20191117093845if_/http://www.kbdbabel.org/conn/kbd_connector_ibmpc.png
- https://allpinouts.org/pinouts/connectors/input_device/keyboard-xt-5-pin/
- https://old.pinouts.ru/InputCables/KeyboardPC5_pinout.shtml


AT SDL connector
See https://github.com/tmk/tmk_keyboard/wiki/IBM-PC-AT-Keyboard-Protocol#at---din-5p-180-sdl


PS/2 MiniDIN-6P

Female socket from the front:
      ,--_--.       1: Data
     / o6 5o \      2: Data2
    | o4   3o |     3: GND
     - 2o o1 -      4: VCC
      `-___-'       5: Clock
                    6: Clock2


Data2 and Clock2 are optional for secondary device(Dual device support).

- https://github.com/tmk/tmk_keyboard/wiki/IBM-PC-AT-Keyboard-Protocol#ps2---mini-din-6p
- http://www.kbdbabel.org/conn/kbd_connector_ps2.png
- https://web.archive.org/web/20200422034207if_/http://www.kbdbabel.org/conn/kbd_connector_ibm_m.png
- https://pinouts.ru/InputCables/KeyboardPC6_pinout.shtml


Terminal DIN 5P 240°, RJ-45(8P5C)

- http://www.kbdbabel.org/conn/kbd_connector_ibm3179_318x_319x.png
- http://www.kbdbabel.org/conn/kbd_connector_ibmterm.png
- http://www.kbdbabel.org/conn/kbd_connector_ibmrt.png (IBM RT)




Pro Micro Caveat
Pro Micro is not recommended unless you are already familiar or have skill and time enough.
Don't ask Pro Micro specific question/help here like which pins to be used and how to flash.
MoreYou have to use VCC pin to power your keyboard, not RAW pin.
RAW pin is not for 5V power supply directly from USB line. The name may be confusing but it is used for external power input, not output. You get only around 4.6V due to protection diode(D2 in schematic) forward voltage drop(0.4V typically) on RAW pin.
And you have to make J1 solder bridged, without this you will get same voltage as RAW pin or lower.
With J1 solder bridge you can get raw power(possibly 5V) directly from USB line on VCC pin. Note that RAW pin doesn't give 5V even with the solder bridge.
Check this wiki for detail. https://github.com/tmk/tmk_keyboard/wiki/Pro-Micro#j1-solder-bridge

PD0, PD1 and PB6 are maked on Pro Micro PCB as 3, 2 and 10 respectively.

https://github.com/tmk/tmk_keyboard/wiki/Pro-Micro#pinout








Debug
Use hid_listen to see debug outputs from the converter.

https://github.com/tmk/tmk_keyboard/wiki#debug

You will see debug ouputs like this.

--- Code: ---TMK:95aba6dd/LUFA

USB configured.

Keyboard start.
rAA rBF rBF wF5 rFA wF2 rFA rBF rBF wF4 rFA ID: BFBF
kbd: Terminal
wF8 rFA 

--- End code ---


Scan Code Map
https://github.com/tmk/tmk_keyboard/wiki/IBM-PC-Keyboard-Converter#default-mapping

Check this default mapping if your keyboard is not consistent with keymapping code or Keymap Editor layout.
Use hid_listen to see scan code of questioned key and find it in the default mapping table.

Sigrok Decoder
You can use this protocol deocoder with sigrok PulseView to see commands and data for debug. The docoder supports only AT protocol, not XT at this time.
MoreCheap $10-20 logic analyzer that is compatible with sigrok works well for this job. Get one and try. 1MHz sample rate is actually good enough for the protocol.

https://github.com/tmk/tmk_keyboard/wiki/Signal-Capture-for-debug#sigrok


Or instead of using logic analyzer you can use 'Signal Capture' firmware on your converter hardware to capture signal(this won't always work). See below.


Signal Capture Firmware
With this firmware you can capture signals from keyboards without logic analzyer.

https://github.com/tmk/tmk_keyboard/wiki/Signal-Capture-for-debug/#signal-capture-firmware




Issues
Let me know here or on github if you have any problem.
https://github.com/tmk/tmk_keyboard/issues







Media keys support
Media keys are mapped to F13-F24 by default. You can remap on Keymap Editor.

Check this wiki entry.
https://github.com/tmk/tmk_keyboard/wiki/IBM-PC-Keyboard-Converter#media-keys



Mouse support
Default firmware is built with Mouse support. Just plug mouse to PS/2 converter or AT/XT converter using adapter.

- PS/2 mouse protocols are also supported now. 2021-08
  - Default mouse - 3-button
  - IntelliMouse - 3-button with v-wheel
  - ExplorerMouse - 5-button with v-wheel
  - Logitech PS/2++ - 8-button with v and h-wheel

Confirmed Mouses
- Logitech MX510



Dual device support
Supported only by PS/2 converter. To use secondary interface you need Y-splitter cable.
You can host two devices at same time regardless of any combination(keyboard/mouse, 2 keyboards or 2 mouses).



AT/XT protocol auto-switching keyboard
Some keyboards support both AT and XT protocol and can detect host protocol automatically without physical switch.  TMK IBMPC converter selects AT protocol in preference to XT with such keyboards.
https://github.com/tmk/tmk_keyboard/wiki/IBM-PC-Keyboard-Converter#atxt-auto-switching




Converter Implementation and Protocol Considerations
Check TMK wiki pages.
- https://github.com/tmk/tmk_keyboard/wiki/IBM-PC-Keyboard-Converter
- https://github.com/tmk/tmk_keyboard/wiki/IBM-PC-XT-Keyboard-Protocol
- https://github.com/tmk/tmk_keyboard/wiki/IBM-PC-AT-Keyboard-Protocol



Solved Issues:
MoreIBM PC XT 83-key:
- Random issues show up.
https://geekhack.org/index.php?topic=103648.msg2898287#msg2898287
https://github.com/tmk/tmk_keyboard/issues/635#issuecomment-626363659
https://github.com/tmk/tmk_keyboard/issues/635#issuecomment-626346945
It was hardware issue probably. 2020-05-14

- miss start bit(0) and register wrong key
https://github.com/tmk/tmk_keyboard/issues/635#issuecomment-626249036
https://github.com/tmk/tmk_keyboard/wiki/IBM-PC-XT-Keyboard-Protocol#note-for-start0

https://github.com/tmk/tmk_keyboard/commit/7c3b669e6f7f449fa4ae58e028fcd07182cafa99
https://github.com/tmk/tmk_keyboard/issues/635#issuecomment-627397611
Updated firmware and solved. Use the latest firmware. 2020-05-14

https://github.com/tmk/tmk_keyboard/issues/635#issuecomment-636972917
Updated firmware for further improvemtn. 2020-06-03


Zenith Z-150 AT:
- Start bit and ACK when sedinging data

Detailed Issue Description:
- https://github.com/tmk/tmk_keyboard/issues/661
- https://github.com/tmk/tmk_keyboard/wiki/IBM-PC-AT-Keyboard-Protocol#zenith-z-150-at

hasu:
anyone? please check first post.



--- Quote ---REQUEST FOR HELP: Try and report your result.
Post your keyboard model number here, also debug outputs on hid_listen would be helpful.

--- End quote ---

Maledicted:
I have a few ATMega32u4s sitting around waiting to be turned into Soarer's Converters, and probably the necessary resistors. I have both the standard IBM Model F XT, and AT. I also have some AT/XT switchable Uniteks and a DC-2014, although it already currently has a Soarer's converter I built inside of it. I know a guy that has an old RJ11 Wyse too (among other old weird things), if any of that may be helpful for testing.

What exactly is it that you wish to accomplish? An open-source alternative to Soarer's Converter? I would think that the AT/PS2 keyboards should all work just about the same, right? My F AT works with modern systems with a 5 pin din to PS2 adapter. There's certainly no shortage of random old PS2 boards that must be available to you.

hasu:

--- Quote from: Maledicted on Mon, 06 January 2020, 12:00:47 ---I have a few ATMega32u4s sitting around waiting to be turned into Soarer's Converters, and probably the necessary resistors. I have both the standard IBM Model F XT, and AT. I also have some AT/XT switchable Uniteks and a DC-2014, although it already currently has a Soarer's converter I built inside of it. I know a guy that has an old RJ11 Wyse too (among other old weird things), if any of that may be helpful for testing.

--- End quote ---
Report on those keyobards would be definitely helpful. As for DC-2014 this firmware is compatible to Soarer's hardware you can just program it to test. This doesn't break your existent keymap settings of in eeprom, so you just need to program Soarer's firmware again to restore.

I really want to know my firmware with the IBM model F AT and XT(I don't own any unfortunately), they are very original and legitimate test samples for the keyboard  protocols.

I don't know much about RJ11 Wyse but I guess some of them uses Wyse specific protocol, not AT or XT.


--- Quote ---What exactly is it that you wish to accomplish? An open-source alternative to Soarer's Converter? I would think that the AT/PS2 keyboards should all work just about the same, right? My F AT works with modern systems with a 5 pin din to PS2 adapter. There's certainly no shortage of random old PS2 boards that must be available to you.

--- End quote ---

Yes, I like to make this useful open-source converter and I will have to improve it.
I believe that there are still unexpected behaviours of keyboards and bugs on my code that cuases problems. It is difficult to find them without testing with real keyboards.

hasu:
I tested with IBM 122-key Terminal 6110345 and it worked well.

The converter recognizes like below.

--- Quote ---Waiting for new device:.......
Listening:


TMK:5a759850/LUFA


USB configured.

Keyboard start.
err: 2A
rAA rBF rBF wF5 rFA wF2 rFA rBF rBF wF4 rFA ID: BFBF
kbd: Terminal
wF8 rFA r3B rF0 r3B r3B rF0 r3B r3B rF0 r3B

--- End quote ---

Navigation

[0] Message Index

[#] Next page

Go to full version