查看: 4376|回复: 0

[原创] How use USB as both gadget mode and host mode usb USB_OTG?

[复制链接]

该用户从未签到

20

主题

809

帖子

1

超级版主

Rank: 8Rank: 8

积分
1566
最后登录
2023-1-17
发表于 2017-9-28 20:56:58 | 显示全部楼层 |阅读模式
硬件:usb otg diagram, as follow
pastedImage_1.png

软件

Software: You can use USB OTG port for both host mode and device gadget mode. Thereare 2 signals you should care:- USB_OTG_ID- USB_OTG_MODE (control power for usb vbus in host mode, this is EIM_D22pin) In device tree:reg_usb_otg_vbus: regulator@0 {
                       compatible = "regulator-fixed";
                       reg = <0>;
                       regulator-name = "usb_otg_vbus";
                       regulator-min-microvolt = <5000000>;
                       regulator-max-microvolt = <5000000>;
                       gpio = <&gpio3 22 0>;
                       enable-active-high;
               };
pinctrl_usbotg: usbotggrp {
                       fsl,pins = <
                               MX6QDL_PAD_GPIO_1__USB_OTG_ID          0x17059
                              MX6QDL_PAD_EIM_D22__GPIO3_IO22          0x80000000
                       >;
               };
&usbotg {
        vbus-supply =<®_usb_otg_vbus>;
        pinctrl-names = "default";
        pinctrl-0 =<&pinctrl_usbotg>;
       disable-over-current;       srp-disable;       hnp-disable;       adp-disable;
        dr_mode = "otg";      
        status = "okay";
};
With aboveconfig, one can use OTG port for mouse, usb stick in host mode, and gadget modefor ADB


回复

使用道具 举报

您需要登录后才可以回帖 注册/登录

本版积分规则

关闭

站长推荐上一条 /3 下一条

Archiver|手机版|小黑屋|恩智浦技术社区

GMT+8, 2025-7-20 08:51 , Processed in 0.079509 second(s), 20 queries , MemCache On.

Powered by Discuz! X3.4

Copyright © 2001-2024, Tencent Cloud.

快速回复 返回顶部 返回列表