FPGA as a USB Device directly

Hi, I’ve read the FPGA as USB Device topic and some of the technical documentation for the board. It states that the z2’s usb port is not capable of acting in device mode. Is this a limitation of the USB Controller? if so, would it be possible to route the pins from the USB port into the PL side and create something in FPGA logic that can work as a USB device?

If not, are the GPIO pins capable of operating at USB frequencies? I haven’t been able to find any kind of specification or datasheet on what the limits of those pins are.

In the linked tutorial it mentions that the xilinx usb core costs money, would it be possible to either follow the USB spec and create my own core or find an existing open usb core?

Hi, I am the creator of the article :slight_smile:
I am interested also to an “only-fpga” solution, but I know that usb need an external phy and the usb 2 design in Vivado is not free (during bitstream generation gives a license error).
I have also found this open source USB design for Vivado: Overview :: USB 2.0 Function Core :: OpenCores
But unfortunately I don’t have any experience with Wishbone connection (I have found an AXI-Whisbone converter, but I’m not sure if works).

I follow up your topic, I really appreciate a solution from Pynq / Xilinx team, but I am also available for an open source project if somebody want to join this adventure :wink:

It is also important to analyze a usb 3 solution (but I found nothing)

My biggest problem at the moment is, while I can select the znyq chip in vivado, and I can get the usb pins out, I’m not sure if thats actually connected like that in the pynq z2. There are plenty of open USB core designs and I’d love to try designing my own, I’m just not sure what I can do with the pynq z2.

Hi @hobnob11,

The USB is connected to the PS, hence you will not be able to access the USB from the FPGA.
From the PYNQ-Z2 manual, available on the PYNQ-Z2 page

Mario

Yeah I see that, What does it mean when it says a USB Controller can be connected to MIO Pins, does that mean you can connect the CONTROLLER to the PL side if you want? not the port? i assume thats what the usb pins you can expose in the zynq ip in vivado are then.

Looks like I’ll need to connect to the GPIO directly and get a usb breakout cable.

The short answer to your questions is no; you can’t do this on the PYNQ-Z2.

would it be possible to route the pins from the USB port into the PL side and create something in FPGA logic that can work as a USB device?
No, you can’t do this. The USB controller doesn’t work like this.

The Pmod and Arduino interfaces on the PYNQ-Z2 will probably only work at around 10 MHz.

What does it mean when it says a USB Controller can be connected to MIO Pins

For Zynq you can unable 0, 1 or 2 USB controllers. When you enabled them, they are connected to MIO pins. These are not FPGA pins. These are physical pins on the chip, so if you are using a board like the PYNQ-Z2 the peripherals are fixed. You need to match your design in Vivado to the board.

If you were making your own board you would add a USB PHY and a port and connect it to PL pins then add your IP (paid/free/open source whatever you can find).

This might be an interesting project but what do you really want to do with a USB connection on the FPGA side? You would need a microcontroller/microprocessor to run the software stack. Using the USB controllers that are part of Zynq/Zynq Ultrascale seems like a much better way to do something related to USB.

Regards,
Cathal

Thanks for the information, I already have a PNYQ Z2 and, mostly for learning and curiosities sake, I’m trying to make a KVM over IP Device. I’ve already gotten video encoding working and sent over IP using the HDMI In, And I’m just trying to emulate a keyboard.

From what I can tell the USB spec has minimum rates below which it wouldn’t work, even for something as low bandwidth as a keyboard, So I’m probably going to have to get a secondary board and use i2c like in the article i linked.

1 Like

I’ve been unable to find any kind of spec sheet describing what the gpio pins on the pynq z2 can do, frequencies etc, but usb 1.0 low speed is rated at 1.2mbit/sec, which should be well within the 10mhz you’ve listed, So i’m going to go forward with that as a goal.