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: Nov 26, 2013 12:22 AM   in response to: bbraun in response to: bbraun
Click to report abuse...   Click to reply to this thread Reply
I was just reading some USB docs today (because that's what I do for fun, of course) and I saw this mention of USB initialization. Maybe this explains why you've had some trouble getting USB enumeration to work reliably?

http://www.beyondlogic.org/usbnutshell/usb2.shtml
A USB device must indicate its speed by pulling either the D+ or D- line high to 3.3 volts. ... These pull up resistors at the device end will also be used by the host or hub to detect the presence of a device connected to its port. Without a pull up resistor, USB assumes there is nothing connected to the bus. ... For example Philips Semiconductor has a SoftConnectTM technology. When first connected to the bus, this allows the microcontroller to initialise the USB function device before it enables the pull up speed identification resistor, indicating a device is attached to the bus. If the pull up resistor was connected to Vbus, then this would indicate a device has been connected to the bus as soon as the plug is inserted. The host may then attempt to reset the device and ask for a descriptor when the microprocessor hasnít even started to initialise the usb function device.

Could that be what's going wrong?

Message was edited by: bigmessowires
bigmessowires


Posts: 217
Registered: 10/29/13
Re: 128k/512k/Plus Keyboard Interface
Posted: Nov 28, 2013 1:09 AM   in response to: bigmessowires in response to: bigmessowires
Click to report abuse...   Click to reply to this thread Reply
bbraun, how did you implement the USB mouse/keyboard support? From what I've read, the STM32F051 only supports acting as a USB device, not a USB host. Is it some kind of software-based USB library?
bbraun


Posts: 493
Registered: 7/25/12
Re: 128k/512k/Plus Keyboard Interface
Posted: Nov 29, 2013 11:51 PM   in response to: bigmessowires in response to: bigmessowires
Click to report abuse...   Click to reply to this thread Reply
I'm using the stm32f4 discovery which has a stm32f4xx that has USB otg support. It just needs the USB otg cable to plug the keyboard/mouse in.
bbraun


Posts: 493
Registered: 7/25/12
Re: 128k/512k/Plus Keyboard Interface
Posted: Dec 7, 2013 6:26 PM   in response to: bbraun in response to: bbraun
Click to report abuse...   Click to reply to this thread Reply
The new version of the usb adapter board arrived, and seems pretty good. adb passthrough works and I can chain 2 of these together to use both a usb keyboard and a usb mouse. pre-adb checks out too.

I recently got another usb keyboard. Oddly, this one enumerates fine much more reliably than the keyboard I was testing with, but after enumeration, I don't get any usb packets from it. Pretty odd. I haven't dug all that deep to figure out why.
So, it's basically that and enumeration reliability that are the remaining issues.
If anyone wants to give it a shot as-is, I can send off some adapter boards. I've only got one of the f4 discovery boards left that I can send, so that's available too.
bigmessowires


Posts: 217
Registered: 10/29/13
Re: 128k/512k/Plus Keyboard Interface
Posted: Dec 10, 2013 8:29 PM   in response to: bbraun in response to: bbraun
Click to report abuse...   Click to reply to this thread Reply
Do you have an oscilloscope? It might be helpful to look at the timing of when traffic appears on the USB data lines, to help troubleshoot the enumeration and packet loss.
Sherry Haibara

Posts: 2
Registered: 12/24/13
Re: 128k/512k/Plus Keyboard Interface
Posted: Dec 24, 2013 10:14 AM   in response to: bbraun in response to: bbraun
Click to report abuse...   Click to reply to this thread Reply
Wow, this is an awesome project!

I'd be very, very interested in buying a couple of your adapters should you decide to build some of them - both the PS/2 and the USB models look extremely useful for resuscitating our beloved, old Macs which have lost their own original keyboard and mouse!

Keep up the good work! (:

Sherry Haibara
bbraun


Posts: 493
Registered: 7/25/12
Re: 128k/512k/Plus Keyboard Interface
Posted: Dec 30, 2013 1:58 PM   in response to: Sherry Haibara in response to: Sherry Haibara
Click to report abuse...   Click to reply to this thread Reply
Thanks! The PS2 version is fairly stable at this point, and several people are using them. I've got the parts to build some adapter boards handy, but I'll need to order more discovery boards if you're interested.
The USB version seems to be working ok with mice for me, but I think the keyboard part needs some extra tuning. I'm not quite confident in the keyboard part yet.
michaeld4500

Posts: 1
Registered: 3/15/14
Re: 128k/512k/Plus Keyboard Interface
Posted: Mar 15, 2014 6:46 AM   in response to: bbraun in response to: bbraun
Click to report abuse...   Click to reply to this thread Reply
Are U still making and selling the USB to ADB adaptors ?

Message was edited by: michaeld4500

Message was edited by: michaeld4500
bbraun


Posts: 493
Registered: 7/25/12
Re: 128k/512k/Plus Keyboard Interface
Posted: Nov 2, 2014 6:22 PM   in response to: michaeld4500 in response to: michaeld4500
Click to report abuse...   Click to reply to this thread Reply
The problem with the USB adapter is it doesn't reliably detect when a keyboard or mouse is plugged into it. The ADB and pre-ADB code is the same as the PS2 adapter, so that works OK. I've had some luck just resetting the adapter until the device is detected, although I'm still a little concerned about the real cause of the problem.

This weekend, I tried redoing the entire USB stack around another USB HID host library I came across, but the same problem remained. Still a todo item I guess.
bigmessowires


Posts: 217
Registered: 10/29/13
Re: 128k/512k/Plus Keyboard Interface
Posted: Nov 23, 2014 1:39 AM   in response to: bbraun in response to: bbraun
Click to report abuse...   Click to reply to this thread Reply
Is it possible to detect when a PS2 keyboard/mouse is present, or only when one is actively sending data? If you can check for PS2 presence, then you could try this ugly band-aid: if no PS2 keyboard/mouse is present AND no USB devices are detected, make the firmware reboot itself after 5 seconds. That wouldn't interfere with anything, and if repeated manual resets eventually lead to successful USB detection, the reboot loop will stop.

If the presence of a PS2 keyboard/mouse can't be detected passively, then you could add a manual jumper or switch to choose between PS2 or USB peripherals. Then only do the reboot loop hack if USB is selected but no peripherals are detected.
bbraun


Posts: 493
Registered: 7/25/12
Re: 128k/512k/Plus Keyboard Interface
Posted: Nov 23, 2014 7:41 PM   in response to: bigmessowires in response to: bigmessowires
Click to report abuse...   Click to reply to this thread Reply
Even on reset, with the device connected, it doesn't detect correctly. I should investigate, but I'm eyeing ChibiOS, which supports the STM32F4. I haven't tried ChibiOS before, so it seems like an opportunity to mess with something new, while potentially fixing an issue.
techknight

Posts: 110
Registered: 10/13/12
Re: 128k/512k/Plus Keyboard Interface
Posted: Nov 29, 2014 8:33 AM   in response to: bbraun in response to: bbraun
Click to report abuse...   Click to reply to this thread Reply
I am thinking about converting my ADB keyboards/mice wireless, switchable.

Is there any documentation out there on ADB and its structure? I am sure there is, just not sure where.

I was thinking about having a single keyboard, and single mouse since I have a rather small desk. But I may be bouncing between my file server, and a machine that I am working on. So i can switch between the two machines via a bluetooth link between the keyboard, and a BT ADB receiver hanging off the back of the machine, well, each machine. I just press a button, pick the link and links up ;-)
bbraun


Posts: 493
Registered: 7/25/12
Re: 128k/512k/Plus Keyboard Interface
Posted: Nov 29, 2014 12:17 PM   in response to: techknight in response to: techknight
Click to report abuse...   Click to reply to this thread Reply
I think the Apple IIgs Hardware Reference Manual was my main reference for the ADB signalling.
techknight

Posts: 110
Registered: 10/13/12
Re: 128k/512k/Plus Keyboard Interface
Posted: Nov 29, 2014 6:25 PM   in response to: bbraun in response to: bbraun
Click to report abuse...   Click to reply to this thread Reply
yea, i found a couple different docs out there. Found a Microchip doc as well.

But honestly, the more I thought about it, the less I really needed to understand the protocol. Easiest way is to sample I/O lines and send it across the link. A appears on B, and B appears on A.
bbraun


Posts: 493
Registered: 7/25/12
Re: 128k/512k/Plus Keyboard Interface
Posted: Dec 22, 2014 12:13 AM   in response to: bbraun in response to: bbraun
Click to report abuse...   Click to reply to this thread Reply
Attachment ps2acase1.jpg (136.8 K)
I started messing around with creating a 3D printed case for the ps2 adapter:


I was thinking about making it fully enclosed around the adapter board, but with connectors out both sides plus the top, the top part becomes kind of wire-frame-like and not very sturdy. It doesn't seem to buy a whole lot to enclose the top, since it's basically all connectors.

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