Forum Discussion

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

access to usb device in serial way

I want to connect FPGA to PC with usb device, but most applications access devices by serial (COM port).

Is that possible let usb device appear as an additional COM port?

Thanks!

8 Replies

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

    --- Quote Start ---

    I want to connect FPGA to PC with usb device, but most applications access devices by serial (COM port).

    Is that possible let usb device appear as an additional COM port?

    --- Quote End ---

    Yes, there are USB-to-serial converters and USB-to-FIFO converters that appear to the PC as a serial port. If you have ever used a USB-to-serial adapter cable, the ICs inside those cables are what you want.

    FTDI have a range of parts that work well. They have pre-made modules and cables that you can use to interface to an existing FPGA board, eg.,

    UM245R and UM232H

    http://www.digikey.com/scripts/dksearch/dksus.dll?vendor=0&keywords=um245r

    http://www.digikey.com/product-detail/en/um232h/768-1103-nd/2614628

    and cables with breakout headers

    http://www.digikey.com/product-detail/en/c232hm-ddhsl-0/768-1106-nd/2714139

    http://www.digikey.com/product-detail/en/c232hd-ddhsp-0/768-1011-nd/2767783

    If you need high performance, then the USB-to-FIFO mode devices are pretty good

    http://www.ovro.caltech.edu/~dwh/correlator/pdf/ftdi.pdf

    Cheers,

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

    Thank you, Dave

    But I would like to know if I don't have USB-to-serial adapter cable, are there other ways to convert it in software ?

    sorry I am beginner in FPGA.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    But I would like to know if I don't have USB-to-serial adapter cable, are there other ways to convert it in software ?

    sorry I am beginner in FPGA.

    --- Quote End ---

    Why don't you start by telling me what type of FPGA board you have. Most FPGA boards have a JTAG connector that you can use to program them with. If you have a sufficiently recent FPGA, then you can also use JTAG to communicate with logic inside the design. You can learn about that method here

    http://www.alterawiki.com/wiki/using_the_usb-blaster_as_an_sopc/qsys_avalon-mm_master_tutorial

    Cheers,

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

    Thank you, Dave

    I have Cyclone II and I want to use "USB host/device" port to control or access the on-chip-memory.

    In Matlab, I need the device appear as COM port.

    That link you provide is helpful! I will try it!

    Thank you so much.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    I have Cyclone II and I want to use "USB host/device" port to control or access the on-chip-memory.

    --- Quote End ---

    This comment does not help me help you. The question I asked was "what type of FPGA board you have". Sure you have a board with a Cyclone II on it, but *what* board do you have? Can you tell me the name or send a link?

    If it has a "USB host/device" port on it, then I'd guess you have a DE2 board. Is that right?

    This project uses this interface:

    http://mzakharo.github.io/usb-de2-fpga/

    (I have not tried this code)

    --- Quote Start ---

    In Matlab, I need the device appear as COM port.

    --- Quote End ---

    MATLAB could probably be used to talk to sockets too, so the JTAG client/server in the tutorial I linked to would also work, or you could use the DE2 network interface and communicate directly with a NIOS II processor.

    Cheers,

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

    Sorry, I have DE2 board, that's right.

    Using network interface sounds great, I will try both of this.

    Thank you.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    I have DE2 board

    --- Quote End ---

    Ok, thanks.

    --- Quote Start ---

    Using network interface sounds great, I will try both of this.

    --- Quote End ---

    You said you are a beginner in FPGA, are you also a beginner in writing software? If you are familiar with software then I would recommend;

    1) Creating a NIOS II system containing a server (there are "simple socket server" examples), and write sockets code to test it.

    2) Write MATLAB sockets code.

    3) Modify the design in (1) to provide access to whatever FPGA hardware you want to test.

    You can also go through the tutorial I linked to. If you do not require high bandwidth for your data transfer, then using JTAG may be adequate.

    Cheers,

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

    Yes, I am also a beginner in writing software.

    I want to load data from on-chip-memory to Matlab directly to demo 3D Image, but I don't require high bandwidth in system.

    I guess using JTAG is better for me.

    Thank you!