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

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,

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…

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

  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
    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 (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. it is also configured as Dual Role Port.

Best wishes,

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

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. 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,

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

Hi WayneWWW,

I would like to seek clarification regarding Xavier NX USB.
According to the documentation(Datasheet), 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) 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 (2.3 MB) - Chapter 6. USB and PCIe
Jetson-Xavier-NX-Series-Data-Sheet_DS10184001v1.8.pdf (889.9 KB) - 1.8.2 Universal Serial Bus (USB)

Hi,

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

Hi WayneWWW,

please kindly find the documents attached below
documentation(Datasheet) (889.9 KB) - 1.8.2 Universal Serial Bus (USB)
documentation(Product Design Guide) (2.3 MB) - Chapter 6. USB and PCIe

Best regards

Hi,

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

I don’t think there is such limitation.

Hi,

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

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