How to force AGX Orin Devkit into device USB mode on J40

I’m trying to setup my AGX Orin to be a USB Gadget connected to an iPad, however when I plug in the iPad, it always ends up being the host and not the device. If I put a USB hub in the middle, it works as it forces the iPad into the device mode, but I’d prefer to just have the USB-C connector between the two.

It seems to me the interface in Linux for this is the /sys/class/typec/<port>/data_role, but whenever I do echo device > data_role (as root) I get permission denied errors. It seems <port> is port1, as when I have it connected in a configuration that forces it to be device role then data_role reads [device]

Is this usecase supported? How do I request the USB bus to swap roles from Linux?

I’m on Jetpack 5.1.1

Please confirm which Jetson device you are using. It mentions AGX Orin in title but AGX Xavier in the comment. Not sure which one you use. And the latest Jetpack release is 5.1.1. Please use the latest release.

Description updated. Sorry for the omissions

J40 is an OTG port by default. If the status of VBUS and ID pins are correct, Orin will switch to device mode automatically. This may be an issue in signal quality. Do you have other type-C to type-A cables for a try? May try other cables and see if the issue occurs.

I did a little more digging here. After setting the w bit on data_role, I get

$ echo device | sudo tee data_role
tee: data_role: Operation not supported

meaning we hit

// drivers/usb/typec/class.c:1023
	if (port->cap->data != TYPEC_PORT_DRD) {
		ret = -EOPNOTSUPP;
		goto unlock_and_ret;

this cap seems to come from

// drivers/usb/typec/ucsi/ucsi.c:1040
	command |= UCSI_CONNECTOR_NUMBER(con->num);
	ret = ucsi_send_command(ucsi, command, &con->cap, sizeof(con->cap));

so it does appear to be actually querying the device for the capabilities but it’s coming up without DRD?

This use-case is not supported in current release. We will check if we can support it in the future.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.

We have check ed and confirmed this will not be supported. The data role is defined by the CC handshake, and if both ports are dual roles, then the data role, host/device, will be decided randomly.

We would suggest do hotplug, or put a hub between the devices.