USB 2 CV Failed: Illegal FS bulk endpoint MaxPacketSize: 200 Topic is solved

Technical discussions around xCORE processors (e.g. xcore-200 & xcore.ai).
Post Reply
Ricky
Junior Member
Posts: 7
Joined: Sat Oct 01, 2016 8:47 am

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

Post 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
Attachments
usb2cv.PNG
(128.65 KiB) Not downloaded yet
usb2cv.PNG
(128.65 KiB) Not downloaded yet


View Solution
User avatar
larry
Respected Member
Posts: 275
Joined: Fri Mar 12, 2010 6:03 pm

Post by larry »

What version of USB Audio reference software are you using?
Ricky
Junior Member
Posts: 7
Joined: Sat Oct 01, 2016 8:47 am

Post by Ricky »

sw_usb_audio-[sw]_6.15.2rc1
User avatar
larry
Respected Member
Posts: 275
Joined: Fri Mar 12, 2010 6:03 pm

Post 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?
Ricky
Junior Member
Posts: 7
Joined: Sat Oct 01, 2016 8:47 am

Post 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
Ricky
Junior Member
Posts: 7
Joined: Sat Oct 01, 2016 8:47 am

Post by Ricky »

does anyone has good suggestion?
User avatar
larry
Respected Member
Posts: 275
Joined: Fri Mar 12, 2010 6:03 pm

Post 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?
Ricky
Junior Member
Posts: 7
Joined: Sat Oct 01, 2016 8:47 am

Post by Ricky »

seems it's not supported by default. thanks a lot!
Post Reply