geekhack Projects > Making Stuff Together!
TMK SUN-USB Converter
(1/1)
hasu:
Sun to USB keyboard protocol converter
======================================
This converter translates Sun keyboard protocol into USB HID to use vintage Sun keyboards on modern computer. The converter should work with Sun Type 2-5 Keyboards. Target MCU is ATmega32U2/4. Mouse support is available only to ATmega32U2 at this time.
Prebuilt TMK Sun converter is available here:
https://geekhack.org/index.php?topic=72052.0
Refer to this page for Sun keyboard protocol details.
https://github.com/tmk/tmk_keyboard/wiki/Sun-Keyboard-Protocol
Check wiki for general information about TMK keyboard firmware.
https://github.com/tmk/tmk_keyboard/wiki
Source code is available here.
https://github.com/tmk/tmk_keyboard/tree/master/converter/sun_usb
Update
------
2024-09-28 Add mouse support and rewrite code to use timer for software uart
2020-04-08 Added unimap support
Wiriing
-------
For Type 4 and 5 keyboards use 8Pin mini DIN.
___ ___
/ |_| \
/ 8 7 6 \
| 5 4 3 |
\_ 2 1 _/
\_____/
(receptacle)
Pin mini DIN MCU
----------------------------------
1 GND GND
2 GND GND
3 5V VCC
4 Mouse RX/TX PD4
5 Keyboard RX PD2
6 Keyboard TX PD3
7 GND GND
8 5V VCC
Just wire connecotr pins to MCU pins respectively, no extra component is needed. Pull-up resistor on signal lines are optional.
Keymap Editor
-------------
You can download prebuilt firmware on TMK keymap editor.
https://www.tmk-kbd.com/tmk_keyboard/editor/unimap/?sun_usb
For ATmega32U4 use this link, instead.
https://www.tmk-kbd.com/tmk_keyboard/editor/unimap/?sun_usb_32u4
Build Firmware
--------------
For TMK converter with ATmega32U2 just run `make` to build firmware hex file. For ATmega32U4 use `make -f Makefile.atmega32u4` instead of `make`.
$ cd sun_usb
$ make
Then, load the hex file into MCU with your favorite programmer. If you have `dfu-programmer` installed you can use `make dfu`.
$ make dfu
Keyboard Commands
-----------------
You can send Sun keyboard commands with TMK Magic key combo. Magic key is `LShift + RShift` on the converter.
For example, to send 'Reset' command press `LShift + RShift + Delete` key combo.
Following Sun specific commands are available.
--- Sun keyboard commands ---
Home: Toggle Bell
End: Toggle Click
PgUp: LED All On
PgDown: LED All Off
Insert: Layout
Delete: Reset
doomsday_device:
recently acquired a tatung branded sun 5 (?) board, successfully restored and converted it with this firmware.
it has a big beeper and screams everytime i connect. so my guess would be it is working like the other sun keyboards and is potentionally able to output beeps/clicks with each keypress.
to use this feature i would need to use the tmk "magic" key combo, which in this case would be both shift, both alt or both meta keys + a single extra key. it seems the matrix isnt able to do that.
my question here is, is there any way to remap "magic" key combos, or even to map a key to a single hexcode?
beside wiring up converters and putting the *.hex from the online editor on to the chip my knowledge is very limited.
also off topic: if anyone has any infos on the board or the system it came with it would be much appreciated. couldnt find any infos or pictures at all. its a forward fdw-107a
pic of board attached for beauty bonus
disclaimer: this is a crosspost and is also to be found on DT forums.
hasu:
'Keyboard control' command is configured in config.h, you cannot remap in Keymap Editor.
https://github.com/tmk/tmk_keyboard/tree/2173767a78e3353f40b2bc6bb3f29bc67c896470/converter/sun_usb#keyboard-control
You have to edit these lines and compile firmware to change the command.
https://github.com/tmk/tmk_keyboard/blob/2173767a78e3353f40b2bc6bb3f29bc67c896470/converter/sun_usb/config.h#L33-L37
doomsday_device:
--- Quote from: hasu on Thu, 19 May 2022, 18:05:22 ---'Keyboard control' command is configured in config.h, you cannot remap in Keymap Editor.
https://github.com/tmk/tmk_keyboard/tree/2173767a78e3353f40b2bc6bb3f29bc67c896470/converter/sun_usb#keyboard-control
You have to edit these lines and compile firmware to change the command.
https://github.com/tmk/tmk_keyboard/blob/2173767a78e3353f40b2bc6bb3f29bc67c896470/converter/sun_usb/config.h#L33-L37
--- End quote ---
thanks,
remapping combo to two different mods (shift/alt) helped and it works now.
--- Code: ---#define IS_COMMAND() ( \
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_LALT)) \
)
--- End code ---
thanks to my friend kelvinhall05 for figuring out with me and the compile.
hasu:
Got a mouse recently and added Sun mouse support to my converter finally.
https://github.com/tmk/tmk_keyboard/commit/ff1b743ee9395f8c44d20ccfe931581b16d48693
https://github.com/tmk/tmk_keyboard/wiki/Sun-Keyboard-Protocol#mouse-protocol
Navigation
[0] Message Index
Go to full version