This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Am335x USB OTG Host Mode issue

Hi,

We are using Am335x based board with two MUSB_OTG ports and the MUSB configures it in device mode  (In board_am335.c)  and when it slect MUSB_HOST it configures it to HOST only role,My question is

-How to switch to HOST mode when MUS_OTG is selected in board file?.

-When MUSB_HOST is selected in board file the USB0 is configured to HOST mode and i am not able to insert gadget driver(ex. g_ncm.ko) to the kernel,it give "NO SUCH DEVICE" error, only when the USB0 or USB1  port is in device mode i can insert the gadget driver,but for our use case we need gadget driver to be inserted in the kernel(For dynamic role switching form host to device) before doing  dynamic role switch ,so that after role switching the host can enumerate the device .

  • In OTG mode the Host/Device behaviour is controlled by the USBx_ID pin. For OTG this must be directly connected to the USB OTG connector. If the USB device that's plugged in pulls this signal to GND (<10Ohm resistance to GND), then the OTG controller will switch to Host mode. If this signal is floating (pulled high internally) when the USB device is plugged in, then the OTG controller will switch to Device mode. Please note that the USBx_ID pin is an analog input - it can be tied to GND but in no case should any voltage be applied to it. See also section 16.3.7 in the AM335X TRM Rev. J.

  • Hi Biser,Driver (musb_core) configures the OTG ports  during boot time and it remains in this mode only ,dynamic USB role switching based on ID pin is not working ,i tried by grounding  ID pin (using  A-type OTG connector) and by floating ID pin(using B-type OTG connector.)  in both the  cases it remains in HOST mode.
    -The ti816x driver says that usb-id is conrolled by software for ti816x.

  • Hi Biser,

    Thank you , i checked the link  but there is no information on Dynamic role switching of OTG ports(base don ID pin).

  • What the info Biser provided is correct, and all needed for dynamic role switching.

    - First the port has to be configured to MUSB_OTG mode in board_am335xevm.c, which is the default for MUSB0 port in the TI Linux SDK kernel.

    - In runtime the port switches between host and device mode based on the status of the USBx_ID pin, which is connected to the ID pin of the otg receptacle.

    If this does not work for you, please let us know what exact kernel version do you use, then we will help to debug it. We will have to check the MUSB POWER and DEVCTL registers first.

  • Hi ,

    We are using Linux version 3.2.0-gfe511cc Kernel and Role switching based on ID pin is not working ,it remains in the same mode to which it is connected during boot time.

  • Hi ,

    We are using Linux version 3.2.0-gfe511cc Kernel and Role switching based on ID pin is not working ,it remains in the same mode to which it is configured  during boot time.

  • I am not able to find id gte511cc in TI SDK 3.2 kernel. Is the kernel downloaded from ti.com? If so what is its SDK or PSP version?

    Have you checked if the USB cable grounded the ID pin when plugged in the usb device?

    If you use TI SDK kernel, please provide the log of command 'cat /proc/driver/musb_hdrc.0' before and after plug in the usb cable when trying to switch the role.

  • Hi ,

    Yes it is an ETAB based version.

    The following commands are used to get the kernel source:

    git clone git://gitorious.org/rowboat/kernel.git
    $ cd kernel
    $ git checkout ­b temp­branch origin/rowboat­am335x­kernel­3.2
    $ git checkout fe511ccb76fcce221543b76609796174630334a8

    and the SDK version is:

    ti-sdk-am335x-evm-05.05.01.00

    We have verified ID pin grounding by hardware .

    I am attaching the sample out put of  "cat /proc/driver/musb_hdrc.0"

    ID pin floating o/p is:(by connecting B-type USB to OTG connector)

    Status: MHDRC, Mode=Peripheral (Power=e0, DevCtl=99)
    OTG state: b_peripheral; inactive
    Options: pio, otg (peripheral+host), [eps=16]
    Peripheral address: 00
    Root port status: 00000100
    Gadget driver: g_mass_storage

    ep0 (hw0): 1buf, csr 0000 maxp 0000
            (queue empty)

     

    ID pin grounded o/p is:(by connecting A-type USB to OTG connector)

    Status: MHDRC, Mode=Peripheral (Power=e0, DevCtl=99)
    OTG state: b_peripheral; inactive
    Options: pio, otg (peripheral+host), [eps=16]
    Peripheral address: 00
    Root port status: 00000100
    Gadget driver: g_mass_storage

    ep0 (hw0): 1buf, csr 0000 maxp 0000
            (queue empty)

     

     

  • Hariprasad kb said:

    ID pin floating o/p is:(by connecting B-type USB to OTG connector)

    ...

    ID pin grounded o/p is:(by connecting A-type USB to OTG connector)

    - Please also provide the output between these two steps (after connected b-type, and before connected a-type).

    - Please provide the usb portion of the schematics, I have to check how USBx_VBUS & USBx_DRVVUS are connected.

  • Hi, 

    Output after b-type is connected and before a-type connected is

    Status: MHDRC, Mode=Peripheral (Power=e0, DevCtl=99)
    OTG state: b_peripheral; inactive
    Options: pio, otg (peripheral+host), [eps=16]
    Peripheral address: 00
    Root port status: 00000100
    Gadget driver: g_mass_storage

    ep0 (hw0): 1buf, csr 0000 maxp 0000
            (queue empty)

  • Hariprasad kb said:
    Output after b-type is connected and before a-type connected is

    My apologies, I meant 'after b-type disconnected and before a-type connected' - nothing is connected, after removed b-type cable.

    Can you please provide the schematics? I suspect the design about USBx_VBUS has some issues.