]> git.friedersdorff.com Git - max/tmk_keyboard.git/blob - converter/sun_usb/README.md
e65e2bcd70aadefc24a03282cfb1c927a3460797
[max/tmk_keyboard.git] / converter / sun_usb / README.md
1 Sun to USB keyboard protocol converter
2 ======================================
3 Target MCU is ATMega32u2/4 but other USB capable AVR will also work.
4
5 This converter will work with Sun Type 2-5 Keyboards.
6
7
8 Check wiki pages for other information about TMK keyobard firware.
9
10 https://github.com/tmk/tmk_keyboard/wiki
11
12
13 Update
14 ------
15 2020-04-08 Added unimap support
16
17
18 Connector
19 ---------
20 Modern Type 4 and 5 keyboards uses 8Pin mini DIN.
21
22        ___ ___
23       /  |_|  \
24      / 8  7  6 \
25     | 5    4  3 |
26      \_ 2   1 _/
27        \_____/  
28      (receptacle)
29
30     Wiring:
31     Pin mini DIN        MCU
32     ----------------------------------
33     1   GND             GND
34     2   GND             GND
35     3   5V
36     4   RX/TX(Mouse)
37     5   RX              PD3
38     6   TX              PD2
39     7   GND             GND
40     8   5V              VCC
41
42
43 Protocol
44 --------
45 Signal: Asynchronous, Negative logic, 1200baud, No Flow control
46
47 Frame format: 1-Start bit, 8-Data bits, No-Parity, 1-Stop bit
48
49 AVR USART engine expects positive logic while Sun keyboard signal is negative.
50 To use AVR UART engine you need external inverter in front of RX and TX pin.
51 Otherwise you can use software serial to communicate the keyboard.
52
53 This firmware uses software serial by default, so you don't need any inverter.
54 It can be still built with 'make HARDWARE_SERIAL=y' to enable hardware serial if you have inverter. You can use 74LS04 for example.
55
56
57 ### Commands From System To Keyboard
58
59     0x01 Reset
60             Keyboard responds with following byte sequence:
61             Success: 0xFF 0x04 0x7F
62             Fail:    0x7E 0x01 0x7F
63     0x02 Bell On
64     0x03 Bell Off
65     0x0A Click On
66     0x0B Click Off
67     0x0E LED
68             followed by LED status byte:
69             bit: 3       2       1       0
70             LED: CapsLk  ScrLk   Compose NumLk
71     0x0F Layout
72             Keyboard responds with 'Layout Response' 0xFE 0xXX
73
74 ### Commands From Keyboard To System
75     0x7F Idle
76             means no keys pressed.
77     0xFE Layout Response
78     0xFF Reset Response(followed by 0x04)
79      
80 ### Reference
81 - http://kentie.net/article/sunkbd/page2.htm
82 - http://kentie.net/article/sunkbd/KBD.pdf
83
84
85 Build Firmware
86 --------------
87 Just use 'make'
88
89     $ cd sun_usb
90     $ make
91
92 Then, load the binary to MCU with your favorite programmer.
93
94
95 Keyboard Control
96 ----------------
97 You can send Sun protocol commands with TMK `Magic` key combo. By default `Magic` key is `LShift` + `RShift`, `LAlt` + `RAlt' or `LMeta` + `RMeta`.
98 https://github.com/tmk/tmk_keyboard#magic-commands
99
100 Following Sun specific commands are available. For example, to send 'Bell On' you can press `LShift` + `RShift` + `Up` keys simultaneously.
101
102 ```
103 ----- Sun converter Help -----
104 Up:     Bell On
105 Down:   Bell Off
106 Left:   Click On
107 Right:  Click Off
108 PgUp:   LED all On
109 PgDown: LED all On
110 Insert: Layout
111 Delete: Reset
112 ```
113
114
115 Tested on
116 ---------
117 ### Type 3
118 http://blog.daveastels.com.s3-website-us-west-2.amazonaws.com/2014/12/27/type-3-keyboard.html
119
120 ### CTCSP SHORT TYPE KEYBOARD(Type 5)
121 http://imgur.com/a/QIv6p