Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
20 years ago

NIOS USB Keyboard App ?

Is there an easy (... or known) way to add to a NIOS device some USB Keyboard

functions (standard 101-key USB Keyboard accepted by any USB HID class driver) ?

I guess its a low-speed USB 1.1 port with some software handling the HID stuff ...

4 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Easy..hmmm...no.

    Depending on your quantity and requirements I guess. You can get free IP from www.opencores.org for USB.

    I would say that if you have only a few units to build to rather go for a ps2 keyboard (also easy IP to implement).

    I am just thinking of all the trouble you are going to have to face writing a USB master interface to read the keyboard. BUT if you are going to do this for a mass produced product then go right ahead. USB is the face of the future. PS2 will die out soon.

    BTW. If you find an easy solution for USB keyboard and/or mouse let me know as well.

    Victor

    http://www.zerksus.com (http://www.zerksus.com)
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    So yeah, thanx for your fast answer. I did some googling and indeed found some (non-PLD) devices used for that kind of application.

    It´s indeed a USB 1.1 low speed client job using the "HID mode" - so that would be the hardware IP part and shouldn´t be too hard to find.

    The other thing is the software that "emulates" a USB keyboard device - I found some 8051 code that seem to do that, maybe I can

    adapt this for NIOS. PS2 is no option because I need the USB power from the host (-PC) to source my "NIOS-Keyboard" ...
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I use FDTI's FT2232 USB IC. In its basic mode it is a USB to RS232 converter. You can do some other funky stuff with it as well. The nice thing is having the 5V from the PC. So if you just want to do keyboard emulation that is also a possible path to go. Again you can go USB->Serial->8051->PS2. I just hate to see you battle with USB code just to get a few key presses into a PC. :-)

    Below is a picture of something I sell. It is a USB->RS232->RS422 converter. No IP, no Fuss.

    click to view picture (http://www.zerksus.com/bergomi_usb_rs422.jpg)

    But now the question about NIOS2. Where does the FPGA fit in? Hope you don't plan to plug a FPGA in USB port? The power surge won't be good.

    Victor

    http://www.zerksus.com (http://www.zerksus.com)
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Mhhm, I need to deal with USB anyway ... so first thing will be to get my hands on an USB client IP core. Is is somehow possible to directly

    connect USB datalines to the FPGA (with 5V tolerance) or is there the need of any PHY or something to be used in between ?

    That the USB power needs to be level shifted and stabilized for the FPGA is of course a no bainer http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/wink.gif Its going to be in any case a 500 mA

    not a "normal" 100 mA USB device ... will see how to electricaly express that. USB 2.0 is not really needed.

    Besides that keyboard thing I maybe later need some additional USB connectivity through the same connection (other endpoint) anyway...

    I really like these legacy emulation thing so mayby the RS232 "profile" would be a way to go.

    The software seems to be a straight way ... once NIOS can handle the USB port. First has to be a USB enumeration process and then

    establish a HID endpoint. Porting the 8051 code seems to be a good thing ... of course the whole USB communication subsystem has

    to be changed http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/rolleyes.gif