PDA

View Full Version : PS/2 Keyboard and Mouse Question



hippy
04-21-2008, 11:39 AM
Are PS/2 keyboards and mice hot-pluggable/unpluggable when used with the Propeller ProtoBoards, Demo Boards etc ?

That's in terms of electrical damage rather than how any Spin/PASM handler may react to such an occurence.

There are all sorts of warnings which say "don't" when it comes to PC's but I've never read a comprehensive explanation as to why not, just dire warnings that electrical damage can occur ( keyboard/mouse and/or motherboard ).

Oldbitcollector (Jeff)
04-21-2008, 11:42 AM
Been hot-swapping them on PC's for years without issue..

(Having said that I'll fry a motherboard in the morning doing it.. )

OBC

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
New to the Propeller?

Getting started with the Protoboard? - Propeller Cookbook 1.4 (http://ucontroller.com/Propeller%20Protoboard%20Designs%20for%20the%20Beg inner.pdf)
Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us (http://propeller.warrantyvoid.us)
Got an SD card? - PropDOS (http://www.orrtech.net/propdos/)
A Living Propeller FAQ - The Propeller Wiki (http://propeller.wikispaces.com/)
(Got the Knowledge? Got a Moment? Add something today!)

vampyre
04-21-2008, 02:40 PM
actually i killed the PS2 keyboard port on my computer doing that, just a few months ago. Not that I know why or how, but it is possible to do.

jazzed
04-21-2008, 03:06 PM
hippy said...

There are all sorts of warnings which say "don't" when it comes to PC's but I've never read a comprehensive explanation as to why not, just dire warnings that electrical damage can occur ( keyboard/mouse and/or motherboard ).

Well this is not comprehensive, but in the "hot-swap" world of large systems (and even SD cards apparently judging by the pin placements), the voltage being used by the device should be engauged last on insert; ground connections are usually first contact. The keyboard and mouse connectors don't have·special pin placements to allow for deterministic behaviour with hot-swap. ADDED: ... but since the interfaces·are serial, side-effects caused by hot-swap are very unlikely to cause hardware function to misbehave.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
jazzed·... about·living in·http://en.wikipedia.org/wiki/Silicon_Valley (http://en.wikipedia.org/wiki/Silicon_Valley)

Traffic is slow at times, but Parallax orders·always get here fast 8)

Post Edited (jazzed) : 4/21/2008 3:21:46 PM GMT

stevenmess2004
04-21-2008, 03:56 PM
It is possible to fry things when attempting to hotswap PS2 things. The ports aren't designed to let the ground contacts mate first. Also, on my windows box the keyboard won't work if you unplug it an put it back in. Does work on the proto board though.

hinv
04-21-2008, 08:21 PM
It also depends on how much current your keyboard is drawing. I use barcode readers on the keyboard ports at work, and have blown a surface mount fuse by hot plugging them and the keyboard into the keyboard port. I haven't, AFAIK, blown a port on a system yet just plugging in a keyboard or mouse. If it would happen, I would suspect static discharge as the cause.

stevenmess2004
04-21-2008, 08:30 PM
Here is the link to the wikipedia article. It mentions hot plugging at the end. en.wikipedia.org/wiki/PS/2_connector (http://en.wikipedia.org/wiki/PS/2_connector)

propelleruser999
04-21-2008, 09:36 PM
stevenmess2004,
i worked for the company that invented the PS/2 port. I have not yet fryed any port device or the port itself after a few 1000 hot plugs within 20 years.

On the PS/2 port you have 4 pins connected ( 5V, clock, data ,GND). Depending on the angle you try to put the plug in, the worst thing , that can happen is: plugging +5V first, then either the clock or data pin. But both pins are designed for 5 volt operation. Since most all keyboards and mice are powered by the main board of your PC, that shouldnt pose a problem.
Except, in that fry cases , ESD was involved.

I can conform cases, where the keyboard or mouse didnt work after hotplugging; but this is keyboard/mouse HW and/or SW issue . e.g.: Older keyboards relied on a keyboard controller reset during BIOS boot (you could see it on the flashing num/shift/scroll LED's); plugged in later,they didnt work; you had to reboot your PC.
On the prop: e.g. FEMTOBASIC. during startup it tries to find a keyboard, else it displays the message "NO KEYBOARD FOUND" . If you forget to plug in your keyboard before startup, it will never look again for one. so you have plug your keyboard and restart your prop and it works.

propelleruser999
04-21-2008, 10:25 PM
hippy,
now i understand your question.
the proto- and demoboard have only 100 ohm series resistors for keyboard and mouse port. the general recommendation from parallax is at least 1kohm, when interfacing to 5 volt devices.
so in the worst case we get I= (U5v- UpropmaxIO) / 100, which is (5-3,3)/100 = 1.7mA for a high level . for a low level on an I/O pin, and thats what we should be assuming for a hot plug worst case it is (U5v-0)/100, which is 5 ma, which is well below the max sink limit of 30mA for an I/O pin. Even with the additional specification of maximum group sink limitof 100mA, you will not reach that limit.

so, should not be a problem with the prop.

hippy
04-21-2008, 10:38 PM
Thanks for the feedback. The bottom line seems to be, if one were writing it in a user manual -

1) Hot-swapping is not recommended
2) Hot-swapping should not cause damage, however,
3) Hot-swapping is done entirely at your own risk
4) Hot connection of the keyboard/mouse may not always be detected by the software

Both DAT and CLK are meant to be open-collector so I can visualise how less robust hardware could be hard-driving the lines with an expectation of the state the bus and that could cause problems on hot connection.

The Parallax Keyboard driver lets the lines float high as input, and outputs low to pull the bus down, so the bad case would be +5V on a bus line while pulling low, which through the 100R would be 50mA.

That's 25% above the rated 40mA sink shown in the datasheet. 120R would drop it to 42mA, 150R to 33mA.

Edit : @ propelleruser999 : Looks like you were typing as I was. But I think you have an error with 5/100=0.005 http://forums.parallax.com/images/smilies/blush.gif

Extra Edit : Assuming the keyboard could put +5V out on DAT or CLK without there being any current limiting there. Given that there is either no pull-up in the keyboard itself or at least 25R there shouldn't be any problem. Only if the keyboard hard-pulled the line to +5V would there be a problem, and that would also be a problem under normal use.

Post Edited (hippy) : 4/21/2008 2:48:09 PM GMT

propelleruser999
04-21-2008, 11:12 PM
Hippy,

at first i have to agree to my (10 times) mistake.

corrected:
so in the worst case we get I= (U5v- UpropmaxIO) / 100, which is (5-3,3)/100 = 17mA for a high level . for a low level on an I/O pin, and thats what we should be assuming for a hot plug worst case it is (U5v-0)/100, which is 50 ma, which is well above the max sink limit of 30mA for an I/O pin.
i now say: in the case of hot plugging not quickly enough, you could do damage. I dont think the time you need to plug a connector will be more than 1 second.
but may be Chip Gracey has done some evaluations, how long overloading a pin wil be sacrificed by the prop.

I need to scope signals on keyboard and mouse, in what state they are most of the time. i hope its mostly 0 volts.
Keep you informed.

propelleruser999
04-21-2008, 11:16 PM
i meant,

i hope its mostly 5 volts.

cgracey
04-21-2008, 11:23 PM
I've never had a problem hot-plugging mice and keyboards into the Propeller Demo Board. Electrically, I don't think there's anything to go wrong.

The problem on big systems, like PCs, seems to be that the O.S. can't adapt to a hot-plugged mouse, due to software issues. At least, this has been my experience; you had better have the mouse plugged in before starting windows, otherwise it won't see it. Keyboards seem to have looser rules.

As far as the mouse.spin and keyboard.spin drivers go, they (re)configure the mouse or keyboard whenever it gets plugged in anew, which is a lot more than a PC ever seemed to do.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


Chip Gracey
Parallax, Inc.

hippy
04-21-2008, 11:54 PM
Chip Gracey (Parallax) said...
As far as the mouse.spin and keyboard.spin drivers go, they (re)configure the mouse or keyboard whenever it gets plugged in anew, which is a lot more than a PC ever seemed to do.


And many thanks for that. I hadn't checked how it behaved in such circumstances, but that saves additional work.

stevenmess2004
04-22-2008, 05:07 AM
You can plug and unplug the mouse in the graphics demo and it keeps working. Unlike windows http://forums.parallax.com/images/smilies/smile.gif