Welcome

Keyboard/mouse

Ofcourse, I wanted to connect the original keyboard and mouse to the Mac. The MacSE uses a protocol called ADB, the Apple Desktop Bus, to connect multiple desktop accesories to the Mac. It's a fairly nice bus: you just daisy-chain all your peripherials in any way you deem handy, connect it all to the Mac and it works.

I did some research first, to see if anyone else has tackled the conversion problem before. Via the Keyboard Babel project, I got one hit: someone tried to connect his Apple keyboard to an PS/2-bus. Unfortunately, the site was dead; the archive.org mirror still was there but without any downloadable programs. These would have been kind of useless anyway: the guy who made it didn't put any source code online. With that being the only free implementation I found, I decided I had to build my own converter from scratch.

While the protocol has long been deprecated, there's still some info floating around. The two documents I used the most: Microchip still has an ancient application note floating around which describes how to make an ADB device and includes hints on the physical protocol. Apple has legacy documentation about the higher levels, most concerning the Macintosh OS support but making more than a few things clear about the underlying protocol too.

With these documents in hand, I had the ADB protocol implemented fairly quickly, and I could start getting the USB-part to work. I decided to use the V-USB project for that, which is a software low-speed USB stack implementable in most generic AVRs. While reading through the documentation of the stack, I found out I would have to install a separate microcontroller to handle the USB-portion of the converter: both ADB and USB are asynchronous, and there was no way one microcontroller could just halt an USB-transfer-in-progress and go service the ADB-bus, or the other way around. So I had to use two of them, one to handle ADB and another to handle USB, making my final schematic look like this:

The schematic consists of the 2 ATTiny2313s, one handling the ADB and the other handling the USB portion of the conversion. The ADB-AVR has firmware polling the ADB-line and checking if mouse-movement has occurred or if a key has been pressed. it'll then convert the ADB-specific scancodes and mouse-movement-codes into ones that fit the USB standard. This AVR has the Tx-line of its serial port connected to the Rx of the USB-microcontroller; it uses it to send USB HID-reports to the other microcontroller. The second AVR picks these up and sends them more-or-less verbatim over the USB-line to the connected PC (or Dockstar).

Apart from the microcontrollers themselves, there's some more components needed: USB is a 3.3V-based protocol while ADB runs on 5V. That's why I inserted 2 diodes in the Vcc-line of the USB-AVR: these drop the supply voltage down to something that's more-or-less 3.3V-ish. For that same reason, there's an 1K resistor in the serial line: that'll limit the current when the ADB AVR tries to output 5V and the USB AVRs ESD-diodes try to clamp that to 3.3V.


And here's how I physically put everything together: a nice little PCB with an ADB-connector on one side and an USB-plug on the other. The firmware inside the 2 AVRs still isn't completely 100% btw; it has no support for the Apple Extended Keyboard (but treats it as a 'normal', basic keyboard) and sometimes manages to miss a keypress. It's probably something trivial in the code, maybe I'll fix it later; I'm not planning on typing too much on it anyway.

« Prev 4 Next »


© 2006-2016 Sprite_tm - Contact