2012-10-18 01:41:37 +00:00
|
|
|
Sun to USB keyboard protocol converter
|
|
|
|
======================================
|
2012-10-19 05:06:18 +00:00
|
|
|
Target MCU is ATMega32u4 but other USB capable AVR will also work.
|
|
|
|
|
2015-04-23 06:24:28 +00:00
|
|
|
This converter will work with Sun Type 2-5 Keyboards.
|
2012-10-18 01:41:37 +00:00
|
|
|
|
|
|
|
|
2015-04-23 06:24:28 +00:00
|
|
|
Tested on:
|
|
|
|
Sun Type 3 Keyboard: http://blog.daveastels.com.s3-website-us-west-2.amazonaws.com/2014/12/27/type-3-keyboard.html
|
|
|
|
CTCSP SHORT TYPE KEYBOARD(Type 5): http://imgur.com/a/QIv6p
|
|
|
|
|
|
|
|
|
|
|
|
Keymap of Type 3(keymap_sun3.c) were impoted from dastels's repository.
|
|
|
|
https://github.com/dastels/tmk_keyboard/tree/master/converter/sun3_usb
|
|
|
|
|
2012-10-18 01:41:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
Connector
|
2012-10-19 05:06:18 +00:00
|
|
|
---------
|
2012-10-18 01:41:37 +00:00
|
|
|
8Pin mini DIN
|
|
|
|
___ ___
|
|
|
|
/ |_| \
|
|
|
|
/ 8 7 6 \
|
|
|
|
| 5 4 3 |
|
|
|
|
\_ 2 1 _/
|
|
|
|
\_____/
|
|
|
|
(receptacle)
|
|
|
|
|
2012-10-19 05:06:18 +00:00
|
|
|
Wiring:
|
|
|
|
Pin mini DIN MCU
|
|
|
|
----------------------------------
|
|
|
|
1 GND GND
|
|
|
|
2 GND GND
|
|
|
|
3 5V
|
|
|
|
4 RX/TX(Mouse)
|
|
|
|
5 RX PD3
|
|
|
|
6 TX PD2
|
|
|
|
7 GND GND
|
|
|
|
8 5V VCC
|
2012-10-18 01:41:37 +00:00
|
|
|
|
|
|
|
|
2012-10-19 05:06:18 +00:00
|
|
|
Protocol
|
2012-10-18 01:41:37 +00:00
|
|
|
--------
|
2014-01-05 03:45:52 +00:00
|
|
|
Signal: Asynchronous, Negative logic, 1200baud, No Flow control
|
2012-10-19 05:06:18 +00:00
|
|
|
Frame format: 1-Start bit, 8-Data bits, No-Parity, 1-Stop bit
|
|
|
|
|
|
|
|
AVR USART engine expects positive logic while Sun keyboard signal is negative.
|
2014-01-05 03:45:52 +00:00
|
|
|
To use AVR UART engine you need external inverter in front of RX and TX pin.
|
2012-10-19 05:06:18 +00:00
|
|
|
Otherwise you can software serial routine to communicate the keyboard.
|
|
|
|
|
|
|
|
This converter uses software method, you doesn't need any inverter part.
|
|
|
|
|
|
|
|
|
|
|
|
Commands From System To Keyboard
|
|
|
|
0x01 Reset
|
|
|
|
Keyboard responds with following byte sequence:
|
|
|
|
Success: 0xFF 0x04 0x7F
|
|
|
|
Fail: 0x7E 0x01 0x7F
|
|
|
|
0x02 Bell On
|
|
|
|
0x03 Bell Off
|
|
|
|
0x0A Click On
|
|
|
|
0x0B Click Off
|
|
|
|
0x0E LED
|
|
|
|
followed by LED status byte:
|
|
|
|
bit: 3 2 1 0
|
|
|
|
LED: CapsLk ScrLk Compose NumLk
|
|
|
|
0x0F Layout
|
|
|
|
Keyboard responds with 'Layout Response' 0xFE 0xXX
|
|
|
|
|
|
|
|
Commands From Keyboard To System
|
|
|
|
0x7F Idle
|
|
|
|
means no keys pressed.
|
|
|
|
0xFE Layout Response
|
|
|
|
0xFF Reset Response(followed by 0x04)
|
|
|
|
|
|
|
|
Reference
|
|
|
|
http://kentie.net/article/sunkbd/page2.htm
|
|
|
|
http://kentie.net/article/sunkbd/KBD.pdf
|
|
|
|
|
|
|
|
|
|
|
|
Build Firmware
|
|
|
|
--------------
|
|
|
|
Just use 'make'
|
2012-10-18 01:41:37 +00:00
|
|
|
$ cd sun_usb
|
|
|
|
$ make
|
2012-10-19 05:06:18 +00:00
|
|
|
Then, load the binary to MCU with your favorite programmer.
|
2014-08-01 04:26:42 +00:00
|
|
|
|
|
|
|
|
|
|
|
Sun commands
|
|
|
|
------------
|
|
|
|
You can send Sun protocol commands with TMK `Magic` key combo. By default `Magic` key is `LShift` + `RShift`, `LAlt` + `RAlt' or `LMeta` + `RMeta`.
|
|
|
|
https://github.com/tmk/tmk_keyboard#magic-commands
|
|
|
|
|
|
|
|
Following Sun specific commands are available. For example, to send 'Bell On' you can press `LShift` + `RShift` + `Up` keys simultaneously.
|
|
|
|
|
|
|
|
```
|
|
|
|
----- Sun converter Help -----
|
|
|
|
Up: Bell On
|
|
|
|
Down: Bell Off
|
|
|
|
Left: Click On
|
|
|
|
Right: Click Off
|
|
|
|
PgUp: LED all On
|
|
|
|
PgDown: LED all On
|
|
|
|
Insert: Layout
|
|
|
|
Delete: Reset
|
|
|
|
```
|