Mac68k Forums

Home


Welcome, Guest
Guest Settings
Help

Mac68k Forums » Development » Hardware Hacking

Thread: 128k/512k/Plus Keyboard Interface


Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 93 - Pages: 7 [ Previous | 1 2 3 4 5 6 7 | Next ] - Last Post: Mar 13, 2018 4:38 PM Last Post By: Popjoel Threads: [ Previous | Next ]
bigmessowires


Posts: 217
Registered: 10/29/13
Re: 128k/512k/Plus Keyboard Interface
Posted: Oct 30, 2013 11:46 PM   in response to: bbraun in response to: bbraun
Click to report abuse...   Click to reply to this thread Reply
That sounds like a good idea - then you won't need to maintain two different versions of the software for the different boards.

What did you end up doing about the keyboard cable vs phone cable? It's always the phone cable now?
bbraun


Posts: 493
Registered: 7/25/12
Re: 128k/512k/Plus Keyboard Interface
Posted: Oct 30, 2013 11:47 PM   in response to: bigmessowires in response to: bigmessowires
Click to report abuse...   Click to reply to this thread Reply
Yeah, it's just always phone right now.
bbraun


Posts: 493
Registered: 7/25/12
Re: 128k/512k/Plus Keyboard Interface
Posted: Nov 1, 2013 12:13 AM   in response to: bbraun in response to: bbraun
Click to report abuse...   Click to reply to this thread Reply
Attachment usbadb1.jpg (62.1 K)
I sent off the mini pcb with a spare pin grounded and I toyed with the spacing of the DB9 connector a little more, trying to get enough space to see the keyboard vs. mouse labeling for the PS2 connectors.

I also was able to make the USB detection more reliable for the USB/ADB adapter. I rewrote the timing code to use the timer I was already using for the ADB and pre-ADB protocols.

USB mouse or keyboard to ADB is working right now. I'm still working on bringing the pre-ADB code over, and haven't soldered those connectors on quite yet.

bbraun


Posts: 493
Registered: 7/25/12
Re: 128k/512k/Plus Keyboard Interface
Posted: Nov 1, 2013 11:41 PM   in response to: bbraun in response to: bbraun
Click to report abuse...   Click to reply to this thread Reply
I've got USB mouse to pre-ADB mouse working now, in addition to ADB mouse and ADB keyboard. I just need to port over the pre-ADB keyboard.

I've found a couple things to improve with another PCB spin on this too. Since you can only do one of keyboard or mouse with this board, a passthrough ADB port seems reasonably important.
I also realized that if I added a second GPIO for the ADB line, I could read and write the bus simultaneously, in order to implement collision detection.

I've put the gerbers up at http://synack.net/~bbraun/mackbd/usbadb1.zip
bbraun


Posts: 493
Registered: 7/25/12
Re: 128k/512k/Plus Keyboard Interface
Posted: Nov 4, 2013 12:25 AM   in response to: bbraun in response to: bbraun
Click to report abuse...   Click to reply to this thread Reply
pre-ADB keyboard working now too, so all the major pieces are in place. I haven't implemented the ADB power button yet, but that is pretty straightforward.
I think I'm going to go ahead with the last (usbadb1.zip) version of the PCB tomorrow, since things seem to be working.
bigmessowires


Posts: 217
Registered: 10/29/13
Re: 128k/512k/Plus Keyboard Interface
Posted: Nov 5, 2013 3:16 PM   in response to: bbraun in response to: bbraun
Click to report abuse...   Click to reply to this thread Reply
That's great! I've been using my adapter for several weeks now with my Mac Plus, and it works like a champ. Support for USB keyboards and mice will be awesome. Now you just need a 3D printed case!
bbraun


Posts: 493
Registered: 7/25/12
Re: 128k/512k/Plus Keyboard Interface
Posted: Nov 5, 2013 4:14 PM   in response to: bigmessowires in response to: bigmessowires
Click to report abuse...   Click to reply to this thread Reply
Yeah, I've been thinking about asking olePigeon about a 3D case, since it seems like he has access to a printer. :)

The two major downsides to the USB at the moment are: 1) no hubs, so two adapters are necessary, 2) fallout from #1 is many (most?) keyboards are really hubs that have the keyboard hanging off of the internal hub. So for keyboards, you need to get a keyboard without any extra USB ports on it.

Hub support would be nice, but there's a lot I need to learn to understand if it's even possible on the discovery board's hardware. Plus, the existing ST sample code is not at all structured for multiple devices. Internally it assumes there is "a", singular, device in all its datastructures. So, basically all the USB code would need to be rewritten. There's several (RT)OS' out there that support the chip, so maybe at some point it might be interesting to try getting one of those running.

Current status on the USB: I'm having some difficulty getting reliable device enumeration. It'll see a device attached, and then fail to retrieve the descriptors. It seems to be timing dependent, since I can tweak the timing and get 100% reliable enumeration of my mouse, and then the keyboard will only successfully enumerate about 1/5th of the time. I'm still poking at it though.
I rearranged some of the pins, since I was using some of the pins that are also used for the discovery board's LEDs, and I actually wanted to use some of the LEDs to indicate status. I'm now using an LED to indicate successful device enumeration, so you can see the status there without needing a serial connection, or if your device doesn't have any way of indicating it's working.

I ordered the PCBs yesterday, but within a couple hours I realized I left the RJ11 wired for straight through instead of telephone cables. Sigh.
bigmessowires


Posts: 217
Registered: 10/29/13
Re: 128k/512k/Plus Keyboard Interface
Posted: Nov 5, 2013 5:38 PM   in response to: bbraun in response to: bbraun
Click to report abuse...   Click to reply to this thread Reply
Would looking at something like LUFA or AVR USB be any help for understanding how to support multiple devices? They're designed for a different microcontroller and so not directly usable, but they seem to be well-supported and well-documented. Maybe a peek at the source code would help explain how things are supposed to work with a USB hub.
bbraun


Posts: 493
Registered: 7/25/12
Re: 128k/512k/Plus Keyboard Interface
Posted: Nov 5, 2013 9:10 PM   in response to: bigmessowires in response to: bigmessowires
Click to report abuse...   Click to reply to this thread Reply
Well, it'd probably help understanding, but pretty much none of the existing code will work because of the assumptions of a single device. So maybe something like Coocox that already supports the mcu and usb and everything, then just port the adb & pre-adb to that.
bbraun


Posts: 493
Registered: 7/25/12
Re: 128k/512k/Plus Keyboard Interface
Posted: Nov 7, 2013 10:41 PM   in response to: bbraun in response to: bbraun
Click to report abuse...   Click to reply to this thread Reply
Attachment minipcb-5.jpg (61.7 K)
Attachment minipcb-4.jpg (66.1 K)
Attachment minipcb-3.jpg (100.7 K)
Attachment minipcb-2.jpg (114.3 K)
Attachment minipcb-1.jpg (89.7 K)
I got the taller female headers to get the ps2 adapter board higher up off the jumpers of the discovery board. It works with the minipcb I've already got, and I just soldered a single wire to ground to match the detection pin I added to the new revision that isn't here yet.
So the only real difference is the newer board will be slightly larger and hopefully the DB9 won't be as crowded.
I modified the code to check for that pin, and I've tested it with both this minipcb and the older fullsized one, and it works. It's committed to the svn repository here on mac68k.info.

Here's some pictures of it all together:






Anyone that wants one of this batch, let me know and I can send it off.
bbraun


Posts: 493
Registered: 7/25/12
Re: 128k/512k/Plus Keyboard Interface
Posted: Nov 13, 2013 12:58 AM   in response to: bbraun in response to: bbraun
Click to report abuse...   Click to reply to this thread Reply
Back on the USB side, I remembered the discovery board has accelerometers on it. So when no USB device is plugged in, it's an accelerometer mouse: http://youtu.be/0NzBXN57Yno
bigmessowires


Posts: 217
Registered: 10/29/13
Re: 128k/512k/Plus Keyboard Interface
Posted: Nov 13, 2013 11:33 AM   in response to: bbraun in response to: bbraun
Click to report abuse...   Click to reply to this thread Reply
That is crazy! Very cool.
bbraun


Posts: 493
Registered: 7/25/12
Re: 128k/512k/Plus Keyboard Interface
Posted: Nov 22, 2013 10:50 PM   in response to: bigmessowires in response to: bigmessowires
Click to report abuse...   Click to reply to this thread Reply
Attachment lastps21.jpg (130.0 K)
Attachment lastps22.jpg (134.3 K)
What I hope is the final version of the PS2 board arrived today. The spacing is much better than the previous one.



I haven't tested out the pre-ADB keyboard yet, since I realized I don't actually have a handset cord with 4 conductors. But ADB works.
bigmessowires


Posts: 217
Registered: 10/29/13
Re: 128k/512k/Plus Keyboard Interface
Posted: Nov 22, 2013 11:47 PM   in response to: bbraun in response to: bbraun
Click to report abuse...   Click to reply to this thread Reply
Looking good!

That's a great point that typical handset cords won't have 4 conductors. Do you need special multi-line phone cable?
bbraun


Posts: 493
Registered: 7/25/12
Re: 128k/512k/Plus Keyboard Interface
Posted: Nov 23, 2013 4:44 PM   in response to: bigmessowires in response to: bigmessowires
Click to report abuse...   Click to reply to this thread Reply
Well, I just went to radio shack and picked up a regular handset cord from them, and it was 4 conductor. The keyboard works, although I found that I grounded one of the mouse pins for some reason. I just had to cut that trace and the mouse worked. oops.

Point your RSS reader here for a feed of the latest messages in all forums