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

Technical discussions around xCORE processors (e.g. General Purpose (L/G), xCORE-USB, xCORE-Analog, xCORE-XA).
Ricky
Junior Member
Posts: 7
Joined: Sat Oct 01, 2016 8:47 am

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

Postby Ricky » Tue Jan 17, 2017 2:05 pm

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
You do not have the required permissions to view the files attached to this post.
View Solution
User avatar
larry
Respected Member
Posts: 275
Joined: Fri Mar 12, 2010 6:03 pm

Postby larry » Wed Jan 18, 2017 5:02 pm

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

Postby Ricky » Thu Jan 19, 2017 10:44 am

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

Postby larry » Thu Jan 19, 2017 2:10 pm

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

Postby Ricky » Fri Jan 20, 2017 12:18 pm

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

Postby Ricky » Fri Feb 10, 2017 6:52 am

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

Postby larry » Fri Feb 10, 2017 3:30 pm

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

Postby Ricky » Fri Feb 24, 2017 10:37 am

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

Who is online

Users browsing this forum: No registered users and 1 guest