You are on page 1of 2

OTG HOST 切换说明

本文档主要简单介绍 开发板 OTG 模式和 HOST 模式的互相切换。

版本说明

日期 修订版本 修订内容 修改人 核定人 当前版本

2020-12-16 V1.0 初始版本 lixin lixin √

切换说明

pro_rv1126 和 pro_rv1109 的 OTG USB接口可以在 OTG 模式和 HOST 模式互相切换,如图所示。

当 GPIO0_A2 被拉高的时候,切换至 HOST 模式,这时候 OTG USB 口可以外接 USB 设备,当


GPIO0_A2 被拉低的时候,切换至 OTG 模式,此时开发板可以通过 OTG USB 口与 PC 或者其他设备进行
通信。

模式切换

echo 1 > /proc/rp_gpio/otg_host         # 切换至 HOST 模式


echo 0 > /proc/rp_gpio/otg_host # 切换至 OTG 模式

说明:当 OTG USB 口接上 USB 数据线的时候,不能实现 OTG 模式与 HOST 模式切换,主板上电默
认为 OTG 模式。

开机默认模式配置在 sdk/kernle/arch/arm/boot/dts/pro_rv1126.dts (或 pro_rv1109.dts),根据当前


的版型进行选择。
rp_gpio {
status = "okay";
compatible = "rp_gpio";
pinctrl-names = "default";
pinctrl-0 = <&usb_power>;
   
otg_host{
gpio_num = <&gpio0 RK_PA2 GPIO_ACTIVE_LOW>; //0:otg,1:host
gpio_function = <0>;  
};
};

You might also like