]> git.donarmstrong.com Git - qmk_firmware.git/blob - keyboard/hhkb/doc/HHKB.txt
[Erez & Jack] Optimizes shift_interrupted array
[qmk_firmware.git] / keyboard / hhkb / doc / HHKB.txt
1 Internal of HHKB pro
2 =====================
3 HHKB pro has MCU and some chips on separate two PCBs.
4
5 Controller PCB
6 --------------
7     M38K07M4    Renesas MCU with USB function
8                 http://documentation.renesas.com/eng/products/mpumcu/rej03b0192_38k0ds.pdf
9
10     (HHKB_controller.jpg)
11
12 Keyswitch PCB
13 -------------
14     HC4051      Analog Multiplexer: select a row line.
15                 http://www.ti.com/lit/ds/schs122j/schs122j.pdf
16     LS145       BCD Decoder: select a column line.
17                 http://www.ti.com/lit/ds/symlink/sn74ls145.pdf
18     BU9831      Non-volatile electronic potentiometer: for calibration?
19                 https://www.spezial.com/doc/rohm-a/bu9831.pdf
20     TP1683/4    Capacitive Sensing controller: no datasheet available.
21
22     (HHKB_keyswitch.jpg)
23
24     Topre original chip?
25     (HHKB_TP1684.jpg)
26
27
28 Connector Cable
29 ---------------
30 Two PCBs are connected by 15 lines(13 in case of Pro2).
31 Vcc and GND use 3(2) lines each, other lines are for keyboard signaling.
32
33     HHKB connector lines:
34     JP   Pro2   Pro     Function    Description                               TMK pin usage
35     --------------------------------------------------------------------------------------------
36                  1      Vcc(5V)                                               5V
37      1    1      2      Vcc(5V)                                               5V
38      2    2      3      Vcc(5V)                                               5V
39      3    3      4      TP1684      ~KEY: Low(0) when key is pressed          PD7 input(with pullup)
40      4    4      5      TP1684      HYS: High(1) when key is pressed          PB7 output
41      5    5      6      HC4051      A(bit0)\                                  PB0 output
42      6    6      7      HC4051      B(bit1) > select row 0-7                  PB1 output
43      7    7      8      HC4051      C(bit2)/                                  PB2 output
44      8    8      9      LS145       A(bit0)\                                  PB3 output
45      9    9     10      LS145       B(bit1) > select column 0-7               PB4 output
46     10   10     11      LS145       C(bit2)/                                  PB5 output
47     11   11     12      LS145       ~D(enable) Low(0) enables selected column PB6 output
48     12   12     13      GND                                                   GND
49     13   13     14      GND                                                   GND
50                 15      GND
51     14                  HC4051(Z2)  ~Enable of Z2   row0-7                    PC6
52     15                  HC4051(Z3)  ~Enable of Z3   row8-15                   PC7
53
54     NOTE: Probably HYS changes threshold for upstroke and makes hysteresis in the result.
55     NOTE: HYS should be given High(1) when previous KEY state is Low(0).
56     NOTE: 1KOhm didn't work as pullup resistor on KEY. AVR internal pullup or 10KOhm resistor was OK.
57     NOTE: JP has two HC4051(Z2,Z3) and line 5, 6 and 7 are connected to both of them.
58
59     (HHKB_connector.jpg)
60
61
62 Keyswitch matrix
63 ----------------
64 HHKB switch matrix is ghost-free and bounce-free.
65
66     Pro/Pro2(8x8):
67       COL 0     1       2       3       4       5       6       7
68     ROW ---------------------------------------------------------------
69       0|  2     q       w       s       a       z       x       c
70       1|  3     4       r       e       d       f       v       b
71       2|  5     6       y       t       g       h       n       _NONE_
72       3|  1     Esc     Tab     Control LShift  LAlt    LMeta   Space
73       4|  7     8       u       i       k       j       m       _NONE_
74       5|  \     `       Delete  Return  Fn      RShift  RAlt    RMeta
75       6|  9     0       o       p       ;       l       ,       _NONE_
76       7|  -     +       ]       [       '       /       .       _NONE_
77
78
79     JP(16x8):
80       COL 0     1       2       3       4       5       6       7
81     ROW ---------------------------------------------------------------
82       0|                ESC     TAB     LFn     LShift  LCtrl
83       1|                4       E       MuHKN   C       D
84       2|                3       W       LAlt    X       S
85       3|                1               HHK
86       4|  
87       5|                5       R               V       F
88       6|                2       Q       LGui    Z       A
89       7|                6       T       Space   B       G
90       8|                9       I       Kana    ,       K
91       9|                8       U       Henkan  M       J
92       A|                7       Y               N       H
93       B|                0       O       RAlt    .       L
94       C|                BS              Right   RShift  Enter
95       D|                \       [       Down    Up      ]
96       E|                -       P       RFn     /       ;
97       F|                ~       @       Left    Ro      :
98
99
100 Matrix diagram:
101
102     Pro/Pro2:
103              +-------------------------+-+-+-+-+-+-+-+     Vcc
104              |bias control?            - - - - - - - -     ---
105              |                  3.9K*8 R R R R R R R R      |
106     +--------^+      +--------+        - - - - - - - -      |  
107     |        2|      | HC4051 <0-------|-|-|-|-|-|-|-|--|R|-+
108     |         |capa. |        <1-------|-|-|-|-|-|-|-|--|R|-+
109     | TP1684  |sense |        <2-------|-|-|-|-|-|-|-|--|R|-+
110     |       11<------|        <3-------|-|-|-|-|-|-|-|--|R|-+
111     |         |      |        <4-------|-|-|-|-|-|-|-|--|R|-+
112     |         |      |        <5-------|-|-|-|-|-|-|-|--|R|-+
113     |         <-+    |        <6-------|-|-|-|-|-|-|-|--|R|-+
114     |   1   4 | |    |        <7-------|-|-|-|-|-|-|-|--|R|-+
115     +---V---^-+ |    +-^-^-^--+        0 1 2 3 4 5 6 7  33K*8
116        KEY HYS  |      A B C         +-----------------+
117         |   | +-^----+ | | |         |      LS145      |
118     Vcc |   | |BU9831| | | |         +-^--^--^--^------+
119     --- |   | +------+ | | |           A  B  C  D   +-------+
120      |  |   |          | | |           |  |  |  |   |       |
121     1-3 4   5          6 7 8           9 10 11 12 13-15 Pro |
122     1-2 3   4          5 6 7           8  9 10 11 12-13 Pro2|
123     +--------------------------------------------------+    |
124     |                connector                         |   ---
125     +--------------------------------------------------+   GND
126
127
128     JP:
129              +-----------------------------+-+-+-+-+       Vcc
130              |bias control?                - - - - -       ---
131              |                  3.9K*5     R R R R R        |
132     +--------^+      +--------+            - - - - -        |  
133     |         |      | HC4051 <0-----------|-|-|-|-|----|R|-+
134     |         |capa. |    Z2  <1-----------|-|-|-|-|----|R|-+
135     | TP1684  |sense |        <2-----------|-|-|-|-|----|R|-+
136     |         <---+--|        <3-----------|-|-|-|-|----|R|-+
137     |         |   |  |        <4-----------|-|-|-|-|----|R|-+
138     |         |   ~En|        <5-----------|-|-|-|-|----|R|-+
139     |         | +---->        <6-----------|-|-|-|-|----|R|-+
140     |         | | |  | A B C  <7-----------|-|-|-|-|----|R|-+
141     +---V---^-+ | |  +-^-^-^--+            | | | | |        |
142        KEY HYS  | |    | | |               | | | | |        |
143         |   |   | |  +--------+            | | | | |        |
144         |   |   | |  | HC4051 <8-----------|-|-|-|-|----|R|-+
145         |   |   | |  |    Z3  <9-----------|-|-|-|-|----|R|-+
146         |   |   | +--|        <A-----------|-|-|-|-|----|R|-+
147         |   |   |    |        <B-----------|-|-|-|-|----|R|-+
148         |   |   |    |        <C-----------|-|-|-|-|----|R|-+
149         |   |   | ~En|        <D-----------|-|-|-|-|----|R|-+
150         |   |   |  +->        <E-----------|-|-|-|-|----|R|-+
151         |   |   |  | | A B C  <F-----------|-|-|-|-|----|R|-+
152         |   |   |  | +-^-^-^--+        0 1 2 3 4 5 6 7  33K*8
153         |   |   |  |   | | |         +-----------------+
154         |   |   |  |   | | |         |      LS145      |
155     Vcc |   |   |  |   | | |         +-^--^--^--^------+
156     --- |   |   |  |   | | |           A  B  C  D   +-------+
157      |  |   |   |  |   | | |           |  |  |  |   |       |
158     1-2 3   4  14 15   5 6 7           8  9 10 11 12-13     |
159     +--------------------------------------------------+    |
160     |                connector                         |   ---
161     +--------------------------------------------------+   GND
162                                     
163
164 Signals charts
165 --------------
166     While pressing space bar, watched HHKB Pro original controller signals by logic analyzer.
167     Row and column is looping between 0-7 each for selecting a key.
168     A key is scaned every about 15ms, so scan rate is 66Hz.
169
170     (HHKB_chart1.jpg)
171
172     Space bar locate at ROW:3 COL:7. A key is selected by HC4051(C,B,A) and LS145(C,B,A).
173     Key state can be read on TP1684(4/KEY) while asserting low on LS145(D). 
174
175     (HHKB_chart2.jpg)
176
177
178     Signal of JP:
179
180     1) Select row
181     rowC    ____~~~~____~~~~    3.8/3.8ms(JP) 7.7/7.7ms(Pro)   S2 of HC4051
182     rowB    __~~__~~__~~__~~    1.9/1.9ms(JP) 3.8/3.8ms(Pro)   S1 of HC4051
183     rowA    _~_~_~_~_~_~_~_~    1.0/1.0ms(JP) 1.9/1.9ms(Pro)   S0 of HC4051
184             0123456701234567    selected row(Pro)
185             0123456789ABCDEF    selected row(JP)
186     rowEn0  ________~~~~~~~~    7.7/7.7ms(JP only)              ~Enable of Z2 HC4051(JP only)
187     rowEn1  ~~~~~~~~________    7.7/7.7ms(JP only)              ~Enable of Z3 HC4051(JP only)
188
189     2) Select column
190     colC    ____~~~~____~~~~    550/410us(JP)      /   us(Pro)
191     colB    __~~__~~__~~__~~    200/210us(JP)   450/460us(Pro)
192     colA    _~_~_~_~_~_~_~_~    100/110us(JP)   220/230us(Pro)
193             0123456701234567    selected column
194
195     3) Wait 5us after column select, then set prev, strobe colD to spit out key status and read it.
196     hys     _~~~~_____          20us if previous key state is low
197     colD    ~~~__~~~~~          10us strobe
198     key     ~~~____~~~          22us indicates current state of the key
199
200     NOTE: JP scans twice fast as Pro/Pro2 does. So Pro/Pro2 scans 8x8 matrix in 15.4ms while JP scans 16x8 in that time.
201
202
203
204 EOF