The PS2Adapter allows using PS2 keyboards and mice with both ADB and pre-ADB systems.
The adapter uses a USB micro-B cable for power. This can be plugged into a computer, powered USB hub, or USB wall charger to provide power to the adapter. External power must be supplied because the PS2 specifications for power exceed the maximum power specifications for both pre-ADB and ADB systems. PS2 keyboards and mice may use up to 275mA each, for a total of up to 550mA. Pre-ADB systems may only use a combined total of 200mA for all peripherals. ADB power specifications vary depending on the system. Desktop systems generally provide a grand total of 500mA for all ADB devices, while portable systems generally provide 200mA for all ADB devices.
To use the adapter, just plug in all devices, then connect the power source. I have hot-plugged all the connectors and have not experienced a problem, but it's probably safest to plug in the connectors first, then apply power last.
The pre-ADB keyboard connector is wired for straight through cables, as used on the original keyboards for these systems. DO NOT use a telephone handset cable. Handset cables are rolled, so pin 1 becomes pin 4, pin 4 becomes pin 1, etc. This will swap power and ground connections and can damage your computer and/or the adapter. Always use a straight through cable for the pre-ADB keyboard.
The pre-ADB mouse connector, the DB9 in the middle, can use a straight through male to female DB9 serial cable to connect to the computer. The adapter has a DB9 male, the computer has DB9 female.
The ADB connector is a normal ADB connector and can be used with normal ADB cables.
There are two buttons on the stm32f0discovery, one is blue and one is black. The blue button does nothing, and the black button resets the adapter. If you experience problems with the adapter, hit the black reset button to reset the adapter. The reset button can be used at any time during normal operation.
The adapter maps the windows key as the mac Command key.
The mac keyboard's power button is mapped to shift-escape on the ps2 keyboard.
Keys found on ADB keyboards but not found on pre-ADB keyboards will still work. The system software still understands the key scan codes. For example, the Plus and earlier keyboards lacked the Control key. The control key on the ps2 keyboard connected to the adapter will still work as expected on pre-ADB systems.
The adapter board connects to the bottom of the discovery board (the side with the longer pins), and the PS2 connectors belong on the same side as the discovery board's USB connector.
The adapter is composed of an entirely passive PCB with all the connectors that attaches to the headers of an stm32f0discovery board. The connector PCB can be separated easily, and the stm32f0discovery board can be used for other purposes, or if the connector PCB is revised, the revised board can be swapped on.
The entire adapter consists of:
2 DIN 6 Pin Mini Plug Right Angle Panel Mount Jack Connector
2 1x40 pin 2.54mm pitch straight single row PCB female pin headers, cut down to 1x33.
1 4P4C unshielded modular telephone PCB jack
1 S-Video PCB panel mount jack connector
And 1 adapter PCB.
The PCB was designed using OsmondPCB on OSX. Both the Osmond file and the gerber files used for the latest revision of the PCB are available in the source repository. I use seeedstudio for the pcb production.
The code for the adapter is built on this template for building stm32f0 code using gcc, make, and openocd: https://github.com/szczys/stm32f0-discovery-basic-template
That template, and the README.md file inherited from it, describe how to setup the gcc and openocd environments necessary to build the code.
The stm32f0discovery has its programmer built in, so all that is necessary to program the adapter is to connect the USB micro-B connector of the stm32f0discovery to the system with openocd installed. The 'make program' makefile target will run openocd with the correct parameters and program the adapter.
The code its self is hosted on the mac68k.info subversion repository and is accessible using your forum username/password: https://mac68k.info/repo/ps2adapter/
Check out the code locally using:
The discovery board uses USART2 to send diagnostic information. It is set to 8n1 9600 baud. USART2 is pins PA.2 (TX) and PA.3 (RX). They're of course TTL level signals, so you'll need a TTL serial adapter.