# USB3 Type C as a device mode, custom board Jetson Xavier NX

**URL:** <https://forums.developer.nvidia.com/t/usb3-type-c-as-a-device-mode-custom-board-jetson-xavier-nx/257164>\
**Category:** Jetson Xavier NX\
**Tags:** usb, board-design\
**Created:** [June 19, 2023, 2:30pm UTC](https://forums.developer.nvidia.com/t/usb3-type-c-as-a-device-mode-custom-board-jetson-xavier-nx/257164 "2023-06-19T14:30:30Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![ahlicpp](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@ahlicpp](https://forums.developer.nvidia.com/u/ahlicpp)\
**Post date:** [June 19, 2023, 2:30pm UTC](https://forums.developer.nvidia.com/t/usb3-type-c-as-a-device-mode-custom-board-jetson-xavier-nx/257164/1 "2023-06-19T14:30:30Z")

</div>

I have a custom board for the Xavier NX, and it works fine with micro-USB for USB0 -OTG (USB2.0 High Speed). but how to use the USB3.0/USB3.1 (SuperSpeed) in device mode as a slave. The custom board’s USB3 port is Type-C rather than Type-A like it was on the original carrier board.  
To control the board, we intend to connect this to a desktop PC. And as of right now, the PC has not detected it; neither a PID nor a VID have been found; nothing has occurred. (Perhaps it is currently only in host mode.)  
is it possible to configure or switch from “host-mode” to “device mode/slave mode” via software?  
for the host-mode, this USB Type-C can work well, it can read/write keyboard and webcam.

Best regards,

---

<div class="post-metadata">

**Author:** ![WayneWWW](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/waynewww/32/14043_2.png) [@WayneWWW](https://forums.developer.nvidia.com/u/WayneWWW)\
**Post date:** [June 20, 2023, 3:56am UTC](https://forums.developer.nvidia.com/t/usb3-type-c-as-a-device-mode-custom-board-jetson-xavier-nx/257164/3 "2023-06-20T03:56:17Z")

</div>

Try

> echo device \> /sys/class/usb\_role/usb2-0-role-switch/role

Or your device tree has to be written correctly in the beginning… but that also requires your hardware design is correct…

---

<div class="post-metadata">

**Author:** ![ahlicpp](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@ahlicpp](https://forums.developer.nvidia.com/u/ahlicpp)\
**Post date:** [June 21, 2023, 12:56pm UTC](https://forums.developer.nvidia.com/t/usb3-type-c-as-a-device-mode-custom-board-jetson-xavier-nx/257164/4 "2023-06-21T12:56:25Z")

</div>

Hallo @WayneWWW  
Thank you so much for your reply.  
that command does not work for me, I have no folder named ‘usb\_role’ in /sys/class/  
currenty, I am using JetPack 4.6.3 [L4T 32.7.3]

I have tried to modify the device tree, by following this reference:  
[reference](https://medium.com/@haoye94/editing-device-tree-and-compiling-kernel-for-nvidia-jetson-xavier-nx-11a1df20939c)

1. Download and install the Toolchain  
`wget http://releases.linaro.org/components/toolchain/binaries/7.3-2018.05/aarch64-linux-gnu/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu.tar.xz`  
Execute the following commands to extract the toolchain:  
`mkdir $HOME/l4t-gcc cd $HOME/l4t-gcc tar xf gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu.tar.xz`

2. Download the kernel sources  
[NVIDIA Jetson Linux 32.7.3 - Driver BSP](https://developer.nvidia.com/downloads/remksjetpack-463r32releasev73t186jetsonlinur3273aarch64tbz2)  
Execute the following commands to extract the kernel:  
`tar -xvf public_sources.tbz2`  
`cd Linux_for_Tegra/source/public`  
`JETSON_XAVIER_NX_KERNEL_SOURCE=$(pwd)`  
`tar -xf kernel_src.tbz2`

3. Modify the Device Tree - _specifically for USB?_  
public\_sources/Linux\_for\_Tegra/source/public/kernel\_src/hardware/nvidia/platform/t19x/jakku/kernel-dts/common/_tegra194-p3668-common.dtsi_  
[tegra194-p3668-common.dtsi](https://forums.developer.nvidia.com/uploads/short-url/69HQl3bym2sjwDlPgJDMe4rxwph.dtsi) (11.7 KB)  
i just edited:  
ports {  
usb2-0 {  
mode = “otg”;  
status = “okay”;  
};  
usb2-1 {  
mode = **“otg”** ;  
status = “okay”;  
};  
usb2-2 {  
mode = **“otg”** ;  
vbus-supply = \<&battery\_reg\>;  
status = “okay”;  
};  
usb3-2 {  
nvidia,usb2-companion = \<1\>;  
status = “okay”;  
};  
};

4. Compile kernel and dtb  
the steps:  
`cd $JETSON_XAVIER_NX_KERNEL_SOURCE TOOLCHAIN_PREFIX=$HOME/l4t-gcc/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-`  
`TEGRA_KERNEL_OUT=$JETSON_XAVIER_NX_KERNEL_SOURCE/build`  
`KERNEL_MODULES_OUT=$JETSON_XAVIER_NX_KERNEL_SOURCE/modules`  
`make -C kernel/kernel-4.9/ ARCH=arm64 O=$TEGRA_KERNEL_OUT LOCALVERSION=-tegra CROSS_COMPILE=${TOOLCHAIN_PREFIX} tegra_defconfig`  
`make -C kernel/kernel-4.9/ ARCH=arm64 O=$TEGRA_KERNEL_OUT LOCALVERSION=-tegra CROSS_COMPILE=${TOOLCHAIN_PREFIX} -j8 --output-sync=target zImage`  
`make -C kernel/kernel-4.9/ ARCH=arm64 O=$TEGRA_KERNEL_OUT LOCALVERSION=-tegra CROSS_COMPILE=${TOOLCHAIN_PREFIX} -j8 --output-sync=target modules` `make -C kernel/kernel-4.9/ ARCH=arm64 O=$TEGRA_KERNEL_OUT LOCALVERSION=-tegra CROSS_COMPILE=${TOOLCHAIN_PREFIX} -j8 --output-sync=target dtbs`  
`make -C kernel/kernel-4.9/ ARCH=arm64 O=$TEGRA_KERNEL_OUT LOCALVERSION=-tegra INSTALL_MOD_PATH=$KERNEL_MODULES_OUT modules_install`

5. Copy device tree into jetpack  
sdk-manager has been installed.  
`export NVIDIA_SDK_MANAGER=$HOME/nvidia/nvidia_sdk/`  
Select DTB and directory based on Jetson Xavier NX module type  
`export DTB=tegra194-p3668-all-p3509-0000.dtb`  
`JETPACK_4_6_P3668=${NVIDIA_SDK_MANAGER}/JetPack_4.6-3_Linux_JETSON_XAVIER_NX_TARGETS/Linux_for_Tegra`

6. Flash Jetson Board (device tree only)  
This command flashes only the device tree, excluding the kernel image and filesystem.  
the Jetson NANO is in recovery mode.  
`cd ${JETPACK_4_3_P3448}`  
Copy device tree generated  
`cp $JETSON_XAVIER_NX_KERNEL_SOURCE/build/arch/arm64/boot/dts/${DTB} kernel/dtb/`

`sudo ./flash.sh -r -k kernel-dtb jetson-xavier-nx-devkit mmcblk0p1`

* * *

the output :  
\*\*\* The [kernel-dtb] has been updated successfully. \*\*\*

but i am still not able to use this USB Type-C as device mode or OTG.

in the hardware design, by using IC [HD3SS3220](https://www.ti.com/lit/ds/symlink/hd3ss3220.pdf?ts=1687351538848&ref_url=https%253A%252F%252Fwww.ti.com%252Finterface%252Fusb%252Ftype-c-and-power-delivery%252Fproducts.html). it is also configured as Dual Role Port.

Best wishes,

---

<div class="post-metadata">

**Author:** ![kayccc](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/kayccc/32/14043_2.png) [@kayccc](https://forums.developer.nvidia.com/u/kayccc)\
**Post date:** [July 4, 2023, 8:41am UTC](https://forums.developer.nvidia.com/t/usb3-type-c-as-a-device-mode-custom-board-jetson-xavier-nx/257164/5 "2023-07-04T08:41:07Z")

</div>

Sorry for the late response, have you managed to get issue resolved or still need the support? Thanks

---

<div class="post-metadata">

**Author:** ![ahlicpp](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@ahlicpp](https://forums.developer.nvidia.com/u/ahlicpp)\
**Post date:** [July 5, 2023, 1:23pm UTC](https://forums.developer.nvidia.com/t/usb3-type-c-as-a-device-mode-custom-board-jetson-xavier-nx/257164/6 "2023-07-05T13:23:52Z")

</div>

Hallo kayccc,

Ja, i still need help on this.  
I’ve seen that this chip is supported on linux/tree/master/drivers/usb/typec/ [hd3ss3220.c](https://github.com/torvalds/linux/blob/master/drivers/usb/typec/hd3ss3220.c). and I have checked that **JetPack 5.1.1** already has this library as well.  
I thought if I upgrade to the latest version of JetPack. my USB-C should be able to run automatically, but it doesn’t work. when I connect it to PC HOST (device mode), PC doesn’t detect anything. But it still work as HOST only (mouse, webcam, etc)

Best regards,

---

<div class="post-metadata">

**Author:** ![WayneWWW](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/waynewww/32/14043_2.png) [@WayneWWW](https://forums.developer.nvidia.com/u/WayneWWW)\
**Post date:** [July 6, 2023, 2:26am UTC](https://forums.developer.nvidia.com/t/usb3-type-c-as-a-device-mode-custom-board-jetson-xavier-nx/257164/7 "2023-07-06T02:26:23Z")

</div>

Hi,

We cannot help you on hd3ss3220.c. It is 3rdparty device and there are too many kinds. Unlikely to know every type C controller over the world.  
What we can help is after you are sure the function of hd3ss3220.c is fine, you could refer to document here to write host side usb configuraiton.

[https://docs.nvidia.com/jetson/archives/r35.3.1/DeveloperGuide/text/HR/JetsonModuleAdaptationAndBringUp/JetsonAgxXavierSeries.html?highlight=universal%20serial%20bus#porting-the-universal-serial-bus](https://docs.nvidia.com/jetson/archives/r35.3.1/DeveloperGuide/text/HR/JetsonModuleAdaptationAndBringUp/JetsonAgxXavierSeries.html?highlight=universal%20serial%20bus#porting-the-universal-serial-bus)

---

<div class="post-metadata">

**Author:** ![ahlicpp](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@ahlicpp](https://forums.developer.nvidia.com/u/ahlicpp)\
**Post date:** [July 11, 2023, 9:20am UTC](https://forums.developer.nvidia.com/t/usb3-type-c-as-a-device-mode-custom-board-jetson-xavier-nx/257164/8 "2023-07-11T09:20:48Z")

</div>

Hi WayneWWW,

I would like to seek clarification regarding Xavier NX USB.  
According to the [documentation(Datasheet)](https://developer.download.nvidia.com/assets/embedded/secure/jetson/Xavier%20NX/Jetson-Xavier-NX-Series-Data-Sheet_DS10184001v1.8.pdf?EoW4MoFWd6jYnIXiCHZUykpXiMcEuuv3NtcT82P2nSc4Q4iOC_U8JJnhenn08O9V2kOojxsVuqddeIvYn6DjmAAJ6sDeJdR9w_RWDLGx8FBSF-VF5a0LnWLnPCJfOw37ZXC3xUHIdji2s7q79fWB28JjsMe5XCnMMq-oQtU31UWRwc5F9-UuXU6YnZlZI45uHxyukWiIe2G8PJw4uC0=&t=eyJscyI6ImdzZW8iLCJsc2QiOiJodHRwczovL3d3dy5nb29nbGUuY29tLyJ9#%5B%7B%22num%22%3A112%2C%22gen%22%3A0%7D%2C%7B%22name%22%3A%22XYZ%22%7D%2C52%2C716%2C0%5D), it mentions that USB3.0 can function in device mode, but there is no presence of a USB3.0 lane in the Xavier NX. it says USB.3.1’s support for host mode only. Consequently, does this imply that USB2.0 is the only option for operating in device mode?

I am confused because the [document(Product Design Guide)](https://developer.download.nvidia.com/assets/embedded/secure/jetson/Xavier%20NX/Jetson_Xavier_NX_Product_Design_Guide_DG-09693-001_v1.7.pdf?6o9WPW4cM-gkswJ-Y9pMlTAgWF4PGC0GU1iLrVu0HkY1zRswEM2vHvL1vTEfFbNxFx7vW5bPxP4dof5xwOvD_oIF3lve10TXFkhmzB3o9iA0YJkelFNtKbhJMpFp3l04cuym0ERHIKbEfJD-IL2kRy_quk3Hnh9hwTkhwr-pk5purLb3vUqr1Tz9X_m-qs-tep5X6QvolXnZzejf8saTgIU5v9w=&t=eyJscyI6ImdzZW8iLCJsc2QiOiJodHRwczovL3d3dy5nb29nbGUuY29tLyJ9#%5B%7B%22num%22%3A103%2C%22gen%22%3A0%7D%2C%7B%22name%22%3A%22XYZ%22%7D%2C81%2C720%2C0%5D) only mentions USB2.0 and USB3. **2** , which leaves me uncertain about the support for USB3.1/ **2** and whether it is limited to host mode only.

Best regards,  
[Jetson\_Xavier\_NX\_Product\_Design\_Guide\_DG-09693-001\_v1.7.pdf](https://forums.developer.nvidia.com/uploads/short-url/gEZBN5UQCmNdu5f2CqnJ8EOEYt9.pdf) (2.3 MB) - Chapter 6. USB and PCIe  
[Jetson-Xavier-NX-Series-Data-Sheet\_DS10184001v1.8.pdf](https://forums.developer.nvidia.com/uploads/short-url/jypHaR9FpKlFIXv6BiSNqZzzJaa.pdf) (889.9 KB) - 1.8.2 Universal Serial Bus (USB)

---

<div class="post-metadata">

**Author:** ![WayneWWW](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/waynewww/32/14043_2.png) [@WayneWWW](https://forums.developer.nvidia.com/u/WayneWWW)\
**Post date:** [July 11, 2023, 9:34am UTC](https://forums.developer.nvidia.com/t/usb3-type-c-as-a-device-mode-custom-board-jetson-xavier-nx/257164/9 "2023-07-11T09:34:04Z")

</div>

Hi,

The link of that datasheet seems not correct so I am not sure which document you are referring to.

---

<div class="post-metadata">

**Author:** ![ahlicpp](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@ahlicpp](https://forums.developer.nvidia.com/u/ahlicpp)\
**Post date:** [July 11, 2023, 11:07am UTC](https://forums.developer.nvidia.com/t/usb3-type-c-as-a-device-mode-custom-board-jetson-xavier-nx/257164/10 "2023-07-11T11:07:14Z")

</div>

Hi WayneWWW,

please kindly find the documents attached below  
[documentation(Datasheet)](https://forums.developer.nvidia.com/uploads/short-url/jypHaR9FpKlFIXv6BiSNqZzzJaa.pdf) (889.9 KB) - 1.8.2 Universal Serial Bus (USB)  
[documentation(Product Design Guide)](https://forums.developer.nvidia.com/uploads/short-url/gEZBN5UQCmNdu5f2CqnJ8EOEYt9.pdf) (2.3 MB) - Chapter 6. USB and PCIe

Best regards

---

<div class="post-metadata">

**Author:** ![WayneWWW](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/waynewww/32/14043_2.png) [@WayneWWW](https://forums.developer.nvidia.com/u/WayneWWW)\
**Post date:** [July 11, 2023, 11:16am UTC](https://forums.developer.nvidia.com/t/usb3-type-c-as-a-device-mode-custom-board-jetson-xavier-nx/257164/11 "2023-07-11T11:16:17Z")

</div>

Hi,

Let me check with internal team about why the document is written like this.

I don’t think there is such limitation.

---

<div class="post-metadata">

**Author:** ![WayneWWW](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/waynewww/32/14043_2.png) [@WayneWWW](https://forums.developer.nvidia.com/u/WayneWWW)\
**Post date:** [August 2, 2023, 1:49am UTC](https://forums.developer.nvidia.com/t/usb3-type-c-as-a-device-mode-custom-board-jetson-xavier-nx/257164/13 "2023-08-02T01:49:29Z")

</div>

Hi,

The datasheet actually indicates usb device mode can work up to 3.1 while host mode can work up to 3.2.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/system/32/68080_2.png) [@system](https://forums.developer.nvidia.com/u/system)\
**Post date:** [August 23, 2023, 2:58am UTC](https://forums.developer.nvidia.com/t/usb3-type-c-as-a-device-mode-custom-board-jetson-xavier-nx/257164/15 "2023-08-23T02:58:41Z")

</div>

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