]> git.gir.st - tmk_keyboard.git/blob - keyboard/hhkb/doc/HHKB.txt
Improve documentation
[tmk_keyboard.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.alldatasheet.com/datasheet-pdf/pdf/203989/KODENSHI/KK74HC4051A.html
16 LS145 BCD Decoder: select a column line.
17 http://www.alldatasheet.com/datasheet-pdf/pdf/27373/TI/SN74LS145D.html
18 BU9831 Non-volatile electronic potentiometer: for calibration?
19 http://www.alldatasheet.com/datasheet-pdf/pdf/36387/ROHM/BU9831.html
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 9 lines are for keyboard signaling.
32
33 Keyswitch PCB connector Teensy++ pins
34 -------------------------------------------------------------------------------
35 1 Vcc(5V) Not exist on Pro2 5V
36 2 Vcc(5V) 5V
37 3 Vcc(5V) 5V
38 4 TP1684 KEY: Low(0) when key pressed PE6 input(with pullup)
39 5 TP1684 KEY_PREV: assert previous key state??? PE7 output
40 6 HC4051 A(bit0) select 8 rows(0 to 7) PB0 output
41 7 HC4051 B(bit1) PB1 output
42 8 HC4051 C(bit2) PB2 output
43 9 LS145 A(bit0) select 8 columns(0 to 7) PB3 output
44 10 LS145 B(bit1) PB4 output
45 11 LS145 C(bit2) PB5 output
46 12 LS145 D(enable) Low(0) enable selected column PB6 output
47 13 GND GND
48 14 GND GND
49 15 GND Not exist on Pro2 GND
50
51 NOTE: guessing pin5(KEY_PREV) may work for hysteresis of capacitive sensing.
52
53 (HHKB_connector.jpg)
54
55
56 Keyswitch matrix
57 ----------------
58 60 keyswitches in 8*8 matrix. It is ghost-free and bounce-free.
59
60 COL 0 1 2 3 4 5 6 7
61 ROW ---------------------------------------------------------------
62 0| 2 q w s a z x c
63 1| 3 4 r e d f v b
64 2| 5 6 y t g h n _NONE_
65 3| 1 Esc Tab Control LShift LAlt LMeta Space
66 4| 7 8 u i k j m _NONE_
67 5| \ ` Delete Return Fn RShift RAlt RMeta
68 6| 9 0 o p ; l , _NONE_
69 7| - + ] [ ' / . _NONE_
70
71
72 Matrix diagram:
73
74 +-------------------------+-+-+-+-+-+-+-+ Vcc
75 |bias control? - - - - - - - - ---
76 | 3.9K*8 R R R R R R R R |
77 +--------^+ +--------+ - - - - - - - - |
78 | 2| | HC4051 <0-------|-|-|-|-|-|-|-|--|R|-+
79 | |capa. | <1-------|-|-|-|-|-|-|-|--|R|-+
80 | TP1684 |sense | <2-------|-|-|-|-|-|-|-|--|R|-+
81 | 11<------| <3-------|-|-|-|-|-|-|-|--|R|-+
82 | | | <4-------|-|-|-|-|-|-|-|--|R|-+
83 | | | <5-------|-|-|-|-|-|-|-|--|R|-+
84 | <-+ | <6-------|-|-|-|-|-|-|-|--|R|-+
85 | 1 4 | | | <7-------|-|-|-|-|-|-|-|--|R|-+
86 +---V---^-+ | +-^-^-^--+ 0 1 2 3 4 5 6 7 33K*8
87 KEY PREV | A B C +-----------------+
88 | | +-^----+ | | | | LS145 |
89 Vcc | | |BU9831| | | | +-^--^--^--^------+
90 --- | | +------+ | | | A B C D +------+
91 | | | | | | | | | | | |
92 1-3 4 5 6 7 8 9 10 11 12 13-15 |
93 +--------------------------------------------------+ |
94 | connector | ---
95 +--------------------------------------------------+ GND
96 to controller
97
98
99 Signals charts
100 --------------
101 While pressing space bar, watched HHKB original controller signals by logic analyzer.
102 Row and column is looping between 0-7 each for selecting a key.
103 A key is scaned every about 15ms, so scan rate is 66Hz.
104
105 (HHKB_chart1.jpg)
106
107 Space bar locate at ROW:3 COL:7. A key is selected by HC4051(C,B,A) and LS145(C,B,A).
108 Key state can be read on TP1684(4/KEY) while asserting low on LS145(D).
109
110 Usage of TP1684(5) is not clear. Controller seemed to output previous key state on this line.
111 However key state can be read without using this signal.
112
113 (HHKB_chart2.jpg)
114
115
116 Matrix scan pseudo code
117 -----------------------
118 for (row: 0-7) {
119 SELECT_ROW(row); // set HC4051(A,B,C)
120
121 for (col: 0-7) {
122 SELECT_COL(col); // set LS145(A,B,C)
123
124 _delay_us(40);
125
126 if (prev_key_state(row, col)) {
127 KEY_PREV_ON;
128 }
129
130 _delay_us(7);
131
132 ENALBLE_COL(); // set LS145(D) to low
133
134 _delay_us(10);
135
136 if (KEY == 0) { // read TP1684(KEY)
137 // key pressed
138 } else {
139 // not pressed
140 }
141
142 KEY_PREV_OFF;
143 UNALBLE_COL(); // set LS145(D) to high
144
145 _delay_us(150);
146 }
147 }
148
149
150
151 EOF
Imprint / Impressum