geekhack
geekhack Community => Keyboards => Topic started by: Manyak on Sat, 25 July 2009, 06:37:46
-
So, I've been thinking. How does a keyboard - like a Filco for example - detect if it's connected to PS/2 or USB?
Is there like, a secret handshake or something? :)
-
It seems like the microcontroller does that based on the kind of signals it sees.
-
It seems like the microcontroller does that based on the kind of signals it sees.
Yeah but like, what's the process it uses to check that signal?
-
Sorry to disappoint you, but it's much, much simpler in reality.
The passive adapter just swaps GND and VCC, so the controller gets a negative voltage in PS/2 mode.
-huha
-
USB and PS/2 both have 0V and +5V power lines, so initial power up is no problem.
PS/2 has two open collector data lines, normally at +5V unless pulled low by a transmission.
USB has a differential signal carried over the two data lines, one will be near 0V, the other at 2.8 - 3.6V.
Monitoring the two data lines for a short while should reveal what bus is in use.
-
Negative supply? No way. That would be a good way to blow up the chip.
From the EM78M611 datasheet:
The firmware checks the state of R7 [4,5]. If the state of this two bit is 0b00, set the
IOCA - to “1” to define the “USB mode.” Otherwise, set the IOCA [1] to “1,” to
define “PS/2 mode.”
R7 is the Port I/O register, basically reflecting the state of the I/O ports. Bit 4 is mapped to P74 / D+ / CLK while bit5 is mapped to P75 / D- / DATA.
-
Negative supply? No way. That would be a good way to blow up the chip.
A modified diode bridge could be used to swap the polarity and bring some extra detection pin high, hence it's not impossible.
This design looks a tradeoff of hardware versus controller complexity/cost.