Keyboard and Mouse

To complete our workstation, after the video output, we need a keyboard and, eventually, a mouse.

Sun keyboards : FR Type 6 and US Type 5c. (find the wrong key !)

Sun keyboards : FR Type 6 and US Type 5c. (find the wrong key !)

As-is, the SP605 board has very few buffered I/O interfaces useable for connecting a keyboard and mouse.

  • The best solution is to have a real Sun Type 5 or 6 keyboard. With 3 discretes you can connect the Keyboard RX and TX and the Mouse TX. Even with 3.3V on the J55 connector instead of 5V, Sun hardware works well.
  • If you only have a PS/2 keyboard, you need 4 discretes, two transistors and two resistors for the interface. Most keyboards seem to work with a 3.3V power supply. Alas, there is not enough I/O for connecting a mouse (and most PS/2 mice don’t work with 3.3V). Check carefully the connector orientation to avoid swapping the ground and V+.
  • If you don’t have anything that old, sorry. There is still Ethernet for remote X display.

Selection between the SUN and PS/2 modes is done with the PS2EMU constant in ts_io.vhd

To avoid transients and risk damaging the FPGA board, don’t hot-plug/unplug the keyboard or mouse.

WiringWiring for Sun and PS/2 keyboards
Adapters

Adapters

Sun interface

Sun type 5/6 keyboards and mice use 5V serial ports running at 1200bauds, 8bits, 1start, 1stop. They are controlled through an UART identical to the one used for the serial console interface (actually a simplified version, but we do not support all the features from the serial port UART anyway).
The mouse uses the “Mouse Systems” protocol, which was sometimes available on three buttons RS/232 mice for PCs (remember Genius Mouse ?).

Inside the FPGA, there is just a copy of the serial UART and a pair of asynchronous serialisation/deserialiation blocks.

The keyboard protocol is described there:

www.sparc.org/wp-content/uploads/2014/01/KBD.pdf.gz
If you can get a cheap Sun keyboard, this is by far the best solution.

PS/2 interface

Connecting a PS/2 keyboard is more complex. In addition to the UART, you need a PS/2 interface port (ps2.vhd) and something to translate PS/2 keypresses into Sun format and manage the Sun protocol for identifying the keyboard, light the leds (ts_ps2sun.vhd,  ts_ps2.vhd).

Sun keyboards have microswitches for setting the layout: QWERTY, AZERTY, QWERTZ… so that the OS can detect the keyboard type.

PS/2 keyboards do not have these refinements, there is no autodetection.
You can change the advertised keyboard layout by changing the KBD_LAYOUT constant in ts_io.vhd. Possible values can be found there :

http://docs.oracle.com/cd/E19253-01/817-2521/new-311/index.html
Anyways, OSes can override that value and use any mapping, so this is not very important.

The mapping between PS/2 and Sun keys don’t depend on the country. Keycodes are always fixed for a key position: The Q on a QWERTY keyboard has the same keycode as the A on an AZERTY keyboard. The same keyboard controller is used for all layouts.

Leave a Reply

Your email address will not be published. Required fields are marked *