lpcware

Control pipe stall problem in nxpusblib

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by mozmck on Wed Apr 11 14:01:39 MST 2012
I was having a problem with a control pipe stall not working correctly using nxpUSBlib 0.92

lusub -v in linux (Ubuntu 10.04) would pause and give a timeout when requesting the device qualifier and the debug descriptor.
My device was working in Linux, and also in Win XP on another machine, but it was not working in Win XP in VirtualBox or VMware, even though other USB devices were working.

   Anyhow, I managed to get it to work, but I'm not totally sure why it did not before because the User Manual is not very clear.  Page 251 of UM10360 shows the Set Endpoint Status command and bit 0 (ST) set to 1 should stall the endpoint.  But it also has the CND_ST (bit 7) which it says will stall both control endpoints.  Since it is the control endpoint which needed stalling, I changed the end of the USB_Device_ProcessControlRequest() function in DeviceStandardReq.c from this:

if (Endpoint_IsSETUPReceived())
{
Endpoint_ClearSETUP();
Endpoint_StallTransaction();
}

to this:

if (Endpoint_IsSETUPReceived())
{
Endpoint_ClearSETUP();
SIE_WriteCommandData( CMD_SET_EP_STAT(endpointhandle[endpointselected]), DAT_WR_BYTE(EP_STAT_CND_ST) );
}

And that fixed the problems.  My device works fine now in Win XP under VMware, and lsusb completes without delay and shows no timeouts.

If anyone can shed more light on this for me I'd appreciate it, and especially let me know if my change may break something else or not work in all cases.

Thanks,
Moses

Outcomes