Page 1 of 1

USB 2 CV Failed: Illegal FS bulk endpoint MaxPacketSize: 200

Posted: Tue Jan 17, 2017 2:05 pm
by Ricky
HW:XK-AUDIO-216-MC Development board,
Software: USB AUDIO 2.0 REFERENCE SOFTWARE

it will failed when using "usb 2 Command Verifier" to do the "Chapter 9 Tests".
screenshot is attached. and the failure is related to the MaxPacketSize.

Illegal full speed bulk endpoint MaxPacketSize : 200
(1.2.80) A Full speed Bulk endpoint must have a MaxPacketSize of
0x08/0x10/0x20/0x40.


from the code, I found the MaxPacketSize is set to 0x200 in the descriptor, it's fixed and will not change according to the USB Speed.

So I added some code after XUD_ResetEndpoint, try to modify the MaxPacketSize according to the return USBSpeed, but it seems when doing the test in "usb 2 CV", it will not reset the endpoint. Can someone provide some suggestion? Thanks a lot!


if (result == XUD_RES_RST)
{
#ifdef __XC__
g_curUsbSpeed = XUD_ResetEndpoint(ep0_out, ep0_in);
#else
g_curUsbSpeed = XUD_ResetEndpoint(ep0_out, &ep0_in);
#endif
g_currentConfig = 0;
g_curStreamAlt_Out = 0;
g_curStreamAlt_In = 0;

printstrln("XUD_ResetEndpoint");
printstr("g_curUsbSpeed = ");
printintln(g_curUsbSpeed);
#if 1 //Code added
//For HS, the max packet size is 0x200
if(g_curUsbSpeed == XUD_SPEED_HS) {
cfgDesc_Audio2.configDesc_Midi[68] = 0x00;
cfgDesc_Audio2.configDesc_Midi[69] = 0x02;
cfgDesc_Audio2.configDesc_Midi[82] = 0x00;
cfgDesc_Audio2.configDesc_Midi[83] = 0x02;
}
else{//For FS, the max packet size is 0x40
cfgDesc_Audio2.configDesc_Midi[68] = 0x40;
cfgDesc_Audio2.configDesc_Midi[69] = 0x00;
cfgDesc_Audio2.configDesc_Midi[82] = 0x40;
cfgDesc_Audio2.configDesc_Midi[83] = 0x00;
}
#endif

Re: USB 2 CV Failed: Illegal FS bulk endpoint MaxPacketSize:

Posted: Wed Jan 18, 2017 5:02 pm
by larry
What version of USB Audio reference software are you using?

Re: USB 2 CV Failed: Illegal FS bulk endpoint MaxPacketSize:

Posted: Thu Jan 19, 2017 10:44 am
by Ricky
sw_usb_audio-[sw]_6.15.2rc1

Re: USB 2 CV Failed: Illegal FS bulk endpoint MaxPacketSize:

Posted: Thu Jan 19, 2017 2:10 pm
by larry
Ok, I see what's happening. Our default configuration is to return a USB audio class 2 descriptors in both high speed and full speed. With MIDI enabled, these will both have a bulk endpoint of max packet size 512. That's too much for full speed, where you can have only up to 64.

You can configure your firmware to return a class 1 descriptor in full speed instead. To do that, set FULL_SPEED_AUDIO_2 to 0 and AUDIO_CLASS_FALLBACK to 1 in customdefines.h. Does that make the CV test pass?

Re: USB 2 CV Failed: Illegal FS bulk endpoint MaxPacketSize:

Posted: Fri Jan 20, 2017 12:18 pm
by Ricky
if I changed the code as your suggestion, the HS test will failed. the MaxPacketSize need to be modified dynamiclly according to the usb speed.

Endpoint descriptor raw MaxPacketSize : 40
Endpoint descriptor interval : 0
Illegal high speed bulk endpoint MaxPacketSize : 40
(1.2.81) A High speed Bulk endpoint must have a MaxPacketSize of 0x200.

Endpoint descriptor length : 9
Endpoint descriptor type : 5
Endpoint Type : Bulk, Number : 2, Direction : IN
Endpoint descriptor bmAttributes : 2

Re: USB 2 CV Failed: Illegal FS bulk endpoint MaxPacketSize: 200

Posted: Fri Feb 10, 2017 6:52 am
by Ricky
does anyone has good suggestion?

Re: USB 2 CV Failed: Illegal FS bulk endpoint MaxPacketSize: 200

Posted: Fri Feb 10, 2017 3:30 pm
by larry
Sorry, I'm not sure how it could return 64 in high speed. In the latest code base, cfgDesc_Audio2 has wMaxPacketSize set to 0x200, regardless of FULL_SPEED_AUDIO_2 and AUDIO_CLASS_FALLBACK.

Code: Select all

    0x01,                                 /* 4 wMaxPacketSize : 512 bytes per packet. (field size 2 bytes) - has to be 0x200 for compliance*/
    0x02,                                 /* 5 wMaxPacketSize */
Do you happen to have a USB protocol trace that you could post?

Re: USB 2 CV Failed: Illegal FS bulk endpoint MaxPacketSize: 200

Posted: Fri Feb 24, 2017 10:37 am
by Ricky
seems it's not supported by default. thanks a lot!