Key-Tap: A hardware configurator for the Amiga 500

Update 2021/03: GIT repository available!

In this post I want to provide the details of an older project I published  in 2014 on a1k.org. This little piece of hardware is used to provide some means for configuring an Amiga 500 with the keyboard. This is to replace at least some of the small switches that are commonly used to configure the extensions in an Amiga. The circuit listens to the keys pressed on the Amiga keyboard and then adjusts some of its output pins. These pins connect to jumper headers on the extension boards and hence provide some means to configure these extensions without opening the case or drilling holes into it.
Note however, that this project is not for beginners. If you have other extensions than I have, you will likely have to adapt the firmware to your needs. Also, you have to figure out whether your extensions are configurable by means of an external MCU, that is if is suffices to drive a signal statically high or low. Switching a dynamic signal is not possible (without extra hardware). For example, I have seen some kickstart switches that use a switch to route an enable signal to either of the two ROMs.

In any case you need a possibility to program the AtTiny4313 micro-controller with an in system programmer (ISP). These are cheaply available and connect to USB or parallel port. A lot of information regarding this micro-controller can be obtained on the excellent websites http://www.avrfreaks.net/ or http://www.mikrocontroller.net/ (German).

In addition, if you are not running a Linux machine similar to mine there might be some extra difficulties adapting the code to your build environment. In particular I am not using AVR studio and this distribution does not include any project file for it. I am using avr-gcc, make and avrdude to build and flash the images. However, pre-built firmware images are included, if you are happy with the firmware out of the box.

The PCB files and the firmware are open source,  so build your own!

Disclaimer

I am not responsible for any damages done by this device, and I do not guarantee that it will work at all. Only connect this to your precious Amiga, if you are sure about what it does, how it works, and whether the firmware is what I claim it to be.

Acknowledgments

The idea to this project was born during a discussion in the a1k.org/forum and was suggested by Paradroid. However, if I did not have all the great hardware extensions created by the community I would not have had any reason to start the project. Thanks also to the members of the a1k.org forum encouraging me to continue this project and writing this post.

The hardware

The hardware is plain and simple, an AtTiny4313 in minimal configuration with a few pin headers to connect the configuration jumpers and an ISP Programmer. In addition, the RxD and TxD pins are accessible on additional pins.

There is a board layout done in such a way that the little PCB can be directly fitted on the keyboard connector on the mainboard of an Amiga 500(+). However, the whole circuit is so simple that you might consider building it without a PCB, or you might use an Ardiuno or something similar.

Pinout

Partlist

IC1 AtTiny 4313 SO
C1,C2 100n SMD 0805
C3 10µ SMD 1206
R1 10k SMD 0805
J1 1×8 socket strip 180° 2.54
J2 2×3 pinheader 180° 2.54
J3 1×4 pinheader 180° 2.54
J4 1×8 pinheader 90° 2.54
J5,J6 2×4 pinheader 90° 2.54

The firmware

The firmware for the AtTiny4313 is written in C and compiles with avr-gcc 4.8.2 but may or may not compile with different versions although I tried to be as compatible as possible. The package contains precompiled flash and eeprom images in Hex-format for the 4313. The fuses setting is

LFUSE = 0xD4, HFUSE = 0xDB, EFUSE = 0xFF

Make sure to program both the flash memory with the corresponding .hex file and the eeprom memory with the .eep file. Never attempt to flash the MCU while plugged into a running Amiga 500, since it will switch configuration when finished programming. This could damage your Amiga.

The Makefile provided in the package directory should do the job by simply running make.  If you happen to have a USBasp ISP programmer you can program the MCU by simply running

make fuses

and

make program

The Makefile supports programming with avrdude, the programmer is selected with the variable AVRDUDE_PROG.

The source code should be mostly self explanatory (An obviously biased judgment, YMMV), although small code has been preferred to readable code in some places.

The microcontroller passively listens to the communication of the keyboard and the AMIGA. This is a SPI-like protocol with some quirks (see here for a detailed description), so it is not difficult to decode. See key_tap.c for details. In main.c there is the logic to map the key presses to configuration changes. Basically, every configuration pin emulates a tri-state output and can either be  switched to GND (to emulate a closed jumper) or is open (to emulate an open jumper). For safety reasons the firmware provided does not switch to +5V. If you really want this, you will have to dig into the source code and change it. Otherwise adding a pull-up resistor might work.

Usage

There are two firmware packages below. The description here refers to  Package 1, the generic package. In package 2 there is also a specialized version that can be used to configure special extensions, it contains a manual in pdf format.

In package 1 you have the possibility to switch the configuration Pins individually. The keys F1-F8 are used to switch the configuration pins as follows:

F1 set C1 Shift+F1 clear C1
F2 set C2 Shift+F2 clear C2
F3 set C3 Shift+F3 clear C3
F4 set C4 Shift+F4 clear C4
F5 set C5 Shift+F5 clear C5
F6 set C6 Shift+F6 clear C6
F7 set C7 Shift+F7 clear C7
F8 set C8 Shift+F8 clear C8

To change the configuration proceed as follows:

  1. Push Fx or Shift-Fx if you intend to enable (resp. disable) configuration pin x.
  2. Hit the Help-key three times. This changes the next configuration that gets activated but does not yet switch the configuration pins.
  3. You can repeat steps 1 and 2 to change further pins.
  4. To activate the configuration perform a keyboard reset. This also stores the new configuration setting to eeprom so that it loads on the next power on.

If you accidentally select a configuration that does not run and is screwed in such a way that the keyboard is not initialized, you can do a keyboard reset for at least 6 seconds to load the hopefully save configuration where all pins are disabled. This fail-safe configuration is defined by the macro CONFIG_DEFAULT in the file ee_helper.h.

The licence

All parts of this project are free to use. The firmware is licensed under terms of the GPL 2. See the file COPYRIGHT in the packages for additional information, in particular the reference to Peter Fleury who provided a neat UART library for the
Atmel MCUs.

The packages

Package 1 : Generic configurator

ZIP: config-v0.2-generic.zip

Manual: manual-generic.pdf

Package 2: Specialized configurator

ZIP: config-v0.2-special.zip

Manual: manual-v1.pdf

GIT Repository

Here is the GIT repository for the Project https://github.com/jmA500/Key-Tap