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?
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).
The USB-C "Power In" port doubles as a USB-OTG port (or dual-role port (DRP) in USB-C speak).
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).
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).
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:
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 guide. After reboot with that config, the RPI4 shows up on MacOS as a networking device named
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.