AMIGA 500/1000/2000 Keyboard Interface

Yeah. I'll double check it with my A1000. I did notice that with the A1000 keyboard, I needed an external power supply for it (the Arduino kept on browning-out) and also if i touched the data/clock pins, it would generate more noise.

A couple things I'm going to try (and will report back here afterwards, to document it)

  • Try out the keyboard on my real A1000, confirm it is workign
  • Try out my second A1000 keyboard (it's packed away currently)
  • Hit the data/clock pins on the A500 and A1000 keyboards with my scope to see if they're outputting different voltage levels
  • if all of that looks ok. i'll solder directly to the A1000 keyboard connectors, avoiding the RJ-12 cable and its interconnects... admittedly, this could be a HUGE factor

But yeah, the pullups in the A500 schematic are different than the A1000 (4.7k vs 10k) so that, combined with the RJ-12 cable could be pushing the voltage levels down to the point that the Ardy can't quite read the right levels...

Okay. I just tried a whole bunch of things...

Just tried two A1000 keyboards on my A1000, and both work perfectly. Also tried them on my A500 with an adapter I made, and they work as-expected there too. I measured the output from the keyboards. The A500 keyboard shows a 0 - 2.8v range on its clock and data lines. The A1000 keyboard shows a 0 - 1.9v range on the same lines. I did connect wiring directly to the A1000 keyboard internally as well, and it showed no difference nor improvement.

So I think I need to build some sort of voltage level converter to boost the A1000 keyboard's signaling range.

How did you measure the output voltages? Oscilloscope?

Yes. on a scope. Although I just got a better one on loan from a friend and I've found something interesting...

The signalling looks the same (Since i've run the A1k keyboard on my A500, i know it's compatible) however, it's MUCH quicker.

Clock pulses on the A500 keyboard are around 50us. On the A1000 keyboard, they're about 25us, so this code won't work as it is. I'm looking into optimizing it.

For the A1k keyboard, you also will probably need to clean up the signal by throwing some external pullup resistors. I'm using 3.3k pullups (as per the A1k schematic) and it squares out the A1000's signal pretty well. The A500 keyboard works fine with these pullups as well.

Updated code soonish... :slight_smile: Although I may end up rewriting it...

(and the voltage measurement was wrong. they're both rock solid around 4v)

Hello @all!

As I'm also using a German keyboard layout, I noticed two errors in CypherXG's code.

CypherXG:
[...]

                 if ((key==0x2B) && (_keyReport.modifiers & 0x22)) keystroke(0x35,0x00);  // ^ (with shift)                  else if (key==0x00) if (_keyReport.modifiers & 0x22) keystroke(0x30,0x40); else keystroke(0x35,0x20); // ~,`                  else if (key==0x0D) if (_keyReport.modifiers & 0x22) keystroke(0x64,0x40); else keystroke(0x2D,0x40); // |,\                  else if (key==0x5A) if (_keyReport.modifiers & 0x22) keystroke(0x24,0x40); else keystroke(0x25,0x40); // {,[                  else if (key==0x5B) if (_keyReport.modifiers & 0x22) keystroke(0x27,0x40); else keystroke(0x26,0x40); // },]                  else if (key < 0x68) keypress(key);  // Code table

Has to be replaced with

                  if ((key==0x2B) && (_keyReport.modifiers & 0x22)) keystroke(0x35,0x00);  // ^ (with shift)
                  else if (key==0x00) if (_keyReport.modifiers & 0x22) keystroke(0x30,0x40); else keystroke(0x32,0x02); // ~,'
                  else if (key==0x0D) if (_keyReport.modifiers & 0x22) keystroke(0x64,0x40); else keystroke(0x2D,0x40); // |,\
                  
                  else if (key==0x5A) if (_keyReport.modifiers & 0x22) keystroke(0x24,0x40); else keystroke(0x25,0x40); // {,[
                  else if (key==0x5B) if (_keyReport.modifiers & 0x22) keystroke(0x27,0x40); else keystroke(0x26,0x40); // },]
                  else if (key < 0x68) keypress(key);  // Code table

This works with the current WebIDE (Web App Version - 3.0.8 ). Note the additional free line behind the definition of " |,\ " (otherwise the next line will be ignored) and the corrected keystroke for " ~,' " (was actually " ~,° ").

Also, I'm experiencing weird behaviour when using "Ctrl+Amiga+Amiga", regardless of activating the reset code or not. Every time, "Ctrl-Amiga+Amiga" is pressed, the keyboard seems to be stuck at holding "Ctrl+Amiga". I verified this a lot of times, after "Ctrl+Amiga+Amiga" p.e. pressing "d" opens a new virtual desktop in Windows 10. After pressing each of the three keys once (and alone), everything is as normal.

"Ctrl+Amiga" (one, not both Amiga keys) does not produce this "stuck keys" behaviour.

Anyone an idea for a solution?

Greetings from Germany

René

You're probably seeing that behavior with Ctrl-A-A because you get most of those key-down messages (at least for whatever the first two keys that are pressed, and then the keyboard controller resets itself and toggles the RESET line. You never actually get the key up messages. maybe. I haven't fully figured out the capabilities of the code provided here...

I'm working on new firmware which has slightly different wiring, to improve compatibility with A1000's speed and the A2000/3000 keyboard behaviors. -- Clock and data connect to pins D0 and D1 instead of D8 and D9. I am not yet ready to share this, but i will post on this thread when i am.

A2000/3000 have a different reset (ctrl-a-a) behavior than the A500.. You can simulate this by disconnecting Q1 from the circuit on your keyboard's controller. It won't be necessary for mine...

Hi everyone, I'm new user.
I have a problem I would like to transform the A500 USB keyboard with Arduino Leonardo pro micro, but I do not know how to connect someone has some picture or scheme on where the A500 connector should be placed?
Thanks to all of you, I hope I have explained myself well.

It is in the first post:
https://forum.arduino.cc/index.php?topic=139358.0

From that post:

Keyboard   Leonardo
Connector  IO           

1   KBCLK   8
2   KBDATA  9
3   KBRST   10
4   5v      5v
5   NC
6   GND     GND
7   LED1    5V
8   LED2    -

Hi Polymorph thank you for reply :slight_smile:
I'm just starting, which files should I upload then on to Arduino Leonardo pro micro in order to work?

if I purchase Arduino Leonardo pro micro with ATMEGA32U4, should it be all right?

thank you

I attach the scheme of the two models, according to you and correct?

First of all. Thanks to all involved in this project! With minimal soldering skills and knowlage in Arduino i managed to make this happen. So happy to finaly get my project going and resurrect my A500+ from the dead (broken motherboard).

I used a Arduino Leonardo pro micro clone for this project.

Phoenix2003:
Hi Polymorph thank you for reply :slight_smile:
I'm just starting, which files should I upload then on to Arduino Leonardo pro micro in order to work?

if I purchase Arduino Leonardo pro micro with ATMEGA32U4, should it be all right?

thank you

I attach the scheme of the two models, according to you and correct?

I've used the same board and your scheme for the connection. And it works. :slight_smile:

patts75:
I've used the same board and your scheme for the connection. And it works. :slight_smile:

Thank you :wink:

how did you program it?

Phoenix2003:
Thank you :wink:

how did you program it?

I used @DrRemulak script on page 5 (post #60) and the latest IDE. And it works like a charm with Amibian. No joystick DSubs wired up just yet. But i'll try that out later.

It works! I'm typing this text from my Amiga 1000 keyboard. I first experimented the same issues as Yorgle did (garbage text with an A1000 keyboard, as he mentioned on comment #63), but it appears the issue didn't come from a presumed specific clock speed (comment #68), it just came from a faulty adapter, making noise in the signal. Here is what I did to make it work:

  • Plugging the RJ9 male jack from the Amiga 1000 keyboard cordon into a regular RJ45 CAT5e female connector

  • Wiring pins 3, 4, 5 and 6 from the RJ45 to the pins 5v, 8, 9, GRND respectively on the Arduino Leonardo with CAT5e single-strand network cable (I think THIS PARTICULAR kind of cable makes it works without making any noise on the signal)

The wires are not soldered. They are crimped on the RJ45 side and have the right width for connecting them directly into the Arduino Leonardo headers.

My keyboard is a French version (ISO/European layout), and I use the code from DrRemulak (comment #60).

EDIT: the controller on my A1000 keyboard with ISO layout is a MOS 6570-36, the same one found on the other Amiga keyboard (500, 2000, 3000, 4000). I guess it's because this Amiga is the second generation of A1000, the PAL version, launched in Europe in 1986, just before the A500 and A2000. Yorgle seems to have an original A1000 NTSC, produced in 1985. On this earlier model the controller is a MOS 6570-33. Maybe that explains the incompatibility he experimented with the code we discuss here.

Hey guys, I'm new to the forum. sorry for my english.
I built an a500, inside I mounted a toshiba portege r830,
I adapted the a500 keyboard with arduino pro micro 5v. when windows started system everything works perfectly. often I use the bios to boot from cd ... every time I have to connect an external usb keyboard, because of the problem of hid leonardo recognition ... I also read a certain NICOHOOD who released patches in about. but let's say that I'm very good with wired electronics, and the electronics programmed for me is a bit difficult to understand ... someone would know how to help me about the problem of bios with an example to apply, and I would be grateful. :slight_smile:

Here is code for early A1000 keyboards with the MOS 6570-33/328191-01 keyboard controller IC! My tests have all been great so far.

I also figured out the reboot issue! The A1000 keyboard does not have a separate RESET signal wire, it only has 4 wires on the connector. Also the 4-wire reboot code in this sketch can be applied to my previous A2000 code to make it work on 4-wire A2000 keyboards.

sketch_a1000kbd.ino (6.95 KB)

And here is a version for A2000 4-wire keyboards. I have not tried it on A500/A2000 with extra Reset wire, but it very well may work.

Annoyingly, my 4-wire A2000 keyboard (and possibly others), ignore the first keystroke. What happens is the Leonardo waits for the first keystroke to sync with the keyboard, and during that sync phase misses the keypress. However it does get the key release, so I added code there to process it as a press-and-release. Because of that, held-down modifiers (shift, ctrl, alt) are ignored. I did get CTRL+Amiga+Amiga to work as the first keystroke though.

sketch_a2000_4wirekbd.ino (7.97 KB)

lagri:
I am a totally noob in Arduino,
i am trying program a Arduino Pro Micro with this code to use a spanish A2000 keyboard on a Raspberry Pi , when i connect the Arduino on the PC USB connector, the computer think that i has press CTRL+ALT+DEL,
Whats append?
Is problem of my Arduino Pro Micro?
I am doing something wrong?

Which code are you using? The original code by the original poster has this issue, but not my modified code. See the code attached to my latest posts.

I have discovered one more bug. The CTRL-ALT-DEL command is being sent on bootup and connection. I missed it because uploading the sketch and the reconnection/restart of the Arduino did not cause it. It is only when I boot up a PC, or when I plug the Arduino in to USB that the this happens. I discovered that I have no need for the CTRL+A+A reboot functionality, so I simply commented out the two lines that send it. They must be both commented out to avoid this issue. Not sure why both are being executed at connection, I will revisit this later.

This is the keyboard mapping (with wire colors) that worked for my Amiga 500 …

Amiga 500 wire harness Arduino pin

1 KBCLK (bronze wire) 9
2 KBDATA (black wire) 8
3 KBRST (red wire) 10
4 5v (orange wire) 5v
5 NC
6 GND (green wire) GND
7 LED1 (blue wire) 5v
8 LED2