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.

AM335x: USB Babble Interrupt upon USB remote wakeup

We have run in to a reproducible problem with a USB device connected to a Beagle Bone Black Rev. A5C.


We wish to suspend the USB link between the host (Beagle Bone Black configured in host mode) and the device. The device support remote wakeup (a.k.a. remote resume.) This works fine, and host-initiated resume works fine as well. But whenever we try to resume from the device, we get the dreaded "CAUTION: musb: Babble Interrupt Occurred" entry in dmesg.

Our setup is as follows:


The USB host is a Beagle Bone Black running Linux 3.13.

The USB device is an OMAP L-138 running a custom eCos.

The device has shown to successfully support suspend/resume including remote wakeup if connected to a PC.

The device is connected directly to the USB controller, with no additional hubs between. It is the only device on the bus.
If remote wakeup is attempted while connected to the BBB, the following error is seen in the kernel log (extended USB debugging enabled.)

Jan  1 00:03:06 bganut kernel: [  186.643735] hub 1-0:1.0: hub_resume
Jan  1 00:03:06 bganut kernel: [  186.643790] CAUTION: musb: Babble Interrupt Occurred
Jan  1 00:03:06 bganut kernel: [  186.643814] hub 1-0:1.0: port 1: status 0507 change 0004
Jan  1 00:03:06 bganut kernel: [  186.643893] hub 1-0:1.0: state 7 ports 1 chg 0002 evt 0002
Jan  1 00:03:06 bganut kernel: [  186.657143] usb 1-1: usb wakeup-resume
Jan  1 00:03:06 bganut kernel: [  186.657211] usb 1-1: usb auto-resume
Jan  1 00:03:06 bganut kernel: [  186.698134] usb 1-1: finish resume
Jan  1 00:03:11 bganut kernel: [  191.698230] usb 1-1: khubd timed out on ep0in len=0/2
Jan  1 00:03:11 bganut kernel: [  191.698261] usb 1-1: retry with reset-resume
Jan  1 00:03:11 bganut kernel: [  191.803667] usb 1-1: reset high-speed USB device number 2 using musb-hdrc

The problem occurs every time we attempt to remote wakeup.

The behaviour is unchanged on Linux 3.8

  • This forum supports only the TI distributed Linux EZSDK, which currently is v.3.2. For support of BB Black and other versions of Linux please turn to the community at http://www.beagleboard.org/Community/Forums.
  • The affected USB SW components are virtually unchanged since 3.2 (and before.) I'd wager that the issue persists on the 3.2-based EZSDK.

  • Here is feedback from the factory team:
     
    "TI does not officially support mainline 3.13 kernel yet, especially on the USB module. It is better to run the same test with TI SDK 3.2 kernel (note: not mainline 3.2 kernel).
    We validated remote wakeup with usb keyboard/mouse on AM335x GP EVM with TI SDK 3.2 kernel and did not have such babble issue."
  • Could you describe how you tested remote resume with a mouse so I can test it here?

    I have tested with the latest 3.2 kernel from TI (linux-3.2.0-psp04.06.00.11) and it does not

    resume properly. My test:


    attach a mouse to the host port on the beaglebone black

    Do something like this to enable autosuspend and remote wakeup:

    echo enabled > /sys/bus/usb/devices/1-1/power/wakeup
    echo auto > /sys/bus/usb/devices/1-1/power/control

    Dump events from the mouse:

    cat /dev/input/mouse0

    Then I get the events from the mouse in binary form on the terminal.

    When the suspend kicks in after several seconds I use the mouse again and

    nothing happens. Even a button press gives nothing on the terminal. With some

    debug in the kernel I can see that the beaglebone gets the resume signalling but

    does not resume the usb mouse device properly.

    If I terminate the "cat /dev/input/mouse0" and start it again events are again dumped until

    the mouse goes asleep again. The close and reopen causes a host side resume which always works.

    When the system tries to resume (from a mouse click) I have traced the flow to here:

    int usb_remote_wakeup(struct usb_device *udev)
    {
            int     status = 0;

            if (udev->state == USB_STATE_SUSPENDED) {
                    dev_dbg(&udev->dev, "usb %sresume\n", "wakeup-");
                    status = usb_autoresume_device(udev);

    where usb_remote_wakeup is called with the musb host device. The udev->state is not suspended so

    no resume is attempted and the flow stops here. It seems to me that there is something wrong with the musb host controller's state when it reports that it is not suspended.

    The same test carried out on a PC where we dump the state of the host controller (UHCI) at the same point shows it to be suspended and the call to usb_autoresume_device ends with the mouse returning to fully active and functioning state.


    It seems to me that remote resume does *not* work on the 3.2 TI kernel now (perhaps it has worked at some point in the past) neither for a mouse nor for our own device.

  • It should be mentioned that with the 3.2 TI kernel we don't get the babble interrupt. Whether that'll start happening once the above issue has been fixed is anyone's guess.

  • Brian Murphy67318 said:
    echo enabled > /sys/bus/usb/devices/1-1/power/wakeup
    echo auto > /sys/bus/usb/devices/1-1/power/control

    This is only enabling selective suspend on the mouse device, I believe you have to do the same on usb1 bus as while.

    But I just tried it, and remote wakeup still does not work. I can see the remote wakeup attribute is not enabled before the bus goes to suspend. I will look into it and get you back when I have an answer.

  • I believe since the mouse is directly connected to the root hub, and hubs are the only USB device with power management and autosuspend enabled by default in Linux, everything works out alright.

    Any news on the remote wakeup attributes?

  • Through a colleague who is working on something else I found that this kernel based on 3.12.x stable:

    http://git.ti.com/ti-linux-kernel/ti-linux-kernel/commits/ti-linux-3.12.y


    has full power management support and remote wakeup from usb works!

    Could you not have told us this? At the very least when the official 3.2 kernel was demonstrated not to work...

  • Brian Murphy67318 said:
    Any news on the remote wakeup attributes?

    Sorry, I just came back from a long vacation and have not started debug it yet. I remembered it worked before on TI 3.2 kernel.

    Brian Murphy67318 said:
    Could you not have told us this?

    This 3.12 kernel is still under development and has not been released. You could use it for now for evaluation but will not be able to get official support from TI at this moment.

  • hi TI

    i am using sitara sdk 07 and BBB, i am using arago-base file system

    i want to expose eMMC/SD fat partition as usb storage (should be detected by windows) can you please provide the necessary steps ?

    regards

    Nagendra

  • From another thread http://e2e.ti.com/support/embedded/linux/f/354/p/106554/1190890.aspx#1190890, it seems you have some progress on this.

    To understand why Windows host does not recognize the MSC gadget, please plug the BBB board into a Linux host, then capture the log of command 'dmesg | tail -n 30' on the Linux host and post it here.

  • hi TI,

    it is working with proper command line arguments

    now  i have another question

    i want USB1 of BBB to be used in device mode

    i did following work around :

             i write the register USB1MODE (0x474018e8) to the value 0x180 (force device mode)

             connected usb1 of bbb to win-PC using USB A to A cabel, and detecting as a unknown usb device in

             u-boot.  but not in kernel

    may i know the reason ? and can you please suggest proper way how can i use USB-1 also in device mode ?

    regards

    nagendra

  • Nagendra,

    The BBB USB1 port is designed for host-only mode. There are multiple factors which affect the MUSB mode switching, USBx_MODE register or ID pin status is just one of them.

    The BBB USB0 port is designed for device-only mode. Why you want to use USB1 port instead?

  • hi TI,

    thank you very much

    i got your inputs. but we have a design (based on BBB) in which, the mode change is required using SW commands, we do not have ID pins connected for usb1 in our final product

    so i would like to know how can we achieve this, how can i tell the gadget module to use which usb ?

    regards

    Nagendra

  • Nagendra,

    You want USB1 to be in device-only mode? or dual-role mode which can switch between host and device mode based on the ID pin status?

    nagendra bankupalli said:
    how can i tell the gadget module to use which usb ?

    For USB0 and USB1, if only one port is configured as otg, you can only one gadget driver for that otg controller. But if both are configured as otg, you should load two gadget drivers, the first is for USB0, and the second is for USB1.

  • first thank you,

    the requirement is USB1 should be otg and should be configured as device/host using SW (not using ID pin), using USB1MODE register


    so how can i achieve ?

    1. configuring USB to OTG on BBB ?

    2. how can i use USB1MODE (sw control) effectively ?

    3. is USB0 in OTG mode for BBB ?

    4. if USB1 in otg, the g_multi, will the module g_multi work if inserted second time ?

    regards

    nagendra

  • Nagendra,

    nagendra bankupalli said:

    1. configuring USB to OTG on BBB ?

    2. how can i use USB1MODE (sw control) effectively ?

    I never tried to set BBB USB1 to OTG mode, but I guess you can try the following.

    - set dr_mode = "otg" for USB1 in dts;

    - set USB1MODE = 0x180, then connect BBB USB1 port to USB host, BBB should work in USB device mode;

    - set USB1MODE = 0x80, then connect a USB device to BBB USB1 port, BBB should work in USB host mode;

    If any of the two tests above does not work, get the MUSB register dump by 'cat /sys/kernel/debug/musb-hdrc.1.auto/regdump'.

    nagendra bankupalli said:
    3. is USB0 in OTG mode for BBB ?

    No, BBB USB0 is in device-only mode. But the AM335x GPEVM USB0 is in OTG mode.

    nagendra bankupalli said:
    4. if USB1 in otg, the g_multi, will the module g_multi work if inserted second time ?

    No, the gadget driver can only be loaded *ONCE*.

  • i tried following

    1. added line "otg"  in the file am335x-bone-common.dtsi as below

                                 usb@47401800 {
                                            status = "okay";
                                             dr_mode = "otg";
                                  };
    created dtb file "am335x-boneblack.dtb" and copied to /boot/ folder

    2. booted normally,  the output cat /sys/kernel/debug/musb-hdrc.1.auto/regdump is

    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      : 80
    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

    ************* (all zeros)

    DMA_CNTLch7 : 0000
    DMA_ADDRch7 : 00000000
    DMA_COUNTch7: 00000000

    3. now changed the register USB1MODE to 180  with memory r/w utility

    root@am335x-evm:/boot# ./test 0x474018e8
    0x00000100
    root@am335x-evm:/boot# ./test 0x474018e8 0x180
    root@am335x-evm:/boot# ./test 0x474018e8
    0x00000180
    root@am335x-evm:/boot#

    4.  the output cat /sys/kernel/debug/musb-hdrc.1.auto/regdump is same as before

    5. connected the usb1 to host machine (still usb0 is connected to host pc)

    6. the output cat /sys/kernel/debug/musb-hdrc.1.auto/regdump is same as above except

     DevCtl      : 98

    observations :

    1. if i remove usb0 the system is power is off

    2. if i do above wiht out "otg" added to dtb file, the system is not loosing power if i remove usb0, means it is drawing power from isb1

    3. so i have not removed the usb0

    4. now i inserted the g_multi module is working fine (since usb0 is available)

    5. if i do same with old dts file (wiht out otg option), BBB is able to work with out usb0 (taking power from usb1).

        but nothing working even after inserting g_multi module

    queries ?

    1. according to previous discussion, we have to insert gadget module twice if both usbs are in device mode, now you are saying gadget module should be inserted once ! can you clarify ?

    2. how can i use USB1 and USB0 simultaneously as gadgets ? (export different memory partitions to separately)?

    3. according to previous discussion/posts, after changing USB1MODE reg, we need to control DEVCTL[SESSION], how can i do this ?

    thanks and regards

    Nagendra

  • Nagendra,

    nagendra bankupalli said:
    1. according to previous discussion, we have to insert gadget module twice if both usbs are in device mode, now you are saying gadget module should be inserted once ! can you clarify ?

    Sorry for the confusion, I meant the same gadget driver cannot be loaded more than once. So if both USB ports are in OTG mode, you have to load two different gadget drivers.

    But, what is your exact use case? Why you want the both ports to be in OTG mode?

    nagendra bankupalli said:
    2. how can i use USB1 and USB0 simultaneously as gadgets ? (export different memory partitions to separately)?

    What gadgets are they? If MSC gadget, how to use the memory partition is up to your application, the kernel does not care.

    nagendra bankupalli said:
    3. according to previous discussion/posts, after changing USB1MODE reg, we need to control DEVCTL[SESSION], how can i do this ?

    set bit0 of DEVCTL register. You only need to do this when the MODE register is 0x80 - in host mode.