]>
Commit | Line | Data |
---|---|---|
97ee1be5 | 1 | Sun to USB keyboard protocol converter |
2 | ====================================== | |
b56717b8 | 3 | Target MCU is ATMega32u4 but other USB capable AVR will also work. |
4 | Supported keyboards: Sun Type 5 Keyboard, CTCSP SHORT TYPE KEYBOARD(CKUB) | |
5 | ||
6 | CTCSP SHORT TYPE KEYBOARD: http://imgur.com/a/QIv6p | |
97ee1be5 | 7 | |
97ee1be5 | 8 | |
9 | ||
97ee1be5 | 10 | |
11 | Connector | |
b56717b8 | 12 | --------- |
97ee1be5 | 13 | 8Pin mini DIN |
14 | ___ ___ | |
15 | / |_| \ | |
16 | / 8 7 6 \ | |
17 | | 5 4 3 | | |
18 | \_ 2 1 _/ | |
19 | \_____/ | |
20 | (receptacle) | |
21 | ||
b56717b8 | 22 | Wiring: |
23 | Pin mini DIN MCU | |
24 | ---------------------------------- | |
25 | 1 GND GND | |
26 | 2 GND GND | |
27 | 3 5V | |
28 | 4 RX/TX(Mouse) | |
29 | 5 RX PD3 | |
30 | 6 TX PD2 | |
31 | 7 GND GND | |
32 | 8 5V VCC | |
97ee1be5 | 33 | |
34 | ||
b56717b8 | 35 | Protocol |
97ee1be5 | 36 | -------- |
3ee5f565 | 37 | Signal: Asynchronous, Negative logic, 1200baud, No Flow control |
b56717b8 | 38 | Frame format: 1-Start bit, 8-Data bits, No-Parity, 1-Stop bit |
39 | ||
40 | AVR USART engine expects positive logic while Sun keyboard signal is negative. | |
3ee5f565 | 41 | To use AVR UART engine you need external inverter in front of RX and TX pin. |
b56717b8 | 42 | Otherwise you can software serial routine to communicate the keyboard. |
43 | ||
44 | This converter uses software method, you doesn't need any inverter part. | |
45 | ||
46 | ||
47 | Commands From System To Keyboard | |
48 | 0x01 Reset | |
49 | Keyboard responds with following byte sequence: | |
50 | Success: 0xFF 0x04 0x7F | |
51 | Fail: 0x7E 0x01 0x7F | |
52 | 0x02 Bell On | |
53 | 0x03 Bell Off | |
54 | 0x0A Click On | |
55 | 0x0B Click Off | |
56 | 0x0E LED | |
57 | followed by LED status byte: | |
58 | bit: 3 2 1 0 | |
59 | LED: CapsLk ScrLk Compose NumLk | |
60 | 0x0F Layout | |
61 | Keyboard responds with 'Layout Response' 0xFE 0xXX | |
62 | ||
63 | Commands From Keyboard To System | |
64 | 0x7F Idle | |
65 | means no keys pressed. | |
66 | 0xFE Layout Response | |
67 | 0xFF Reset Response(followed by 0x04) | |
68 | ||
69 | Reference | |
70 | http://kentie.net/article/sunkbd/page2.htm | |
71 | http://kentie.net/article/sunkbd/KBD.pdf | |
72 | ||
73 | ||
74 | Build Firmware | |
75 | -------------- | |
76 | Just use 'make' | |
97ee1be5 | 77 | $ cd sun_usb |
78 | $ make | |
b56717b8 | 79 | Then, load the binary to MCU with your favorite programmer. |
523cc6aa | 80 | |
81 | ||
82 | Sun commands | |
83 | ------------ | |
84 | You can send Sun protocol commands with TMK `Magic` key combo. By default `Magic` key is `LShift` + `RShift`, `LAlt` + `RAlt' or `LMeta` + `RMeta`. | |
85 | https://github.com/tmk/tmk_keyboard#magic-commands | |
86 | ||
87 | Following Sun specific commands are available. For example, to send 'Bell On' you can press `LShift` + `RShift` + `Up` keys simultaneously. | |
88 | ||
89 | ``` | |
90 | ----- Sun converter Help ----- | |
91 | Up: Bell On | |
92 | Down: Bell Off | |
93 | Left: Click On | |
94 | Right: Click Off | |
95 | PgUp: LED all On | |
96 | PgDown: LED all On | |
97 | Insert: Layout | |
98 | Delete: Reset | |
99 | ``` |