Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
07/16/06 00:35
Read: times


 
#120326 - re: autodetect
Responding to: ???'s previous message
Onyau Chan said:
Did anyone know how to auto-detect USB and PS2? I have a project to build a dual interface keyboard using normal 8051 MCU and a Philips SIE, PDIUSBD12. I can use any 2 pin to do the PS2 interface. The first step needs to detect the interface. If it is USB, I will enable the SIE. Otherwise, the SIE will remain disabled. Did anyone know how to detect the USB signal with MCU?


First: those little gizmos that come with USB mice and keyboards that let you attach the device to a PS/2 port are passive. They just provide pass-through for the two signal wires and the power and ground wires. When connected to a USB port those signals are called D+ and D-, when connected to a PS/2 port, those signals are called CLK and DATA.

Second: the devices that support this feature have micros that allow one to use port pin as regular I/O or as a USB port. Unless your micro has such a feature (I know SiLabs parts don't and I'm too lazy to look up Microchip or anyone else's parts), then you'll need to connect each of the two data pins to two ports on the micro, one being the relevant USB pin (D+ or D-) and the other being a GPIO bit.

Anyways: you know that both types of port provide +5V, so when you plug in your device you get power. You should also know that the PS/2 clock line from the computer should start running as soon as the computer is powered up. Contrast that with USB, where D+ and D- from the computer are high-impedance (but pulled down with 15 K resistors) until the device is attached. So it should be pretty easy to detect whether or not the clock is running; if so, then the micro should start running it's "I'm on the PS/2 port" stuff. If the micro doesn't see the clock, then it should get itself set up to do USB, and when ready, it should pull up either D+ or D- (depending on desired bus speed), at which point the USB hub will detect the attach and enumerate the device, and the device should be running it's "I'm a USB device" firmware.

Also: forget about bit-banging USB. Get a micro that has a proper USB serial interface engine.

-a

List of 28 messages in thread
TopicAuthorDate
Auto-detecting USB and PS2            01/01/70 00:00      
   Power            01/01/70 00:00      
      Power didn't tell            01/01/70 00:00      
         So it's on the same connector ?            01/01/70 00:00      
            I will try            01/01/70 00:00      
            Too long to detect            01/01/70 00:00      
            nope            01/01/70 00:00      
         Mechanical solution            01/01/70 00:00      
            Cable is fixed            01/01/70 00:00      
               How to do it.            01/01/70 00:00      
                  USB Expert            01/01/70 00:00      
            Why not ...            01/01/70 00:00      
         why not put the 'intelligence' into the adapter            01/01/70 00:00      
            Cost/complexity issues            01/01/70 00:00      
               then go the other way            01/01/70 00:00      
                  Still need hardware            01/01/70 00:00      
                     you\'ll need that anyhow, how else?            01/01/70 00:00      
            Agree with Chris            01/01/70 00:00      
               Which is why I suggested Cypress            01/01/70 00:00      
      float to ascii            01/01/70 00:00      
         Start a New Thread and ask again            01/01/70 00:00      
         start a new thread!            01/01/70 00:00      
   Doesn't seem to hard            01/01/70 00:00      
      D+ and D- is not differential at the begining            01/01/70 00:00      
      nope, II            01/01/70 00:00      
   re: autodetect            01/01/70 00:00      
   I bought on of these at radio shack.            01/01/70 00:00      
      speed detect            01/01/70 00:00      

Back to Subject List