Shop OBEX P1 Docs P2 Docs Learn Events
Has anyone connected a standard USB keyboard to a Propeller chip? — Parallax Forums

Has anyone connected a standard USB keyboard to a Propeller chip?

cgervasicgervasi Posts: 7
edited 2012-09-20 20:11 in Propeller 1
We had little trouble connecting a PS/2 keyboard to the demoboard, but we can't get a USB keyboard working. We've been trying to connect it to the Vinculum chip on Memory Stick Datalogger. We've been really digging into the USB HID spec. There ought to be a way to do this?

Does everyone who connects a keyboard to Propeller use PS/2?

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2012-09-19 22:12
    USB is much much more complicated than PS/2. There's a USB host driver for the Propeller in the Object Exchange (here). The host driver is quite large and complex and not too many people have used it. I don't think it includes a HID driver. You'd have to make your own. It will talk to a FTDI serial adapter, mass storage devices, and Bluetooth adapters.
  • Peter KG6LSEPeter KG6LSE Posts: 1,383
    edited 2012-09-19 22:42
    with BT I dont see a huge step to a USB KB .. just a thought ..
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-09-19 23:34
    cgervasi wrote: »
    We had little trouble connecting a PS/2 keyboard to the demoboard, but we can't get a USB keyboard working. We've been trying to connect it to the Vinculum chip on Memory Stick Datalogger. We've been really digging into the USB HID spec. There ought to be a way to do this?

    Does everyone who connects a keyboard to Propeller use PS/2?
    Although it's possible to make the Prop do USB it is very resource hungry, and for what? A lousy keyboard! However I use USB connectors on my boards and many of the keyboards are USB and PS/2 compatible so I talk to them in PS/2 protocol. How do you know if the keyboard is PS/2 compatible? Most will say so or they include a USB to PS/2 dongle which is nothing but a dumb gender-bender which I throw away and just plug the keyboard directly into my USB connector but talk to it in PS/2.
  • RickInTexasRickInTexas Posts: 124
    edited 2012-09-20 04:50
    I've had issues with some "classic" PS/2 keyboards, but with a little research I found a USB-PS/2 combo keyboard that works quite well.

    It comes with a pretty purple dongle, which I use, but I bet it would work direct-connect (as a PS/2) per Peter's instructionsg contained in his TACHYON Forth links. It is widely available via the usual PC parts outlets for about $15 USD.

    http://www.kensington.com/kensington/us/us/p/1431/K64370A/keyboard-for-life-standard-keyboard-usb-ps2.aspx


  • RaymanRayman Posts: 14,826
    edited 2012-09-20 06:25
    It's pretty trivial to connect a USB keyboard or mouse to the Propeller using a VNC2 device...

    You can get the VNC2-DIP modules from Digikey... Just program it with the HID sample and connect the TX out of the VNC2 to a Prop RX pin running fullduplexserial.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-09-20 06:48
    Rayman wrote: »
    It's pretty trivial to connect a USB keyboard or mouse to the Propeller using a VNC2 device...

    You can get the VNC2-DIP modules from Digikey... Just program it with the HID sample and connect the TX out of the VNC2 to a Prop RX pin running fullduplexserial.
    I find that recommendation hard to take seriously. A VNC2-DIP is not a small nor cheap module nor would I think that solution trivial especially considering that the option has already been given to use 2 I/O and 2 pullups. Now that, that is trivial.
  • RaymanRayman Posts: 14,826
    edited 2012-09-20 07:05
    If you can use PS/2, there's no question that is the best approach...

    But, if you need USB, then I think the VNC2 is the best solution for the Propeller...
  • cgervasicgervasi Posts: 7
    edited 2012-09-20 07:39
    Thanks for all the thoughtful feedback!

    My Reason for using USB Instead of PS/2:
    I need a wireless keyboard.
    VNC2: We have been using the VNC1A chip on the Parallax Memory Stick Datalogger. The chip has two ports. We've tried both of them. It was easy getting Propeller talking to a flash drive memory stick (called a BOMs in the USB world). We get some response when we request descriptors from a keyboard. We cannot put the key board in a mode where it spits out keystrokes nor can we poll it for keystrokes. Is VNC2 better than VNC1A at interfacing to keyboards (HIDs)?
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-09-20 07:58
    I have often thought of getting one of the fast little SIlabs C8051F micros and programming it to convert USB keyboard and mice to PS/2 or I2C or serial. These chips can be had for around $2 and would really simplify the interfacing, in fact with I2C you wouldn't need any extra lines, just the P28 and P29.
  • cavelambcavelamb Posts: 720
    edited 2012-09-20 08:24
    I find that recommendation hard to take seriously. A VNC2-DIP is not a small nor cheap module nor would I think that solution trivial especially considering that the option has already been given to use 2 I/O and 2 pullups. Now that, that is trivial.

    On the other hand, I just bought a new keyboard for my Windoze box From Frys Electronics.

    Then didn't HAVE any PS2 style keyboards (with the little round connector) in stock...
  • cgervasicgervasi Posts: 7
    edited 2012-09-20 12:16
    I have often thought of getting one of the fast little SIlabs C8051F micros and programming it to convert USB keyboard and mice to PS/2 or I2C or serial. These chips can be had for around $2 and would really simplify the interfacing, in fact with I2C you wouldn't need any extra lines, just the P28 and P29.
    And you could sell them to people like us. :smile:
  • RaymanRayman Posts: 14,826
    edited 2012-09-20 12:22
    Here's a photo of my test setup
    http://forums.parallax.com/showthread.php?135775
  • tritoniumtritonium Posts: 543
    edited 2012-09-20 14:41
    @Peter Jakacki
    Although it's possible to make the Prop do USB it is very resource hungry, and for what? A lousy keyboard! However I use USB connectors on my boards and many of the keyboards are USB and PS/2 compatible so I talk to them in PS/2 protocol. How do you know if the keyboard is PS/2 compatible? Most will say so or they include a USB to PS/2 dongle which is nothing but a dumb gender-bender which I throw away and just plug the keyboard directly into my USB connector but talk to it in PS/2.

    Hey Peter is this really true? - if you know how to connect it up, most usb keyboards will work as ps2?
    Am I understanding you correctly as this is a great piece of information, and not at all expected!
    Can you direct me to some more detail on this - can you think of an easy test?
    Come to think of it I do have an adapter to plug usb keyboard into ps2 socket but always thought there must be some pretty clever stuff going on in there - but I see these for sale for a couple of pounds so maybe....
    You say you've done it so it must be true!
    Excuse my astonishment as I have been studiously developing code to use arduino to interface ps2 to raspberry pi to use in 'bare metal' as their USB useability in bare metal is still under development.
    Seems all I need to do is connect the usb to two i/o pins and do some bit banging.(on the raspberry pi)
    (cant find much on google)

    Dave H
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-09-20 15:19
    Yes, many USB keypads and keyboards are PS/2 compatible as they have firmware that detects which interface to use at power-up. So you never need to use an old PS/2 keyboard with the round plug, besides they are practically impossible to get. So it's really dumb to even think about using a PS/2 style socket on your design even as you are then forced to use the dumb and bulky gender benders that come with some keyboards. The gender benders are also dumb because they have not an iota of electronics in them, you can continuity test them to convince yourself if you like.

    Once you have a USB socket on your pcb then you are free to implement PS/2 protocol for the keyboards that are compatible or you can make the decision to implement the resource hungry USB protocol using an object from the OBEX. I haven't used one of the USB objects yet but I know if I need to I can.

    @cgervasi: I will see what I can do.
  • cgervasicgervasi Posts: 7
    edited 2012-09-20 15:47
    Rayman wrote: »

    Very cool! Which firmware version did you use?

    We are struggling with VNC1L's VDAP firmware. We are ordering VNC2 and the programmer now. Thanks!!
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2012-09-20 16:30
    @Peter, that is really interesting information. So ok, there are these adaptors http://compare.ebay.com.au/like/280777887288?ltyp=AllFixedPriceItemTypes

    and you could either put a PS/2 socket on a board and use an adaptor. Or you could put a USB socket on a board, but it is kind of a fake USB (and maybe it needs a label as such - "keyboard USB" as other USB devices won't work.

    Come to think of it, does a similar backwards compatible thing apply to mice? This article (the legacy ports section) seems to suggest they are.
  • jmgjmg Posts: 15,183
    edited 2012-09-20 17:01
    I have often thought of getting one of the fast little SIlabs C8051F micros and programming it to convert USB keyboard and mice to PS/2 or I2C or serial. These chips can be had for around $2 and would really simplify the interfacing, in fact with I2C you wouldn't need any extra lines, just the P28 and P29.

    Er, don't you need a USB Host ?
  • jmgjmg Posts: 15,183
    edited 2012-09-20 17:11
    cgervasi wrote: »
    Very cool! Which firmware version did you use?

    We are struggling with VNC1L's VDAP firmware. We are ordering VNC2 and the programmer now. Thanks!!


    I also see FTDI now have a device called FT311D, which is a pre-programmed Host controller (just happens to match VNC2 pinout, and price ;) ), that targets Android, but could be worth checking into, to see if it can enumerate Std Keyboards, and Touchscreen USB slaves ?

    The FT311D seems to spec/drive a single USB, whilst the VNC2 supports Dual USB.
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2012-09-20 17:34
    Er, don't you need a USB Host ?

    It would appear not. In fact, it would appear that for connecting a USB keyboard and a USB mouse to a propeller chip, all you need is pullup resistors and the existing obex drivers. This is very interesting.
  • jmgjmg Posts: 15,183
    edited 2012-09-20 17:56
    Dr_Acula wrote: »
    It would appear not. In fact, it would appear that for connecting a USB keyboard and a USB mouse to a propeller chip, all you need is pullup resistors and the existing obex drivers. This is very interesting.

    For that to work, presumes your Keyboard has a Default PS/2 mode, for those that do not, clearly it is not a solution.
  • RaymanRayman Posts: 14,826
    edited 2012-09-20 18:22
    I haven't found a wireless USB keyboard that works with PS/2 interface. But, I haven't looked terribly hard either...
    Still, I have a general impression that new fancy keyboards and mice don't support PS/2.
    Would be nice to be wrong about that though...

    I think the 64-pin VNC2 makes a great companion for the Propeller. Their stock HID firmware lets you just plug in any keyboard or mouse and right out of the box,
    and you just need 1 Prop pin to input serial data... But, you can do a whole lot more, if you're willing to wade into the devoloper tool muck...

    Just as an aside... I'm about to finally start seeing if I can hook up a USB camera to it and easy get video on the Prop...
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-09-20 19:41
    Dr_Acula wrote: »
    @Peter, that is really interesting information. So ok, there are these adaptors http://compare.ebay.com.au/like/280777887288?ltyp=AllFixedPriceItemTypes

    and you could either put a PS/2 socket on a board and use an adaptor. Or you could put a USB socket on a board, but it is kind of a fake USB (and maybe it needs a label as such - "keyboard USB" as other USB devices won't work.

    Come to think of it, does a similar backwards compatible thing apply to mice? This article (the legacy ports section) seems to suggest they are.

    Even if you had USB software with a USB socket you still can't just plug anything in there anyway. Unless it is a very standard HID or mass storage device etc it's unlikely to work. Now, if you only had PS/2 software on a USB socket and you plug any USB device in it just won't work, so no problem really. My strong advice is never put a PS/2 socket on a new design, just use USB sockets and I have a resnet with solder jumpers to select if it's standard PS/2 with pullups or USB.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-09-20 19:50
    jmg wrote: »
    For that to work, presumes your Keyboard has a Default PS/2 mode, for those that do not, clearly it is not a solution.
    Many keyboards support PS/2 but not all, however there are plenty to choose from and they are cheap. There are pitfalls, I ordered a carton load of keypads off ebay that were supposed to be PS/2 compatible but they weren't. Not deterred in the slightest I pulled one apart and it had a fairly standard little PCB so I designed my own very cheap pcb to replace it. The keypads are still cheap after all this and now I have stacks of keypads that not only do PS/2 but serial and I2C etc. So it worked out well as I can use these in designs where I can hook up to the I2C bus easily without dedicating any extra I/O or maybe just a single serial receive pin.
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2012-09-20 19:57
    The keypads are still cheap after all this and now I have stacks of keypads that not only do PS/2 but serial and I2C etc. So it worked out well as I can use these in designs where I can hook up to the I2C bus easily without dedicating any extra I/O or maybe just a single serial receive pin.

    Hey, cool! An I2C keyboard. That would be great for the prop as there is already an I2C bus there for the eeprom, so effectively you can add a keyboard without using any extra propeller pins. Are your I2C keyboards for sale?
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-09-20 20:11
    Dr_Acula wrote: »
    Hey, cool! An I2C keyboard. That would be great for the prop as there is already an I2C bus there for the eeprom, so effectively you can add a keyboard without using any extra propeller pins. Are your I2C keyboards for sale?
    Just keypads, not keyboards :( I'm using the keypads in my own products but if you do want some that should be okay.
Sign In or Register to comment.