Skip to content

ACORN ARCHIMEDES Keyboard

hasu@tmk edited this page Nov 17, 2023 · 42 revisions

TMK Archimedes keyboard converter

This covnerter makes Acorn Archimedes keyboard usable on modern USB computer.

Preassembled converter is available here.

Archimedes converter hardware is identical to 'TMK IBMPC[PS/2]', if you already have one you can try this just by changing firmware.

Discussion: https://geekhack.org/index.php?topic=121747.0

Firmware

Source code: https://github.com/tmk/tmk_keyboard/tree/master/converter/archimedes_usb

Tested with A300 keyboard.

Keymap Editor

Wirings

You can make your own coverter easily if you are familiar to AVR. Reset pin is optional.

            Connector                   AVR pin                                                               
                ------------------------------------                                                              
  ,--_--.       1: Reset                    PD0
 / o6 5o \      2: NC                                                                                             
| o4   3o |     3: GND                      GND                                                                   
 - 2o o1 -      4: 5V                       VCC                                                                   
  `-___-'       5: In(from keyboard)        PD1                                                                   
                6: Out(to keyboard)         PD3    

Target microcontroller is Atmel ATMega32U2 by default but porting this project to other 8-bit AVR controllers would be easy.

Mouse support

Have not tested with mouse yet, but it should work somehow. I don't have an Archimedes mouse to test. Contact me if you have Archimedes mouse and can test this.

Protocol

Commands

HRST    FFh                         keyboard reset
RAK1    FEh                         response in reset protocol
RAK2    FDh                         response in reset protocol
RQMP    22h                         request for mouse data
PRST    21h                         do nothing
RQID    20h                         request keyboard ID
LEDS    0000 0xxx                   Set LED state
              ||`--- Caps Lock
              |`---- Num Lock
              `----- Scroll Lock
RQPD    0100 xxxx                   request to echo data. keyboard replies with PDAT.
             ````--- Data

BACK    3Fh                         ack for first byte
NACK    30h                         disable key and mouse
SACK    31h                         enable key
MACK    32h                         enable mouse
SMAK    33h                         enable key and mouse

KDDA    1100 xxxx                   key down data comprised of two bytes
             ````--- Row(first byte)/Col(second byte)
KUDA    1101 xxxx                   key up data comprised of two bytes
             ````--- Row(first byte)/Col(second byte)
MDAT    0xxx xxxx
         ``` ````--- X(first byte)/Y(second byte)
                                    mouse data

Reset sequence

Keyboard sends HRST to System when it powers up and detects user reset or error. Also keyboard reply with HRST to HRST command from system.

Reset sequence:

System                      Keyboard
------------------------------------------------------
sends HRST
                            sends HRST(as reply)
sends RAK1
                            sends RAK1(as reply)
sends RAK2
                            sends RAK2(as reply)
sends SMAK/SACK/MACK
                            no reply for last ack

Data Transmission

The protocol is essentially half duplex, so in normal operation the keyboard controller will not send a second byte until it has received BACK.

Scan code

Keyboard sends code for key event with command KDDA(key down) or KUDA(key up). Key data comprised of two bytes, byte1 encodes Row and byte2 does Col.

Scan code = (Row << 4) | Col

Key matrix:

R/C 0 1 2 3 4 5 6 7 8 9 A B C D E F
0 ESC F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 Prt ScL Brk
1 `~ 1 2 3 4 5 6 7 8 9 0 -_ =+ £ BS Ins
2 Hom PgU NmL P/ P* P# Tab Q W E R T Y U I O
3 P [{ ]} | Del Cpy PgD P7 P8 P9 - LCt A S D F
4 G H J K L ;: '" Rtn P4 P5 P6 P+ LSh Z X
5 C V B N M ,< .> /? RSh Up P1 P2 P3 Cap LAl Spc
6 Ral RCt Lef Dow Rig P0 P. PEn
7 SW1 SW2 SW3

SW*: mouse button

Mouse data

Keyboard sends two mouse movement data for X and Y with command MDAT at once. First command encodes 7-bit X counts and sencond does 7-bit Y counts(-64 to 63).

Signal

31250 baud, 8-bit data(LSB-first), non-parity, active low

Format: start bit(0), 8-bit data(LSB first), stop bit(1)

0     ___ ___ ___ ___ ___ ___ ___ ___ ___
1 ___/   \___X___X___X___X___X___X___X___\______
       S   0   1   2   3   4   5   6   7   S

For example,

0     ___  
1 ___/   \______________________________________    HRST(FFh)
       S   0   1   2   3   4   5   6   7   S

0     ___         _______         _______  
1 ___/   \_______/       \_______/       \______    SMAK(33h)  
       S   0   1   2   3   4   5   6   7   S

pulse width: 32us = 1sec / 31250

Pinouts

A300 Service Manual p.67

Keyboard

Mini-DIN-6P female socket from the front:
  ,--_--.       1: Reset
 / o6 5o \      2: NC
| o4   3o |     3: GND
 - 2o o1 -      4: 5V
  `-___-'       5: In(from keyboard)
                6: Out(to keyboard)

Reset pin

Reset pin is pulled down when reset button on keyboard is pressed by user.

Keyboard microcontroller is also restarted when the button is pressed and Reset sequence begins again.

NC pin

Notice that this pin is given 12V on system according to schematics. A300 Keytronic keyboard is not connected to the pin.

A300 Service Manual p.126

Mouse

9-pin Mini DIN(not interchangeable with Microsoft bus mouse)

    ______
  /________\
 / o9o8  o7 \
| o6 o5 o4 o3|
  |  o2 o1 |
   `------'

Pin number  Pin function            
6           5v supply for Mouse     
4           0v return for Mouse     
2           Switch 1                
3           Switch 2                
8           Switch 3
1           X Reference             
5           X Direction             
7           Y Reference             
9           Y Direction             

Rise and fall time 20 maximum, Vol to Voh or Voh to Vol. Each mouse switch operates with a contact closure to 0 V. The switch debounce period is 20 ms minimum.

Confirmed that SW1/2/3 on A300 keyboard with TMK converter. Proper key data appeared when the pins were pulled down with 1K ohm resistor. 2023-10-25

Resources

Clone this wiki locally