You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

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