Connecting PC and embedded system via USB difficult

Hi!Guys!
I have embedded system with USB3300 PHY and FPGA, which I have to program as a Link. I want my system to be able to communicate with my PC but I am not sure if I have gathered all information. Here is how I see it. I program FPGA to handle ULPI interface to be able to communicate with PHY. Then I write simple computer program to send data via USB that my system will be able to understand ? I am not sure if PC sends some extra information at the beggining of the transmission that I have to ignore ?

It sounds like you want the FPGA to act as a device which any host can use. Is that correct? If so, you have a couple of choices.

One is that the FPGA can use USB as a simple serial port over USB (a serial UART). In this case it should recognize an FTDI brand USB chip, though it would perhaps require using some form of setup in the boot of the chip (I’m assuming the FT230X series of USB to BASIC UART ICs under FTDI). Then any host which recognizes USB serial UARTS with that brand of chip would work, and that includes most hosts (Jetsons should see that out of the box). You’d be limited to USB1.1 speeds, approximately 12Mbit/s.

The next choice is to set up your FPGA as a USB device. There are broadly two categories of USB device…those using a standardized class interface, and those using a custom interface.

Custom interface implies the driver on the host will never be known without you manually writing the driver and porting it to every single platform needing it. You’d have to write one driver compatible with your Jetson, and if it were to work on a desktop, perhaps another driver for Linux x86_64, a separate driver for Windows 7, and yet another for Windows 10.

The standardized classes have a full interface which is understood by the USB system and probably will just work on Jetsons and other platforms, but you’re restricted to those behaviors. A common class on these forums is the USB Video Class (you see a lot of mention of driver names starting with “uvc*”…that is USB Video Class). Another typical class is the bulk storage class…which is good for external hard drives which do bulk transfers, pause, and restart. You could run these at the maximum speed of the USB bus (USB2 or USB3, depending on where it is connected…but beware as speeds go up so do design requirements).

In the case of the Jetson’s OTG port (“On the Go”), this port normally runs at USB2 speeds as a host. You can normally plug in external hard drives, keyboards, mice, so on, to this port.

When a Jetson is in recovery mode the OTG port becomes a custom device understood only by a Linux host that has the L4T driver package flash program;.

However, the OTG port has an alternate ability to become a device if you’ve customized and will run under the Linux/L4T operating system of a normal Jetson boot-up.

The USB “gadget” interface in the kernel is a framework to speed up development of standardized classes of the device mode port and other hosts treat this port like the Jetson is a standard device class. You can pick if the Jetson is seen as a bulk storage device, USB video class device, so on.

The device mode of the USB port could also be turned into a fully custom device with no limitations on what could be put into it, but then you’d once more be given the task of building your driver from scratch for every host it plugs into. The OTG port in device mode and the USB interface of your FPGA would be no different in this respect…either could be made into a standardized class, either could be made into a custom class. Both require at least some driver development, only serial UART does not require any driver development (the driver is required, it’s just that it is so common every system already has drivers for FTDI brand serial UARTs).