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.

Problem in USB2.0 TEST MODE ----TEST_PACKET.



Dear All,

Here I had another problem in TEST MODE ----TEST_PACKET.

My env.

1.AM335X_StarterWare_02_00_01_01 source code

2.Use 0x4740140F (USB0_BASE+TEST_MODE)

I use the AM335X_StarterWare_02_00_01_01 source code to implement USB TEST_MODE.

According pdf file.

//========================================================================

2 8 . 4 . T E S T _ PACKET
To execute the Test_Packet test, the software should:
(i) Start a session (if the core is being used in Host mode).
(ii) Write the standard test packet (shown below) to the Endpoint 0 FIFO.
(iii) Write 7’h08 to the TestMode register to enter Test_Packet test mode.
(iv) Set the TxPktRdy bit in the CSR0 register (D1).
The 53 byte test packet to load is as follows (all bytes in hex). The test packet only has to be loaded once; the MUSBMHDRC will
keep re-sending the test packet without any further intervention from the software.
00 00 00 00 00 00 00 00
00 AA AA AA AA AA AA AA
AA EE EE EE EE EE EE EE
EE FE FF FF FF FF FF FF
FF FF FF FF FF 7F BF DF
EF F7 FB FD FC 7E BF DF
EF F7 FB FD 7E
This data sequence is defined in Universal Serial Bus Specification Revision 2.0, Section 7.1.20. The MUSBMHDRC will add the
DATA0 PID to the head of the data sequence and the CRC to the end.

//========================================================================

The pdf list four parts to implement.

 

(i)I use the device0 not a host so that I skip (i).

(ii)I use the API USBEndpointDataPut to put PATTEN(53bytes) to FIFO

"USBEndpointDataPut(0x47401400, USB_EP_0, TESTPATTEN, 53);"   //TESTPATTEN[53]={0x00,.......0x7E}

(iii) HWREGB(0x047401400 + USB_O_TEST)   |= 0x08; 
(iv) HWREGB(0x047401400 + USB_O_CSRL0)|= 0x02; 

And I use the protocol analyzer capture the packet , USBDevice did not sent TESTPATTEN(53Bytes).

Is that another register need to set?

What should I do when I occur this condition?

  • Hi Smomo,

    Have you ensured that the MUSB has been configured in device mode properly.  The right way would have been to enter into test mode once you receive a SET_FEATURE - TEST_MODE command from the host. Have you taken any of the StarterWare USB device examples to begin this exercise?

    The sequence of steps that you need to put the controller in test mode :

    1. Configure the controller to operate in Peripheral mode ( can be done in host mode also) - this can be done by using any of the device mode examples as provided by the StarterWare package.

    2. Copy the test packet into EP0 FIFO and configure the TESTMODE register.

    3.Set the TxPktRdy bit for EP0.

    USB_O_TEST - needs to be at an offset of 0x0F

  • Hi Vineeth,

    Thanks for your reply.

    I use the Starterware example "usb_dev_bulk" and I add some code to enable TESTMODE register in USBDSetFeature for recevice Control transfer command from host software (HS ElectricalTestTool.exe).

    ---1. Configure the controller to operate in Peripheral mode ( can be done in host mode also) - this can be done

    ---   by using any of the device mode examples as provided by the StarterWare package.

        I use example "usb_dev_bulk"  based and I think conteroller in Peripheral mode .

    ---2. Copy the test packet into EP0 FIFO and configure the TESTMODE register.

    ---3.Set the TxPktRdy bit for EP0.

        When I recevice the command (TEST_PACKET) form PC software.

        I will do following steps. 

        USBEndpointDataPut(0x47401400, USB_EP_0, TESTPATTEN, 53);     // Copy to FIFO Buffer

        ulByteCount = HWREGH(g_USBInstance[0].uiBaseAddr + USB_O_COUNT0 + USB_EP_0);
        ulFIFO = g_USBInstance[0].uiBaseAddr + USB_O_FIFO0 + (USB_EP_0 >> 2);
        UARTprintf("ulByteCount= 0x%x,  addr=0x%x\r\n",ulByteCount,ulFIFO);      

         HWREGB(g_USBInstance[0].uiBaseAddr + USB_O_TEST) |= 0x08;                                  //0x4740140F
         HWREGB(g_USBInstance[0].uiBaseAddr + USB_O_CSRL0)= USB_CSRL0_TXRDY;  //0x47401502

         log= USBSHOWREG(g_USBInstance[0].uiBaseAddr,USB_O_DEVCTL);
         UARTprintf("USB_O_DEVCTL= 0x%x \r\n",log);    
         log= USBSHOWREG(g_USBInstance[0].uiBaseAddr,USB_O_TEST);
         UARTprintf("USB_O_TEST= 0x%x \r\n",log);   
         log= USBSHOWREG(g_USBInstance[0].uiBaseAddr,USB_O_CSRL0);
         UARTprintf("USB_O_CSRL0= 0x%x \r\n",log);  

    Log is

    ulByteCount = 0x0  ,addr=0x47401420    ==>Why I use the API (USBEndpointDataPut();  ) and the FIFO buffer still 0 bytes?  

    USB_O_DEVCTL= 0x99
    USB_O_TEST      = 0x8
    USB_O_CSRL0  = 0x2

    Do you know what step is wrong or other method I should try?

    If you have any query, please feel free contact me.

    Smomo