TX2NX - How to use USB port for both recovery and host?

Hello! I’m designing a carrier board for TX2NX and I was wondering about USB ports.

I want to have a single USB port that can be used as a recovery port but when it boots up, it becomes normal USB port. I couldn’t exactly find any references to it. Is it possible to configure USB port like that?

You’re looking for the “on-the-go” (“OTG”) specification (the specification is from USB.org). Basically you need to have a connector with a “detect” pin to know if the mating connector is “type-A” (for host mode when someone plugs in a device) or if it is “type-B” (for device mode, when someone treats the Jetson as a device, e.g., a network device or mass storage).

The dev kits implement this with a micro-OTG port, and then adds software to switch port modes depending on the detect pin. Dev kit carrier boards have published schematics, and then there is some device tree content to tell the drivers which lanes go where about the detect pin.

1 Like

Yes, I’m looking for the USB OTG. Will check out the detect pin stuff, thanks.

But what about the networking? How do I disable it? Right now if I have plugged in Micro USB cable on the devkit, Jetson gets internet passthrough from PC.

You can refer to this topic for host mode on the port.

1 Like

Devkit is different from “your design” since devkit only has usb device mode on this port. No host mode.

And the reason behind this “no host mode” is due to hardware, not only software.

If your port is deigned for OTG which can work for both host and device mode, then that network won’t show up when it is in host mode.

1 Like

Okay, I understand the host mode thing. But what if I don’t want the network when it’s in OTG/device mode?

There is a nv-l4t-usb-device-mode.service systemd service. Stop this and it won’t bring the network interface up.

1 Like

What @WayneWWW refers to is a script for stopping or starting that service. The networking is purely software and is unrelated to the hardware design. Simply don’t run the service and the port does all you ask without complicating things. Both the bulk storage and the networking functions are basically example programs for what is known as the “gadget” framework for USB.

Example stopping if it is present:
sudo systemctl disable nv-l4t-usb-device-mode.service
(or there are stop and start scripts available for manual use within /opt/nvidia/l4t-usb-device-mode, but this is not permanent)

The part which hooks in to this (and causes this to run each reboot) is at “/etc/systemd/system/nv-l4t-usb-device-mode.service”. This is a symbolic link which points to the previously mentioned “/opt” content. Removing the symbolic link in “/etc” will prevent the service from automatically running. Better yet you might want to remove the package providing the service file, but there is no harm in leaving the content there so long as it does not auto run.

1 Like

Thanks for comprehensive answer! Now I understand that the Ethernet is purely software - I didn’t know that it was even possible via USB. Right now last thing I have to do is to delete all the Ethernet stuff but keep the storage thing and change storage to use a specific folder I need

Trivia: USB is just a data pipe, but the hardware used with such a “pipe” is “plug-n-play”…meaning USB can ask the hardware what it is, and then broadcast this to a set of drivers. If a driver sees hardware it can handle, then it takes ownership. The actual hardware is never part of USB, it is just hardware and some driver. The twist on the story is that because some classes of hardware are so common that USB happens to supply “generic” drivers for several classes of device, and if the manufacturer adheres to that “standard” specification, then USB itself will provide a driver…but that driver is not part of USB, it is just a companion which always ships with USB. Examples are human interface devices, the HID class, e.g., mice and keyboards. The device describing itself can be standalone hardware, or it can be the computer pretending to be hardware.

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