How to test the OTG port on i.MX50 EVK using Linux BSP? -blog archive

Discussion created by PeterChan Employee on Mar 6, 2012

LTIB configuration

Just use the default configuration for MX50 RD3 is good enough. Below is the default i.MX50 USB support  settings in LTIB.


Device Drivers

    [*] USB support

        <*> Support for Host-side USB

            [*] USB device class-devices (DEPRECATED)

            [*] USB runtime power management (suspend/resume and wakeup)

        <*> EHCI HCD (USB2.0) support

            [*] Support for Freescale controller

                [*] Support for DR host port on Freescale controller

        [*] Root Hub Transaction translators

        <*> USB modem (CDC ACM) support

        <*> USB Mass Storage support

        <*> USB Gadget Support

            (2) Maximum VBUS Power usage (2-500mA)

            USB Peripheral Controller -> (Freescale USB Device Controller)           

            -*- OTG support

            <M> USB gadget Drivers

                <M> Ethernet Gadget (with CDC Ethernet support)

                    [*] RNDIS support

                <M> File-backed Storage Gadget

                <M> Serial Gadget (with CDC ACM and CDC OBEX support)

        <*> USB OTG pin detect support


EVK board setup

The board I am using here is the MCIMX50EVK REV D. Its schematic can be downloaded from here.

In my testing, the board is powered by an external AC adaptor to the WALL5V_IN jack. J4 is set to REG_4V2 and J5 is set to 5V_MAIN.

If battery is used, both J4 and J5 should be set to BATTERY positions. AC adaptor at WALL5V_IN is still required to the board for 5V_MAIN power. It is because on our i.MX508 RD3 EVK, both OTG 5V power rail (USB_5V_OTG) and host 5V power rail (USB_5V_HOST) is powered from 5V_MAIN. If the board is powered from Li-ion battery and no 5V_MAIN, there will be no 5V supply to the the OTG port and no USB device will be detected.


OTG port as USB device

1. Connect USB cable from PC to the OTG port

2. execute this command to load the g_file_storage module and specify the backing storage. Here the storage is /dev/mmcblk0p1.

insmod g_file_storage.ko file=/dev/mmcblk0p1

3. You should see the USB mass storage device to PC.

4. Disconnect USB cable

5. run this command to unload the g_file_storage module

rmmod g_file_storage


OTG port as USB host

1. Connect a mouse to OTG port using an USB cable with ID pin shorted to GND at the i.MX50 end

2. i.MX50 should detect the USB mouse device automatically

2. cat /dev/input/mouseX

3. drag the mouse

4. Press ^C to quit