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.

PROCESSOR-SDK-AM335X: USB Device mode

Part Number: PROCESSOR-SDK-AM335X
Other Parts Discussed in Thread: AM3352, AM3359

Hello,

I have a problem with USB0 in peripheral mode.

The USB0 side works in host mode  we did try that and there were no problems getting a link established. When in host mode the ARM USB0 does supply VBUS to the external peripheral.

 The USB1 host mode also work perfectly.

It is in Peripheral is where the issues appear to occur.

When USB0 is in peripheral mode it puts out the pulses on the D+ line that conform to the 2.0 standard. With the updates to the board there are no resistors or caps on the signals line D+/- between the ARM and the USB connector. It is a direct 0 ohm connection from the D+/- signal lines on the ARM to the USB connector.

The ARM detects when the external USB cable is connected since as soon as the cable is present (VBUS is valid) the ARM stops putting out pulses on D+. The VBUS detection at the input to the ARM is a valid level according to the 2.0 standard.

Nothing occurs after the USB cable is connected to the board there are no attempts by the ARM USB0 to try and communicate with the external host. The external host is supplying VBUS to the USB0 ARM interface.

The ARM USB0 detects when the USB cable is removed. When watching the VBUS and D+ line on a scope you can see that as soon as the cable is removed the pulses on D+ start-up again and continue until a USB cable is again inserted into the board.

 Linux USB driver config I am following the user guide as described here.

processors.wiki.ti.com/.../AM335X_USB_Driver_User_Guide_04.06.00

Here is the snippet of my linux defconfig file

# TI MUSB
CONFIG_USB_MUSB_HDRC=y
#CONFIG_USB_MUSB_HOST not set
#CONFIG_USB_MUSB_GADGET not set
#CONFIG_USB_MUSB_OMAP2PLUS not set
CONFIG_USB_MUSB_DSPS=y
CONFIG_USB_MUSB_AM335X_CHILD=y
CONFIG_USB_MUSB_DUAL_ROLE=y
CONFIG_MUSB_PIO_ONLY=y

# USB Gadget Drivers
CONFIG_USB_GADGET=y
#CONFIG_USB_GADGETFS not set
#CONFIG_USB_LIBCOMPOSITE not set
#CONFIG_USB_CONFIGFS not set
#CONFIG_USB_FUNCTIONFS not set
#CONFIG_USB_ZERO not set
#CONFIG_USB_AUDIO not set
#CONFIG_USB_ETH not set
#CONFIG_USB_ETH_RNDIS not set
#CONFIG_USB_MASS_STORAGE not set
CONFIG_USB_G_SERIAL=y
#CONFIG_USB_G_PRINTER not set
#CONFIG_USB_MIDI_GADGET not set
#CONFIG_USB_CDC_COMPOSITE not set
#CONFIG_USB_G_HID not set
#CONFIG_USB_G_DBGP not set
#CONFIG_USB_G_MULTI not set
#CONFIG_USB_G_NOKIA not set
#CONFIG_USB_G_WEBCAM not set
#CONFIG_USB_G_NCM not set
#CONFIG_USB_G_ACM_MS not set
#CONFIG_USB_GADGET_TARGET not set

Here is the snippet of the device tree file:


musb: usb@47400000 {
status = "okay";

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

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

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

usb@47401000 {
status = "okay";
/* USB 0  is peripheral */
dr_mode = "peripheral";
};

usb@47401800 {
status = "okay";
/* USB 1  is host */
dr_mode = "host";
};

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

Can you help ? Are we missing something from either HW or Linux driver ?

Thanks

Maulin

could you send me the link ?
  • Hello,

    Thank you for the information.

    I went through the link I think I have configured the drivers properly only difference is I am using PIO mode only instead of DMA (CONFIG_USB_TI_CPPI41_DMA). But I have tried both PIO Mode only and with DMA only modes with no success.

    From the link and the defconfig + dts in the original forum topic do you see any issue with driver configuration ?
    If not are we missing some in our HW design for USB0 peripheral mode.

    Thanks

    Maulin Lodhia
  • Can you post the USB part of the schematic?
  • Hello Biser,

    Yes we can put partial schematics.

     

    Attached is the schematic for the USB0 circuit.  It functions as a host – no issue.

     

    TVS – D3 is not-populated, It is show in in the schematic but has been removed from the board.

     

    The caps C443 and C444 have also been not-populated, they have been removed from the board.

     

    The resistors R651 and R653 have been replaced with 0 ohm resistors.

     

    The resistor R652 has also been removed from the board.

     

    Thanks

    Maulin Lodhiausb_host_or_peripheral_comments.pdf

  • Hello Maulin,

    USB Mini-B is a USB Peripheral only socket. It doesn't support USB Host operation. You'd need Mini-AB (still officially supported, but deprecated since 2007) or Micro-AB to be compliant. You may still have a Linux config issue, but I can help with looking at the HW side until the SW gurus can chime in:

    1) Verify that USBn_ID state at the processor is correct when the USB port is connected. Your schematic notes are correct in this regard.

    2) Verify that USBn_VBUS is at the correct voltage.. For USB Peripheral mode, the USBn_VBUS needs to be =>4.4V.

    3) Hopefully the removal of I64/C443/C444 didn't introduce significant stubs on the DP/DM lines. This isn't related to the issue at hand, but could be problematic down the road. Check out SPRAAR7 for our USB layout requirements.

  • Hello DK,

    Yes we had made a special cable Mini - AB compliant to verify Host functionality on USB0.

    But our main issue is to make this USB0 port as peripheral. Our Hw expert verified and confirmed all 3 points highlighted in your last response. Thus it may be something else... SW configuration related perhaps ?

    FYI - Linux version we are using is  3.12.17

    Thanks

    Maulin Lodhia

  • Maulin,

    Please provide the console output of command 'cat /sys/class/udc/*/uevent'.

  • and the output of command 'ls /sys/class/udc' as well.
  • cat /sys/class/udc/*/uevent
    USB_UDC_NAME=musb-hdrc
  • ls /sys/class/udc/
    musb-hdrc.0.auto
  • Maulin Lodhia said:
    cat /sys/class/udc/*/uevent
    USB_UDC_NAME=musb-hdrc

    Ok, the gadget driver is not bound to the controller driver. Please change your kernel config to build the gadget drivers as modules.

    Ensure you can get the following log when "cat uevent".

    DRIVER=serial
    USB_UDC_NAME=musb-hdrc
    USB_UDC_DRIVER=serial
    

    3.12 kernel is a few years old, I am not sure if the gadget driver can be builtin in 3.12.

  • Just to confirm:
    CONFIG_USB_GADGET=m // instead of y
    CONFIG_USB_G_SERIAL=m // instead of y

    Any other drivers that need to be module ?
  • Yes, I would think just those two.
    If changing the two configs doesn't solve the issue, I will test it out later this afternoon.
  • Hello Bin,

    Once I make the above to as module the MUSB drivers also become modules.
    When I install the modules in this order.
    insmod udc-core.ko
    insmod msusb_hdrc.ko
    insmod musb_dsps.ko
    insmod musb_am335x.ko

    At this point I get following errors.
    [ 80.341116] musb-hdrc musb-hdrc.0.auto: Enabled SW babble control
    [ 80.347666] musb-hdrc musb-hdrc.0.auto: Falied to request rx1.
    [ 80.388390] musb-hdrc musb-hdrc.0.auto: musb_init_controller failed with status -517
    [ 80.397119] platform musb-hdrc.0.auto: Driver musb-hdrc requests probe deferral
    [ 80.405945] musb-hdrc musb-hdrc.0.auto: Enabled SW babble control
    [ 80.429899] musb-hdrc musb-hdrc.1.auto: Enabled SW babble control
    [ 80.436452] musb-hdrc musb-hdrc.1.auto: Falied to request rx1.
    [ 80.449559] musb-hdrc musb-hdrc.0.auto: Falied to request rx1.
    [ 80.455762] musb-hdrc musb-hdrc.0.auto: musb_init_controller failed with status -517
    [ 80.479433] musb-hdrc musb-hdrc.1.auto: musb_init_controller failed with status -517
    [ 80.487677] platform musb-hdrc.1.auto: Driver musb-hdrc requests probe deferral
    [ 80.497893] platform musb-hdrc.0.auto: Driver musb-hdrc requests probe deferral
    [ 80.506634] musb-hdrc musb-hdrc.0.auto: Enabled SW babble control
    [ 80.545547] musb-hdrc musb-hdrc.0.auto: Falied to request rx1.
    root@kona64:/lib/modules/3.12.17/kernel/drivers/usb# [ 80.572916] musb-hdrc musb-hdrc.0.auto: musb_init_controller failed with status -517
    [ 80.604440] platform musb-hdrc.0.auto: Driver musb-hdrc requests probe deferral
    [ 80.630704] musb-hdrc musb-hdrc.1.auto: Enabled SW babble control
    [ 80.661190] musb-hdrc musb-hdrc.1.auto: MUSB HDRC host driver
    [ 80.667276] musb-hdrc musb-hdrc.1.auto: new USB bus registered, assigned bus number 1
    [ 80.696572] hub 1-0:1.0: USB hub found
    [ 80.703964] hub 1-0:1.0: 1 port detected
    [ 80.718686] musb-hdrc musb-hdrc.0.auto: Enabled SW babble control
    [ 81.119316] usb 1-1: new high-speed USB device number 2 using musb-hdrc
    [ 81.262205] usb 1-1: config 1 has an invalid interface number: 8 but max is 3
    [ 81.269755] usb 1-1: config 1 has no interface number 1

    Note that i do not get this when the musg drivers in built-in (confirmed via dmesg)

    Now when I tried installing individual gadget driver I get these errors
    insmod g_serial.ko
    [ 103.857157] g_serial: Unknown symbol usb_remove_function (err 0)
    [ 103.864330] g_serial: Unknown symbol usb_get_function_instance (err 0)
    [ 103.871601] g_serial: Unknown symbol usb_add_config_only (err 0)
    [ 103.877977] g_serial: Unknown symbol usb_string_ids_tab (err 0)
    [ 103.884545] g_serial: Unknown symbol usb_get_function (err 0)
    [ 103.891032] g_serial: Unknown symbol usb_composite_unregister (err 0)
    [ 103.897906] g_serial: Unknown symbol usb_put_function (err 0)
    [ 103.904591] g_serial: Unknown symbol usb_add_function (err 0)
    [ 103.910935] g_serial: Unknown symbol usb_composite_probe (err 0)
    [ 103.917308] g_serial: Unknown symbol usb_composite_overwrite_options (err 0)
    [ 103.925033] g_serial: Unknown symbol usb_put_function_instance (err 0)
    [ 103.932135] g_serial: Unknown symbol usb_ep_autoconfig_reset (err 0)
    Error: could not insert module g_serial.ko: Unknown symbol in module


    insmod u_serial.ko <-- This is successful

    insmod libcomposite.ko
    [ 203.257567] libcomposite: Unknown symbol config_group_init (err 0)
    [ 203.264178] libcomposite: Unknown symbol configfs_unregister_subsystem (err 0)
    [ 203.272740] libcomposite: Unknown symbol config_item_set_name (err 0)
    [ 203.279865] libcomposite: Unknown symbol configfs_register_subsystem (err 0)
    [ 203.287765] libcomposite: Unknown symbol config_group_init_type_name (err 0)
    [ 203.295286] libcomposite: Unknown symbol config_item_put (err 0)
    Error: could not insert module libcomposite.ko: Unknown symbol in module

    insmod usb_f_serial.ko
    [ 235.257529] usb_f_serial: Unknown symbol usb_interface_id (err 0)
    [ 235.263985] usb_f_serial: Unknown symbol usb_assign_descriptors (err 0)
    [ 235.271843] usb_f_serial: Unknown symbol usb_string_id (err 0)
    [ 235.278328] usb_f_serial: Unknown symbol config_ep_by_speed (err 0)
    [ 235.285155] usb_f_serial: Unknown symbol usb_function_register (err 0)
    [ 235.292032] usb_f_serial: Unknown symbol config_group_init_type_name (err 0)
    [ 235.299745] usb_f_serial: Unknown symbol usb_ep_autoconfig (err 0)
    [ 235.306448] usb_f_serial: Unknown symbol usb_put_function_instance (err 0)
    [ 235.313677] usb_f_serial: Unknown symbol usb_function_unregister (err 0)
    [ 235.321015] usb_f_serial: Unknown symbol usb_free_all_descriptors (err 0)
    Error: could not insert module usb_f_serial.ko: Unknown symbol in module

    insmod usb_f_obex.ko
    [ 841.409776] usb_f_obex: Unknown symbol usb_interface_id (err 0)
    [ 841.416793] usb_f_obex: Unknown symbol usb_assign_descriptors (err 0)
    [ 841.423626] usb_f_obex: Unknown symbol config_ep_by_speed (err 0)
    [ 841.430442] usb_f_obex: Unknown symbol usb_function_register (err 0)
    [ 841.437358] usb_f_obex: Unknown symbol config_group_init_type_name (err 0)
    [ 841.444600] usb_f_obex: Unknown symbol usb_ep_autoconfig (err 0)
    [ 841.451215] usb_f_obex: Unknown symbol usb_put_function_instance (err 0)
    [ 841.458453] usb_f_obex: Unknown symbol usb_function_activate (err 0)
    [ 841.465144] usb_f_obex: Unknown symbol usb_function_unregister (err 0)
    [ 841.472296] usb_f_obex: Unknown symbol usb_free_all_descriptors (err 0)
    [ 841.479437] usb_f_obex: Unknown symbol usb_gstrings_attach (err 0)
    [ 841.485975] usb_f_obex: Unknown symbol usb_function_deactivate (err 0)
    Error: could not insert module usb_f_obex.ko: Unknown symbol in module

    insmod usb_f_acm.ko
    [ 864.534779] usb_f_acm: Unknown symbol usb_interface_id (err 0)
    [ 864.541750] usb_f_acm: Unknown symbol usb_assign_descriptors (err 0)
    [ 864.549095] usb_f_acm: Unknown symbol config_ep_by_speed (err 0)
    [ 864.555678] usb_f_acm: Unknown symbol usb_function_register (err 0)
    [ 864.562279] usb_f_acm: Unknown symbol config_group_init_type_name (err 0)
    [ 864.569730] usb_f_acm: Unknown symbol usb_ep_autoconfig (err 0)
    [ 864.576157] usb_f_acm: Unknown symbol usb_put_function_instance (err 0)
    [ 864.583274] usb_f_acm: Unknown symbol usb_function_unregister (err 0)
    [ 864.590381] usb_f_acm: Unknown symbol usb_free_all_descriptors (err 0)
    [ 864.597451] usb_f_acm: Unknown symbol usb_gstrings_attach (err 0)


    None of these error show up in dmesg when gadget driver was built-in ??

    Thanks
    Maulin Lodhia
  • Maulin,

    There are a few things probably wrong.

    Maulin Lodhia said:
    [ 80.347666] musb-hdrc musb-hdrc.0.auto: Falied to request rx1.

    I am not sure about this error, never saw it before. Let's ignore it for now.

    Maulin Lodhia said:
    [ 80.388390] musb-hdrc musb-hdrc.0.auto: musb_init_controller failed with status -517

    Very likely you didn't build kernel with CONFIG_MUSB_PIO_ONLY=y this time, and the musb driver is waiting for CPPI DMA driver, and not loaded properly.

    Maulin Lodhia said:
    Now when I tried installing individual gadget driver I get these errors
    insmod g_serial.ko

    Don't try to load a gadget driver at this point, because the usb controller driver is not ready.

    Please avoid to use insmod command for loading usb drivers, and use modprobe instead. The usb drivers have many dependencies, and using insmod can easily get it wrong.

    Please use command 'modprobe musb_am335x' to load all the usb controller related drivers, then use 'modprobe g_serial' to load the serial gadget driver.

    BTY, you should'nt need 'modprobe musb_am335x' if you installed all the kernel modules correctly into your filesystem, the kernel boot process should load those usb drivers automatically for you.

  • Hello Bin,

    When I use 'modeprobe musb_am335x' it doesn't install the driver. However insmod works. You are correct I was experimenting with CPPI41 DMA after I removed DMA functionality and used CONFIG_MUSB_PIO_ONLY=y the following error is not seen.

    musb-hdrc musb-hdrc.0.auto: musb_init_controller failed with status -517

    Error gone:
    insmod udc-core.ko
    root@kona64:/lib/modules/3.12.17/kernel/drivers/usb# insmod musb_hdrc.ko
    root@kona64:/lib/modules/3.12.17/kernel/drivers/usb# insmod musb_dsps.ko
    root@kona64:/lib/modules/3.12.17/kernel/drivers/usb# insmod musb_am335x.ko
    [ 232.352950] musb-hdrc musb-hdrc.0.auto: Enabled SW babble control
    [ 232.401676] musb-hdrc musb-hdrc.1.auto: Enabled SW babble control
    [ 232.408330] musb-hdrc musb-hdrc.1.auto: MUSB HDRC host driver
    [ 232.448282] musb-hdrc musb-hdrc.1.auto: new USB bus registered, assigned bus number 1
    [ 232.464394] hub 1-0:1.0: USB hub found
    [ 232.470695] hub 1-0:1.0: 1 port detected
    root@kona64:/lib/modules/3.12.17/kernel/drivers/usb# [ 232.881177] usb 1-1: new high-speed USB device number 2 using musb-hdrc
    [ 233.024139] usb 1-1: config 1 has an invalid interface number: 8 but max is 3
    [ 233.031708] usb 1-1: config 1 has no interface number 1
    [ 233.045079] GobiSerial 1-1:1.0: GobiSerial converter detected
    [ 233.062562] usb 1-1: GobiSerial converter now attached to ttyUSB0
    [ 233.081419] GobiSerial 1-1:1.2: GobiSerial converter detected
    [ 233.103708] usb 1-1: GobiSerial converter now attached to ttyUSB1
    [ 233.121268] GobiSerial 1-1:1.3: GobiSerial converter detected
    [ 233.128771] usb 1-1: GobiSerial converter now attached to ttyUSB2
    [ 233.148617] GobiNet 1-1:1.8 wwan0: register 'GobiNet' at usb-musb-hdrc.1.auto-1, GobiNet Ethernet Device, 3a:7c:d0:01:0a:7d
    [ 233.161011] Ethernet mode
    [ 233.180214] USB Speed : USB 2.0
    [ 235.365578] TE Flow Control Enabled
    [ 235.657205] creating qcqmi0

    But I cant still install individual modules on target since I am not sure if modprobe actually installed the modules correctly due to lack of feedback. However as mentioned in my previous message insmod g_serial and related modules gives me errors.

    Thanks
    Maulin
  • Maulin Lodhia said:
    [ 233.180214] USB Speed : USB 2.0
    [ 235.365578] TE Flow Control Enabled
    [ 235.657205] creating qcqmi0

    But I cant still install individual modules on target since I am not sure if modprobe actually installed the modules correctly due to lack of feedback. However as mentioned in my previous message insmod g_serial and related modules gives me errors.

    By now you only loaded usb controller related drivers. To load g_serial driver, please try the following - note that I didn't test it... (you really should use modprobe, if it doesn't load the drivers correctly, you should fix your filesystem - you didn't install all the kernel modules properly.)

    # insmod libcomposite
    # insmod g_serial

  • Hello Bin,

    I used arogo and bitbake to create rootfs ubi which is installed on the target. this ubi installs kernel and kernel-modules. However for individual USB test I did not want to create the entire rootfs again instead just changing uImage (kernel image) and dtb (device tree (if necessary).

    By default all the usb drivers are built-in which works fine for USB1 host mode. But for peripheral it doesnt thus trying install individually as module as per your suggestion.

    I tried installing it individually as per your suggestion but still get errors.
    insmod libcomposite.ko
    [ 2486.214639] libcomposite: Unknown symbol config_group_init (err 0)
    [ 2486.221251] libcomposite: Unknown symbol configfs_unregister_subsystem (err 0)
    [ 2486.229821] libcomposite: Unknown symbol config_item_set_name (err 0)
    [ 2486.236944] libcomposite: Unknown symbol configfs_register_subsystem (err 0)
    [ 2486.244593] libcomposite: Unknown symbol config_group_init_type_name (err 0)
    [ 2486.252109] libcomposite: Unknown symbol config_item_put (err 0)
    Error: could not insert module libcomposite.ko: Unknown symbol in module
    root@kona64:/lib/modules/3.12.17/kernel/drivers/usb# insmod g_serial.ko
    [ 2540.942261] g_serial: Unknown symbol usb_remove_function (err 0)
    [ 2540.949581] g_serial: Unknown symbol usb_get_function_instance (err 0)
    [ 2540.956858] g_serial: Unknown symbol usb_add_config_only (err 0)
    [ 2540.963440] g_serial: Unknown symbol usb_string_ids_tab (err 0)
    [ 2540.969711] g_serial: Unknown symbol usb_get_function (err 0)
    [ 2540.976095] g_serial: Unknown symbol usb_composite_unregister (err 0)
    [ 2540.983346] g_serial: Unknown symbol usb_put_function (err 0)
    [ 2540.989449] g_serial: Unknown symbol usb_add_function (err 0)
    [ 2540.995844] g_serial: Unknown symbol usb_composite_probe (err 0)
    [ 2541.002220] g_serial: Unknown symbol usb_composite_overwrite_options (err 0)
    [ 2541.010138] g_serial: Unknown symbol usb_put_function_instance (err 0)
    [ 2541.017276] g_serial: Unknown symbol usb_ep_autoconfig_reset (err 0)
    Error: could not insert module g_serial.ko: Unknown symbol in module
  • Maulin,

    Maulin Lodhia said:
    owever for individual USB test I did not want to create the entire rootfs again instead just changing uImage (kernel image) and dtb (device tree (if necessary).

    This is not recommended. Unlike the old 2.6 kernel, now the kernel usb subsystem, especially the udc, is getting more and more complicated in terms of dependencies. You'd better update the kernel modules along with kernel image and dtb in the rootfs, unless you know how the kernel exactly works.

    Maulin Lodhia said:
    I tried installing it individually as per your suggestion but still get errors.
    insmod libcomposite.ko
    [ 2486.214639] libcomposite: Unknown symbol config_group_init (err 0)
    [ 2486.221251] libcomposite: Unknown symbol configfs_unregister_subsystem (err 0)
    [ 2486.229821] libcomposite: Unknown symbol config_item_set_name (err 0)
    [ 2486.236944] libcomposite: Unknown symbol configfs_register_subsystem (err 0)
    [ 2486.244593] libcomposite: Unknown symbol config_group_init_type_name (err 0)
    [ 2486.252109] libcomposite: Unknown symbol config_item_put (err 0)
    Error: could not insert module libcomposite.ko: Unknown symbol in module

    All those missing symbols are in the fs/configfs, please check if you have 'CONFIG_CONFIGFS_FS=y' in your .config.

    Maulin Lodhia said:
    root@kona64:/lib/modules/3.12.17/kernel/drivers/usb# insmod g_serial.ko
    [ 2540.942261] g_serial: Unknown symbol usb_remove_function (err 0)
    ...
    Error: could not insert module g_serial.ko: Unknown symbol in module

    Don't try to insmod g_serial if libcomposite.ko is not loaded properly.

  • Hello Bin

    After making CONFIG_CONFIGFS_FS=y instead of 'm' orginally

    I was able to successfully install external modules in this order

    • udc-core
    • musb_hdrc
    • musb_dsps
    • musb_am335x
    • libcomposite
    • u_serial
    • usb_f_serial
    • usb_f_acm
    • usb_f_obex
    • usb_g_serial
    • finally... insmod g_serial.ko

    Output: 


    [ 292.069948] g_serial gadget: Gadget Serial v2.4
    [ 292.074846] g_serial gadget: g_serial ready

    But the original problem still persists when I plug USB0 (using a cable) to PC it doesn't even attempt to enumerate. 

    Conclusion:

    Both built-in and external loading on modules (gadget drivers) have the same behavior.

    Thanks

    Maulin 

  • Here is the same output when gadget drivers are built in to the kernel

    dmesg | grep gadget
    [ 1.473402] g_serial gadget: Gadget Serial v2.4
    [ 1.478186] g_serial gadget: g_serial ready
  • Maulin Lodhia said:

    [ 292.069948] g_serial gadget: Gadget Serial v2.4
    [ 292.074846] g_serial gadget: g_serial ready

    But the original problem still persists when I plug USB0 (using a cable) to PC it doesn't even attempt to enumerate. 

    Please provide the output of 'cat /sys/class/udc/musb_hdrc.0.auto/uevent' in this case, before I start debug this.

    And please attach you .config for my debug.

  • Do you have the following config set?

    CONFIG_AM335X_CONTROL_USB=y

    CONFIG_AM335X_PHY_USB=y

    CONFIG_NOP_USB_XCEIV=y

    Attached below is my .config for v3.12.17 which works with g_serial.ko.

    _config.v3.12.17-musb-builtin.txt

    root@am335x-evm:~# lsmod
    Module                  Size  Used by
    usb_f_acm               6299  1 
    u_serial               10748  1 usb_f_acm
    g_serial                3024  0 
    libcomposite           38296  2 usb_f_acm,g_serial
    configfs               25773  3 usb_f_acm,libcomposite
    lm75                    4501  0 
    matrix_keypad           6271  0
    
  • And attached below is my .config which has g_serial builtin working.

    _config.v3.12.17-musb-g_serial-builtin.txt

  • Yes I have all 3 CONFIG flags set to 'y'

  • Hello Bin,

    Here is the output of gadget when it built in

    dmesg | grep gadget
    [ 1.473908] g_serial gadget: adding 'acm'/dd9c53c0 to config 'CDC ACM config'/c05ed5c4
    [ 1.473964] g_serial gadget: acm ttyGS0: dual speed IN/ep1in OUT/ep1out NOTIFY/ep2in
    [ 1.473992] g_serial gadget: Gadget Serial v2.4
    [ 1.478759] g_serial gadget: g_serial ready

    Here is the output of usb in general for the same linux load

     dmesg | grep usb
    [ 0.257687] usbcore: registered new interface driver usbfs
    [ 0.257962] usbcore: registered new interface driver hub
    [ 0.258269] usbcore: registered new device driver usb
    [ 1.322228] usbcore: registered new interface driver asix
    [ 1.328253] usbcore: registered new interface driver ax88179_178a
    [ 1.334946] usbcore: registered new interface driver cdc_ether
    [ 1.341333] usbcore: registered new interface driver r815x
    [ 1.347316] usbcore: registered new interface driver net1080
    [ 1.353525] usbcore: registered new interface driver cdc_subset
    [ 1.359995] usbcore: registered new interface driver zaurus
    [ 1.366151] usbcore: registered new interface driver cdc_ncm
    [ 1.376700] usbcore: registered new interface driver GobiNet
    [ 1.384307] usbcore: registered new interface driver usbserial
    [ 1.390698] usbcore: registered new interface driver GobiSerial
    [ 1.397142] usbserial: USB Serial support registered for GobiSerial
    [ 1.412177] of_get_named_gpio_flags: can't parse gpios property of node '/ocp/usb@47400000/usb-phy@47401300[0]'
    [ 1.413706] musb-hdrc musb-hdrc.0.auto: Enabled SW babble control
    [ 1.420142] musb-hdrc: ConfigData=0xde (UTMI-8, dyn FIFOs, bulk combine, bulk split, HB-ISO Rx, HB-ISO Tx, SoftConn)
    [ 1.420159] musb-hdrc: MHDRC RTL version 2.0
    [ 1.420171] musb-hdrc: setup fifo_mode 4
    [ 1.420197] musb-hdrc: 28/31 max ep, 16384/16384 memory
    [ 1.421668] of_get_named_gpio_flags: can't parse gpios property of node '/ocp/usb@47400000/usb-phy@47401b00[0]'
    [ 1.423088] musb-hdrc musb-hdrc.1.auto: Enabled SW babble control
    [ 1.429516] musb-hdrc: ConfigData=0xde (UTMI-8, dyn FIFOs, bulk combine, bulk split, HB-ISO Rx, HB-ISO Tx, SoftConn)
    [ 1.429532] musb-hdrc: MHDRC RTL version 2.0
    [ 1.429543] musb-hdrc: setup fifo_mode 4
    [ 1.429567] musb-hdrc: 28/31 max ep, 16384/16384 memory
    [ 1.429676] musb-hdrc musb-hdrc.1.auto: MUSB HDRC host driver
    [ 1.435858] musb-hdrc musb-hdrc.1.auto: new USB bus registered, assigned bus number 1
    [ 1.473348] udc musb-hdrc.0.auto: registering UDC driver [g_serial]
    [ 1.554095] usbcore: registered new interface driver usbhid
    [ 1.559955] usbhid: USB HID core driver
    [ 2.053750] usb 1-1: new high-speed USB device number 2 using musb-hdrc
    [ 2.217037] usb 1-1: config 1 has an invalid interface number: 8 but max is 3
    [ 2.224572] usb 1-1: config 1 has no interface number 1
    [ 2.294312] usb 1-1: GobiSerial converter now attached to ttyUSB0
    [ 2.324194] usb 1-1: GobiSerial converter now attached to ttyUSB1
    [ 2.354015] usb 1-1: GobiSerial converter now attached to ttyUSB2
    [ 2.383926] GobiNet 1-1:1.8 wwan0: register 'GobiNet' at usb-musb-hdrc.1.auto-1, GobiNet Ethernet Device, 32:d1:59:7f:05:81

    As per the highlighted g_serial is registered. However when I plug the cable in to PC it doesn't even attempt to enumerate.

    Thanks

    Maulin Lodhia

  • Maulin Lodhia said:
    As per the highlighted g_serial is registered. However when I plug the cable in to PC it doesn't even attempt to enumerate.

    Please don't forget to check the output of 'cat /sys/class/udc/musb-hdrc.0.auto/uevent', to ensure the gadget driver is bound t MUSB driver.

    Then dump the following two registers.

    # devmem2 0x47401401 b
    # devmem2 0x47401460 b


  • Here is the requested output.

    cat /sys/class/udc/musb-hdrc.0.auto/uevent

    DRIVER=g_serial

    USB_UDC_NAME=musb-hdrc

    USB_UDC_DRIVER=g_serial

    devmem2 0x47401401 b

    /dev/mem opened.

    Memory mapped at address 0xb6fbf000.

    Read at address  0x47401401 (0xb6fbf401): 0xF0

    devmem2 0x47401460 b

    /dev/mem opened.

    Memory mapped at address 0xb6fad000.

    Read at address  0x47401460 (0xb6fad460): 0x89

  • Ok, everything on the sw side is good now, but

    Maulin Lodhia said:

    devmem2 0x47401460 b

    Read at address  0x47401460 (0xb6fad460): 0x89

    tells the AM335x is unable to sense VBUS - this register should be 0x99 by now, but it is 0x89 instead.

    So I guess because AM335x MUSB controller is unable to detect VBUS, it doesn't enable D+ pullup, so the USB host is unable to detect the attach,

    I will let the hw guru to help you to check your hw again, but just to double check, you removed R759 to not ground the ID pin, right?

  • Hello Bin,

    Could you send be the register description for 0x47401460 and any other register that we should be checking ?

    I tried looking at SPRUH73G document and couldn't find it.

    Also as per SPRUH73G pg. 1686 (section 16.3.7)

    The procedure for the USB2.0 OTG controller determining its operating modes (usb controller assuming a

    role of a host or a peripheral) starts when the USB 2.0 controller goes into a session. The USB 2.0

    controller is in session when either it senses a voltage (>= 4.4V) on the USBx_VBUSIN pin and the

    controller sets its DEVCTL[SESSION] bit field or when the firmware sets the DEVCTL[SESSION] bit;

    assuming that it will operating as a host.

    I couldn't find the DEVCTL register in section 16.5 (USB Registers) of the same document

    Regards,

    Maulin Lodhia

  • Please verify USBn_VBUS is >4.4V at the processor.

  • Hello DK,

    It is 5.1V which is > 4.4V

    Thanks

    Maulin

  • VBUS is being supplied by the Host when you are in Device mode, yes? Verify USBn_VBUS is 0V when we are disconnected from the Host, and >4.4V when we are connected to the Host.

  • -DK- said:

    VBUS is being supplied by the Host when you are in Device mode, yes? Verify USBn_VBUS is 0V when we are disconnected from the Host, and >4.4V when we are connected to the Host.

    In addition to DK's request above, please also dump register 'devmem2 0x47401460 b' in both cases.

  • When USB is Disconnected:

    • USBn_VBUS is 0V
    • devmem2 0x47401460 b

    /dev/mem opened.

    Memory mapped at address 0xb6f11000.

    Read at address  0x47401460 (0xb6f11460): 0x80

    When USB is Connected:

    • USBn_VBUS is 5.1V
    • devmem2 0x47401460 b

    /dev/mem opened.

    Memory mapped at address 0xb6f11000.

    Read at address  0x47401460 (0xb6f11460): 0x89


    Thanks

    Maulin

  • Maulin Lodhia said:

    When USB is Connected:

    USBn_VBUS is 5.1V

    devmem2 0x47401460 b

    Read at address  0x47401460 (0xb6f11460): 0x89

    I still think there is something wrong on the board. When the AM335x USB0 controller detects VBUS > 4.4v, bit[3,4] of register 0x47401460 should be 11b, but now it is 01b, which means the detected VBUS is < AVALID.

  • Hello Bin,

    Could you please send us this information about the register 0x47401460 and any other register that we should be checking ?
    It is not evident in SPRUH73G.
    Thanks
    Maulin
  • Maulin, that document requires NDA. It is not needed in debugging this case though.
  • These registers are not available as they are proprietary (not included in TRM for this reason).

    The SoC doesn't see VBUS @ >= 4.4V on your board. This is what needs debugging.
  • Hello DK/Bin,

    What about USB_CTRL0 register? What are the bits set to for this register?

     Reference SPRUH73G–October 2011 pg. 780

    Figure 9-24, Table 9-31

    Bits 31 to 24 must always stay 0x3c?

     

    Bit 23, datapolarity_inv what is that set to?

     

    Bit 20, otgsessenden, session end detect enable

     

    Bit 19, otgvdet_n, vbus detect enable? Should this be set to 1?

     

    Bit 18, dmgpio_pd, DM is not being used in GPIO mode, no pulldown enabled?

     

    Bit 17, dpgpio_pd, no pulldown enabled?

     

    Bit 14 and bit 15, no UART or inversion?

     

    Bit 12, gpiomode, USB mode = 0 and not GPIO mode (uart mode)?

     

    Bit 10, cdet_extctl, charger detection is bypassed?

     

    Bit 9 and bit 8, pullups enabled or no effect?

     

    Bits 7 and 6 charger case bits?

     

    Bits 5 and 4 sink or source?

     

    Bit 2, charger detect disable, 1 disable?

     

    Bit 1 and 0 power down bits?

     

     So when I read the value for this register it is showing 0x00000000

    Tried reading this on 2 units with same results ?

    Could this be the reason why VBUS is not getting detected ?

    Thanks

    Maulin Lodhia

  • Maulin,

    You don't need to touch USB_CTRL0 register, the Linux driver already takes care of it.

    USB_CTRL0 has nothing to do with VBUS detection. VBUS detection doesn't require any sw configuration, as long as the MUSB module clock is running, DEVCTL[bit3,4] will reflect the VBUS voltage. So if the VBUS is hooked up correctly, DEVCTL[bit3,4] should be 11b when you connect it to a USB host port.
  • Maulin Lodhia said:
     So when I read the value for this register it is showing 0x00000000

    It shouldn't be 0. Are you sure you were reading from 0x44e10620?

    What is the value of USB_CTRL1 which is 0x44e10628 for the 2nd usb port?

  • I was reading 0x47401620 address which is clearly incorrect.

    now its reading correct value it seems.

    devmem2 0x44e10620 w
    /dev/mem opened.
    Memory mapped at address 0xb6f16000.
    Read at address 0x44E10620 (0xb6f16620): 0x3C106004
  • FYI

    The following is a scope shot of the USB0_VBUS (Pin P15) on the AM3352. This scope shot is taken right under the device on the secondary side of the board. Since the part is populated on the primary side of the board. The scope shot shows the USB0_VBUS signal rising from close to ground to 5.07V as the USB cable is plugged in. There is no other point on the board that is closer to the device to be able to measure. I have checked this on a few boards so the enclosed waveform should be what is present on the input USB0_VBUS pin of the device. Even with the enclosed waveform the device is not showing that VBUS is being detected (via the devmem2 read that was mentioned earlier). The enclosed Vbus level 5.07V is > than 4.75V is > than 4.4V.

    Why would the device not be able to see this VBUS signal which is at the correct level at its respective input pin (P15)?

    VSSA_USB_0 (pin N14) and VSSA_USB_1 (pin M14) are connected to ground. VDDA3P3V_USB0 (pin N15) and VCCA3P3V_USB1 (pin R15) are connected to 3.3V. VDDA1P8V_USB0 (pin N16) and VDDA1P8V_USB1 (pin R16) are connected to 1.8V.

  • Hello,

    Any update on this ? Could you please help answer Ron's concerns/questions for HW design ? As per the design and scope capture the VBUS level is 5.07v which is greater than 4.4V to be detected. So why would am335x now detect it ? 

    Are we missing something here ?

    Thanks

    Maulin

  • You say this port works in Host mode. Please switch it to Host mode and repeat the previous experiment:

    devmem2 0x47401460 b


    Please post the result here.

  • Before connecting a device 

    Read at address  0x47401460 (0xb6f9c460): 0x19

    After connecting a device

    [  632.123519] usb 1-1: new full-speed USB device number 5 using musb-hdrc

    devmem2 0x47401460 b

    /dev/mem opened.

    Memory mapped at address 0xb6f66000.

    Read at address  0x47401460 (0xb6f66460): 0x5D

    [  642.273662] hid-generic 0003:2047:0301.0004: timeout initializing reports

    [  642.280831] hid-generic 0003:2047:0301.0004: device has no listeners, quitting

     

  • Maulin,

    The log shows USB0 is able to detect VBUS correctly in host mode.
    Can you please describe any hw and sw changes when running USB0 in host and device mode?
    Any hw mode?
    Did you rebuild kernel with any config change? what is the change?
  • Hello Bin,

    SW Change:

    I did not rebuild the kernel only thing I changed is device tree (only one line).

    usb@47401000 {
    status = "okay";
    /* USB 0 is peripheral - trying host mode */
    dr_mode = "host";
    };

    In regards to HW change I will summarize the change shortly.

    Thanks

    Maulin Lodhia