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 ID pin for OTG

Hi,

I am trying USB OTG support to dm365.

Host was working when boot time pluged pendrive & at boot time not pluged pendrive after booting is not detected.
ID pin configured below,
USB ID=0 => Host
USB ID=1 => Device

root@edge-shelf:~# cat /proc/driver/musb_hdrc
Status: MHDRC, Mode=Peripheral (Power=e0, DevCtl=99)
OTG state: b_idle; inactive
Options: cppi-dma, host, debug=0 [eps=5]
Root port status: 00000000
DaVinci: ctrl=00 stat=0 phy=21f0
        rndis=00000 auto=0000 intsrc=00000000 intmsk=01f71e1f
CPPI: txcr=1 txsrc=0 txena=f; rxcr=1 rxsrc=0 rxena=f

echo "F" > /proc/driver/musb_hdrc is not working to changed host mode. its always set Peripheral mode.

BR
Tejas

  • Hi Tejas,

    I suggest you to pay attention on whether gadget driver is built as module. If it is true to start a host session plug in your device (e.g. a flash memory) to the board then insert it to complete USB initialization:

    # modprobe g_cdc_ms

    and then type:

    # echo "F" > /proc/driver/musb_hdrc

    to start the host session, the device will be registered and you will be able to use it. For example, for a flash memory mount it using

    # mkdir usb

    # mount /dev/sdXX usb/

    where XX should be replaced according to the specific case. Notice that if you're using MDEV to automount the devices the previous instructions are not required.

    NOTE: The procfs entry /proc/driver/musb_hdrc is used to control the driver behavior and to control its status. for the driver to create it you must enable the USB debugging messages:  

    Symbol: USB_MUSB_DEB [=y]                                                                                              
    Prompt: Enable debugging messages                                                                                       
    Defined at drivers/usb/musb/Kconfig:194                                                                        
    Depends on: USB_SUPPORT && USB_MUSB_HDRC

    Location:                                                                                                                
       ->Kernelconfiguration                                                                                                
         -> Device Drivers                                                                                                  
           -> USB support (USB_SUPPORT [=y])                                           
             -> Inventra Highspeed Dual Role Controller (TI, ADI, ...) (USB_MUSB_HDRC [=y])

    BR

    Tsvetolin Shulev

  • Hi Tsvetolin,

    insmod g_mass_storage.ko file=/dev/mmcblk0p1 stall=0 removable=1

    USB cable connected pc to board. It is working fine.But after connect pen-drive it is not detected

    Using echo "F" > /proc/driver/musb_hdrc

    cat /proc/driver/musb_hdrc
    Status: MHDRC, Mode=Peripheral (Power=f0, DevCtl=99)
    OTG state: b_peripheral; active
    Options: cppi-dma, otg (peripheral+host), debug=0 [eps=5]
    Peripheral address: 01
    Root port status: 00000000
    DaVinci: ctrl=00 stat=0 phy=21f0
            rndis=00000 auto=0000 intsrc=00080000 intmsk=01f71e1f
    CPPI: txcr=1 txsrc=0 txena=f; rxcr=1 rxsrc=0 rxena=f
    Gadget driver: g_mass_storage

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

    ep1in (hw1): 1buf dma, csr 2400 maxp 0200
    TX DMA0: 00000000 834cb800, 834cb800 82e0000d; 00020000 0000000d 0791d7a8 .. 834cb800
            (queue empty)

    ep1out (hw1): 1buf dma, csr 2000 maxp 0200
    RX DMA0: 3 left, 00000000 8345f8c0, 8345f8a0 8345f8a0; 82e0001f 001f01e1 0000001f .. 8345f8a0
            req c2e12480, !short, 0/512

    BR

    Tejas