]> git.donarmstrong.com Git - tmk_firmware.git/blob - converter/ibm4704_usb/ibm4704.txt
c17d172af1dc5b0652c45a8dc3ac0979972a5ad3
[tmk_firmware.git] / converter / ibm4704_usb / ibm4704.txt
1 4704 Keyboard
2 =============
3 Keyboard Models:
4     Model 100 6019273 50-key (grid layout)
5     Model 200 6019284 62-key Alpha(60% layout)
6     Model 300 6019303 77-key Expanded Alpha
7     Model 400 6020218 107-key Full key
8
9 Resourse
10 --------
11 The IBM 4704: lots of pictures and info
12 http://kishy.dyndns.org/?p=648#more-648 
13
14 Brochure:
15 http://ed-thelen.org/comp-hist/IBM-ProdAnn/4700.pdf
16
17
18
19 4704 Keyboard Protocol
20 ======================
21 On powering up the keyboard sends keyboard id; A3h for 6019284(62-key), for example.
22 After that firmware enters FC command mode and waits for parameter data from host
23 so that it doesn't send any scancode until you send 'FF'(End of FC command).
24
25
26 Connector
27 ---------
28     Keyboard Plug from front
29
30     DSUB-9
31     -------------
32     \ N 2 3 4 5 /
33      \ N N N N /
34       ---------
35     2   GND
36     3   VCC 5V
37     4   DATA
38     5   CLOCK
39     N   No connection/No pin.
40
41
42 Keyboard to Host
43 ----------------
44 Data bits are LSB first and Pairty is odd. Clock has around 60us high and 30us low part.
45
46             ____      __   __   __   __   __   __   __   __   __   ________
47     Clock       \____/  \_/  \_/  \_/  \_/  \_/  \_/  \_/  \_/  \_/
48                  ____ ____ ____ ____ ____ ____ ____ ____ ____ ____    
49     Data    ____/    X____X____X____X____X____X____X____X____X____X________
50                 Start   0    1    2    3    4    5    6    7    P  Stop
51
52 Start bit:  can be long as 300-350us.
53 Inhibit:    Pull Data line down to inhibit keyboard to send.
54 Timing:     Host reads bit while Clock is hi.
55 Stop bit:   Keyboard pulls down Data line to lo after 9th clock.
56
57
58 Host to Keyboard
59 ----------------
60 Data bits are LSB first and Pairty is odd. Clock has around 60us high and 30us low part.
61
62             ____        __   __   __   __   __   __   __   __   __   ________
63     Clock       \______/  \_/  \_/  \_/  \_/  \_/  \_/  \_/  \_/  \_/
64                 ^   ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ___
65     Data    ____|__/    X____X____X____X____X____X____X____X____X____X   \___
66                 |  Start   0    1    2    3    4    5    6    7    P   Stop
67                 Request by host
68
69 Start bit:  can be long as 300-350us.
70 Request:    Host pulls Clock line down to request to send a command.
71 Timing:     After Request keyboard pull up Data and down Clock line to low for start bit.
72             After request host release Clock line once Data line becomes hi.
73             Host wirtes a bit while Clock is hi and Keyboard reads while low.
74 Stop bit:   Host releases or pulls up Data line to hi after 9th clock and waits for keybaord pull down the line to lo.
75
76
77 Scancodes
78 ---------
79 Keyboard doesn't send Break code for all keys except for Alt by default.
80
81     6019284 62-key:
82     ,-----------------------------------------------------------.
83     |  `|  1|  2|  3|  4|  5|  6|  7|  8|  9|  0|  -|  =|???|BS |
84     |-----------------------------------------------------------|
85     |Tab  |  Q|  W|  E|  R|  T|  Y|  U|  I|  O|  P| ¢|  \|  PD2|
86     |-----------------------------------------------------------|
87     |Ctrl  |  A|  S|  D|  F|  G|  H|  J|  K|  L|  ;|  '| {}| PD3|
88     |-----------------------------------------------------------|
89     |Shif| <>|  Z|  X|  C|  V|  B|  N|  M|  ,|  ,|  /|???|Shift |
90     |-----------------------------------------------------------|
91     |Reset|blk|Alt  |         Space             |Alt  |blk|Enter|
92     `-----------------------------------------------------------'
93     +----------+---------------------+----------+----------+
94     |`       00|PD1     04|Caps    20|LShift  30|Reset   31|
95     |1       18|q       05|a       21|<>      3E|Rblank  41|
96     |2       19|w       06|s       22|z       32|Alt     3F|
97     |3       1A|e       13|d       23|x       33|Space   40|
98     |4       10|r       14|f       24|c       34|Alt     3F|
99     |5       11|t       15|g       25|v       35|Lblank  42|
100     |6       12|y       16|h       26|b       36|Enter   2F|
101     |7       08|u       17|j       27|n       37|          |
102     |8       09|i       01|k       28|m       38|          |
103     |9       0A|o       02|l       29|,       39|          |
104     |0       0F|p       03|;       2A|.       3A|          |
105     |-       1F|¢      1B|'       2B|/       3B|          |
106     |=       0D|\       1C|{}      2C|???     3C|          |
107     |???     0C|PD2     1D|PD3     2D|RShift  3D|          |
108     |BS      0E|          |          |          |          |
109     +----------+---------------------+----------+----------+
110     Bit7 is 'press flag' which set 1 on press and 0 on release when break code is enabled.
111
112 NOTE: When break code is enabled the key sends scancode with setting 7th bit on press
113 and without it on release. That is, '`' sends 80h on press and 00h on release.
114
115
116 keyboard command
117 ----------------
118     FF  Soft Reset(0008h)
119     FE  Resend(00e8h)
120     FD  Buzzer stop?(00edh)
121     FC  Set Key flag(00f6h)
122     FB  Soft Reset(0008h)
123     FA  Reset(0000h)
124     
125
126 Keyboard response
127 -----------------
128     FF  Not exist. [Outgoing buffer cannot have FFh(00h in fact)]
129     FE  Overflow(key event/receive data)        at 00c5h, 0346h
130     FE  Memory test error                       at 0224h
131     FD  Command out of bound                    at 00d8h
132         Key out of bound
133     7E  Read/Parity error in receive from host  at 00bch
134
135
136 Set Key flag command(FC)
137 ------------------------
138 After 'Power on Reset' firmware enters this command mode and waits for data from host,
139 so that you don't need to send 'FC' and it doesn't send any scancode until you send 'FF'.
140
141 Data sent from host:
142
143     bit: 7   6 ... 0
144          en  |     |
145          |   `-----`--- scan code
146          `------------- enable bit(0: enable repeat, 1: enable break)
147
148     00-77   Enable repeat(78-7F: invalid scancode)
149     80-F7   Enable break(F8-FF: invalid scancode)
150     FE      Resend(011ah) no need to use
151     FF      End(0114h) exits FC command mode.
152
153 Response from keyboard:
154     FD      Out of bound - Invalid scancode
155
156 Examples:
157     To enable break code of all keys.
158
159     FC 80 81 ... F7 FF
160