USB - OTG

USB OTG (On-The-Go)

Definition(定义):

    * USB OTG 可让平板电脑或智能手机等设备充当主机,允许其他 USB 设备(如 USB 闪存驱动器、数码相机、鼠标或键盘)连接到它们。

    * 它允许设备在主机和外设之间切换角色。例如,智能手机可以作为主机设备从可移动媒体读取数据,但在连接到主机时,又可以作为 USB 大容量存储设备。

    * USB OTG enables devices like tablets or smartphones to act as hosts, allowing other USB devices (such as USB flash drives, digital cameras, mice, or keyboards) to be attached to them.

    * It allows devices to switch roles between being a host and a peripheral. For example, a smartphone can read from removable media as the host device but present itself as a USB Mass Storage Device when connected to a host computer.

Roles(角色):

    * USB OTG 为设备定义了两种角色:

        * OTG A 设备: 供电设备。

        * OTG B 设备: 用电设备。

    * 在默认链接配置中,A 设备充当 USB 主机,B 设备充当 USB 外围设备。主机和外设模式可在以后通过主机协商协议(HNP)进行交换。

    * USB OTG defines two roles for devices:

        * OTG A-device: The power supplier.

        * OTG B-device: The power consumer.

    * In the default link configuration, the A-device acts as a USB host with the B-device acting as a USB peripheral. The host and peripheral modes may be exchanged later by using Host Negotiation Protocol (HNP).

Initial Detect(初始化检测):

每个设备的初始角色由 ID 引脚的接线决定。

The initial role of each device is determined by the wiring of the ID pin.

micro 插头的 pin 脚定义:

1 pin 连接电源(VBUS);

2、3 pin 用来传送数据(D+、D-);

5 pin 接地(GND);

4 pin 检测 ID。ID pin——当 OTG 设备检测到 ID pin 接地时,OTG 设备应初始化为 A 设备(主机); 而检测到 ID 引脚浮空时,应初始化为 B 设备(外设)。

type-A 插头的 pin 脚定义:

2 条用来传送数据(D+、D-);

1 条是电源 线(VBUS);

1 条是接地线(GND);

type-A 接口,用于连接 host。

手机使用 OTG 线连接 U 盘时,OTG 线的 micro 插座,ID 引脚直接连接到 GND,ID pin 处于接地状态。 而 OTG 线另一端的 type-A 母座,是没有 ID pin 的。

手机端的 micro 母座,检测到接入的 micro 插头的 ID pin 为接地,所以手机作为主设备 A。

U 盘端 type-A 插座,ID pin 在设计之初就已经拉死,处于悬空状态,所以 U 盘作为从设备 B。

(固定为 device 的设备,一般会直接将 ID pin 悬空,不需要引出到 type-A 接口)

OTG转接线:

micro 数据线:

接口 ID pin 状态:

1.OTG 设备检测到 USB_ID 信号为低电平时,该设备应作为 Host(主机,也称 A 设备)。

2.OTG 设备检测到 USB_ID 信号为高电平时,该设备应作为 Slave(外设,也称 B 设备)。

3.实际的 USB 连接线缆中,不存在 USB_ID 线缆,而在接口部分就直接拉死,要不处于接地状态,要不就 是悬空状态。

4.对于非 OTG 设备,host 设备默认将 USB_ID pin 和地短接,Slave 设备则默认将 USB_ID pin 悬空。

type-A 母座的设备,一般只作为 host,例如 PC。

type-A 插头的设备,一般只作为 device,例如 mouse、keyboard、U 盘。

micro 母座的 OTG 设备,既可作为 host,也可作为 device,例如手机。

Use Cases(使用示例):

    * 连接外部设备: 您可以使用 USB OTG 将外置存储设备(如硬盘或闪存驱动器)连接到手机或平板电脑。

    * 键盘和鼠标: 使用 USB OTG 线缆将键盘或鼠标连接到智能手机或平板电脑。

    * 数码相机: 使用 USB OTG 直接将照片从相机传输到手机。

    * 游戏控制器: 将游戏控制器或其他输入设备连接到移动设备。

    * USB 闪存盘: 轻松访问存储在 USB 闪存驱动器中的文件。

    * Connecting External Devices: You can use USB OTG to connect external storage devices (like hard drives or flash drives) to your phone or tablet.

    * Keyboard and Mouse: Use a USB OTG cable to connect a keyboard or mouse to your smartphone or tablet.

    * Digital Cameras: Transfer photos directly from your camera to your phone using USB OTG.

    * Game Controllers: Connect game controllers or other input devices to your mobile device.

    * USB Flash Drives: Easily access files stored on a USB flash drive.

Compatibility(兼容性):

    * 并非所有设备都支持 USB OTG,但近年来它已变得越来越普遍。

    * 请查看设备规格,了解其是否支持 USB OTG。

    * Not all devices support USB OTG, but it has become more common over the years.

    * Check your device’s specifications to see if it supports USB OTG.

Host Negotiation Protocol (HNP) (主机协商协议):

    * HNP 允许两个 OTG 系统在 USB 连接期间交换主机/外设角色。

    * 当两个设备都是 OTG 双角色设备时,HNP 可使它们交换角色。

    * 通过使用 HNP,OTG 设备可以获得数据传输调度的控制权。因此,任何 OTG 设备都能通过 USB OTG 总线启动数据传输。

    * HNP allows two OTG systems to swap their host/peripheral roles during a USB connection.

    * When both devices are OTG dual-role devices, HNP enables them to exchange roles.

    * By using HNP, an OTG device can acquire control of data-transfer scheduling. Thus, any OTG device can initiate data transfer over the USB OTG bus.

总之,HNP 使 USB OTG 设备能够在主机和外设角色之间动态切换,增强了其多功能性和适应性!

In summary, HNP empowers USB OTG devices to dynamically switch between host and peripheral roles, enhancing their versatility and adaptability!

参考:

1,CSDN

USB OTG基本原理-CSDN博客

2,Bing Copilot

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

夜流冰

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值