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.

Unable to access serial driver(gadget serial driver) -- AM335x as USB Device.



Hi,

we already posted for the loading of usb serial drvier - it is done but we are not able to access the drvier.

from the menuconfig - we selected this option load the serial driver 

1.

usb support -> usb gadget support in that below option is selected.  if not we have to load using modprobe. 

USB Gadget Drivers (Serial Gadget (with CDC ACM and CDC OBEX support)).

2. How to access the serial driver in the device side (AM335x as devcie)..??   like send data and receive data. ??

3. we need to change the vid and pid to a vender specific.

please help us in this

regards,

Viswanath K

  • in the host PC -- dmesg log:

    [16241.424356] cp210x 4-1:1.0: device disconnected
    [16244.028126] usb 4-1: new full-speed USB device number 5 using uhci_hcd
    [16244.148107] usb 4-1: device descriptor read/64, error -71
    [16244.372108] usb 4-1: device descriptor read/64, error -71
    [16244.588112] usb 4-1: new full-speed USB device number 6 using uhci_hcd
    [16244.708114] usb 4-1: device descriptor read/64, error -71
    [16244.932105] usb 4-1: device descriptor read/64, error -71
    [16245.148113] usb 4-1: new full-speed USB device number 7 using uhci_hcd
    [16245.556097] usb 4-1: device not accepting address 7, error -71
    [16245.668123] usb 4-1: new full-speed USB device number 8 using uhci_hcd
    [16246.076101] usb 4-1: device not accepting address 8, error -71
    [16246.076141] hub 4-0:1.0: unable to enumerate USB device on port 1
    [16386.828109] usb 4-1: new full-speed USB device number 9 using uhci_hcd
    [16386.948107] usb 4-1: device descriptor read/64, error -71
    [16387.172120] usb 4-1: device descriptor read/64, error -71
    [16387.388115] usb 4-1: new full-speed USB device number 10 using uhci_hcd
    [16387.508104] usb 4-1: device descriptor read/64, error -71
    [16387.732112] usb 4-1: device descriptor read/64, error -71
    [16387.948129] usb 4-1: new full-speed USB device number 11 using uhci_hcd
    [16388.356094] usb 4-1: device not accepting address 11, error -71
    vk29835@vk29835-HP-Compaq-6000-Pro-MT-PC:~$

    regards,
    Viswanath K.
  • Hi ,
    Can you please help us -- we struct --some where -- but we are not able to find -- where we got block and how to come out this issue.
    below the details, we were trying to debug the issue --

    As per this link:
    processors.wiki.ti.com/.../USB_Debug_Techniques

    we are getting the USB devices
    root@am335x-evm:~# ls /sys/bus/usb/devices/
    1-0:1.0 2-0:1.0 usb1 usb2

    root@am335x-evm:~# lsusb -v

    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Device Descriptor:
    bLength 18
    bDescriptorType 1
    bcdUSB 2.00
    bDeviceClass 9 Hub
    bDeviceSubClass 0 Unused
    bDeviceProtocol 1 Single TT
    bMaxPacketSize0 64
    idVendor 0x1d6b Linux Foundation
    idProduct 0x0002 2.0 root hub
    bcdDevice 3.14
    iManufacturer 3 Linux 3.14.26-g2489c02-dirty musb-hcd
    iProduct 2 MUSB HDRC host driver
    iSerial 1 musb-hdrc.0.auto
    bNumConfigurations 1
    Configuration Descriptor:
    bLength 9
    bDescriptorType 2
    wTotalLength 25
    bNumInterfaces 1
    bConfigurationValue 1
    iConfiguration 0
    bmAttributes 0xe0
    Self Powered
    Remote Wakeup
    MaxPower 0mA
    Interface Descriptor:
    bLength 9
    bDescriptorType 4
    bInterfaceNumber 0
    bAlternateSetting 0
    bNumEndpoints 1
    bInterfaceClass 9 Hub
    bInterfaceSubClass 0 Unused
    bInterfaceProtocol 0 Full speed (or root) hub
    iInterface 0
    Endpoint Descriptor:
    bLength 7
    bDescriptorType 5
    bEndpointAddress 0x81 EP 1 IN
    bmAttributes 3
    Transfer Type Interrupt
    Synch Type None
    Usage Type Data
    wMaxPacketSize 0x0004 1x 4 bytes
    bInterval 12
    Hub Descriptor:
    bLength 9
    bDescriptorType 41
    nNbrPorts 1
    wHubCharacteristic 0x0011
    Per-port power switching
    No overcurrent protection
    TT think time 8 FS bits
    bPwrOn2PwrGood 5 * 2 milli seconds
    bHubContrCurrent 0 milli Ampere
    DeviceRemovable 0x02
    PortPwrCtrlMask 0xff
    Hub Port Status:
    Port 1: 0000.0100 power
    Device Status: 0x0001
    Self Powered

    Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    [ 416.225562] hub 2-0:1.0: over-current condition on port 1
    Device Descriptor:
    bLength 18
    bDescriptorType 1
    bcdUSB 2.00
    bDeviceClass 9 Hub
    bDeviceSubClass 0 Unused
    bDeviceProtocol 1 Single TT
    bMaxPacketSize0 64
    idVendor 0x1d6b Linux Foundation
    idProduct 0x0002 2.0 root hub
    bcdDevice 3.14
    iManufacturer 3 Linux 3.14.26-g2489c02-dirty musb-hcd
    iProduct 2 MUSB HDRC host driver
    iSerial 1 musb-hdrc.1.auto
    bNumConfigurations 1
    Configuration Descriptor:
    bLength 9
    bDescriptorType 2
    wTotalLength 25
    bNumInterfaces 1
    bConfigurationValue 1
    iConfiguration 0
    bmAttributes 0xe0
    Self Powered
    Remote Wakeup
    MaxPower 0mA
    Interface Descriptor:
    bLength 9
    bDescriptorType 4
    bInterfaceNumber 0
    bAlternateSetting 0
    bNumEndpoints 1
    bInterfaceClass 9 Hub
    bInterfaceSubClass 0 Unused
    bInterfaceProtocol 0 Full speed (or root) hub
    iInterface 0
    Endpoint Descriptor:
    bLength 7
    bDescriptorType 5
    bEndpointAddress 0x81 EP 1 IN
    bmAttributes 3
    Transfer Type Interrupt
    Synch Type None
    Usage Type Data
    wMaxPacketSize 0x0004 1x 4 bytes
    bInterval 12
    Hub Descriptor:
    bLength 9
    bDescriptorType 41
    nNbrPorts 1
    wHubCharacteristic 0x0011
    Per-port power switching
    No overcurrent protection
    TT think time 8 FS bits
    bPwrOn2PwrGood 5 * 2 milli seconds
    bHubContrCurrent 0 milli Ampere
    DeviceRemovable 0x02
    PortPwrCtrlMask 0xff
    Hub Port Status:
    Port 1: 0000.050c highspeed power oc suspend
    Device Status: 0x0001
    Self Powered
    root@am335x-evm:~# [ 416.512042] musb-hdrc musb-hdrc.1.auto: VBUS_ERROR in a_wait_vrise (80, <SessEnd), retryc

    last error :
    [ 416.512042] musb-hdrc musb-hdrc.1.auto: VBUS_ERROR in a_wait_vrise (80, <SessEnd), retryc -- we are getting
    i define the vbus line in the dts file also.

    dts file config:
    usb0_pins_default: usb0_pins_default
    {
    pinctrl-single,pins = < 0x21c ( PIN_OUTPUT | MUX_MODE0 ) /* (F16) USB0_DRVVBUS.USB0_DRVVBUS */
    >;
    };
    &usb {
    pinctrl-0 = <&usb0_pins_default>;
    status = "okay";

    control@44e10620 {
    status = "okay";
    };

    usb-phy@47401300 {
    status = "okay";
    };

    usb@47401000 {
    status = "okay";
    };

    dma-controller@47402000 {
    status = "okay";
    };

    usb-phy@47401b00 {
    status = "okay";
    };
    usb@47401800 {
    status = "okay";
    dr_mode = "host";
    };
    };

    even though we are able to load the usb - gadget serial driver also.
    we tried to send some data from HOST(pc) to the device -- but we are unable to receive at the device side --ofcourse we are had a err-71 which protocol for the reading device descriptor read/64, error -71.

    if i am missing anything -- please messg me -- i will come out with those details.

    regards,
    Viswanath K
  • I got the point -- we need USB as device but it is configuring to root hub -- how to change this...??
  • Which AMSDK do you use?

    Which USB port do you use for device mode, USB0 or USB1?

    Please don't modify anything USB related in the dts file.

    Please run the diagnostic script attached below on your board and post the output.

    #!/bin/sh
    #
    # Util to check USB subsystem on for Linux kernel 3.12+
    #
    # TODO: usage
    
    VERSION=0.2.1
    
    
    ### functions ###
    
    has_supported_kernel() {
    	local _ver
    	local _t
    
    	_ver=`uname -r`
        DBG_PRINT "kernel $_ver"
        _t=${_ver%%.*}
        # 2.x.x, unsupported
        [ $_t -ge 3 ] || return 1
        # 4.x.x, supported
        [ $_t -lt 4 ] || return 0
    
        _ver=${_ver#*.}
        _t=${_ver%%.*}
        # < 3.12.x, unsupported
        [ $_t -ge 12 ] || return 1
        return 0
    }
    
    check_platform () {
    	local _hw
        [ "$PLATFORM" != "" ] || {
    	    _hw=`grep '^Hardware' /proc/cpuinfo`
    	    DBG_PRINT $_hw
    
            if [ "${_hw#*AM33XX}" != "$_hw" ]; then
                PLATFORM="am335x"
            elif [ "${_hw#*AM43}" != "$_hw" ]; then
                PLATFORM="am437x"
            elif [ "${_hw#*DRA74X}" != "$_hw" ]; then
                PLATFORM="am57x"
            else
                PLATFORM="unknown"
            fi
        }
    
        DBG_PRINT $PLATFORM
        case $PLATFORM in
            "am335x")
                USB0='usb@47400000/usb@47401000'
                USB1='usb@47400000/usb@47401800'
                return 0;;
            "am437x")
                USB0='omap_dwc3@48380000/usb@48390000'
                USB1='omap_dwc3@483c0000/usb@483d0000'
                return 0;;
            "am57x")
                USB0='omap_dwc3_1@48880000/usb@48890000'
                USB1='omap_dwc3_2@488c0000/usb@488d0000'
                return 0;;
            *)
                echo "Unsupported $PLATFORM"
                return 1;;
        esac
    }
    
    # check a kernel CONFIG option
    # params $1 - the config option
    #        $2 = '-q', quiet output
    # return 0 - undefined
    #        1 - defined as 'm', kernel module
    #        2 - defined as 'y', kernel builtin
    check_kernel_config() {
        local _cfg
    
        [ -n "$1" ] || return 0
        _cfg=`zcat /proc/config.gz | grep "^$1\>"`
    
        case ${_cfg#*=} in
            "y") return 2;;
            "m") return 1;;
              *) [ "$2" = "-q" ] ||
                  echo "Error: $1 is undefined in kernel config"
              return 0;;
        esac
    }
    
    # check a kernel module
    # $1 - module name, relative path from drivers/, with .ko surfix
    # return 0 - found
    #        1 - error
    check_module() {
        local _modname
        local _moddep
    
        [ -n "$1" ] || return 1
    
        _modname="/lib/modules/`uname -r`/kernel/drivers/${1}.ko"
        _moddep="/lib/modules/`uname -r`/modules.dep"
    
        DBG_PRINT 1
        [ -f $_modname ] || {
            echo "Error: $_modname not found."
            echo "       Please ensure 'make module_install' is done properly."
            return 1
        }
    
        DBG_PRINT 2
        [ -f $_moddep ] || $moddep_checked || {
            echo "Error: $_moddep not found."
            echo "       Please ensure 'make module_install' is done properly."
            moddep_checked=true
        }
    
        DBG_PRINT 3
        lsmod | grep `basename $1 | tr '-' '_'` > /dev/null || {
            DBG_PRINT ">>>> ${1}.ko:"
            if grep "${1}.ko:" $_moddep > /dev/null; then
                DBG_PRINT 5
                echo "Error: $_moddep seems to be valid,"
                echo "       but `basename $1`.ko is not loaded."
                echo "       Please provide /proc/config.gz and /lib/module/`uname -r`/*"
                echo "       for further investigation."
            else
                DBG_PRINT 6
                echo "Error: `basename $1`: $_moddep is invalid."
                echo "       Please run command 'depmod' on the target to re-generate it,"
                echo "       then reboot the target. If the issue still exists, please"
                echo "       ensure 'make module_install' is done properly."
            fi
    
            DBG_PRINT 7
            return 1
        }
        DBG_PRINT 8
        return 0
    }
    
    check_musb_drivers() {
        check_kernel_config CONFIG_USB_MUSB_HDRC
        [ $? != 1 ] || check_module 'usb/musb/musb_hdrc'
    
        check_kernel_config CONFIG_USB_MUSB_DUAL_ROLE -q
        [ $? != 0 ] || echo "Warning: CONFIG_USB_MUSB_DUAL_ROLE undefined."
    
        check_kernel_config CONFIG_USB_MUSB_DSPS
        [ $? != 1 ] || {
            check_module 'usb/musb/musb_dsps'
            check_module 'usb/musb/musb_am335x'
        }
    
        check_kernel_config CONFIG_AM335X_PHY_USB
        [ $? != 1 ] || {
            check_module 'usb/phy/phy-am335x'
            check_module 'usb/phy/phy-am335x-control'
        }
    
        check_kernel_config CONFIG_MUSB_PIO_ONLY -q
        [ $? != 0 ] || {
           if check_kernel_config CONFIG_TI_CPPI41 -q; then
               echo "Error: MUSB CPPI DMA mode is enabled, but CPPI moudle is not enabled in DMA Engine."
               echo "       Please enable CONFIG_TI_CPPI41 under DMA Engine Support in kernel config."
           fi
        }
    }
    
    check_dwc3_drivers() {
        check_kernel_config CONFIG_USB_DWC3
        [ $? != 1 ] || check_module 'usb/dwc3/dwc3'
    
        check_kernel_config CONFIG_USB_DWC3_DUAL_ROLE -q
        [ $? != 0 ] || echo "Warning: CONFIG_USB_DWC3_DUAL_ROLE undefined."
    
        check_kernel_config CONFIG_USB_DWC3_OMAP
        [ $? != 1 ] || check_module 'usb/dwc3/dwc3-omap'
    
        check_kernel_config CONFIG_USB_XHCI_HCD
        [ $? != 1 ] || {
            check_module 'usb/host/xhci-plat-hcd'
            check_module 'usb/host/xhci-hcd'
        }
    
        check_kernel_config CONFIG_OMAP_CONTROL_PHY
        [ $? != 1 ] || check_module 'phy/phy-omap-control'
    
        if [ $PLATFORM = am437x ]; then
            check_kernel_config CONFIG_OMAP_USB2
            [ $? != 1 ] || check_module 'phy/phy-omap-usb2'
        else
            check_kernel_config CONFIG_TI_PIPE3
            [ $? != 1 ] || check_module 'phy/phy-ti-pipe3'
        fi
    }
    
    ### debug ###
    
    g_log_file=/tmp/chmusb.log
    
    DBG_ENABLE() { g_dbg_enabled=true; }
    DBG_DISABLE() { g_dbg_enabled=false; }
    DBG_LOG_RESET() { ! $g_dbg_enabled || echo > $g_log_file; }
    DBG_PRINT() { ! $g_dbg_enabled || echo "$(date +%H:%M:%S) [$(basename $0)]: $*"; }
    DBG_LOG() { DBG_PRINT $* >> $g_log_file; }
    DBG_LOG_MARK() { DBG_PRINT "----------------" >> $g_log_file; }
    
    
    ### main ####
    
    moddep_checked=false
    
    echo "chkusb.sh Version $VERSION"
    
    [ "$V" = "1" ] && DBG_ENABLE && DBG_LOG_RESET || DBG_DISABLE
    
    has_supported_kernel ||
        { echo "Unsupported kernel version: `uname -r`"; exit 1; }
    check_platform || exit 2
    DBG_PRINT device: $PLATFORM
    
    which lsusb > /dev/null ||
        { echo "Error; lsusb command not found"; exit 3; }
    
    if lsusb > /dev/null 2>&1; then
        echo "USB is initialized"
    else
        echo "USB initialization failed"
    
        # failed, continue checking
        [ -f /proc/config.gz ] ||
            { echo "Error: /proc/config.gz not found"; exit 4; }
    
        case $PLATFORM in
            am335x) check_musb_drivers;;
            am437x | am57x) check_dwc3_drivers;;
            *)
                echo "Error: unsupported platform $PLATFORM"
                exit 5;;
        esac
    fi
    
    # check dr_mode & gadget drivers
    
    [ -d /proc/device-tree ] || {
        echo "Warning: /proc/device-tree/ not found"
        if [ -d "/lib/modules/`uname -r`/" ]; then
            echo "The list of USB gadget drivers installed:"
            ls -1Rp "/lib/modules/`uname -r`/kernel/drivers/usb/gadget/"
        fi
        exit 0
    }
    
    for _usb in "${USB0}" "${USB1}"; do
        _usb_dir="/proc/device-tree/ocp/${_usb}"
        _status=`cat $_usb_dir/status 2> /dev/null`
        _dr_mode=`cat $_usb_dir/dr_mode`
        echo `basename $_usb`: $_dr_mode, $_status
    
        [ "$_status" = "disabled" -o "$_dr_mode" = "host" ] || gadget_mode=true
    done
    
    DBG_PRINT $gadget_mode
    $gadget_mode || exit 0
    
    echo
    
    check_kernel_config CONFIG_USB_LIBCOMPOSITE
    case $? in
        0) echo "Error: no any gadget driver enabled"
           exit 6;;
        1) is_gadget_builtin=false;;
        2) echo "The gadget driver is built-in"
           is_gadget_builtin=true;;
    esac
    
    check_kernel_config CONFIG_USB_ZERO -q ||
        echo "Gadget Kernel Config: g_zero is enabled"
    check_kernel_config CONFIG_USB_AUDIO -q ||
        echo "Gadget Kernel Config: g_audio is enabled"
    check_kernel_config CONFIG_USB_ETH -q ||
        echo "Gadget Kernel Config: g_ether is enabled"
    check_kernel_config CONFIG_USB_G_NCM -q ||
        echo "Gadget Kernel Config: g_ncm is enabled"
    check_kernel_config CONFIG_USB_MASS_STORAGE -q ||
        echo "Gadget Kernel Config: g_mass_storage is enabled"
    check_kernel_config CONFIG_USB_G_SERIAL -q ||
        echo "Gadget Kernel Config: g_serial is enabled"
    check_kernel_config CONFIG_USB_G_PRINTER -q ||
        echo "Gadget Kernel Config: g_printer is enabled"
    
    g_driver=`grep '^DRIVER=' /sys/class/udc/*/uevent 2>/dev/null`
    echo "gadget driver loaded: ${g_driver:-(none)}"
    
    echo
    
    if ! $is_gadget_builtin; then
        if [ -d "/lib/modules/`uname -r`/" ]; then
            echo "The list of USB gadget drivers installed:"
            ls -1Rp "/lib/modules/`uname -r`/kernel/drivers/usb/gadget/"
        else
            echo "Error: /lib/modules/`uname -r`/ not found"
            echo "       Please ensure 'make module_install' is done properly."
            exit 7
        fi
    fi
    
    # vim: ft=sh:ts=4:sw=4:et
    

  • Hi Bin,
    We are using SDK- 08. USB0 need to configure as Device. we are using 5760 chkusb we were using -- as u given earlier post.

    we done few changes:
    1. while USB detection problem/issue for that : our client given a pull-up from vcc to vbus line.
    2. As we are facing USB as device-- configuration issue -- i removed USB1 related configurations from dts file.

    Debug:
    1. i posted the lsusb -v log above
    2. from the host side dmesg log also posted (-71 error).

    and our problem is : 1. how to configure the USB as USB Device with CDC-ACM class.

    regards,
    Viswanath K
  • Viswanath,

    VISWANATH KONDAPALLI said:
    we are using 5760 chkusb we were using -- as u given earlier post.

    Then please provide the output of the script. It might tell what is wrong.

    VISWANATH KONDAPALLI said:
    1. while USB detection problem/issue for that : our client given a pull-up from vcc to vbus line.

    Do you mean you have hw external pullup on VBUS line? If so, remove it. There should not be any pull-up/down on any USB line.

    VISWANATH KONDAPALLI said:
    2. As we are facing USB as device-- configuration issue -- i removed USB1 related configurations from dts file.

    As I said, not change any USB related in dts file. USB1 is independent from USB0.

    VISWANATH KONDAPALLI said:
    and our problem is : 1. how to configure the USB as USB Device with CDC-ACM class.

    I assume you know how to enable CDC-ACM gadget driver in kernel config and g_serial.ko is loaded after kernel booted?

  • 1. tomorrow i will send u the log.

    2. As you suggested will remove the external pull-up resistor --- but USB detection is getting detected.

    3. i will add USB1 - back to the place.

    4. from menuconfig we are configured "device drivers -> USB support -> usb gadget-> there choosen Serial gadget cdc_acm and odx -- so we thought g_serial we be loaded automatically -- might we have to check once -- then will load . then what about "lsusb -v " will the descriptors will load......???

    regards,
    Viswanath K
  • VISWANATH KONDAPALLI said:

    2. --- but USB detection is getting detected.

    Why this is a problem? You don't want USB device gets detected? What is 'USB detection' anyway? What detect what?

    VISWANATH KONDAPALLI said:
    so we thought g_serial we be loaded automatically

    No, you have to 'modprobe g_serial' after system booted.

    VISWANATH KONDAPALLI said:
    then what about "lsusb -v "

    You don't need to care this. lsusb command is for usb host. You are in USB device.

    VISWANATH KONDAPALLI said:
    will the descriptors will load......???

    The descriptors are in the USB gadget driver. Once the driver is loaded, and the board is connected to USB host, the host will read the descriptors during the enumeration process.

  • I need to say sorry -- i didnt posted clearly in the point 2.

    1. in the above post - about external pullup resistor, used for the USB detection -- if we remove the pullp-resistor -- will it USB detect ???.

  • Yes.

    The pullups on USB data lines are controlled by the hw internally. External pullups will cause communication failure. Please refer to any TI AM335x reference board, none of them has external pullups on USB lines.
  • Hi Bin,

    YES, i think g_serial driver loaded. but how to identify ?? is the question.

    Thank s for the script. YES. g_serial driver is loaded. This is the log:

    root@am335x-evm:/# ls /sys/bus/usb/devices/
    1-0:1.0 2-0:1.0 usb1 usb2

    root@am335x-evm:/usr# ./8726.chkusb.sh
    chkusb.sh Version 0.2.1
    USB is initialized
    usb@47401000: otg, okay
    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_serial

    The list of USB gadget drivers installed:
    /lib/modules/3.14.26-g2489c02-dirty/kernel/drivers/usb/gadget/:
    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
    libcomposite.ko
    u_ether.ko
    u_serial.ko
    usb_f_acm.ko
    usb_f_ecm.ko
    usb_f_ecm_subset.ko
    usb_f_fs.ko
    usb_f_mass_storage.ko
    usb_f_ncm.ko
    usb_f_obex.ko
    usb_f_rndis.ko
    usb_f_serial.ko
    usb_f_ss_lb.ko
    root@am335x-evm:/usr#

    root@am335x-evm:/usr# ./usbreg.sh
    bus #0:
    Power : e0
    DevCtl : 80
    bus #1:
    Power : e0
    DevCtl : 80
    root@am335x-evm:/usr#

    and the kernel boot log:
    13.747355] musb-hdrc musb-hdrc.0.auto: MUSB HDRC host driver
    [ 13.808220] musb-hdrc musb-hdrc.0.auto: new USB bus registered, assigned bus number 1
    [ 13.863424] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
    [ 13.870693] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
    [ 13.878301] usb usb1: Product: MUSB HDRC host driver
    [ 13.883549] usb usb1: Manufacturer: Linux 3.14.26-g2489c02-dirty musb-hcd
    [ 13.890711] usb usb1: SerialNumber: musb-hdrc.0.auto
    [ 13.979999] hub 1-0:1.0: USB hub found // here i am getting doubt
    [ 13.990119] hub 1-0:1.0: 1 port detected
    [ 14.012512] musb-hdrc musb-hdrc.1.auto: MUSB HDRC host driver
    [ 14.032555] musb-hdrc musb-hdrc.1.auto: new USB bus registered, assigned bus number 2
    [ 14.041178] usb usb2: New USB device found, idVendor=1d6b, idProduct=0002
    [ 14.048335] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
    [ 14.055972] usb usb2: Product: MUSB HDRC host driver
    [ 14.061218] usb usb2: Manufacturer: Linux 3.14.26-g2489c02-dirty musb-hcd
    [ 14.068366] usb usb2: SerialNumber: musb-hdrc.1.auto
    [ 14.075416] hub 2-0:1.0: USB hub found
    [ 14.079435] hub 2-0:1.0: 1 port detected
    [ 14.233711] g_serial gadget: Gadget Serial v2.4
    [ 14.238581] g_serial gadget: g_serial ready
    [ 14.341967] cryptodev: driver 1.6 loaded.
    [ 14.498724] EXT4-fs (mmcblk0p2): re-mounted. Opts: data=ordered
    Starting Bootlog daemon: bootlogd: cannot allocate pseudo tty: No such file or directory
    bootlogd.
    Populating dev cache
    [ 14.693643] musb-hdrc musb-hdrc.1.auto: VBUS_ERROR in a_wait_vrise (80, <SessEnd), retry #3, port1 0008010c
    [ 14.856160] musb-hdrc musb-hdrc.0.auto: VBUS_ERROR in a_wait_vrise (80, <SessEnd), retry #3, port1 00080108

    root@am335x-evm:/# ls /sys/bus/usb/devices/
    1-0:1.0 2-0:1.0 usb1 usb2 // in the kernel log -- showing as hub --

    please guide me -- how to differentiate host and device ??

    regards,

    Viswanath K
  • Hi Bin,
    Sorry. I didnt saw it properly. YES with your only -- i done it -- and we got "/dev/ttyGS0".

    Thanks for the big help -- i like to give u a big Applause for the help.

    1. we are not able to identify the device in the HOST and in the lsusb -v we are getting only root-hub details only
    2. Device side in drivers/usb/gadget/serial.c -- if i change here -- will it effect to the host
    because we like to configure as vendor specific --.

    static struct usb_device_descriptor device_desc = {
    .bLength = USB_DT_DEVICE_SIZE,
    .bDescriptorType = USB_DT_DEVICE,
    .bcdUSB = cpu_to_le16(0x0200),
    /* .bDeviceClass = f(use_acm) */
    .bDeviceSubClass = 0,
    .bDeviceProtocol = 0,
    /* .bMaxPacketSize0 = f(hardware) */
    .idVendor = cpu_to_le16(GS_VENDOR_ID),
    /* .idProduct = f(use_acm) */
    .bcdDevice = cpu_to_le16(GS_VERSION_NUM),
    /* .iManufacturer = DYNAMIC */
    /* .iProduct = DYNAMIC */
    .bNumConfigurations = 1,
    };

    3. how to test this /dev/ttyGS0 from target to host and viceversa..

    once again a big thanks for the big help.

    regards,
    Viswanath K
  • VISWANATH KONDAPALLI said:
    YES with your only -- i done it -- and we got "/dev/ttyGS0".

    This only means the g_serial driver is loaded properly, does not tell if the USB host can detect it or not.

    VISWANATH KONDAPALLI said:
    2. Device side in drivers/usb/gadget/serial.c -- if i change here -- will it effect to the host
    because we like to configure as vendor specific --.

    Let's focus on this later. First we have to ensure the USB host can enumerate the ACM gadget on AM335x.

    Once you loaded g_serial driver on am335x board and connected to a USB host, does the host enumerate the ACM device? What is in the host dmesg log and lsusb output?

    Your previous post has the following log, which seems telling you have board design issue. Please provide your schematics for review.

    [ 14.693643] musb-hdrc musb-hdrc.1.auto: VBUS_ERROR in a_wait_vrise (80, <SessEnd), retry #3, port1 0008010c
    [ 14.856160] musb-hdrc musb-hdrc.0.auto: VBUS_ERROR in a_wait_vrise (80, <SessEnd), retry #3, port1 00080108

  • VISWANATH KONDAPALLI said:
    1. we are not able to identify the device in the HOST and in the lsusb -v we are getting only root-hub details only

    by 'HOST', do you mean a seperate board or a PC? or the host port on your am335x board? It has to be the former.

    Where did you run lsusb command? It has to be on the USB host board or PC, not your am335x board.

  • SS. lsusb we are looking in host -- HOST is PC only. sorry i forgot to post lsusb log.

    for vbus - error is this link will help ?? 

    https://e2e.ti.com/support/arm/sitara_arm/f/791/p/324491/1129388 

    Schematic:

    VBUS wire jump_v1.pdf

  • Hi Bin,

    1. we have not removed external-resistor -- we will test this later --

    dmesg:
    [196667.120107] usb 7-2: new full-speed USB device number 18 using uhci_hcd
    [196667.240106] usb 7-2: device descriptor read/64, error -71
    [196667.464101] usb 7-2: device descriptor read/64, error -71
    [196667.680110] usb 7-2: new full-speed USB device number 19 using uhci_hcd
    [196667.800101] usb 7-2: device descriptor read/64, error -71
    [196668.024104] usb 7-2: device descriptor read/64, error -71
    [196668.240109] usb 7-2: new full-speed USB device number 20 using uhci_hcd
    [196668.648092] usb 7-2: device not accepting address 20, error -71
    [196668.760112] usb 7-2: new full-speed USB device number 21 using uhci_hcd
    [196669.168094] usb 7-2: device not accepting address 21, error -71
    [196669.168128] hub 7-0:1.0: unable to enumerate USB device on port 2
    vk29835@vk29835-HP-Compaq-6000-Pro-MT-PC:~$


    lsusb log:
    vk29835@vk29835-HP-Compaq-6000-Pro-MT-PC:~$ lsusb
    Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 001 Device 002: ID 3207:0300
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 005 Device 002: ID 03f0:0024 Hewlett-Packard KU-0316 Keyboard
    Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 004 Device 019: ID 10c4:ea60 Cygnal Integrated Products, Inc. CP210x UART Bridge / myAVR mySmartUSB light
    Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 003 Device 002: ID 0461:4d15 Primax Electronics, Ltd Dell Optical Mouse
    Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    vk29835@vk29835-HP-Compaq-6000-Pro-MT-PC:~$


    regards,
    Viswanath K
  • Hi Bin,

    e2e.ti.com/.../1504897;tisearch=Search-EN-Everything

    is this post about : AM335x USB1_DRVVBUS -- is post also suits to us -- for VBUS_ERROR -- ??

    regards,
    Viswanath K
  • Viswanath,

    Please try to remove the external pullups, if USB still does not work, please provide the schematics for review, I suspect you have hw design error which causes VBUS_ERROR.


    (Deleted the post, since schmatics is provided above. I will review it and post comments here.)

  • Viswannath,

    1. Please remove the external pullup on D+;
    2. R231 - '0/J/04_DNE', is this populated? if so, please remove it. The ID pin has to be floating to let MUSB work in device mode.
  • Hi Bin,

    In my previous post -- i added the schematic.

    regards,
    Viswanath K
  • Yeah, I noticed it after my response. Sorry for missing it.

    I have posted my comments for the schematics in my previous response. Please let me know how it goes after the hw change.

  • Sure. i will test and will let you know.
  • Hi,

    1. Removed pullup on D+
    2. R231 also removed

    target boot log:

    [ 13.610900] musb-hdrc musb-hdrc.0.auto: MUSB HDRC host driver
    [ 13.649167] musb-hdrc musb-hdrc.0.auto: new USB bus registered, assigned bus number 1
    [ 13.701269] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
    [ 13.708467] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
    [ 13.716125] usb usb1: Product: MUSB HDRC host driver
    [ 13.721379] usb usb1: Manufacturer: Linux 3.14.26-g2489c02-dirty musb-hcd
    [ 13.728535] usb usb1: SerialNumber: musb-hdrc.0.auto
    [ 13.801892] hub 1-0:1.0: USB hub found
    [ 13.805932] hub 1-0:1.0: 1 port detected
    [ 13.817070] musb-hdrc musb-hdrc.1.auto: MUSB HDRC host driver
    [ 13.824125] musb-hdrc musb-hdrc.1.auto: new USB bus registered, assigned bus number 2
    [ 13.832696] usb usb2: New USB device found, idVendor=1d6b, idProduct=0002
    [ 13.839860] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
    [ 13.847511] usb usb2: Product: MUSB HDRC host driver
    [ 13.852771] usb usb2: Manufacturer: Linux 3.14.26-g2489c02-dirty musb-hcd
    [ 13.859930] usb usb2: SerialNumber: musb-hdrc.1.auto
    [ 13.869065] hub 2-0:1.0: USB hub found
    [ 13.873173] hub 2-0:1.0: 1 port detected
    [ 14.027664] g_serial gadget: Gadget Serial v2.4
    [ 14.032617] g_serial gadget: g_serial ready
    [ 14.136258] cryptodev: driver 1.6 loaded.
    [ 14.306708] EXT4-fs (mmcblk0p2): re-mounted. Opts: data=ordered
    Starting Bootlog daemon: bootlogd: cannot allocate pseudo tty: No such file or directory
    bootlogd.
    [ 14.487305] musb-hdrc musb-hdrc.1.auto: VBUS_ERROR in a_wait_vrise (80, <SessEnd), retry #3, port1 0008010c
    Populating dev cache
    ALSA: Restoring mixer settings...


    this is the log for the lsusb in the host:  

    vk29835@vk29835-HP-Compaq-6000-Pro-MT-PC:~$ lsusb
    Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 001 Device 002: ID 3207:0300
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 005 Device 003: ID 03f0:0024 Hewlett-Packard KU-0316 Keyboard
    Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 004 Device 004: ID 10c4:ea60 Cygnal Integrated Products, Inc. CP210x UART Bridge / myAVR mySmartUSB light
    Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 003 Device 002: ID 0461:4d15 Primax Electronics, Ltd Dell Optical Mouse
    Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    vk29835@vk29835-HP-Compaq-6000-Pro-MT-PC:~$

    regards,
    Viswanath K

  • After plug to the host PC, please run the following command on the am335x board to read the registers. Also please use scope to probe USB0_VBUS, USB0_DP, and USB0_DM lines near the SoC, and provide the screenshot.

    # grep -i 'power\|devctl' /sys/kernel/debug/musb-hdrc.0/regdump

  • This is the log: for the grep command. wavefourm i will send u later.

    gdumpam335x-evm:~# grep -i 'power\|devctl' /sys/kernel/debug/musb-hdrc.0.auto/re
    Power : 20
    DevCtl : 98
    root@am335x-evm:~#


    root@am335x-evm:/sys/kernel/debug/musb-hdrc.0.auto# cat regdump
    MUSB (M)HDRC Register Dump
    FAddr : 00
    Power : 20
    Frame : 0000
    Index : 0f
    Testmode : 00
    TxMaxPp : 0000
    TxCSRp : 0000
    RxMaxPp : 0000
    RxCSR : 0000
    RxCount : 0000
    ConfigData : 33
    DevCtl : 98
    MISC : 44
    TxFIFOsz : 07
    RxFIFOsz : 07
    TxFIFOadd : 0780
    RxFIFOadd : 0780
    VControl : 00000000
    HWVers : 0800
    EPInfo : ff
    RAMInfo : 0d
    LinkInfo : 5c
    VPLen : 3c
    HS_EOF1 : 80
    FS_EOF1 : 77
    LS_EOF1 : 72
    SOFT_RST : 00
    DMA_CNTLch0 : 0000
    DMA_ADDRch0 : 00000000
    DMA_COUNTch0: 00000000
    DMA_CNTLch1 : 0000
    DMA_ADDRch1 : 00000000
    DMA_COUNTch1: 00000000
    DMA_CNTLch2 : 0000
    DMA_ADDRch2 : 00000000
    DMA_COUNTch2: 00000000
    DMA_CNTLch3 : 0000
    DMA_ADDRch3 : 00000000
    DMA_COUNTch3: 00000000
    DMA_CNTLch4 : 0000
    DMA_ADDRch4 : 00000000
    DMA_COUNTch4: 00000000
    DMA_CNTLch5 : 0000
    DMA_ADDRch5 : 00000000
    DMA_COUNTch5: 00000000
    DMA_CNTLch6 : 0000
    DMA_ADDRch6 : 00000000
    DMA_COUNTch6: 00000000
    DMA_CNTLch7 : 0000
    DMA_ADDRch7 : 00000000
    DMA_COUNTch7: 00000000
    root@am335x-evm:/sys/kernel/debug/musb-hdrc.0.auto#

    root@am335x-evm:/sys/kernel/debug/musb-hdrc.0.auto.dsps# cat regdump
    revision = 0x4ea20800
    control = 0x00000000
    status = 0x00000000
    eoi = 0x00000000
    intr0_stat = 0x00000000
    intr1_stat = 0x00000000
    intr0_set = 0x00000000
    intr1_set = 0x00000000
    txmode = 0x00000000
    rxmode = 0x00000000
    autoreq = 0x00000000
    srpfixtime = 0x0280de80
    tdown = 0x00000000
    phy_utmi = 0x00000002
    mode = 0x00000100
    root@am335x-evm:/sys/kernel/debug/musb-hdrc.0.auto.dsps#

    regards,
    Viswanath K
  • VISWANATH KONDAPALLI said:
    Power : 20
    DevCtl : 98

    It tells you didn't load the gadget driver. Please re-test it with the gadget driver loaded using modprobe command.

  • red-wire is voltage is having +5V. without pillup. black is ground obviously. D+ and D- signal is 0V only.
  • root@am335x-evm:~# modprobe g_serial
    [ 696.526756] g_serial gadget: Gadget Serial v2.4
    [ 696.531684] g_serial gadget: g_serial ready
    gdumpam335x-evm:~# grep -i 'power\|devctl' /sys/kernel/debug/musb-hdrc.0.auto/reg
    Power : e0
    DevCtl : 99
    root@am335x-evm:~#

    without loading also we got ttyGS0 port in /dev. the value is changing after modprobe only.

    dmesg log error in host:

    [91080.884059] usb 7-1: new low-speed USB device number 10 using uhci_hcd
    [91081.004090] usb 7-1: device descriptor read/64, error -71
    [91081.228108] usb 7-1: device descriptor read/64, error -71
    [91081.444110] usb 7-1: new low-speed USB device number 11 using uhci_hcd
    [91081.564131] usb 7-1: device descriptor read/64, error -71
    [91081.788108] usb 7-1: device descriptor read/64, error -71
    [91082.004123] usb 7-1: new low-speed USB device number 12 using uhci_hcd
    [91082.412047] usb 7-1: device not accepting address 12, error -71
    [91082.524120] usb 7-1: new low-speed USB device number 13 using uhci_hcd
    [91082.932097] usb 7-1: device not accepting address 13, error -71
    [91082.932136] hub 7-0:1.0: unable to enumerate USB device on port 1
    vk29835@vk29835-HP-Compaq-6000-Pro-MT-PC:~$ lsusb
    Bus 002 Device 006: ID 22b8:2e62 Motorola PCS
    Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 001 Device 002: ID 3207:0300
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 005 Device 005: ID 03f0:0024 Hewlett-Packard KU-0316 Keyboard
    Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 004 Device 008: ID 10c4:ea60 Cygnal Integrated Products, Inc. CP210x UART Bridge / myAVR mySmartUSB light
    Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 003 Device 004: ID 0461:4d15 Primax Electronics, Ltd Dell Optical Mouse
    Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    vk29835@vk29835-HP-Compaq-6000-Pro-MT-PC:~$


    regards,

    Viswanath K
  • VISWANATH KONDAPALLI said:
    without loading also we got ttyGS0 port in /dev. the value is changing after modprobe only.

    You should not have /dev/ttyGS0 before load g_serial driver. I am not sure why you have this node before load the driver.

    The register value change tells you have the gadget driver loaded.

    VISWANATH KONDAPALLI said:
    [91080.884059] usb 7-1: new low-speed USB device number 10 using uhci_hcd

    Previously your log showed 'full-speed' but now it is 'low-speed'. Please double check your USB wires on the connector to ensure D+/D- are not swapped.

    If wire connection is correct, what is your system clock? Is it 24MHz? If not, please ensure your u-boot has set the clock register correctly.

  • [91080.884059] usb 7-1: new low-speed USB device number 10 using uhci_hcd:
    I didnt changed any wire - it is same -- only things is earlier --pullup is there -- now NO pullp -- that is only the difference -- YES ofcourse -- based on the VBUS line -- might the speed concludes -- AS you suggested i removed the external pullup.

    i saw the u-boot code-- which is setting for 24MHZ in the clock_am33xx.c file --in arch/cpu/armv7/am33xx. we didnt modified any thing .

    is there any debugging techniques for USB.

    I suspect the voltage levels given to the USB vpp lines -- it is 3.3 and 1.8.
    in Sitara starter kit it is connected to the TTL lines of the HUB -- becoz hub handles -- rest of things -- In our custom board -- NO USB HUB is present -- is there any impact on the voltage levels.

    regards,
    Viswanath K.
  • VISWANATH KONDAPALLI said:
    i saw the u-boot code-- which is setting for 24MHZ in the clock_am33xx.c file --in arch/cpu/armv7/am33xx. we didnt modified any thing .

    My question is that does your board use 24MHz crystal or other one, such as 25MHz?

  • DRVVBUS -F16- i configured -- in dts file -- might it is wrong i have done -- just now i saw in pin-mux -- this is line configuration is given -- if we select HOST mode -- might there i am doing wrong -- i will remove and will check --

    regards,
    Viswa..
  • YES -- it is 24MHZ crystal only we are also using.

  • Just take the dts from the AMSDK as is, please don't change anything that is related to USB.
  • Just for testing, can you please try to swap the D+/D- wires to the connector to see what will happen?
  • OK. Will test. Is there any difference/dependency on speed to device...??