1
\$\begingroup\$

A few months ago I did some research on the web for implementing USB on an FPGA, I came across several articles that hinted that it was not possible for complete USB implementation on an FPGA citing the following concerns

  1. The voltage levels of USB data lines are in 3.3V range while FPGA runs on 3.3 or 1.2 logic levels. (i was a bit skeptical regarding this since PIC24F which work on 3.3V supply have implemented USB hardware on chip)
  2. USB requires embedded software that needs to be implemented on a MCU that will work in tandem with the hardware part of USB.

Today I came across an FPGA dev board, The Orange Crab where the USB pins were directly to the FPGA. Its an open source board with schematics available to be checked out.

Citing from that page

Direct USB connection to the FPGA (Operate as a DFU, MSC, CDC, or composite device!)

I began to wonder how would they be implementing the USB inside the FPGA and the resources that would be necessary for that. Would they for instance instantiate a soft CPU core inside the FPGA and then handle the necessary USB code on it using a C library for the USB framework. Wouldn't that be a terrible waste of FPGA resources, instead of just using an external FTDI chip to offload the USB part?

It would be interesting to know if my hunch is correct or is it really possible to do USB completely in hardware and how?

\$\endgroup\$
1
  • 1
    \$\begingroup\$ "The voltage levels of USB are in 5V range" - the bus voltage is, but the signals are 3.3V for the USB2.0 lines (D+/D-) or CML for superspeed. \$\endgroup\$ Commented Aug 24, 2020 at 22:30

1 Answer 1

2
\$\begingroup\$

It would be interesting to know if my hunch is correct or is it really possible to do USB completely in hardware and how?

It's possible, but the FPGA would need differential transceivers that support 480MHz for USB 2.0, and I suppose that a clock running at 240MHz or more. Because this is difficult for many FPGA's most designs use UMTI which parallelizes the incoming serial stream.

For USB 1.2 I would think that cores are available and speed isn't that much of an issue since it runs at 12MHz

The figure below shows what is involved in implementing UMTI, if you could do this (I never have implemented on directly only a UMTI core) on an FPGA, then yes, you could run the data pins right into the FPGA. I am not aware of any cores that do this but that doesn't mean they aren't out there.

enter image description here Source: https://www.intel.com/content/dam/www/public/us/en/documents/technical-specifications/usb2-transceiver-macrocell-interface-specifications.pdf

This is an open cores USB 2.0 diagram, the external phy implements the UMTI and the opencores usb 2.0 core processes the UMTI stream. In many cases it's better to have the trancievers outside of the FPGA or microprocessor even though it uses more GPIO.

enter image description here
Source: https://opencores.org/projects/usb

The orange crab uses a 12Mbit USB device which isn't hard to implement since it runs at 12MHz. Full-speed (12Mbit) USB with a direct connection to the FPGA

It probably wouldn't be worth it to do USB on chip because it takes a lot of resources. If you spent 30$ or more for an FPGA and implementing USB uses 5 or 10% of resources, then it doesn't justify the cost of adding an external phy or USB to UART (which can be found for 1-2$). Unless you really need to save on space, I'd use an external phy or USB to Uart.

\$\endgroup\$
6
  • \$\begingroup\$ Interesting! This is some really amazing information that you have shared. The page that I linked to also said Operate as a DFU, MSC, CDC, or composite device! Wouldn't implementing each of these require lots of software or do you imply that all these can be implemented in pure hardware? \$\endgroup\$ Commented Aug 24, 2020 at 23:25
  • 1
    \$\begingroup\$ I have heard you can bit-bang USB 1.2 with software, but the speeds aren't that fast and polling would be an option with a very fast micro. I wouldn't think it would be hard to implement a USB 1.2 controller in hardware. \$\endgroup\$
    – Voltage Spike
    Commented Aug 24, 2020 at 23:53
  • 1
    \$\begingroup\$ I dont know about 1.2, but I did use bit-banged USB 1.1 on Atmega running at 20 MHz. \$\endgroup\$
    – Rokta
    Commented Aug 25, 2020 at 6:42
  • \$\begingroup\$ Would the external PHY just include differential drivers, or there is there more to it than that? \$\endgroup\$ Commented Aug 26, 2020 at 8:25
  • 1
    \$\begingroup\$ @MiguelSanchez, yes, there used to be an external USB 1.1 PHY having a diff driver, and SE outputs: inst.eecs.berkeley.edu/~cs150/Documents/PDIUSBP11A_3.pdf This IC will make your serial-interface engine electrically compliant to USB specifications. It is still available from some odd shops. \$\endgroup\$ Commented Aug 28, 2020 at 6:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.