6

Is it possible to run both USB Host and USB Device controllers on top of an AVR (ATMega64)? Specifically, what I'm looking for is to receive data from a usb keyboard, and simultaneously sending keystrokes to a PC.

From what I've seen, both VUSB & LUFA stacks support USB host modes, but they work with a single usb port only.

Any help is appreciated! Thanks!

Trygve Laugstøl
  • 1,410
  • 2
  • 19
  • 28
mentalist
  • 395
  • 3
  • 7

2 Answers2

5

You might consider using a PS/2 keyboard, they are simple to interface with, it's basically just a serial protocol. Then you can still use USB in Device mode to connect to the host PC.

davr
  • 6,802
  • 2
  • 25
  • 37
  • 1
    You can even make it look like fake USB - many keyboards I have seen are dual-mode USB and PS/2. You could have a USB connector wired up like the "USB to PS/2" adapter and just interface using PS/2. Don't know if the requirement is USB or just a keyboard with a USB connector. – W5VO May 02 '10 at 07:59
  • 2
    IIRC most of these keyboard and mouse adapters did not contain any logic and required the mice/keyboards to have true USB signals on the PS/2 connector (which has 2 unused pins). – jpc May 02 '10 at 16:26
  • Actually I'm looking for a way to work with a real USB keyboard, but in case that will get complicated, I'll sure go with the PS/2 option. Thanks for the advice! – mentalist May 02 '10 at 23:32
2
  1. I don't think that V-USB supports host (OTG) mode and LUFA host mode will require at least an AT90USB646 which is quite expensive.

  2. I don't know about a cheap micro that has 2 USB port but you may try using two. Just connect them via an UART and exchange the needed information.

That said, davr is probably right that using a PS/2 keyboard would be simpler.

jpc
  • 5,302
  • 1
  • 24
  • 45