Skip to content
hasu@tmk edited this page Oct 10, 2024 · 71 revisions

NeXT Keyboard Converter

With this converter you can use NeXT keyboard(non-ADB) on modern computer.

You can support this project by buying prebuilt TMK NeXT Keyboard Converter.

TMK NeXT Keyboard Converter does not support mouse at this point.(2023-02)

Souce Code

https://github.com/tmk/tmk_keyboard/tree/master/converter/next_usb

Firmware Build

make -f Makefile.unimap clean
make -f Makefile.unimap
make -f Makefile.unimap dfu

Edit MCU in Makefile for your own DIY converter.

For prebuilt TMK NeXT Keyboard Converter you can use Keymap Editor.

Keymap Editor

You can remap keys with Keymap Editor for prebuilt TMK NeXT Keyboard Converter.

http://www.tmk-kbd.com/tmk_keyboard/editor/unimap/?next_usb

Wiring

Connections to ATmega32U2/U4

FROM(Pin3): PD0
TO(Pin2):   PD1
PSW(Pin4):  PD4
GND(Pin5):  GND
VCC(Pin1):  VCC

NeXT Keyboard non-ADB

https://deskthority.net/wiki/NeXT

Pinouts

Socket

        _____
 GND  / 5   4 \  PSW 
FROM | 3     2 | TO
      |     1 |  VCC 
       `-----'
FROM: keyboard to computer
TO:   computer to keyboard
PSW:  Power key

Power key line is normally high and is pulled to ground when pressed. PSW pin is needed to detect Power key unlike ADB.

Cable inside keyboard

+-----+
|Black|\
|Green|-\
|Yello|--\--------  to computer via Mini-Din 5 plug
|Orang|--/--------
|Red  |-/
|Brown|/
+-----+
Black:  FG
Green:  GND
Yellow: PSW(Power key)
Orange: FROM Keyboard
Red:    TO Keyboard
Brown:  VCC

NeXT Keyboard Protocol

Signal

It seems to be UART with 18958.3333baud(= 455kHz / 24) and its pulse width is 52.7472us.

It is a kind of UART signal with 11-bit frame probably. 1-start bit(0), 8-data bit(lsb-first), X(0/1), 1-stop bit(1)

or

1-start bit(0), 9-data bit(lsb-first), 1-stop bit(1)

'X' part bit or 9th data-bit is unclear about its usage, not parity.

Confirmed that on 'SET_LED' command interval between first and second data can be varied. This means the command is consisted of two 8/9-bit data, not one 22-bit data.

Responses

Keyboard to Host

KEYBOARD events

Response to QUERY_KEYBOARD command

 ____   ___________________   ______________________
     \_/_________________/ \_/_________________/
      S 0 1 2 3 4 5 6 F X T S a b c d e f g h X T

0-6: keycode   / F: 0 when key is pressed, 1 when released
a-g: modifiers / h: 0 when modifier state is changed, 1 when not changed

Modifier state: 0(off), 1(on)
    a: Control
    b: L-Shift
    c: R-Shift
    d: L-Command
    e: R-Command
    f: L-Alt
    g: R-Alt

No event

0x00, 0x00

____                   ___                   ______       
    \_________________/   \_________________/        
     S 0 1 2 3 4 5 6 F X T S a b c d e f g h X T

Key only event

0xKK, 0x80

Key with no modifiers

 ____   _______________   _                 _   ____
     \_/_______________\_/ \_______________/ \_/
      S 0 1 2 3 4 5 6 F x T S a b c d e f g h x T

Key event with modifiers

0xKK, 0xMM

Note that modifiers state is not changed(h=1)

 ____   _______________   _   _______________   ____
     \_/_______________\_/ \_/_______________\_/
      S 0 1 2 3 4 5 6 F x T S a b c d e f g h x T

Modifiers only event

0x80, 0xMM

No other key is pressed

____                 _   _   _____________     ____
    \_______________/ \_/ \_/_____________\___/
     S 0 1 2 3 4 5 6 F x T S a b c d e f g h x T

Modifiers with key pressed

0xKK, 0xMM

when modifiers is changed with a key already pressed

 ____   _____________     _   _____________     ____
     \_/_____________\___/ \_/_____________\___/
      S 0 1 2 3 4 5 6 F x T S a b c d e f g h x T

Modifiers with keycode released

0xKK, 0xMM

when modifiers is changed with a key released. This cannot seem to be happened.

 ____   _______________   _    ____________     ____
     \_/_______________\_/ \__/____________\___/
      S 0 1 2 3 4 5 6 F x T S a b c d e f g h x T

MOUSE events

Response to QUERY_MOUSE command

____   ___________________   ______________________
    \_/_________________/ \_/_________________/
     S L 0 1 2 3 4 5 6 X T S R 0 1 2 3 4 5 6 X T

      L: Left Button        R: Right Button
      0-6: X-movement       0-6: Y-movement

No event

0x00, 0x00

____                   ___                   ______       
    \_________________/   \_________________/        
     S L 0 1 2 3 4 5 6 X T S R 0 1 2 3 4 5 6 X T

MOUSE button event

____   _                 _   _                 ____
    \_/_\_______________/ \_/_\_______________/      
     S L 0 1 2 3 4 5 6 x T S R 0 1 2 3 4 5 6 x T

MOUSE move event

____   _______________   _   _______________   ____
    \_/_______________\_/ \_/_______________\_/
     S L 0 1 2 3 4 5 6 x T S R 0 1 2 3 4 5 6 x T

Commands

Host to Keyboard

QUERY_KEYBOARD

0x10

____           _       ____
    \_________/ \_____/
     S 0 1 2 3 4 5 6 7 X T

SET_LED

0x00, 0x0?

____                   _____   ___               __
    \_________________/     \_/___\_____________/
     S 0 1 2 3 4 5 6 7 X T   S L R 2 3 4 5 6 7 x T

L: Left LED
R: Right LED
LED state: 0(off), 1(on)

RESET

0xEF, 0x00

____   _______   ___________                     __
    \_/       \_/           \___________________/
     S 0 1 2 3 4 5 6 7 X T   S 0 1 2 3 4 5 6 7 x T

QUERY_MOUSE

0x11

____   _       _       ____
    \_/ \_____/ \_____/
     S 0 1 2 3 4 5 6 7 X T

Keyboard Scan code

,---------------------------------------------------------. ,-----------. ,---------------.
|Esc|  1|  2|  3|  4|  5|  6|  7|  8|  9|  0|  -|  =|  BS | |VUp|Pwr|BrU| |`  |  =|  /|  *|
|---------------------------------------------------------| |-----------| |---------------|
| Tab |  Q|  W|  E|  R|  T|  Y|  U|  I|  O|  P|  [|  ]|  \| |VDn|   |BrD| |  7|  8|  9|  -|
|---------------------------------------------------------| `---'   `---' |---------------|
| Ctrl |  A|  S|  D|  F|  G|  H|  J|  K|  L|  ;|  '|Return|               |  4|  5|  6|  +|
|---------------------------------------------------------|     ,---.     |---------------|
| Shift  |  Z|  X|  C|  V|  B|  N|  M|  ,|  .|  /|  Shift |     |Up |     |  1|  2|  3|   |
|---------------------------------------------------------| ,-----------. |-----------|Ent|
|Alt  |Cmd  |              Space              | Cmd | Alt | |Lef|Dow|Rig| |      0|  .|   |
`---------------------------------------------------------' `-----------' `---------------'

,---------------------------------------------------------. ,-----------. ,---------------.
| 49| 4A| 4B| 4C| 4D| 50| 4F| 4E| 1E| 1F| 20| 1D| 1C|  1B | | 1A|*58| 19| | 26| 27| 28| 25|
|---------------------------------------------------------| |-----------| |---------------|
| 41  | 42| 43| 44| 45| 48| 47| 46| 06| 07| 08| 05| 04| 03| | 02|   | 01| | 21| 22| 23| 24|
|---------------------------------------------------------| `---'   `---' |---------------|
|  *57 | 39| 3A| 3B| 3C| 3D| 40| 3F| 3E| 2D| 2C| 2B|  2A  |               | 12| 18| 13| 15|
|---------------------------------------------------------|     ,---.     |---------------|
|   *56  | 31| 32| 33| 34| 35| 37| 36| 2E| 2F| 30|   *55  |     | 16|     | 11| 17| 14|   |
|---------------------------------------------------------| ,-----------. |-----------| 0D|
| *52 | *54 |              38                 | *53 | *51 | | 09| 0F| 10| |    0B | 0C|   |
`---------------------------------------------------------' `-----------' `---------------'
*: pseudo scan code

There are two variants for keyboard layout. Note that Return and \ key are different.

https://www.nextcomputers.org/forums/index.php?topic=4918.msg29168#msg29168

NeXT Mouse non-ADB

Pinouts

Mouse is connected to keyboard and host queries to keyboard for mouse data.

Resources

Keyboard Interface

  • NeXT Computer(N1000) have non-ADB interface on Display(N4000).

  • NeXTcube(N1000A) seems to have non-ADB interface on Display(N4000A).

  • NeXTstation seems to have ADB interface on SoundBox and Display.

  • NeXTstation Turbo(N1100)

  • NeXTstation Turbo Color(N1200)

  • SoundBox(N4004)

  • https://www.okqubit.net/machines/next.html

MegaPixel Display

Clone this wiki locally