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.

USB OTG

Other Parts Discussed in Thread: DA8XX, OMAP-L137, AM1808

don't know what's wrong with my customer board, USB slave works fine but HOST no respond to the insert of the device.

I tested the kernel before on logicPD's evb, any clue how to debug the board?

 

USB_ID is tie to GND, and I got no clue why it goes wrong.

 

why compile the kernel with host only, it works fine.

 

anybody could confirm:

the driver will test USB_VBUS by setting USB0_DRVVBUS before enabling Host like BSL usb test sample does.


if so, I could solve the problem.

 

 

trace result: usb irq :device connected and then nothing happened....

 musb_stage0_irq in musb_core.c was not called...

 

please advise.

best regards,

Power pan

 

 

 

  • problem solved

    musb_core.c line 1556: modified to

     

    if ( (is_otg_enabled(musb) || is_peripheral_enabled(musb)) && ((devctl&4)==0) )

    from: 

    if (is_otg_enabled(musb) || is_peripheral_enabled(musb))

     

     

    might be a bug... for host only of course no gadget driver, I found 2 bugs in this c.

    but strange why logicPD could work.. might be I test device insmod first before test host driver, that will work.

     

    Power

  • I don't think that's a bug. The kernel needs to be configured for that "if" statement to work as you would expect.

    See kernel config under
     "Driver Mode"
    can be one of
     "USB Peripheral (gadget stack)" -> CONFIG_USB_MUSB_PERIPHERAL
     "USB Host" -> CONFIG_USB_MUSB_HOST -> CONFIG_USB_MUSB_HOST
      "Both host and peripheral:  USB OTG (On The Go) Device" -> CONFIG_USB_MUSB_OTG

    I have never beeen able to get OTG to work just configuring the kernel. I believe OTG mode requires extra code, scripts, configuration to load up the appropirate drivers as the role changes. I've always used HOST or PERIPHERAL. With PERIPHERAL, you have to add the Gadget as a built-in or loadable module.

     

  • Hi, Mr Wong,

    thanks for your reply.

    I am sure there are bugs in musb_core.c, and some of the bugs were fixed in the 2.6.38 kernel. and also da8xx.c in the same dir needs to rework for bug clean.

    I tested on logicPD's evm before and it works(might be I tested gadget before testing the host), but the board was down because wrong power inserted so I could verify it again.

     

    here is what I did before, if you could, then test it if it works. below modification is under latest SDK by TI

    enable:

    device drivers->usb support->usb gadget support

    then back to : Driver Mode ( now you could choose OTG)

    advance into USB Gadget Support

    modify USB Peripheral Controller to Inventra HDRC USB Peripheral (TI, ADI, ...) 

    choose Ethernet Gadget as module ( for test)

    mark musb_core.c line 1944-1948 ( you could compare with the same part in the latest kernel, these lines are gone)

    make and make modules

     

    when I test, I remember I insmod g_ether.ko first before insert a USB disk into the socket (need an adapter), both works, I am pretty sure.

     

    I found in BSL, it will test the VUSB by controlling the DRVVUSB pin but my board does not have this kind of schematic, that's why I get stuck.

    a new EVB will be back the next Monday, I'll try to test then.

     

    BTW: how u make the modules to change the role of USB, if I could run scripts, that's fine, just please tell me how.

    Best regards,

    Power Pan

  • There are so many TI kernels, I can't tell which source to look at. I think those lines you mentioned are still there. Just moved around.

    http://www.kernel.org/
    2.6.39-rc7
    drivers/usb/musb/musb_core
    ...
    1939 static int __init
    1940 musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
    ...
    2064         /* For the host-only role, we can activate right away.
    2065          * (We expect the ID pin to be forcibly grounded!!)
    2066          * Otherwise, wait till the gadget driver hooks up.
    2067          */
    2068         if (!is_otg_enabled(musb) && is_host_enabled(musb)) {
    ...
    2085         } else /* peripheral is enabled */ {

    You are right that there are a lot of changes. I am hoping the next DVSDK will have the changes from the mainline.

    I no longer have any HW to test anything. Got shipped out. I do remember that on my OMAP-L137 EVM, the DVSDK did not even have an OTG kernel option. It was HOST or PERIPHERAL but not both. In fact I did not see any option to support the other USB Host only port on the L137.

    I have never setup a working OTG. Sorry I can't help you on that. Google gave a few hits:

    http://processors.wiki.ti.com/index.php/USB_OTG_on_DaVinci
    http://processors.wiki.ti.com/index.php/DaVinci_GIT_Linux_Kernel <- OTG not supported?
    https://www.ridgerun.com/developer/wiki/index.php/How_to_configure_DM365_for_USB_host,_device_and_OTG_support

  • hi , Mr Wong, 

     

    thanks for you kind reply.

    guess you are in HK/TW by the surname. could you please tell me how to insmod HOST or DEVICE ? or how you use it as HOST/DEVICE without reboot the kernel?

     

    Best regards,

    Power Pan

     

  • I think you know all that I know.

    USB Host
    I've never done much config with USB Host. Usually the EVM is configured as Host from the factory. All my work is with USB Device. I usually just do a simple test:
    1) Program kernel with USB Host support
    2) Plug a USB Flash Drive. It should automatically recognize the drive and might auto-mount it. I believe the pre-built FS has hotplug scripts for this functionality.

    USB Device
    1) Program kernel with USB Device support and Gadgets as modules.
    2) Load the modules with insmod or modprobe. Note the modprobe requires the module dependencies on the target FS.
       insmod g_some_module.ko
       Note that each Gadget has setup tasks and parameters to get them to work properly.
    3) Plug in the device to a PC. PC should enumerate or recogize the Gadget.
    4) Unload the module.
       rmmod g_some_module.

    My trials with USB Gadgets are in the thread below. Note I was using the 2.6.18 kernel at that time. The Gadgets in the newer kernels will auto-create the "/dev" files. No need to mknod. The Gadget Serial uses a different device file name. I think is was "/dev/ttyGS0" or something like that.

    http://e2e.ti.com/support/embedded/f/354/t/97292.aspx

     

  • Hi, Mr. Wong,

     

    thanks for replying.

    I wanna make the USB either Host or Device without loading different kernels, my changes to the kernel could load Host or Device by rebooting, I'm finding a way that no need to restart the kernel and could make it. the kernel I'm using in SDK is 2.6.33.

    I did not test if we could insmod the host driver, device is piece of cake cause we use it often.

     

    Best Regards,

    Power Pan

  • The example at

    http://processors.wiki.ti.com/index.php/USB_OTG_on_DaVinci

    does show a dynamic switch of roles. The example is symmetrical as both sides can be File Storage Gadgets. I assume that cable determines who is initially Host. Manual override of the cable appears to be through " /proc/driver/otg".

    All assumes that the patches on the above webpage have already been or can be applied to your kernel.

     

  • Hi, Norman, 

    I'm using AM1808 with kernel 2.6.33, seems those patches is too old for my board.

     

    Best regards,

    Power Pan

  • Norman, Pan,

     

       Good discussion. I'm moving this to the E2E Linux forum as this has become a discussion about the kernel configuration.