geekhack Projects > Making Stuff Together!

Macintosh M0110 USB converter

(1/28) > >>

hasu:

This firmware converts the protocol of Apple Macintosh 128K/512K/Plus Keyboards like M0110, M0110A(with keypad) and M0120(keypad) into USB. The retro keyboard can be revived connecting to mordern compter with this converter.





M0110


M0110A


MoreM0110 + M0120


M0120




README FIRST
https://github.com/tmk/tmk_keyboard/tree/master/converter/m0110_usb

and optionally,
https://github.com/tmk/tmk_keyboard/wiki
https://github.com/tmk/tmk_keyboard/labels/NOTE




Changes:
2012/05/26: M0110A is now supported. Thanks for your contribution, skagon!
2013/08: Change port for signals PF to PD
2013/09: Change port again, it uses inversely PD0 for data and PD1 for clock line now.
2015/03: Add support for "International"(ISO) keyboard(keymap_intl.c)
2015/07: Update keymap editor(for Rev.1)
2016/01: Updated keymap editor(for Rev.2)
2019/01: Reorgarnized first post a bit.  This thread is not dead :)
2020/09: Add NEED HELP section in this post



TMK M0110 Converter Revisions:
Instead of building converter yourself  you can get preassembled converter from me.

Preassembled TMK converter is available here! https://geekhack.org/index.php?topic=72052

Rev.2.5 Micro USB/ATMega32u2 with detachable cable


Older revisions:
MoreRev.2: Micro USB/ATMega32u2


Rev.1: Mini USB/ATMega32u4







Build Hardware yourself
You need 4P4C cable and ATMega32U4 or ATMega32U2 dev board. Port of the MCU PD1 is assigned to CLOCK line and PD0 to DATA by default, you can change pin configuration with editing config.h.


4P4C Plug:
You can find 4P4C plug as phone handset cable if you don't have Mac keyboard cable.
http://en.wikipedia.org/wiki/Modular_connector#4P4C

NOTE: Original cable used with Mac is straight while phone handset cable is crossover. Close-up pics of handset cable. You can see one end of plug has reverse color codes against the other. Click to enlarge.
More



Socket pinout:

--- Quote ---
Mac 128k/512k/Plus Keyboard pinout
.---------,
| 1 2 3 4 | 1 GND
|         | 2 Clock
|         | 3 Data
`---___---' 4 5V
from front of socket on keyboard

--- End quote ---

This image displays pinouts on Mac side socket but same on keyboard side.
http://www.kbdbabel.org/conn/kbd_connector_macplus.png
http://old.pinouts.ru/Inputs/MacKeyboard_pinout.shtml



Pull-up resistor:
You are strongly recommended to have pull-up resistors on two signal lines though it might work well without them. In particular when you use long or coiled cable you probably need them.





Keymap Editor
You can use Keymap Editor to define your keymap and download firmware using web browser(Chrome is recommended).
http://www.tmk-kbd.com/tmk_keyboard/editor/



For preassembled TMK M0110 Converter(ATmega32u2):
- M0110 layout: http://www.tmk-kbd.com/tmk_keyboard/editor/unimap/?m0110_usb
- M0110A layout: http://www.tmk-kbd.com/tmk_keyboard/editor/unimap/?m0110_usb_m0110a

For DIY converter with ATmega32u4:
- M0110 layout: http://www.tmk-kbd.com/tmk_keyboard/editor/unimap/?m0110_usb_rev1
- M0110A layout: http://www.tmk-kbd.com/tmk_keyboard/editor/unimap/?m0110_usb_rev1_m0110a


Flash firmware
Refer this wiki page for how to flash firmware onto the converter.

https://github.com/tmk/tmk_keyboard/wiki#flash-firmware



Build Frimware
When Keyamp Editor is not enough for your need you can build firmware from source codes.

$ git clone git://github.com/tmk/tmk_keyboard.git
$ cd converter/m0110_usb
$ make
and program your controller with compiled firmware.

Firmware Source: https://github.com/tmk/tmk_keyboard/tree/master
See also:https://github.com/tmk/tmk_keyboard/tree/master/converter/m0110_usb





Locking CapsLock key support
See this entry. Use keycode 'LCAP' instead of 'CAPS' for the key in short. You can find it as 'Locking Caps Lock' in 'Function and Keypad' tab on Keymap Editor.
https://github.com/tmk/tmk_keyboard/#mechanical-locking-support


Turn locking CapsLock key into normal momentary one physically
For M0110 and M0110A(Alps model): You can get descrete SKCC short stem switch for locking switch replacement here. https://www.aliexpress.com/item/SKCC-BJ0001-keyboard-switch-button-switch-reset-switch-micro-switch/32813803943.html

For M0110A(MITSUMI model): You can just remove locking mechanism of the switch easily instead of replacement. It still requires desoldering though.


M0110 Protocol - technical resource
Source code
    https://github.com/tmk/tmk_keyboard/blob/master/tmk_core/protocol/m0110.c
Technical Info for 128K/512K and Plus
    ftp://ftp.apple.asimov.net/pub/apple_II/documentation/macintosh/Mac%20Hardware%20Info%20-%20Mac%20128K.pdf
    ftp://ftp.apple.asimov.net/pub/apple_II/documentation/macintosh/Mac%20Hardware%20Info%20-%20Mac%20Plus.pdf
Protocol:
    Page 20 of Tech Info for 128K/512K
    http://www.mac.linux-m68k.org/devel/plushw.php
Connector:
    Page 20 of Tech Info for 128K/512K
    http://www.kbdbabel.org/conn/kbd_connector_macplus.png
Signaling:
    http://www.kbdbabel.org/signaling/kbd_signaling_mac.png
    http://typematic.blog.shinobi.jp/Entry/14/
Scan Codes:
    Page 22 of Tech Info for 128K/512K
    Page 07 of Tech Info for Plus
    http://m0115.web.fc2.com/m0110.jpg
    http://m0115.web.fc2.com/m0110a.jpg


TROUBLE WITH YOUR DIY CONVERTER?
You are using Pro Micro?
Confirm it is a 5V version with 16MHz crystal. Make solder bridge on J1 and use VCC for 5V power, not RAW.  MUST check this page also.

I'm never willing to recommend you to use Pro Micro unless you are already familiar to it and have skill to solve problems yourself. Pro Micro is bad choice especially if this is your first time project. Alternatives are PJRC Teensy2.0 and TMK converter, of course!

Please don't ask help for problem specific to Pro Micro here.

Don't ask help before placing pull-up resistors and trying solder on J1!

MoreIn most cases your wiring is wrong. Check your wiring yourself again and again, one hundred times! And try swapping wires at your own risk, note that your wiring are already wrong at this point probably :D It won't break your keyboard unless you are extremely unlucky.

Now you need help? OK. If you are not sure about your wiring, post pics of your hardware and wriring this really save our time. Don't save your time by omitting this. Shots of controller side and ADB connector/keyboard side would be helpful. If you edit code post your code. Don't hesitate to show your dirty code! Also output from hid_listen command would be useful to debug hardware and firmware.

[rant]
Don't take advantage of generosity of kind and helpful members(yes, including me, of course  ;))! Their time is more precious than your time, use your time to learn and look into your problem first.
[/rant]

JMK:
Hello.
I am jmk, a complete newbie here.
It is odd that I used to see many comments and discussions here, but suddenly they are all gone.
Anyway, inspired by hasu's mod of m0110, I also tried to do the mod in a slightly different but fundamentally the same way.
But I encountered a problem with figuring out pinout and connection between the keyboard and teensy.
I sent hasu a message, and he thinks it is better to discuss it publicly. So here is my question and hasu's answer.

I asked about the arrangement of the color of 4p4c because 4p4c is usually crossover-wired. So, for example, yellow can be either +5V or GND (to put is another way, it can be either #4, or #1)

Images below are the messages that I traded with hasu

[ Attachment Invalid Or Does Not Exist ] 43488[/ATTACH]
[ Attachment Invalid Or Does Not Exist ] 43489[/ATTACH]
[ Attachment Invalid Or Does Not Exist ] 43490[/ATTACH]

I hope this helps someone who has the same issue like me.

As I do the mod, I will post my questions and solutions.

JMK:
I have tried to hand-wire the keyboard and teensy without using handset cable.
Based on the information of kbdbabel, I connected keyboard and teensy (directly from keyboard pcb to teensy).
The result was not very good.
Here is the result:
[ Attachment Invalid Or Does Not Exist ] 43491[/ATTACH]

As I strike each key, each letter is typed twice as shown above. After "\" key stroke, the keyboard stopped working, and I disassemble what I did today so far and reverted the keyboard to its original condition.
As soon as I retrieve an handset cable next week, I will try the mod in the exactly the same way that hasu did and post the result.

hasu:
JMK, thanks for posting here again to share.

I tried the converter to test just now and it didn't register any keys at all without pull-up resistors.
Though I think it worked well without them last time, but it doesn't work today.

You might need to add two pull-up resistors on DATA and CLOCK lines in Teensy side in particular when you used long cable or coiled cable.
I used 1.5K Ohm resistors but 1K-10K will be OK.

Now I'm typing my M0110 through the converter with pull-up resistors. No problem.
My pull-up resistors is like this:

JMK:
Thank you hasu
It seems like you plugged both ends of the resistors to clock/data and +5V. So clock and data ports have lines from the 4p4c connector cables and a leg of resistor, and +5V port has two legs of registers from data and clock as well as a line from the 4p4c connector cables.
I don't have resistors. So I think I will have to purchase a bunch of them on ebay or utilize some of the tiny little load resistors on an unused keyboard controller (mx8000, the switches and keycaps of which I used for another project.)
I will keep you updated on this thread.



--- Quote from: hasu;541592 ---JMK, thanks for posting here again to share.

I tried the converter to test just now and it didn't register any keys at all without pull-up resistors.
Though I think it worked well without them last time, but it doesn't work today.

You might need to add two pull-up resistors on DATA and CLOCK lines in Teensy side in particular when you used long cable or coiled cable.
I used 1.5K Ohm resistors but 1K-10K will be OK.

Now I'm typing my M0110 through the converter with pull-up resistors. No problem.
My pull-up resistors is like this:
Show Image
--- End quote ---

Navigation

[0] Message Index

[#] Next page

Go to full version