Two USB ports as gadget/device mode?

Hi, please is it possible to use both USB3 ports of Rock Pi 4A/B as gadget/device ports? IIUC RK3399 has two OTG-capable dwc3 blocks, and two OTG-capable USB2/3 PHYs.

IIUC the board schematics show one of the USB3 A ports is OTG by design (utilizing TYPEC0_U2VBUSDET). But the second USB3 A port is hooked directly to 5V and TYPEC1_U2VBUSDET is not connected.

I would not mind hacking a custom cable with the +5V cable disconnected (USB A -> USB A cables are custom only anyway). Also reconfiguring device tree would not be a problem either.

The purpose would be a dual-gadget USB2/3 bridge to connect between two PCs (network, audio, etc.)

Or please is there a cheaper/smaller Radxa board capable of dual-gadget operation?

Thanks a lot,

Pavel.

Going through the SoCs used by Radxa … IIUC the only two chips with dual dwc3 and two USB phys are RK3399 and RK3588.

You are right, RK3399 and RK3588 both has two USB OTG. ROCK 5B OTG0 works and OTG1 can not work. ROCK 5B+ OTG0 and OTG1 both work. ROCK 4A/4B OTG1 is not tested.

Jack, thanks a lot. I am looking at 5B and 5B+ schematics to understand the difference, so that I can compare with Rock 4. Please can you comment on the following?

Both 5B and 5B+ connect complete OTG0 + TYPEC0 to the USB-C connector which by design supports host and device.

Both 5B and 5B+ connect OTG1 + TYPEC1 to one port of the USB3 type A combo. 5B uses one power switch for both A ports of the dual combo, while 5B+ has a separate power switch for the TYPEC1 port of the combo:
5B:

5B+:

Also 5B has TYPEC1_USB20_VBUSDET not connected:

while 5B+ has it connected to 3.3V fixed:

Now, IIUC to use the TYPEC1 as a device, I would need USB A-A cable. Please how will the DWC3-1 controller for TYPEC1 know that it should switch to device when a cable is connected, when no OTG-ID is used?

I would understand the DWC3-1 must be “static device” as described in RK3588 datasheet:

Configured in device tree.

But please, assuming the above is true (which I am not sure of), why OTG1 on 5B cannot work while on 5B+ it can, if both must be switched to the device statically?

TYPEC1 on Pi4 seems to be connected similarly to 5B, the USBVDET is unconnected to H:

But still it would seem to me that if the second DWC3-1 is statically switched to device in device tree and the custom USB A-A cable has its 5V line disconnected (so that the host 5V does not conflict the 5V in the device port type A), both 5B and 4A/B should work OK.

Please can you comment on that? Thanks a lot!