This small board allows you to plug an amiga keyboard (2000 or 4000 models) to a modern computer with usb ports. The hardware is identical to ps2tousb. Only the firmware is different. As both devices use an usb bootloader, it is easy to switch from one to the other as needed.
Very simple hardware :
- atmega8 chip clocked at 16MHz (likely 12MHz would also work)
- usb port done using v-usb and using their reference schematics
- Amiga keyboard handling done using my own library, bit-banging
- A jumper for firmware upgrade
- A del (because there is no num lock del on the amiga keyboard)
Single side PCB with some SMD parts to make it smaller
I used the USBaspLoader, which takes some space (1024 bytes) on the device but is easy to work with and appropriate for this kind of devices. There is a jumper on the board you have to fit to enable upgrade mode. Else it will start in regular mode and act as a keyboard. This allows easy development (no need for an ISP connector, nor an usbasp once you have bootloaded the atmega).
The software is quite simple. The usb part was heavily based on other v-usb projects, mainly the Dulcimer, a replacement board for IBM Model M keyboards.
The software does the following :
- Register itself as an HID device
- Initialize the keyboard
- Wait for input from the keyboard
- Translate the amiga keycode to an HID keycode
- Maintain an HID report keeping track of the pressed keys (6 of them at a time)
- Send the HID report to the computer
There are some special quirks :
- The caps-lock key is handled by the keyboard, which means it send a "key pressed" event when it is enabled and a "key released" even when it is disabled. However, the PC wants to get "pressed then released" at both times. So we have to cheat and build up events for this key.
- Some keys on the amiga keyboard doesn't exist on the pc. We remap Help to F12, and \| (azerty) on F11. There are others, more suitable keycodes for them in HID (there is a help keycode for example) but Windows doesn't handle them.
Upgrading the firmware
Here are instructions on how to upgrade the firmware :
- You need a PC with windows or linux, or another OS that can run avrdude.
- You need another keyboard to control the computer while the adapter is in upgrade mode
- You need AVRDude ( http://savannah.nongnu.org/projects/avrdude ) or another software that can handle 'usbasp' programming
- You need the latest firmware .hex file
Now how to actually do it :
- Unplug the adapter from the computer
- Open the adapter
- Inside there is a jumper, when the jumper is closed te adpater will enter upgrade mode, when it is open the adapter works as expected
- Close the jumper
- Plug in the adapter again. It should be detected as 'usb asp', not 'amikey'.
- Run the firmware upgrade command :
avrdude -c usbasp -p atmega8 -Uflash:w:keyboard.hex
- Wait for it to finish. It is not too long.
- Unplug the adapter
- Open the jumper
- Close the box
- Replugthe adapter.
And you're done!