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.

Compiler/AM3352: Problems of OTG in win10

Part Number: AM3352

Tool/software: TI C/C++ Compiler

Hi

Our testing department has detected the following problems:

The CPU of our board is am3352. There is an OTG interface on the board. The driver of OTG is g_ mass_ storage.

When OTG is used as a slave, it is connected to a PC, and the system of PC is win10.

When we safely remove the OTG device, we connect it to the PC again. The PC cannot recognize the OTG slave device.

The version of the SDK we use is: 05.03.00.07

  • FYI, our subject owner is out for the week. They will reply next week.

    Regards,

    Nick

  • If you could review this thread:

    https://e2e.ti.com/support/processors/f/791/t/826346?AM3354-USB-gadget-not-recognized-by-Host

    And provide the script outputs and register dumps of your system here, it will likely speed the reply when the owner does return.

    Thank you.

  • Hi RonB:

    Thank you for your reply

    # ./chkusb.sh
    chkusb.sh Version 0.2.4
    Linux am335xepcr3220a1 4.14.79-g6ed2f2d394-r3220a1aim20liv20001 #1 PREEMPT Wed Nov 27 10:01:40 UTC 2019 armv7l GNU/Linux
    USB is initialized
    ./chkusb.sh: line 322: warning: command substitution: ignored null byte in input
    ./chkusb.sh: line 323: warning: command substitution: ignored null byte in input
    usb@47401000: otg, okay
    ./chkusb.sh: line 322: warning: command substitution: ignored null byte in input
    ./chkusb.sh: line 323: warning: command substitution: ignored null byte in input
    usb@47401800: host, okay

    Gadget Kernel Config: g_zero is enabled
    Gadget Kernel Config: g_audio is enabled
    Gadget Kernel Config: g_ether is enabled
    Gadget Kernel Config: g_ncm is enabled
    Gadget Kernel Config: g_mass_storage is enabled
    Gadget Kernel Config: g_serial is enabled
    Gadget Kernel Config: g_printer is enabled
    gadget driver loaded: DRIVER=g_mass_storage

    The list of USB gadget drivers installed:
    /lib/modules/4.14.79-g6ed2f2d394-r3220a1aim20liv20001/kernel/drivers/usb/gadget/:
    function/
    legacy/
    libcomposite.ko
    udc/

    /lib/modules/4.14.79-g6ed2f2d394-r3220a1aim20liv20001/kernel/drivers/usb/gadget/function:
    u_audio.ko
    u_ether.ko
    u_serial.ko
    usb_f_acm.ko
    usb_f_ecm.ko
    usb_f_ecm_subset.ko
    usb_f_eem.ko
    usb_f_fs.ko
    usb_f_hid.ko
    usb_f_mass_storage.ko
    usb_f_midi.ko
    usb_f_ncm.ko
    usb_f_obex.ko
    usb_f_printer.ko
    usb_f_rndis.ko
    usb_f_serial.ko
    usb_f_ss_lb.ko
    usb_f_uac1.ko
    usb_f_uac2.ko
    usb_f_uvc.ko

    /lib/modules/4.14.79-g6ed2f2d394-r3220a1aim20liv20001/kernel/drivers/usb/gadget/legacy:
    g_acm_ms.ko
    g_audio.ko
    g_cdc.ko
    g_dbgp.ko
    g_ether.ko
    g_ffs.ko
    g_hid.ko
    g_mass_storage.ko
    g_midi.ko
    g_multi.ko
    g_ncm.ko
    g_printer.ko
    g_serial.ko
    g_webcam.ko
    g_zero.ko
    gadgetfs.ko

    /lib/modules/4.14.79-g6ed2f2d394-r3220a1aim20liv20001/kernel/drivers/usb/gadget/udc:
    udc-core.ko

    # grep -i 'power\|devctl' /sys/kernel/debug/musb-hdrc.0/regdump
    Power : e0
    DevCtl : 80

    PS: It is normal to test on Win7 system

  • Hi
    Is there any progress now
  • Hi Zhengguang,

    Sorry for my late response.

    Can you please share the command line which you used to load g_mass_storage driver? I'd like to know the parameters passed to the driver.

    When you first plugged the AM3352 OTG to the PC, how did you check if the OTG device is recognized? Is it shown up in File Explorer?

    When the OTG device is plugged to the PC again and you think it is not recongnized, have you checked on Windows 10 to see if the device "Linux File-Stor Gadget USB Device" is still under "Disk drives" in Device Manager?

  • Hi Bin:

    Thank you for your reply.

    1  modprobe g_mass_storage file=/dev/mmcblk0p1 cdrom=0 stall=0 removable=1 nofua=1

    2  Yes, we just check whether it is show up in File Explorer

    3  When it is not be recongnized,  the device "Linux File-Stor Gadget USB Device" is still under "Disk drives" in Device Manager. If our board reboots, it will return to normal.

  • Hi Zhengguang,

    The reason why the device doesn't show up on Windows from the 2nd time plugged in is that after you "Eject" the device in Windows File Explorer, '/dev/mmcblk0p1' is removed from the g_mass_storage driver on AM3352, so you would have to load it again to make it show up on Windows.

    /* at the first time plug it in Windows */
    root@am335x-evm:~# cat /sys/devices/platform/ocp/47400000.usb/47401400.usb/musb-hdrc.0/gadget/lun0/file
    /dev/mmcblk0p1
    
    /* after 'Eject' on Windows */
    root@am335x-evm:~# cat /sys/devices/platform/ocp/47400000.usb/47401400.usb/musb-hdrc.0/gadget/lun0/file
    root@am335x-evm:~#
    
    /* reload the backend storage */
    root@am335x-evm:~# echo '/dev/mmcblk0p1' > /sys/devices/platform/ocp/47400000.usb/47401400.usb/musb-hdrc.0/gadget/lun0/file
    
    /* now the device should show up in Windows File Explorer again */
    

  • Hi Bin:

    Why do not need to reload '/dev/mmcblk0p1' when used on Win7.

  • Hi Zhengguang,

    Unfortunately I cannot explain why the operation of the 'Eject' action is different between Win10 and Win7, it is up to Microsoft.