Search This Blog

Dec 3, 2012

USB CDC command verifier test


1.       Run USB 2.0 Command Verifier

·         It display below message, we need choose second host controller.

But when we select it USB mouse and keyboard lose control, we need find PS2 mouse and then we can continue testing.
·         It opens window like below, we click on Run button, but get error.



Screen clipping taken: 12/3/2012 4:56 PM
 The reason is We have a Card reader socket in LCD monitor, so that is a mass storage device which is not allowed by USB CV.  Disable USB Mass Storage Device in Device Manager.

·         And then we run it again, and select our device VID=10c4, PID=A002



Screen clipping taken: 12/3/2012 4:57 PM
·         Here is the result, we passed most of tests, but failure with item "Halt Endpoint Test".



Screen clipping taken: 12/3/2012 5:00 PM
·         Description of Halt Endpoint Test failed.
Halt Endpoint Test  Failed
INFO  Start time: Mon Dec 03 16:58:38 2012
INFO  Testing Interface number : 0 Alternate setting : 0
WARNING  SetInterface with interface number : 0 failed.
INFO  Testing EndPoint type : Interrupt, Address : 81
INFO  Endpoint is currently not halted
ERROR  Endpoint could not be halted
INFO Cleared endpoint halt
FAIL (1.2.91) A device that has Bulk/Interrupt endpoints must support the Halt Endpoint request on those endpoints.
INFO  Testing Interface number : 1 Alternate setting : 0
WARNING  SetInterface with interface number : 1 failed.
INFO  Testing EndPoint type : Bulk, Address : 3
INFO  Endpoint is currently not halted
ERROR  Endpoint could not be halted
INFO  Cleared endpoint halt
FAIL  (1.2.91) A device that has Bulk/Interrupt endpoints must support the Halt Endpoint request on those endpoints.
INFO  Testing EndPoint type : Bulk, Address : 82
INFO   Endpoint is currently not halted
ERROR  Endpoint could not be halted
INFO  Cleared endpoint halt
FAIL  (1.2.91) A device that has Bulk/Interrupt endpoints must support the Halt Endpoint request on those endpoints.
INFO  Stop time: Mon Dec 03 16:58:55 2012
INFO  Duration: 17 seconds.
INFO  Stopping Test [ Halt Endpoint Test (Configuration Index 0): Number of: Fails (3); Aborts (0); Warnings (2) ]

2.       Analysis.
·         Capture USB data during "Halt Endpoint Test" from Ellisys USB protocol explorer. We know USB CV execute two command. Since the protocol analyzer communicate with PC through USB interface, and CV run, the USB driver was replaced, USB protocol software won't work. We have to setup USB protocol analyzer software in another PC.
·         First it execute SetFeature() to halt endpoint  and then GetStatus to learn whether endpoint halt. From the log, I can see that GetStatusreports that Endpoint doesn't halted.


Screen clipping taken: 12/3/2012 7:25 PM
3.       Check code.
In GetStatus() function we see below code.
   CurrentStatus = Endpoint_IsStalled();
Check Endpoint_IsStalled(),
if(Endpoint_GetEndpointDirection()== ENDPOINT_DIR_IN)
{
status = USB_EPn(usb_ep_selected)->EPCONTROL.ISTSTLI;
}
else
{
status = USB_EPn(usb_ep_selected)->EPCONTROL.OSTSTLI;
}
We should not judge endpoint stall status by those two bit, but instead of below code.
if(Endpoint_GetEndpointDirection()== ENDPOINT_DIR_IN)
{
status = USB_EPn(usb_ep_selected)->EPCONTROL.ISDSTL;
}
else
{
status = USB_EPn(usb_ep_selected)->EPCONTROL.OSDSTL;
}

4.       Verify
Run USB CV again, we pass the "Halt Endpoint Test"

No comments: