jdonald
Posts: 413
Joined: Fri Nov 03, 2017 4:36 pm

USB 3.0 OTG?

Thu Sep 19, 2019 10:14 pm

On Stack Exchange, someone recently asked about OTG at USB 3.0 speeds on the Pi 4: https://raspberrypi.stackexchange.com/q ... usb-gadget

This got me thinking, and the answers provided so far do not seem complete. The OP notes that the USB-C port only connects to USB 2.0 lanes, so if this is remotely possible it would require the blue USB Type-A 3.0 sockets, similar to how OTG can be done on the Pi A+ or original model A with a USB-A-to-A cable.

How would one go about this, assuming willingness to modify the device tree and kernel code? Or if there is a physical limitation that makes this impossible without hardware modifications, can anyone explain that? There's the "hub" argument and maybe that holds with the VLI VL805 just like the earlier Microchip LAN7515, but apparently that doesn't stop USB 2.0 OTG through the USB-C port?

Note this is not about true OTG with dynamic switching as done on a Pi Zero. That is apparently impossible without the required PIN. This is referring to running the Pi in device mode a.k.a. peripheral mode, like the limited OTG mode for A/A+/4.

Apparently USB 3.0 OTG has been demonstrated on Jetson TX1's xhci interface: https://devtalk.nvidia.com/default/topi ... st/5033515
It required a kernel patch and various settings at runtime.

User avatar
rpdom
Posts: 15241
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: USB 3.0 OTG?

Thu Sep 19, 2019 10:39 pm

The USB C port doesn't go through a hub. It is the same USB channel as used on the A and Zero ranges.

The new USB2.0 and 3.0 ports go through the VL805 which prevents the use of OTG on those ports, the same as the LANxxxx chips did on earlier B models.

User avatar
Imperf3kt
Posts: 2785
Joined: Tue Jun 20, 2017 12:16 am
Location: Australia

Re: USB 3.0 OTG?

Thu Sep 19, 2019 10:44 pm

USB 3.0 on the Pi is achieved via PCI-e, you can't use it for OTG
55:55:44:44:4C
52:4C:52:42:41

trejan
Posts: 585
Joined: Tue Jul 02, 2019 2:28 pm

Re: USB 3.0 OTG?

Fri Sep 20, 2019 1:08 am

Not possible on the Pi 4.

The VL805 USB controller doesn't support device mode or OTG. There is a disabled XHCI controller inside the SoC but it is host only and only 2 data lines are connected anyway so it can only run at USB 2.0 speeds. I couldn't get it to work last time I tried so YMMV. The default USB controller for the USB-C port is that old DWC USB 2.0 OTG controller inside the SoC that we've had since the first Pi.

andrum99
Posts: 829
Joined: Fri Jul 20, 2012 2:41 pm

Re: USB 3.0 OTG?

Fri Sep 20, 2019 4:02 am

trejan wrote:
Fri Sep 20, 2019 1:08 am
There is a disabled XHCI controller inside the SoC but it is host only and only 2 data lines are connected anyway so it can only run at USB 2.0 speeds. I couldn't get it to work last time I tried so YMMV.
I had spotted mention of this controller before somewhere. Are the 2 data lines connected to the GPIO header?

jdb
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2097
Joined: Thu Jul 11, 2013 2:37 pm

Re: USB 3.0 OTG?

Fri Sep 20, 2019 6:37 am

No, the controller swaps out the dwc_otg one and uses the same USB2.0 pins.
Rockets are loud.
https://astro-pi.org

andrum99
Posts: 829
Joined: Fri Jul 20, 2012 2:41 pm

Re: USB 3.0 OTG?

Fri Sep 20, 2019 6:45 am

I see. I'm guessing it has similar limitations to dwc_otg, namely that it is meant to be used in either OTG mode or host mode with a single device attached, as it might be used in a set top box for example. Presumably the other data lines to enable USB 3 are disconnected on Pi 4? I wonder if they might find their way to the edge connector on the CM4?

trejan
Posts: 585
Joined: Tue Jul 02, 2019 2:28 pm

Re: USB 3.0 OTG?

Fri Sep 20, 2019 2:14 pm

andrum99 wrote:
Fri Sep 20, 2019 6:45 am
I'm guessing it has similar limitations to dwc_otg, namely that it is meant to be used in either OTG mode or host mode with a single device attached, as it might be used in a set top box for example.
The disabled XHCI controller is host only.

W. H. Heydt
Posts: 10911
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: USB 3.0 OTG?

Fri Sep 20, 2019 3:39 pm

andrum99 wrote:
Fri Sep 20, 2019 6:45 am
I see. I'm guessing it has similar limitations to dwc_otg, namely that it is meant to be used in either OTG mode or host mode with a single device attached, as it might be used in a set top box for example. Presumably the other data lines to enable USB 3 are disconnected on Pi 4? I wonder if they might find their way to the edge connector on the CM4?
Just to clear some of this up...
The Pi4 SoC has one PCIe lane. It is connected to device that serves as a USB hub with two USB 2 ports and 2 USB 3 ports. They are all host only. The SoC has a legacy, internal, USB 2 port. On a Pi4B, the USB 2 is wired to the USB-C power connection. The USB 2 port can be either host or client.

As a side note, since your typical USB 3 port isn't going to supply the kind of current a Pi4B requires, you would either have to construct a special cable to provide power from one source and data from another for the Pi4B USB-C connector, or power the Pi4B some other way, such as through a GPIO +5v pin, or via the PoE HAT.

So far, nothing has been said about what and how interfaces will be exposed if there is a CM4. Part of the problem is that, if everything is exposed (like the CM, CM3, and CM3+), there aren't enough contacts on the current 200-contact form factor. So either some things are going to have to be left off, or a new connector (240 and 288 have been suggested) will have to be used. My own feeling is that the best way to go would be 288 contacts on the grounds that even more may be need in the future and that will delay to pint at which a third form factor will be required.

On top of all that, bear in mind that there has never been a CM2, so it is possible that the next iteration of the CM-series may not be a CM4 at all.

andrum99
Posts: 829
Joined: Fri Jul 20, 2012 2:41 pm

Re: USB 3.0 OTG?

Fri Sep 20, 2019 8:46 pm

W. H. Heydt wrote:
Fri Sep 20, 2019 3:39 pm
andrum99 wrote:
Fri Sep 20, 2019 6:45 am
I see. I'm guessing it has similar limitations to dwc_otg, namely that it is meant to be used in either OTG mode or host mode with a single device attached, as it might be used in a set top box for example. Presumably the other data lines to enable USB 3 are disconnected on Pi 4? I wonder if they might find their way to the edge connector on the CM4?
Just to clear some of this up...
...
You seem to have missed the point - namely that THERE IS A DISABLED XHCI CONTROLLER INSIDE THE SOC. That's what I was speculating about. (Unfortunately I missed the detail that it is host-only in the original mention of it - by trejan in one of the above posts).

Return to “Advanced users”