12

According to this answer the Raspberry Pi 4 Model B has

a total of five USB ports (two USB3 host, two USB2 host, one USB2 OTG).

Where is the fifth USB2 OTG port located and how can I use it? Can I use it with OTG Gadget mode?

Ingo
  • 40,606
  • 15
  • 76
  • 189
  • I think the Rpi4 USB-C power plug can be rewired to do data communication beside supplying power - https://imgur.com/gallery/dlnWmHS – tlfong01 Jul 12 '19 at 13:31

5 Answers5

8

USB2 OTG port is inside the USB-C connector. Yes, you will be able to use the Gadget mode drivers, as it's an upstream-facing (slave) USB port.

OTG is a rather bad name here, because it means a port which can work as both upstream-facing and downstream-facing (i.e. as a host, similar to other USB ports on the RPi). Yet it's not the case: OTG ports should be able to toggle the CC lines of USB-C between 5V and GND, but in case of RPi4 these lines are grounded, making it a strictly upstream-facing (slave).

Dmitry Grigoryev
  • 26,688
  • 4
  • 44
  • 133
6

The USB-C "Power In" port doubles as a USB-OTG port (or dual-role port (DRP) in USB-C speak).

Overview for the Pi 4:

The OTG hardware present on previous models of Pi is still available and it has moved to a single connection on the USB-C port. The OTG hardware is intended to be used in device-only mode on Pi 4.


The USB-C port is the only connector left that could provide USB OTG connectivity, even though the spec does not list the OTG port explicitely.

The official schematics, top left, show the USB-C Power In connector which is labelled "USB2 ONLY" and has the UUSB_D_N and UUSB_D_P data lines connected, pins A6, A7 and B6, B7, which are relevant for USB 2 (and OTG).

enter image description here


Transition Existing Products from USB 2.0 OTG to USB Type-C tells:

In the Type-C ecosystem, the USB 2.0 OTG device is referred as a dual-role port (DRP). A DRP is a device that can function either as a USB host or as a USB peripheral. In Type-C terminology, a USB host is called a downstream-facing port (DFP), and a USB peripheral is called an upstream-facing port (UFP).

Ghanima
  • 15,578
  • 15
  • 58
  • 113
  • Sorry, I'm not very good in hardware understanding. If UUSB_D_N and UUSB_D_P data lines are connected, does it mean I can use the USB-C connector also as USB port? – Ingo Jul 12 '19 at 13:00
  • 1
    @ingo unfortunately all we have are "reduced" schematics. That is, we know there is a a net called "UUSB_D_N" and "_P" connected to the connector but we cannot tell where else it is connected. Likely to the SOC of course, as there is little reason to name it at the connector and not use it anywhere (unless obfuscation). – Ghanima Jul 12 '19 at 13:08
  • @Ingo: Yes - that is what it means. – Seamus Jul 30 '20 at 00:47
5

To illustrate the how, I currently connect my RPI4 with a "USB-C to USB-C" cable to my MacBook Pro, providing both power and allowing OTG connectivity over that single cable. To activate OTG mode on stock Raspian Buster I applied this [dead link] guide. After reboot with that config, the RPI4 shows up on MacOS as a networking device named RNDIS/Ethernet Gadget.

With default Bonjour activated and a local network config is automatically created, you should be able to reach the RPI4 on raspberrypi.local. With some additional config changes this allows me to ssh in or access VNC via MacOs Screen Sharing. I also configure Internet Sharing on the MacOs side, allowing the RPI to access the internet through the MacBooks network configuration.

goldilocks
  • 56,430
  • 17
  • 109
  • 217
gdh
  • 151
  • 2
  • +1, thanks for the useful test. 'The problem I`m fighting with is the power supply. The RasPi needs 2.5A to 3A. A default USB-C connection does not provide this. Do you have any experience with [an **Y** adapter cable](https://raspberrypi.stackexchange.com/q/100667/79866)? – Ingo Jul 16 '19 at 23:02
  • Nope. Are you sure you are using a “non E-marked” cable? I bought a simple one cause other was giving difficulties. Read https://hackaday.com/2019/07/16/exploring-the-raspberry-pi-4-usb-c-issue-in-depth/ – gdh Jul 16 '19 at 23:15
4

This is coming in late - you've likely resolved this by now & may be using it for some time. But just in case, I found a discussion thread in the RPi forum where some additional details on the OTG support provided in RPi4 were provided. Also, this "how-to guide" may be useful in getting this feature working on your RPi 4. These may be useful, so I'm posting them here.

Seamus
  • 18,728
  • 2
  • 27
  • 57
2

The OTG USB port is the USB Type C port that is also typically used to power the Raspberry Pi 4. I haven't independently verified this for myself, but if your computer provides enough power, or you get a modified cable that lets you provide more power than your computer does directly, you should be able to use the Pi in USB Gadget mode the same way you could in past Raspberry Pi's.

It's the USB-C port in this diagram: Diagram of Raspberry Pi 4, indicating USB C port used for OTG

Patronics
  • 129
  • 5
  • 1
    USB C cables are reversible (unlike 2.0 or 3.0 cables) and I would like to believe the ports are too, somewhere -- eg., you could take a laptop with multiple C type power inputs and use one as an input and one as an output. Quick search did not confirm this though. – goldilocks Jul 12 '19 at 12:56
  • @goldilocks you definitely can to some extent, but (at least with my laptop, a MacBook Air) it can only provide 5 volt output, not higher voltages like it accepts as input. This is fine for the Raspberry Pi, which only uses 5 volts, but given the controversy there seems to be about the wiring of the USB C port on the current version of the Pi 4, I doubt most laptops will be willing to provide the 2.5-3 amps the Pi requires. – Patronics Jul 12 '19 at 13:00