]> git.friedersdorff.com Git - max/tmk_keyboard.git/blob - converter/sun_usb/README.md
lufa: Fix comment on INTERRUPT_CONTROL_ENDPOINT
[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 For TMK converter with ATmega32U2 just run `make` to build firmware hex file.
88 For other DIY converters with ATmega32U4 like Teensy2 or Pro Micro use `make -f Makefile.atmega32u4` instead of `make`.
89
90     $ cd sun_usb
91     $ make
92
93 Then, load the hex file into MCU with your favorite programmer. If you have `dfu-programmer` installed you can use `make dfu`.
94
95     $ make dfu
96
97
98
99 Keyboard Control
100 ----------------
101 You can send Sun protocol commands with TMK `Magic` key combo. By default `Magic` key is `LShift` + `RShift`, `LAlt` + `RAlt' or `LMeta` + `RMeta`.
102 https://github.com/tmk/tmk_keyboard#magic-commands
103
104 Following Sun specific commands are available. For example, to send 'Bell On' you can press `LShift` + `RShift` + `Up` keys simultaneously.
105
106 ```
107 ----- Sun converter Help -----
108 Up:     Bell On
109 Down:   Bell Off
110 Left:   Click On
111 Right:  Click Off
112 PgUp:   LED all On
113 PgDown: LED all On
114 Insert: Layout
115 Delete: Reset
116 ```
117
118
119 Tested on
120 ---------
121 ### Type 3
122 http://blog.daveastels.com.s3-website-us-west-2.amazonaws.com/2014/12/27/type-3-keyboard.html
123
124 ### CTCSP SHORT TYPE KEYBOARD(Type 5)
125 http://imgur.com/a/QIv6p