HP HIL - mcaple/tmk_keyboard GitHub Wiki
HP-HIL
https://en.wikipedia.org/wiki/HIL_bus
http://www.hparchive.com/Journals/HPJ-1987-06.pdf
HP-HIL Technical Reference Manual
SDL Receptacle
two types of SDL receptacles are used in the HP-HIL system: "A" and "E" keying configurations. To identify the keying of a receptacle, two methods are used. First, the receptacles usually will have an "A" or "E" visible on the outside back or on the inside back (difficult to see when present). Second, the "A" keyed receptacles are now molded in white plastic, while the "E" keyed receptacles are black.
The HP part numbers for the SOL receptacles are as follows:
"A" Keying, White, Female SDL: AMP PIN 1-520192-1
"E" Keying, Black, Female SDL: AMP PIN 5-520791-1
Interconnection Cable
The pinouts and connections of HP-HIL cables are shown in Figure 2-4. As with the receptacles, the plugs are molded in colors to denote keying. Clear plugs are "All keyed, and correspond to white receptacles. Smoke colored plugs are "E" keyed and correspond to black receptacles.
https://en.wikipedia.org/wiki/Shielded_data_link_connector
SDL Plug
https://www.te.com/global-en/product-1-1761184-1.html
Frame
The command bit distinguishes a command from data. The address field indicates the destination device in a frame sent by the main processor, or the source device in a frame sent by a device. A universal address (000) is used to send a single command to all devices. The a-bit data field contains the opcode for a command, or a bits of data.
HP-HIL communication is a simple asynchronous serial protocol between the main processor and the input device. Information travels asynchronously in the Link in a fixed format called a "frame." Each frame cons ists of 15 bits of information including start, stop, command, parity, address, and data bits. Information packets are transmitted around the Link at the rate of 10 microseconds per bit, or 150 microseconds per frame. The idle state of the Link is a logic "1", with the first bit in a frame (the start bit) at logic "0" and the last bit (the stop bit) at logic "1." The parity bit is computed so that the total number of logic "1" bits in the 15-bit frame (including start, address, command, data, parity, and stop) is odd.
The SLC can receive a new frame every 153 microseconds and transmit a frame every 154 microseconds. This implies a minimum required idle period of 3 microseconds between receiving frames and a minimum of 4 microseconds between sending frames.
HIL Commands
p.4-2
In general, commands are always initiated by the System, although certain commands (described later) may be initiated by a device under the proper conditions. Unless otherwise noted, all commands will by definition be returned to the System (assuming a properly configured Link), preceded by any data reported by the addressed devices. Only one command should be pending on the Link at anyone time; hence the System should always wait for either the command to return or a sufficient period of time so as to indicate that no response is forthcoming before the next transmission. HP-HIL devices are allowed up to 500 microseconds per frame to transmit their response after receiving a command.
Opcode | Mnemonic | Description |
---|---|---|
00h | IFC | Interface Clear |
01h | EPT | Enter Pass-ThruMode |
02h | ELB | Enter Loop-Back Mode |
03h | IDD | Identify and Describe |
04h | DSR | Device Soft Reset |
05h | PST | Perform Self Test |
06h | RRG | Read Register |
07h | WRG | Write Register |
08 .. 0Fh | ACF | Auto Configure |
10 .. 1Fh | POL | Poll |
20 .. 2Fh | RPL | RePoll |
30h | RNM | Report Name |
31h | RST | Report Status |
32h | EXD | Extended Describe |
33h | RSC | Report Security Code |
34 .. 3Ch | RESERVED FOR FUTURE USE | |
3Dh | DKA | Disable Keyswitch AutoRepeat |
3Eh | EKl | Enable Keyswitch AutoRepeat, cursor key repeat rate = 1/30 second * |
3Fh | EK2 | Enable Keyswitch AutoRepeat, cursor key repeat rate = 1/60 second * |
40 .. 46h | PR1 .. PR7 | Prompt 1 •. Prompt 7 |
47h | PRM | Prompt (General Purpose) |
48 .. 4Eh | AK1 .. AK7 | Acknowledge 1 .. Acknowledge 7 |
4Fh | ACK | Acknowledge (General Purpose) |
50 .. 7Fh | RESERVED FOR FUTURE USE | |
80 .. EFh | Device-Specific Commands | |
F0 .. F9h | RESERVED FOR FUTURE USE | |
FAh | RIO | Register I/O Error |
FBh | SHR | System Hard Reset |
FCh | TER | Transmission Error |
FDh | CAE | Configuration Address Error |
FEh | DHR | Device Hard Reset |
FFh | RESERVED - Prohibited Opcode |
DHR(DEVICE HARD RESET) FEh
This command provides a full reset to attached devices, destroying the Link configuration along with any pending device data. Device Hard Reset is used to return devices to their condition at power-up.
Timeouts: 200 ms (devices must perform self-test).
ACF(AUTO CONFIGURE) 08h
Auto Configure is used to assign unique addresses to each device configured onto the Link, up to the maximum of seven devices.
Timeouts: 10 ms (multiple devices may respond).
Command:
addr | cmd | data |
---|---|---|
000 | 1 | 08h + 1(first addr) |
Response:
addr | cmd | data |
---|---|---|
000 | 0 | 08h + <incremented addr[0-7]> |
In 'Incremented addr': 1 means there is no device, 0 means there are seven devices.
CAE(FDh) is received when there are too many devices on the Link?
IFC(INTERFACE CLEAR) 00h
The primary function of the command is to clear Power-Up Mode in devices and to verify the Link integrity. Configuration information is not affected by IFC. Upon rece1v1ng the command, each device will clear Power-Up Mode, and retransmit the command as received.
Timeouts: 10 ms (Multiple devices may respond).
IDD(IDENTIFIY AND DESCRIBE) 03h
Identify and Describe is used by the System to determine the type of the attached devices, as well as some general characteristics of these devices required to understand the data they report.
Timeouts: 10 ms (device may respond with data).
Response:
addr | cmd | data |
---|---|---|
AAA | 0 | Device ID |
AAA | 0 | Describe Record (1-10 bytes) |
AAA | 1 | 03h |
Describe Records:
Describe Record Header
# Counts / cm(m) Low Byte
# Counts / cm(m) High Byte
Maximum Count X-axis Low Byte
Maximum Count X-axis High Byte
Maximum Count Y-axis Low Byte
Maximum Count Y-axis High Byte
Maximum Count Z-axis Low Byte
Maximum Count Z-axis High Byte
I/O Descriptor Byte
Describe Record Header:
bit7: Set if two independ sets of coordinate axes(two joysticks for example)
bit6: Set if data is absolute position
bit5: Set if data is 16-bits/axis
bit4: Set if I/O Descriptor Byte follows(button, proximity detection, prompt/acknowledge)
bit3: Set if 'Extended Describe' is supported
bit2: Sef if 'Report Security Code' is supported
bit1,0: Number of axes
I/O Descriptor Byte:
bit7: Set if the device has Prompt and Acknowlege function
bit6-4: Number of Prompt and Acknowlege function
bit3: Set if the device has Proximity detection
bit2-0: Number of Button
EXD(EXTENDED DESCRIBE) 32h
Extended Describe provides additional information concerning more advanced device features which may not be required for basic operation.
Timeouts: 10ms(device may respond with data).
Response:
addr | cmd | data |
---|---|---|
AAA | 0 | Extended Describe Record (1-6 bytes) |
AAA | 1 | 32h |
Extended Describe Record:
Extended Describe Record Header
Maximum Read Register Supported
Maximum Write Register Supported
Maximum Write Buffer Length Low Byte
Maximum Write Buffer Length Hight Byte
Localization Code
Extended Describe Record Header:
bit7: Reserved
bit6: Set if Localization Code is supported
bit5: Set if Report Status is suspported
bit4: Set if Report Name is supported
bit3: Reserved
bit2: Set if Read Register is supported
bit1,0: Set if Write Register Type2/1 is supported respectively
EPT(ENTER PASS-THRU MODE) 01h
This allows system to sequentially open up the Link to additional device until the last device on the Link is determined. When the EPT command is not returned, a timeout occurs transferring control to the ELB (Enter Loop-Back Mode) oval.
Once in Pass-Thru Mode, the device retransmits the command to next device downstream on the Link. No response(timeout) cocurs if the last device is already in Pass-Thru mode.
Timeouts: 5ms(Only one deivce will respond).
ELB(ENTER LOOP-BACK MODE) 02h
This is used to "close the end" of the Link, returning the last device on the Link to Loop-Back Mode so that frames may be returned to the System. At the end of the configuration process, the last device should be in Loop-Back Mode, while all others are in Pass-Thru Mode.
In Loop-Back Mode, the device retransmits the command back to the System.
Timeouts: 5ms(Only one deivce will respond).
POL(POLL) 10h
The Poll command is the fundamental means for extracting information from the input devices attached to the Link.
Timeouts: 16 ms (multiple devices may respond).
Command:
addr | cmd | data |
---|---|---|
000 | 1 | 10h |
Response:
addr | cmd | data |
---|---|---|
000 | 0 | xxxx xxxx(data) |
: | : | : |
000 | 0 | xxxx xxxx(data) |
000 | 1 | 10h + <num of data[0-15]> |
HP-HIL Input Devices
Device ID
00..1Fh Keyboard, Vectra 46030A
2Ch Audio Interface Unit 45262A
30h Function Box 46086A
34h HP-HIL ID 46084A
5Ch Bar-Code Reader 92916A
60h Rotary Control Knob 46083A
61h HP-HIL Quadrature Port 46094A
61h Control Dials 46085A
68h HP Mouse 46060A
8Ch HP-HIL/Touch Bezel 35123A
93h A-Size Digitizer 46081A
94h B-Size Digitizer 46088A
C0..DFh Keyboard, ITF 46020A, 46021A
A0..BFh Keyboard, Integral
E0h Keyboard with Dial 98203C
HP-HlL Touch Accessory, HP 35723A.
A 12-inch user-installable touchscreen bezel which provides touch interaction with the host computer. The HP 35723A features a resolution of 43x57 points maximum.
HP-HIL Graphics Tablet, HP4591 1A.
An 1 1 x1 1-inch graphics tablet with 1200-lines-per-inch resolution.
HP-HIL Keyboards, HP 46021A and HP 460304.
The HP-HIL keyboards are generally supplied with the computer for which they were designed (e.9., HP TouchScreen ll, Vectra, and HP 9000 Series 300), These keyboards are available in a wide variety of languages.
HP-HlL Mouse, HP 460604.
This mouse simolifies the task of positioning the cursor on the screen. lt has 200-counts-perinch resolution and two buttons.
HP-HIL Rotary Control Knob, HP 46083A
This module provides two-axis relative cursor positioning via a rotary knob and a toggle key. lt has a resolution of 480 counts per revolution.
HP-HIL Security lD Module, HP 46084A.
The lD Module allows users to run secured application software. lt returns an identification number for identifying the computer user and is used in application programs to control access to program lunctions, data bases, and networks,
HP-HlL Control Dial Module, HP 46085A
This module has nine graphics positioning dials. lt is used in graphics display applications to provide three-axis rotate, translate, scale, and other attribute functions. Each dial has a resolution of 480 counts oer revolution.
The HP 46085A Control Dials Module provides nine graphics positioning devices, implemented as three 3-axis devices. The control dials module is commonly used in graphics display applications to provide 3-axis attitude, 3-axis translation, scaling and other attribute functions. It connects to your computer via the HP-HIL interface and occupies 3 addresses.
HP-HlL 32-Button Box, HP 460864
This box provides 32 userdelinable buttons for menu selection and one user-programmable LED. lt is used in CAD/CAE applications.
HP-HlL Digitizers, HP460874 and HP46088A
Thesedigitizers are for use in interactive graphics, graphics entry, and menu selection applications. Two active area sizes (A or B) are offered. They each have a resolution of 1000 lines per inch. An optional cursor with crosshair is available,
HP-HlL Quadrature Port, HP 460944
This product provides a nine-pin subminiature connector for interfacing quadrature signals to HP-HlL. Three keyswitches are supported.
HP-HlL Bar-Code Reader, HP 929164
This module provides an alternatlve to the keyboard for data entry applications. lt reads UPC/EAN/JAN, interleaved 2-out-o{-5, Codabar (MHI and USD-1), 3-of-9, and extended 3-of-9 codes.
HP 98203C
My HIL Keyboard
Describe Record: 0xE0, 0x0A, 0x61, 0x0F
Device ID is 0xE0, it has two 8-bits axes and resolution is 3937(0x0F61)counts/meter which means exactly 100 cpi.
Extended Describe Record: 0x40 0x00
localization is supported and its code 0x00(Reserved).
Axis
Dial sends X axis value while Y axis value with pressing down Shift key.
Keycode
/* HP 98203C Keyboard Keycodes
* https://i.imgur.com/QKqVuQu.jpg
*
* Device ID: E0
* Describe Record: 0A(Extended, 2 axes?), 61, 0F(Resolution; 3937cpm=100cpi)
* Extended Describe Record: 40(Localization), 00(Reserved. No nationality?)
* Poll Record:
* Keys: 0x60(Keycode Set 2), keycode
* Dial: 0x01, XX
* Dial with Shift: 0x02, 00(XX), YY
*
* Keycode Set 2 is device dependent and user definable. Use the LSB to indicate
* the key transition (0 = Down, 1 = Up). 128 keys maximum. (p.E-3):
*
* ,___.___.___.___.___. ,___.___. ,___.___.___. ,___.___.___.___.
* `---'---'---'---'---' `---'---' `---'---'---' `---'---'---'---'
* ,___.___.___.___.___. ,___.___. ,___.___.___. ,___.___.___.___.
* `---'---'---'---'---' `---'---' `---'---'---' `---'---'---'---'
* ,-------------------------------------------------------. ,-----. ,---------------.
* |Ctl| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Bsp| |PUASE| | E | ( | ) | ^-|
* |-------------------------------------------------------| |-----| |---------------|
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | | RUN | | 7| 8| 9| / |
* |-----------------------------------------------------' | |-----| |---------------|
* |CapsL | A| S| D| F| G| H| J| K| L| ;| '| Ent| |CONTI| | 4| 5| 6| * |
* |-------------------------------------------------------| `-----' |---------------|
* |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | | 1| 2| 3| - |
* |-------------------------------------------------------' ,-----. |---------------|
* | Space | |EXECU| | 0| . | , | + |
* `-------------------------------' `-----' `---------------'
*
* Raw Keycodes:
* 34 36 38 40 42 44 46 50 52 54 60 62 64 66
* 3A 3C 3E 48 4A 4C 4E 56 58 5A 68 6A 6C 6E
*
* 0C A0 A2 A4 A6 A8 AA AC AE B0 B2 B4 B6 5C 70 98 9A 9C 9E
* 32 D0 D2 D4 D6 D8 DA DC DE C8 CA B8 BA 5E 90 92 94 96
* 30 E0 E2 E4 E6 E8 EA EC CC CE BC BE 72 74 88 8A 8C 8E
* 0A F0 F2 F4 F6 F8 FA EE C0 C2 C4 0A 80 82 84 86
* C6 76 78 7A 7C 7E
*
*
* (Raw Keycodes)>>1:
* 1A 1B 1C 20 21 22 23 28 29 2A 30 31 32 33
* 1D 1E 1F 24 25 26 27 2B 2C 2D 34 35 36 37
* 06 50 51 52 53 54 55 56 57 58 59 5A 5B 2E 38 4C 4D 4E 4F
* 19 68 69 6A 6B 6C 6D 6E 6F 64 65 5C 5D 2F 48 49 4A 4B
* 18 70 71 72 73 74 75 76 66 67 5E 5F 39 3A 44 45 46 47
* 05 78 79 7A 7B 7C 7D 77 60 61 62 05 40 41 42 43
* 63 3B 3C 3D 3E 3F
*
*/
Replace Encoder
During careless investigation I broke original HP encoder(QEDS-8831) on the keyboard with wrong power connection. And replaced it with COPAL optical encoder RESW20D50, the new encoder requires decoupling capacitor(22uF), without it the keyboard doesn't read signal correctly.
HP-HIL Converters
MMcM's HP-HIL Converter
https://deskthority.net/viewtopic.php?p=465428#p465428
https://github.com/MMcM/qmk_firmware/tree/mmcm/keyboards/converter/hp_hil
TMK HP-HIL to USB
https://github.com/tmk/tmk_keyboard/tree/hphil/converter/hphil_usb
PS/2 to HP-HIL
https://github.com/svenschnelle/hilps2
USB to HP-HIL
NOTES
Pull-up resistor
Microcontroller which has external 1K Ohm pull-up resistor didn't work with HP 98203C.
HP HIL device has 1K Ohm registers on signal lines in series and can't drive the line through the resistor if Converter has strong pull-up resistor. ATmega32u4's internal pull-up works.
TechRef refers to 1 megohm pull-up resistor for SI. (I-21)
The SI input does not have an internal pullup. This means that unless an HP-HIL device is connected to MLC, the line will float and probably cause an error. This can be avoided by connecting a very large (probably 1 megohm) resistor pullup to SI.
Power supply
External power supply with 7.5V-12V is preferable anyway.
With bypassing 5V linear regulator it will work with decent USB power 5V. HP 98203C requires really good 5V power supply particularly when start up, it doesn't work even with 4.9V.
Hot Swap
Connecting and disconnecting HP-HIL devices while some language/ operating systems or application programs are running may lead to unpredictable results. When possible, connect all needed HP -HIL devices to your com pu ter before booting a language/operating system or running an application program.
HP-HIL devices can be added to or removed from the HP-HIL interface without affecting the HP-UX operating system. However, if your application requires the use of a particular device and you remove the device from the link, open the link to the device, or open the link to add a new device, your application might not recognize the change and may not work as expected.
TERMINOLOGY
Loop-Back Mode:
A mode in the SLC which causes the device to transmit all frames back toward the previous device and System.
Pass-Thru Mode:
A mode in the SLC which causes the device to transmit all frames to the next device on the Link, if there is one. If no additional device is connected, the transmitted informtion is lost.
Power-Up Mode:
A condition in an HP-HIL device during which all HP-HIL commands except for Interface Clear, Device Hard Reset, and Device Soft Reset are ignored. This mode is cleared upon reception of the Interface Clear command, and set when an error is detected or the device is reset.
Master Link Controller (MLC):
An HP standard IC developed by Hewlett-Packard that interfaces the System to the BP-HIL input devices. The MLC accepts commands from the System processor and transmits and receives information via HP-HIL. It also polls the input devices, collects data entered by the user, and relays it to the System.
Slave Link Controller (SLC):
An HP standard IC developed by Hewlett-Packard that provides the communication interface between MLC, the HP-HIL communications master, and the microprocessor which controls the input device's hardware.
Match Address:
The address given to devices during the configuration process. The match address corre~ponds to the order of devices connected on the Link. The device connected directly to the Host will have a match address of 1. The next device connected to the device with address 1 will have match address 2, etc. The maximum match address is 7. Address 0 is a universal address .
Universal Address:
This is an address of 0 (zero) which causes all devices on the Link to respond.
Upstream:
Meaning toward the System. A reference made to indicate direction from an input device on the Link. Moving toward the System from a given device is moving "upstream.