How use USB as both gadget mode and host mode usb USB_OTG

cancel
Showing results for 
Search instead for 
Did you mean: 

How use USB as both gadget mode and host mode usb USB_OTG

No ratings

How use USB as both gadget mode and host mode usb USB_OTG

Q:How use USB as both gadget mode and host mode usb USB_OTG?

A:

Hardware:

imx6 sabresd board

usb otg diagram, as follow

pastedImage_1.png

Software:

 

You can use USB OTG port for both host mode and device gadget mode. There are 2 signals you should care:

- USB_OTG_ID

- USB_OTG_MODE (control power for usb vbus in host mode, this is EIM_D22 pin)

 

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 = <&reg_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 above config, one can use OTG port for mouse, usb stick in host mode, and gadget mode for ADB...

 

https://community.nxp.com/message/943460 

Labels (1)
Version history
Revision #:
1 of 1
Last update:
‎09-28-2017 09:03 PM
Updated by: