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.

How to change AM1808 USB OTG role?

Other Parts Discussed in Thread: AM1808, AM3517

When I configure AM1808's USB OTG port as host only, it can detect devices attached. But when I configure it as both host and peripheral port (OTG mode), after boot up, it defaults as USB peripheral. When a A-plug is inserted (ID pin is grounded), the kernel driver change the state to OTG_STATE_A_IDLE, then nothing happen. It does not initiate a session. I am using the kernel source linux-2.6.37-psp03.21.00.04.sdk.tar.gz.

I want to ask how to change the OTG role from peripheral to host and vice versa.

Regards,

Colman

  • when in host and device mode (OTG mode) then use "echo F > /proc/driver/musb_hdrc.0" command to switch on the Vbus so that devices gets detected.

    Ajay

  • Did you try the TI Wiki? Adding to Ajay's suggestion, here's some links:

    The SW instructions in these links should apply to any newer Linux USB driver.
    http://processors.wiki.ti.com/index.php/UsbgeneralpageLinux-v3p1
    http://processors.wiki.ti.com/index.php/Usbgeneralpage
    http://processors.wiki.ti.com/index.php/Sitara_SDK_5.03.02_Release_Notes
    http://processors.wiki.ti.com/index.php/OMAP3_USB_Detection

    This link has HW instructions specific to the AM3517 EVM but the SW instructions should be generic.
    http://processors.wiki.ti.com/index.php/UserGuideUsbDriver_PSP_04_02_00_07

    This link refers to a really old version of Linux and USB Driver. It does give a good overview of the switch between Host and Device. Ignore the specific commands as the newer versions have changed significantly.
    http://processors.wiki.ti.com/index.php/USB_OTG_on_DaVinci

    All the above requires manual switch and device function loading. I haven't seen much to setup an automatic switch. Vaguely remember it might have to with hotplug scripts.

  • I finally found the way to activate the OTG as a host. It is required to load one of a USB Gadget. When the Gadget load, it will create a HCD device, then it can act as a HOST. But when remove the Type-A plug, it cannot switch back to peripheral mode. How can I read back the ID pin status so that I can do a switch manually?

    Regards,

    Colman

     

  • running "cat /proc/driver/musb_hdrc" will show the value of DEVCTL register. D7 bit of this reg is ID pin status. id D7=0 then ID is grounded if D7=1 ID pin is floating.

    Switching to peripheral is not happening could be due to vbus still on. Vbus can be seen at D[3:4] of DEVCTL register.

    Ajay

  • Thank you for the info.

    I can now detect a change between host and peripheral mode now. For the peripheral mode, I have to detect type of connection, it can be a dc charger or a PC host. For a PC host, I have to umount the internal storage and export to the PC. Is there any possible method to implement it?

    Regards,

    Colman

     

  • For a DC charger , peripheral will not be enumerated and so there will not be any RESET or SET _CONFIG control command whereas PC host will enumerate the device and will  send  RESET signalling and SET_CONFIG. You can refer drivers/usb/musb/musb_gadget.c and musb_gadget_ep0.c for this.

    Ajay