USB C as an extra USB socket

Hi everyone.

As the title suggests can I use the USB C socket as an extra USB port in Android?

Thanks

Do you mean you want the USB-C work as Host mode like USB-A port, right?

The USB-C featured with USB 2.0 OTG, and can work as both Host & Slave mode, but to config the USB-C as host, you need to use the VIN to power the VIM1 device.

Hi, Thanks for the reply

At the moment I’m using VIN for power. If I just buy a USB-C to USB_A female adaptor this should be ok as a normal USB port?

Yes, can.

BTW, you can also use the USB interface on the 40-PIN GPIO header.

1 Like

Yes I’m already using those for other devices and now I need one more USB socket

Hello, Depending on the amount of current drawn by your USB connected devices, you may want to consider a powered USB hub.
Also my want to sum the current drawn to see if it approaches the limits of your power supply and/or the boards limits to supply USB devices’ power.

1 Like

Hi, Ok so I’ve plugged in the USB-C to USB-A adaptor but nothing happens. I presume the USB-C port is in slave mode?

Yes, USB-C defaults to slave mode, but also switches to host mode.

Configure USB-C as the host mode step:
First, modify the uboot file:bootloader/uboot/board/khadas/configs/kvim.h

diff --git a/board/khadas/configs/kvim.h b/board/khadas/configs/kvim.h
index 6f8cda8..6fdd158 100644
--- a/board/khadas/configs/kvim.h
+++ b/board/khadas/configs/kvim.h
@@ -118,7 +118,7 @@
         "frac_rate_policy=1\0" \
         "sdr2hdr=0\0" \
         "usb_burning=update 1000\0" \
-        "otg_device=1\0"\
+        "otg_device=0\0"\
         "fdt_high=0x20000000\0"\
         "lock=10001000\0"\
         "try_auto_burn=update 700 750;\0"\

Second, modify the device-tree file:

diff --git a/arch/arm/boot/dts/amlogic/kvim.dts b/arch/arm/boot/dts/amlogic/kvim.dts
index c8e8bc9..3581d50 100755
--- a/arch/arm/boot/dts/amlogic/kvim.dts
+++ b/arch/arm/boot/dts/amlogic/kvim.dts
@@ -651,11 +651,11 @@
                pl-periph-id = <0>; /** lm name */
                clock-src = "usb0"; /** clock src */
                port-id = <0>;  /** ref to mach/usb.h */
-               port-type = <2>;        /** 0: otg, 1: host, 2: slave */
+               port-type = <1>;        /** 0: otg, 1: host, 2: slave */
                port-speed = <0>; /** 0: default, high, 1: full */
                port-config = <0>; /** 0: default */
                port-dma = <0>; /** 0: default ... 6: disable*/
-               port-id-mode = <0>; /** 0: hardware, 1: sw_host, 2: sw_slave*/
+               port-id-mode = <1>; /** 0: hardware, 1: sw_host, 2: sw_slave*/
                usb-fifo = <728>;
                cpu-type = "gxl";
                controller-type = <1>; /** 0: normal, 1: host, 2: device*/

diff --git a/arch/arm64/boot/dts/amlogic/kvim.dts b/arch/arm64/boot/dts/amlogic/kvim.dts
index 774db6f..f5a5cfd 100755
--- a/arch/arm64/boot/dts/amlogic/kvim.dts
+++ b/arch/arm64/boot/dts/amlogic/kvim.dts
@@ -649,11 +649,11 @@
                pl-periph-id = <0>; /** lm name */
                clock-src = "usb0"; /** clock src */
                port-id = <0>;  /** ref to mach/usb.h */
-               port-type = <2>;        /** 0: otg, 1: host, 2: slave */
+               port-type = <1>;        /** 0: otg, 1: host, 2: slave */
                port-speed = <0>; /** 0: default, high, 1: full */
                port-config = <0>; /** 0: default */
                port-dma = <0>; /** 0: default ... 6: disable*/
-               port-id-mode = <0>; /** 0: hardware, 1: sw_host, 2: sw_slave*/
+               port-id-mode = <1>; /** 0: hardware, 1: sw_host, 2: sw_slave*/
                usb-fifo = <728>;
                cpu-type = "gxl";
                controller-type = <1>; /** 0: normal, 1: host, 2: device*/
1 Like

I read somewhere that one USB port is rated at 500mA and the other 900mA. The 2 on the GPIO pins I’m not sure but I think also 500mA?