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.

Linux/PROCESSOR-SDK-AM335X: USB keyboard issue

Part Number: PROCESSOR-SDK-AM335X
Other Parts Discussed in Thread: AM3354

Tool/software: Linux

Hi all,

We have custom board with AM335x and SDK7 used for development. There are two USB host ports available in our design for connecting gadget devices. The problem we have observed is USB device not responding some time when plug it. This issue happen only when two ports are using ex. USB port1 connected with Pen drive already and connecting USB keyboard on second port. This issue occurs randomly when try to connect the keyboard device.

Have applied patches from following link but no luck,

Can any one help on this?

Thanks -Durai

 

 

  • The USB experts have been notified. They will respond here.
  • Hi Durai,

    Do you see any dmesg error/failure logs when there is no response ?
  • Hi Dwarakesh,

    There is no error/failure response for USB in dmesg

    Thanks
    Durai
  • Hi Durai,

    I would suggest the following to get further logs/clue:
    1. Enable dev_dbg logging for MUSB driver.
    2. Try using USB Analyzer if available
    3. Or you can try using CONIFG_USB_MON kernel option to check more logging.
  • Durai,

    Here are a few steps to debug this issue.

    1. have you changed dr_mode to "host" for both usb ports in your dts file?
    2. please share your usb portion of your schematics for both usb ports;
    3. when a keyboard is attached but not enumerated, please dump the MUSB devctl register. Using console command "devmem2 0x47401c60 b", if the keyboard is attached to the 2nd port ( usb1 interface in the AM335x pin naming). If its value is *not* 0x19, the usb controller is not in the right state, the first two items above might tells what is wrong.
    4. If devctl register is 0x19, please use a scope to probe usb1_vbus, usb1_drvvbus, usb1_dp, and usb1_dm signals, while attaching the keyboard. We want to check if the electrical enumeration is correct or not.

    I will provide more instruction once we get there.
  • Bin Liu said:
    Durai,

    Please find the answers in line 

    1. have you changed dr_mode to "host" for both usb ports in your dts file?

    Have configured the USB ports as "host" devices 

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

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

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

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

                    usb@47401800 {
                        status = "okay";
                        dr_mode = "host";
                    };

                             dma-controller@07402000  {
                        status = "okay";
                    };
                };
    2. please share your usb portion of your schematics for both usb ports;

    CURRENT-LIMITED, POWER-DISTRIBUTION SWITCH
    Inline image 1
    ESD protection and USB receptacle Type A
    Inline image 2
    AM3354 USB section:
    Inline image 3


    3. when a keyboard is attached but not enumerated, please dump the MUSB devctl register. Using console command "devmem2 0x47401c60 b", if the keyboard is attached to the 2nd port ( usb1 interface in the AM335x pin naming). If its value is *not* 0x19, the usb controller is not in the right state, the first two items above might tells what is wrong.

    We are trying to reproduce the issue if issue occur, run the devmem command and let you know the values.


    4. If devctl register is 0x19, please use a scope to probe usb1_vbus, usb1_drvvbus, usb1_dp, and usb1_dm signals, while attaching the keyboard. We want to check if the electrical enumeration is correct or not.

    I will provide more instruction once we get there.

    Please review the schematics and give us your feedback 

  • Hi Bin,

    Have captured the signals and attached. 

    The Below attached signals captured when devctl register show 0x19.

    UsbSignalsCaptured_DevCtrl_Value_0x19.zip

    The Below attached signals captured when keyboard device is connected to USB1 port and USB thumb drive connected to USB2 port. keyboard is not enumerated when thumb drive is unplugged.

    UsbSignalAtUsbKeyboardHang_DevCtrlValue_0x5d.zip

    Regards

    Durai

  • Durai,

    The information you provided above tells the DevCtl register is 0x5D after usb devices are attached, it seems implying you read the register from a wrong usb port (unless you have a high-speed usb keyboard, which I have never seen). So please confirm you read DevCtl register from the usb port which the keyboard is connected to based on my information below.

    You referred the two usb ports as USB1 and USB2, which are not the names we normally called for AM335x. We call them USB0 and USB1 to match the pin naming on AM335x. USB0 port has pin names with prefix "usb0_" and USB1 port has pin names with prefix "usb1_" in the data sheet. Both usb controllers are identical so they both have a DevCtl register, but USB0 has its address as 0x47401460, and USB1 has its address as 0x47401c60. So please check your design to ensure you read the DevCtl register for the port which the keyboard is connected to.

    By the way, the schematics you attached above are broken, I cannot download them. Please upload again.

  • Hi Bin,

    Thanks for information. Have connected the usb keyboard to usb1 port and thumb drive to usb0 port. have red the Devctl register value 0x3d from usb1 port ( 0x47401c60 ) when keyboard is attached and enumerated.

      

    When we try to unplug and plug the thumb drive from usb0 port multiple times at certain point keyboard is not enumerating which is attached in usb1. This time red the Devctl value from 0x47401c60  it looks same value 0x3d. 

    Removed the keyboard and red the Devctl value which shows 0x19. Please find signals captured below 

    USB1SignalCapturedDevCtrlValue0x19.zip

    Please find the schematic below

     USB_Interface.pdf

    Regards

    Durai

  • Durai,

    Now 0x3D makes sense, it means the usb controller still detects the usb keyboard. Do you have an USB protocol analyzer to capture a bus trace for usb1 port when the issue happens?

    durai samy said:
    When we try to unplug and plug the thumb drive from usb0 port multiple times at certain point keyboard is not enumerating which is attached in usb1.

    While plug/unplug the thumb drive on the usb0 port, does the usb keyboard stays in the usb1 port or you unplug/plug it as well?

    How USB1_DRVVBUS and VBUS_USB1 signals are connected? They are not shown in the schematics you attached.

    Is it possible to test with the latest processor SDK to see if this issue still exist?

  • Hi Bin, 

                           Bin,

                           Do you have an USB protocol analyzer to capture a bus trace for usb1 port when the issue happens?

    We don't the USB protocol analyzer to check this issue. 

                            Bin,

                            While plug/unplug the thumb drive on the usb0 port, does the usb keyboard stays in the usb1 port or you unplug/plug it as well?

    Yes, keyboard is stays in the usb1 port while plug/unplug the thumb drive on the usb0 port. 

                            Bin,

                            How USB1_DRVVBUS and VBUS_USB1 signals are connected? They are not shown in the schematics you attached.

    USB0 and USB1 both signals connection are identical.

    Please find the below Block diagram of USB's connection and placement. USB signals routed from main board to Rear board with twisted pair cable.

    Will that creating the issues? 

    AM3354_USB_INTERFACE.pdf

    Thanks 

    Durai 

  • durai samy said:

    Please find the below Block diagram of USB's connection and placement. USB signals routed from main board to Rear board with twisted pair cable.

    Will that creating the issues? 

    This is not ideal, it could cause signal integrity problem, but I am not sure it causes this particular issue, you mentioned the usb1 (where the keyboard is connected to) devctl is 0x3D, which means the keyboard is still enumerated. It is just interesting that the kernel does not show any log when the problem happens...

    In your initial report you mentioned plugging/unplugging the keyboard causes it stop responding, but later you said plugging/unplugging the thumb drive on usb0 causes usb1 keyboard stop working. Can you please confirm what exactly you did to trigger the problem? How many times you did the plug/unplug? I have tried the similar procedure on AM335x GP EVM but was not able to see any issue.

    lsusb command on the board shows the usb address of the keyboard, please check if the address number is the same before and after the issue happened.

    Once the keyboard is enumerated, Linux generates /dev/input<n> node, applications get the keyboard events from this node. After the issue happend, can you please try 'cat /dev/input<n>' on your board then press any keys on the keyboard to see if 'cat' command can dump any garbage on the uart console? 

  • Hi Bin, 

    Thanks for reply, We have observed USB issue in below different testing  method 

    1). Plugging and unplugging multiple times of keyboard at certain time keyboard was not responding ( Confirmed the "NmLk" key with corresponding LED glow)

    2). Keyboard connected in one port and plugging and unplugging multiple times of thumb drive from other port at certain time keyboard was not responding

    3). Copying 80MB file from thumb drive to machine failed randomly. Copy command (cp) failed with Input/Output Error. In debug log got the "usb 1-1: reset high-speed USB device number 2 using musb-hdrc" error when it fails. 

    We are suspecting the signal integrity issue on both usb's so forced the USB speed from HIGH to FULL speed. This times have not observed the any issues so far but still testing is going on to confirm this changes really solved the issue. 

    Any thought? why it is not working with HIGH speed ?

    Thanks 

    Durai

  • Durai, thanks for this new information, very likely these issues are caused by signal integrity problem. Please check EyeDiagram first.
  • Durai,

    As Bin has mentioned, signal integrity is likely the problem here. Please refer to SPRAAR7 for PCB layout requirements.