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.

AM3703 USB Testmode

Other Parts Discussed in Thread: AM3703

Hello,

We have a USB issue on the AM3703 at cold temperature and we would like to generate an eye diagram from the onboard USB host controller.  I have a bare-metal memory test app that can be executed by u-boot.  I have tried without success to program the controller in the USB test mode to generate the test_packet required for the USB eye diagram.  I have the manual for the AM3703, and I can see the register set does support the test_mode, but I have not succeeded in getting it into test_mode.

As I understand it, the official USB compliance app from the USB-IF only runs on Windows, which doesn't help us with our embedded product.  I have also looked at the linux testusb code but it does not do what we want.  I don't believe our USB driver has support for this either, which would probably not be desired in a production driver anyway.

We are using kernel version is 2.6.39 armv7l

I was thinking even some pseudo code might help get me there .   I'm guessing my problem is with the L3 or L4 interconnect, as what I have seen so far is that when I try to read or write to the USB Host register set, I get data aborts.  My code has a data abort handler and that's where I end up.

For instance, I can access the General Purpose Timer 0 registers ok, and I can access the serial port ok, but for the USB host controller, I feel like I am not setting up some pre-requisite peripheral muxes or interconnects.    I have also tried to access the registers with different widths,:bytes, hword, word, etc but always get data abort.

Thanks for your help.

JC

  • JC,

    I have not used the AM37xx EHCI port, but I checked the TI 2.6.37 kernel for AM37x on Arago linux-omap3 project, drivers/usb/host/ehci-omap.c has implemented the interface for all the test modes including test-packet.I would think you can directly use it instead of implementing it in u-boot.

  • Hello,

    We saw this issue a few months back, and never really resolved it.  We have seen USB failures at low temperatures (-30 - -40 C).  We want to run the USB electrical tests per the USB spec.  In order to do this we followed the instructions at the following page.


    http://processors.wiki.ti.com/index.php/UsbgeneralpageLinux-v3p1#To_configure_the_USB_driver_features_through_menuconfig


    We got our kernel built and the /sys/kernel/debug entries for USB show up as they are supposed to, however, when setting the testmode as they outline on the webpage, we do not see any USB data on the bus, even though a register dump shows the testmode register correctly set.  I am thinking that maybe there is some more info that was left out, and perhaps there are additional things that need to be done?

    Any help would be appreciated.

    Thanks,

    Jamaal

  • Jamaal,

    Can you check that you have the MUSB configured as HOST prior to running the test script? 

  • Hi DK,

    We do an "echo "force host" > /sys/kernel/debug/musb/testmode" as they instruct on the web page.  However, is that really the correct way to do that?

    Here is my register dump after trying to do "test J",  the testmode register shows "02.  I'm not sure if that is correct, or should it really be "82", since bit 7 is "force host"?  Is there anything here to verify host mode?

    FAddr       : 00
    Power       : 20
    Frame       : 0000
    Index       : 0f
    Testmode    : 02
    TxMaxPp     : 0000
    TxCSRp      : 0000
    RxMaxPp     : 0000
    RxCSR       : 0000
    RxCount     : 0000
    ConfigData  : 33
    DevCtl      : 80
    MISC        : 00
    TxFIFOsz    : 07
    RxFIFOsz    : 07
    TxFIFOadd   : 0780
    RxFIFOadd   : 0780
    VControl    : 00000000
    HWVers      : 0720
    EPInfo      : ff
    RAMInfo     : 8c
    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

    Thanks!

  • Here is the way how I get the test packets out of musb on am37xx:

    1. Pull down the ID pin to ground;

    2. Set bit0 of MUSB_DEVCTL register to start the session. Double check MUSB_DEVCTL should be 0x19 now, which means musb is host mode.

    3. Call the following 3 lines, that will transmit the test packets continuously on the bus.

        musb_writeb(mbase, MUSB_TESTMODE, MUSB_TEST_PACKET);
        musb_load_testpacket(musb);
        musb_writew(musb->endpoints[0].regs, MUSB_CSR0, MUSB_CSR0_TXPKTRDY);
    

    You don't need 'force host'. But you have to put the 3 lines above into somewhere you can trigger it from the command line. In the 2.6.37 kernel in TI SDK for AM37xx, we have a procfs entry for it.

  • Thanks Bin!

    I really appreciate your help.  I have the 2.6.39 kernel with debugfs turned on.  I can see the debugfs entries as mentioned in the processors.wiki.ti.com article.   However, I'm a little confused about the procfs entries.  I see /proc/bus/usb/001/001, but I'm not sure if that is the correct entry for the musb host and how to get those commands in #3 to it. 

    The driver source code I am looking at has the musb_ functions you mention in #3, but I am not sure how I would call those from outside of the kernel.

    Thanks again

  • The procfs entry for test_packet is only available in the TI SDK 2.6.37 kernel, not in other kernels you got from kernel.org or anywhere else.

    The debugfs entry for test_packet in any kernel is incorrect. But it should be fixed with the patch below. Please apply this patch to your 2.6.39 kernel, and follow the follow steps, you should be able to get the test packets on the bus.

    procedure:

    1. ground the ID pin;
    2. # mount -t debugfs none /sys/kernel/debug/
    3. # echo 'test packet' > /sys/kernel/debug/musb/testmode

    patch to fix test_packet in debugfs:

    diff --git a/drivers/usb/musb/musb_debugfs.c b/drivers/usb/musb/musb_debugfs.c
    index f7414a8..88b1df6 100644
    --- a/drivers/usb/musb/musb_debugfs.c
    +++ b/drivers/usb/musb/musb_debugfs.c
    @@ -223,8 +223,28 @@ static ssize_t musb_test_mode_write(struct file *file,
                    test = MUSB_TEST_FORCE_HS;
     
            if (!strncmp(buf, "test packet", 10)) {
    +               u8 reg;
    +
    +               /*start session*/
    +               reg = musb_readb(musb->mregs, MUSB_DEVCTL);
    +               if (!(reg & MUSB_DEVCTL_SESSION)) {
    +                       reg |= MUSB_DEVCTL_SESSION;
    +                       musb_writeb(musb->mregs, MUSB_DEVCTL, reg);
    +               }
    +               mdelay(100);
    +
    +               /*check if session is set*/
    +               reg = musb_readb(musb->mregs, MUSB_DEVCTL);
    +               if (reg & MUSB_DEVCTL_BDEVICE)
    +                       ERR("ERROR: SESSION is not set. devctl 0x%x\n", reg);
    +
    +               /*start test_packet*/
                    test = MUSB_TEST_PACKET;
    +               musb_writeb(musb->mregs, MUSB_TESTMODE, test);
                    musb_load_testpacket(musb);
    +               musb_writew(musb->endpoints[0].regs,
    +                               MUSB_CSR0, MUSB_CSR0_TXPKTRDY);
    +               return count;
            }
     
            if (!strncmp(buf, "test K", 6))