13
\$\begingroup\$

A long time ago, I had to service some of the early Compaq Desktop PCs. They used to have fuses on the motherboard that blew when a customer hot-plugged a keyboard. I found this when googling on the topic:

The keyboard or mouse should not draw more than 275 mA from the host and care must be taken to avoid transient surges. Such surges can be caused by "hot-plugging" a keyboard/mouse (ie, connect/disconnect the device while the computer's power is on.)

Somehow, un-plugging or plugging in a keyboard can cause a surge. I don't recall having these issues with serial ports (RS-232, Appletalk, etc), parallel ports, VGA, etc.

I've always wondered. Why is there a surge risk here? What would have to change to make a PS/2 keyboard interface capable of hot-swap?

\$\endgroup\$
11
  • 3
    \$\begingroup\$ Just a guess, but the PS/2 device probably has capacitors in it that could cause a high start up current. If this happens when the computer is powered up, the power line for the PS/2 port can be energized(raised to normal voltage) slowly enough that the current filling the caps in the device doesn't blow the fuse. When you hot plug a device you'd be exposing it to full voltage immediately. Just a guess though. \$\endgroup\$
    – K H
    Commented Mar 7, 2021 at 6:58
  • 6
    \$\begingroup\$ My observation on other PS/2 equipped PCs running Windows was that hot-plugging a keyboard or mouse would cause no damage but the device would not be recognized until the OS was rebooted. The design must have improved from those units. \$\endgroup\$
    – DoxyLover
    Commented Mar 7, 2021 at 7:28
  • 7
    \$\begingroup\$ By design, the PS/2 plug was not designed for hot-plugging. But later mainboards somehow worked around that and made it possible anyway. This was especially true for laptops with PS/2 plugs, where connecting/disconnecting external keyboards or mice usually worked without a problem. \$\endgroup\$
    – PMF
    Commented Mar 7, 2021 at 9:13
  • 5
    \$\begingroup\$ USB 1.0 was pretty much designed as an answer to your question. \$\endgroup\$ Commented Mar 7, 2021 at 20:53
  • 1
    \$\begingroup\$ Aside - Compaq server hardware was renowned for blowing a keyboard controller if the PS/2 port was hot plugged. The proper answer was to use a KVM unit, and the lazy answer was to leave a keyboard plugged in all the time. \$\endgroup\$
    – Criggie
    Commented Mar 8, 2021 at 2:23

3 Answers 3

25
\$\begingroup\$

Somehow, un-plugging or plugging in a keyboard can cause a surge. I don't recall having these issues with serial ports (RS-232, Appletalk, etc), parallel ports, VGA, etc.

These don't power the equipment on the other end.

What would have to change to make a PS/2 keyboard interface capable of hot-swap?

There has to be a way to limit current to prevent a faulty device from shorting the power supply and frying the motherboard or simply crashing the PC due to a shorted +5V rail. Even if the device is not faulty, if it has a big enough capacitor, connecting it could cause inrush current and a dip on the +5V rail which could cause a crash.

A fuse is a crude way to do this.

USB was designed as hotplug, so it uses active current limiting. There is a whole family of chips to handle this. Here is an example.

Texas Instruments TPS2001D USB Power Distribution Switch is intended for applications where heavy capacitive loads and short circuits are likely to be encountered, such as USB. The TPS2001D limits the output current to a safe level by operating in a constant-current mode when the output load exceeds the current limit threshold. This feature provides a predictable fault current under all conditions. The fast overload response time eases the burden on the main 5V supply to provide regulated power when the output is shorted.

It also provides a FAULT signal to the computer so it knows what's happening.

To make PS/2 hotplug, that wouldn't be enough though.

You'd need a connector that makes contacts in a specific order: ground, then power, then signals. USB does this by making the pins that should make contact first longer. Without this type of connector, power and/or signal can make contact before ground, which means the device will receive IO signals before it has power, ESD protection diodes in the device and/or host will conduct current and it will power itself through its digital IOs, which can lead to fried ESD diodes, or worse latch-up. This requires special mitigation measures.

Also, you'd need the software in the PC to handle hotplug and register that a device has been plugged. With USB this is easy, the chipset does it automatically and raises an interrupt when a device is detected.

EDIT: Also an important part of the USB connector is the shield makes contact first, so any ESD event happens between shields and signal pins are not involved. This is probably the case with PS2 too, since the shield protrudes quite a bit.

The absolute worst case hotplug connectors are RCA audio (signal connects before ground), and of course the audio Jack (signal connects first AND all pins short together during insertion).

\$\endgroup\$
15
  • 2
    \$\begingroup\$ Even if active current limiting is not used on USB and it is just protected with a polyfuse, the USB specs still mandate that an USB device must limit the hotplug surge energy to a certain level, and USB host must be able to provide such a surge. \$\endgroup\$
    – Justme
    Commented Mar 7, 2021 at 8:22
  • 3
    \$\begingroup\$ As an addition: hotpluggable interfaces require a special connector that connects contacts in the appropriate order. Otherwise there's a chance that current leaks through protection diodes to the supply rails which can fry them. Whithout a suitable connector there's almost no chance to have proper hotpluggability. \$\endgroup\$
    – Sim Son
    Commented Mar 7, 2021 at 9:15
  • 1
    \$\begingroup\$ @SimSon yes ;) I already put it in the answer \$\endgroup\$
    – bobflux
    Commented Mar 7, 2021 at 9:37
  • 5
    \$\begingroup\$ "you'd need the software in the PC to handle hotplug" - Not really, a keyboard that's not sending is indistinguishable from a keyboard that's not present. Software-wise the PC can simply consider the keyboard as always plugged in. \$\endgroup\$
    – AndreKR
    Commented Mar 7, 2021 at 18:23
  • 4
    \$\begingroup\$ @bobflux Hey, it even worked for the ARM prototypes by accident - Sophie Wilson famously found their chip was still running even without a power supply, because the current going back up the pullup resistors on the I/O pins was enough to power the processor. \$\endgroup\$
    – Graham
    Commented Mar 8, 2021 at 11:29
2
\$\begingroup\$

What it takes apparently is a desire to make the PS/2 ports capable of hot plugging. I recall a time when hot plugging a PS/2 keyboard or mouse would certainly mean the computer did not recognize the device. I don't recall ever seeing this causing damage that a reboot could not repair. Then came a point when hot plugging PS/2 devices just worked. This feature was seen on laptops first then desktop systems would allow hot plugging.

I have a couple USB to PS/2 adapters and they work fine with hot plugged PS/2 devices. One adapter has color coded ports where one port is mouse only and the other keyboard only. My other adapter will support a keyboard or mouse on either or both ports. This proves that nothing prevents device agnostic PS/2 ports, something I also recall seeing appearing on laptops first.

I do recall coming across an interesting article that discussed how early PS/2 controllers worked. They explained how a bad mouse could affect the keyboard and vice versa, why early ports might wig out with hot plugged devices, why they were device specific, and why new ports don't have these same failings. I wish I could recall where I saw this article so I could link to it and refresh my memory on how this all worked. I recall part of the issue was that it was typical for one chip to handle both ports, hot plugging would upset a delicate balance on what was a single circuit for both devices.

As other answers point out part of the problem is that the port supplies power to the device. Ports like VGA and parallel didn't have this same problem as they are output only and/or relied on the device to be self powered. Connecting power before the signal pins could mean the data got scrambled which might confuse the device as much as the computer. Perhaps a lucky or carefully handled hot plug would allow a device to work. Putting in the effort to build hardware that supports hot plugging avoids the need for this.

One style of Apple serial ports, the GeoPort, had a pin to power low power devices, I don't recall how well they handled hot plugging. There's Power-Over-Ethernet which I gather must support hot plugging. I recall some early Apple computers didn't like hot plugging on ADB. SCSI came in hot plug capable implementations, I have an old server in my basement that allows for this, but in most cases hot plugging SCSI risked expensive damage. Just more examples on ports that did or did not put in the effort to support hot plugging.

I know that my saying that lacking hot plug support in the spec is why early PS/2 ports don't handle hot plugging isn't much of an answer. I can imagine that there's several ways that newer PS/2 ports allow for hot plugging. USB and other ports make this easier to handle with varied lengths of the pins. PS/2 can do hot plugging without the differing lengths of pins. Making it work with same length pins means having filtering/de-bounce, and this can be done in hardware or software. It's possible they need a way to reset the device as a device confused by hot plugging is possible. Because of the various means hot plug can be handled I expect that some computers handle it better than others.

\$\endgroup\$
6
  • \$\begingroup\$ I've never seen or heard of any issue on any Apple computers regarding hot-plugging ADB keyboards or mice, including the earliest (Macintosh SE and Apple IIgs). Nor have I seen or heard of any issues with hot-plugging the Apple GeoPort. \$\endgroup\$
    – Cody Gray
    Commented Mar 8, 2021 at 7:13
  • \$\begingroup\$ @CodyGray It's more quite likely my memory fails me. I do recall being warned on not hot plugging ADB devices, perhaps this was merely from an abundance of caution than any real hazards of harm. \$\endgroup\$
    – MacGuffin
    Commented Mar 8, 2021 at 7:23
  • 1
    \$\begingroup\$ Many of those USB-PS/2 adaptors were passive and just told a USB- and PS/2-compatible mouse which mode to use. \$\endgroup\$
    – Chris H
    Commented Mar 8, 2021 at 9:24
  • \$\begingroup\$ @ChrisH The USB-PS/2 adapters I have are active, they have two PS/2 inputs. I was quite certain nobody made a passive adapter for a PS/2 mouse to plug into a USB port but I did a quick search to verify this, and sure 'nuff someone made such an abomination. That doesn't really solve any PS/2 hot plug issues since it's really a USB mouse with a different connector. Maybe this could help with a PS/2 KVM switch that doesn't handle PS/2 switching well but then so would an active adapter. That brings to mind that if someone needs to hot plug PS/2 then a KVM switch could allow that. \$\endgroup\$
    – MacGuffin
    Commented Mar 8, 2021 at 9:48
  • \$\begingroup\$ @MacGuffin Ah, the useful sort rather than the common sort. Fair enough. The abominations came with mice years ago (I've seen them both ways round, but the more common sort was the opposite to what you've got) \$\endgroup\$
    – Chris H
    Commented Mar 8, 2021 at 9:52
0
\$\begingroup\$

I'd made a circuit which the +5 V was connected through a resistor, sensing if anything was connected. If so, I'd slowly ramp up the voltage. The data lines would only be connected when the supply voltage had been stable for a second or so.

I'm not sure if the controller in the keyboard would start if the supply voltage rises too slowly, so that would be a compromise. Probably limiting the current to the 275 mA would be a sensible solution.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.