跳转至

TYPE-C

模式切换

K5C 硬件版本 ≥ V1.3的TYPE-C接口支持切换为host模式,通过host模式可外接USB设备。

cat /sys/devices/platform/soc/usbc0/otg_role        查看当前模式
cat /sys/devices/platform/soc/usbc0/usb_device      切换为device模式
cat /sys/devices/platform/soc/usbc0/usb_host        切换为host模式

自动切换

K5C 硬件版本 ≥ V1.3的TYPE-C 支持OTG功能(host/device自动切换),默认镜像不支持自动切换,修改方法如下:

diff --git a/longan/device/config/chips/a133/configs/c3/kickpi-k5c.dts b/longan/device/config/chips/a133/configs/c3/kickpi-k5c.dts
index 962d7af6c2..f6c9e785f5 100755
--- a/longan/device/config/chips/a133/configs/c3/kickpi-k5c.dts
+++ b/longan/device/config/chips/a133/configs/c3/kickpi-k5c.dts
@@ -892,7 +892,7 @@
  */
                usbc0:usbc0@0 {
                        device_type = "usbc0";
-                       usb_port_type = <0x0>;
+                       usb_port_type = <0x2>;
                        usb_detect_type = <0x1>;
                        usb_id_gpio = <&r_pio PL 9 0 0 0xffffffff 0xffffffff>;
                        usb_det_vbus_gpio   = "axp_ctrl";