I'm trying to bring up a Generic HID (this is not a keyboard or mouse) on a Freescale Freedom Board FRDM-KL25Z.
I've included a bus capture and the setup_endpoint() code below.
When I run the USB 2. 0 Command Verifier tool on Windows7x64 I always get:
"ERROR Clear endpoint halt failed". Other tests always pass.
These Halt tests take ten seconds to run, while all the other tests take one second to run.
This seems suspicious to me. Is it normal for this Halt Feature test to take so long?
Below is three test runs of the Halt Endpoint Test, in Command Verifier.
First run is code returning the current status of the Halt bit, as the code should work.
Second run status always returns zero, and the third run status always returns 0x0001, to prove that changing the code changes the test results.
Halt Endpoint Test : Failed
INFO Start time: Wed Jul 31 09:55:25 2013
INFO Testing Interface number : 0 Alternate setting : 0
INFO Testing EndPoint type : Interrupt, Address : 81
INFO Endpoint is currently not halted
INFO Endpoint is halted
ERROR Clear endpoint halt failed
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 : Interrupt, Address : 2
INFO Endpoint is currently not halted
INFO Endpoint is halted
ERROR Clear endpoint halt failed
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: Wed Jul 31 09:55:36 2013
INFO Duration: 11 seconds. {This is a lot longer than an of the other tests take.}
INFO Stopping Test [ Halt Endpoint Test (Configuration Index 0):
Number of: Fails (2); Aborts (0); Warnings (0) ]
This test is run with mGET_STATUS returning zero on all requests:
INFO Start time: Wed Jul 31 10:02:30 2013
INFO Testing Interface number : 0 Alternate setting : 0
INFO Testing EndPoint type : Interrupt, Address : 81
INFO Endpoint is currently not halted
ERROR Endpoint could not be halted
ERROR Clear endpoint halt failed
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 : Interrupt, Address : 2
INFO Endpoint is currently not halted
ERROR Endpoint could not be halted
ERROR Clear endpoint halt failed
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: Wed Jul 31 10:02:41 2013
INFO Duration: 11 seconds. {This is a lot longer than an of the other tests take.}
INFO Stopping Test [ Halt Endpoint Test (Configuration Index 0):
Number of: Fails (2); Aborts (0); Warnings (0) ]
Test run with status always returning 0x0001:
Halt Endpoint Test : Failed
INFO Start time: Wed Jul 31 10:14:29 2013
INFO Testing Interface number : 0 Alternate setting : 0
INFO Testing EndPoint type : Interrupt, Address : 81
INFO Endpoint is currently halted
ERROR Clear endpoint halt failed
ERROR Could not clear endpoint halt
INFO Endpoint is halted
ERROR Clear endpoint halt failed
ERROR Could not clear 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 : Interrupt, Address : 2
INFO Endpoint is currently halted
ERROR Clear endpoint halt failed
ERROR Could not clear endpoint halt
INFO Endpoint is halted
ERROR Clear endpoint halt failed
ERROR Could not clear 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: Wed Jul 31 10:14:50 2013
INFO Duration: 21 seconds. {Even longer time.}
INFO Stopping Test [ Halt Endpoint Test (Configuration Index 0):
Number of: Fails (2); Aborts (0); Warnings (0) ]
Bus capture:
[Removed previous enumeration messages to keep this a reasonable length.]
2.087820167,GET_INTERFACE
2.087820167,DATA0,81,0A,00,00,00,00,01,00,DD,C8,
2.087828792,ACK
2.087837083,IN Add:2 EndPoint:0
2.087840375,NAK
2.087849083,IN Add:2 EndPoint:0
2.087852375,DATA1,00,40,BF,
2.087856750,ACK
2.087862917,OUT Add:2 EndPoint:0
2.087866167,DATA1,00,00,
2.087869458,ACK
2.089087625,SETUP Add:2 EndPoint:0
2.089090875,GET_STATUS
2.089090875,DATA0,82,00,00,00,81,00,02,00,1F,11,
2.089099500,ACK
2.089108875,IN Add:2 EndPoint:0
2.089112167,DATA1,00,00,FE,4F,
2.089117208,ACK
2.089130125,OUT Add:2 EndPoint:0
2.089133375,DATA1,00,00,
2.089136667,ACK
2.090311167,SETUP Add:2 EndPoint:0
2.090314417,SET_FEATURE
2.090314417,DATA0,02,03,00,00,81,00,00,00,25,11,
2.090323042,ACK
2.090331333,IN Add:2 EndPoint:0
2.090334625,DATA1,00,00,
2.090338250,ACK
2.090811167,SETUP Add:2 EndPoint:0
2.090814417,GET_STATUS
2.090814417,DATA0,82,00,00,00,81,00,02,00,1F,11,
2.090823042,ACK
2.090831750,IN Add:2 EndPoint:0
2.090835042,DATA1,01,00,FF,DF,
2.090840083,ACK
2.090849000,OUT Add:2 EndPoint:0
2.090852250,DATA1,00,00,
2.090855542,ACK
2.092060875,SETUP Add:2 EndPoint:0
2.092064125,CLEAR_FEATURE
2.092064125,DATA0,02,01,00,00,81,00,00,00,06,D1,
2.092072750,ACK
2.092081792,IN Add:2 EndPoint:0
2.092085083,DATA0,00,00,
2.092088708,ACK
[Long gap of only Start of Frames here. Why?]
7.095046917,SETUP Add:2 EndPoint:0
7.095050167,GET_STATUS
7.095050167,DATA0,82,00,00,00,81,00,02,00,1F,11,
7.095058792,ACK
7.095067167,IN Add:2 EndPoint:0
7.095070458,DATA1,00,00,FE,4F,
7.095075417,ACK
7.095081000,OUT Add:2 EndPoint:0
7.095084250,DATA1,00,00,
7.095087542,ACK
7.097046667,SETUP Add:2 EndPoint:0
7.097049917,GET_STATUS
7.097049917,DATA0,82,00,00,00,02,00,02,00,36,95,
7.097058542,ACK
7.097066917,IN Add:2 EndPoint:0
7.097070208,DATA1,00,00,FE,4F,
7.097075167,ACK
7.097080750,OUT Add:2 EndPoint:0
7.097084000,DATA1,00,00,
7.097087292,ACK
7.098296708,SETUP Add:2 EndPoint:0
7.098299958,SET_FEATURE
7.098299958,DATA0,02,03,00,00,02,00,00,00,0C,95,
7.098308583,ACK
7.098317292,IN Add:2 EndPoint:0
7.098320583,DATA1,00,00,
7.098324208,ACK
7.099546167,SETUP Add:2 EndPoint:0
7.099549417,GET_STATUS
7.099549417,DATA0,82,00,00,00,02,00,02,00,36,95,
7.099558042,ACK
7.099566917,IN Add:2 EndPoint:0
7.099570208,DATA1,01,00,FF,DF,
7.099575333,ACK
7.099584083,OUT Add:2 EndPoint:0
7.099587333,DATA1,00,00,
7.099590625,ACK
7.100800375,SETUP Add:2 EndPoint:0
7.100803625,CLEAR_FEATURE
7.100803625,DATA0,02,01,00,00,02,00,00,00,2F,55,
7.100812250,ACK
7.100820875,IN Add:2 EndPoint:0
7.100824167,DATA0,00,00,
7.100827792,ACK
[Long gap of only Start of Frames here. Why?]
12.104906625,SETUP Add:2 EndPoint:0
12.104909875,GET_STATUS
12.104909875,DATA0,82,00,00,00,02,00,02,00,36,95,
12.104918500,ACK
12.104926958,IN Add:2 EndPoint:0
12.104930250,DATA1,00,00,FE,4F,
12.104935291,ACK
12.104944041,OUT Add:2 EndPoint:0
12.104947291,DATA1,00,00,
12.104950583,ACK
[Nothing but Start of Frames from here on.]
Endpoint feature source:
static void usb_setup_endpoint( endpoint_t *const ep_ptr, USB_SETUP *const setup_ptr )
{
uint16_t status_u16 = 0U;
uint_fast8_t const ep_u8 = (setup_ptr->wIndex & 0x0FU);
switch( setup_ptr->bRequest )
{
case mCLR_FEATURE:
ep_ptr->features_u8 &= (uint8_t) ~FEATURE_ENDPOINT_HALT_MASK;
/* Clear_Feature(ENDPOINT_HALT) resets the ednpoint's data toggle to DATA0: */
ep_ptr->data01_u8 = BD_DATA0_MASK;
// USB0_ENDPT( ep_u8 ) &= ~USB_ENDPT_EPSTALL_MASK; /* Commented out for testing to see if problem is hardware or returned status */
usb_tx( ep_ptr, 0U, NULL ); /* ACK */
break;
case mSET_FEATURE:
ep_ptr->features_u8 |= (uint8_t) FEATURE_ENDPOINT_HALT_MASK;
// USB0_ENDPT( ep_u8 ) |= USB_ENDPT_EPSTALL_MASK; /* Commented out for testing to see if problem is hardware or returned status */
usb_tx( ep_ptr, 0U, NULL ); /* ACK */
break;
case mGET_STATUS:
if( 0 != (FEATURE_ENDPOINT_HALT_MASK & ep_ptr->features_u8) )
{
status_u16 = FEATURE_ENDPOINT_HALT_MASK;
}
// status_u16 = 0x0000U; // TESTING run two
// status_u16 = 0x0001U; // TESTING run three
usb_queue_tx( ep_ptr, 2U, (uint8_t *const) &status_u16 ); /* Processor is Little Endian */
break;
default:
iprintf("%u:EP[%u] ? R:0x%02X V:%u I:%u St:%u\r\n", __LINE__, ep_u8, setup_ptr->bRequest, setup_ptr->wValue, setup_ptr->wIndex, device_state_u8 );
ep_stall( ep_u8 );
break;
}
}
Clear_Feature(ENDPOINT_HALT) is being done in SetConfig and SetInterface per the spec.
Any insights?