Author Topic: Could a Teensy be made to talk PS/2 over the USB connector?  (Read 2602 times)

0 Members and 1 Guest are viewing this topic.

Offline Findecanor

  • Thread Starter
  • Posts: 5036
  • Location: Koriko
Many USB keyboards can talk PS/2 with a simple passive adapter, that (I have been told) routes the pins in a certain way so that the microcontroller on the keyboard can detect whether it should talk USB or PS/2. For instance, my Cherry G80-3000LQCDE does this (The 'C' stands for "Combo", indicating that it has this ability).

Would it be possible to add this ability to a Teensy 2.0 used as keyboard controller, by only soldering components to it? ... and giving it new firmware, of course.
Does anybody here have enough knowledge about the AVR and the passive adapters to tell?

Offline alaricljs

  • I be WOT'ing all day...
  • ** Moderator Emeritus
  • Posts: 3715
  • Location: NE US
Re: Could a Teensy be made to talk PS/2 over the USB connector?
« Reply #1 on: Mon, 27 May 2013, 23:23:53 »
No, it cannot be done using the USB pins.  The USB pins on the atmega32u4 are only capable of USB.
Filco w/ Imsto thick PBT
Ducky 1087XM PCB+Plate, w/ Matias "Quiet Click" spring-swapped w/ XM Greens

Offline hasu

  • Posts: 3472
  • Location: Tokyo, Japan
  • @tmk
    • tmk keyboard firmware project
Re: Could a Teensy be made to talk PS/2 over the USB connector?
« Reply #2 on: Tue, 28 May 2013, 07:32:18 »
ATUSB90162 has that dual protocol function, but Teensy and Teensy++ don't unfortunately.
http://www.atmel.com/Images/doc7707.pdf

This freescale doc seems to be good starting point to learn this function, though I myself didn't read through.
http://www.freescale.com/files/microcontrollers/doc/ref_manual/DRM014.pdf

I'm not sure but guess using some extra I/O ports(two or three?) Teensy also can handle two protocol like this:
Code: [Select]
                   +-------------
                   | ATmega32u4
                   |
           +---+---|Pull-up(optional)
           R   R   |                                                                                             
           |   |   |
           +---|---|CLK
           |   |   |
           |   +---|DATA
           |   |   |
D-/DATA ---|---+---|D-
           |       |
D+/CLK  ---+-------|D+
                   | 
                   +-------------

Offline Soarer

  • * Moderator
  • Posts: 1918
  • Location: UK
Re: Could a Teensy be made to talk PS/2 over the USB connector?
« Reply #3 on: Tue, 28 May 2013, 08:27:02 »
I hadn't noticed that the AT90USB162 had that feature!

Offline 5volts

  • Posts: 4
  • Location: Atlanta
Re: Could a Teensy be made to talk PS/2 over the USB connector?
« Reply #4 on: Thu, 30 May 2013, 15:28:52 »
Not over the USB connector.

However, there are PS/2 libraries available for the Arduino, and the PS/2 interface itself is very simple.

Look at the bottom of this page, for instance: http://playground.arduino.cc/ComponentLib/Ps2mouse

The above library might run unmodified on the Teensy, or maybe need some slight alterations.

Sparkfun has some good PS2 resources: https://www.sparkfun.com/products/8651

Offline kile

  • Posts: 3
Re: Could a Teensy be made to talk PS/2 over the USB connector?
« Reply #5 on: Sun, 02 June 2013, 04:55:26 »
I hadn't noticed that the AT90USB162 had that feature!

It doesn't support the PS/2 protocol in hardware, it just allows for PS/2 levels to be driven on the two pins by software. The protocol itself has to be implemented with bitbanging. Also, it looks like there isn't any built-in mechanism for detecting if it's plugged into PS/2 or USB, it also has to be implemented in software.

I haven't tried this out yet, but I plan to play with it a little.

Offline Soarer

  • * Moderator
  • Posts: 1918
  • Location: UK
Re: Could a Teensy be made to talk PS/2 over the USB connector?
« Reply #6 on: Sun, 02 June 2013, 06:51:59 »
I know, but it still could be a big benefit to someone wanting that feature on a keyboard controller, where using the extra 3 or 4 pins to work around it might mean having to use external circuitry for other functions as well (e.g. multiplexing strobe lines).

(I say "or 4" because in hasu's diagram the D- and D+ lines would be joined via the two pullup resistors, even when they are not pulling up, and I'm not sure if the USB circuitry would be affected. Using two pins to activate each pullup individually would avoid that).

It seems like a pretty simple bit of circuitry inside the AT90USB162, so it's a odd that they didn't include it in all their USB-enabled CPUs!