Control pipe stall problem in nxpusblib

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Control pipe stall problem in nxpusblib

640 Views
lpcware
NXP Employee
NXP Employee
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
Labels (1)
0 Kudos
1 Reply

585 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by tuong on Fri Apr 13 15:37:52 MST 2012
Dear Mozmck,

You are correct! Changing EP_STAT_ST to EP_STAT_CND_ST helps the stack send stall on requesting to control endpoint. As EP_STAT_CND_ST only effects on control endpoint, and you are intend to send stall in USB_Device_ProcessControlRequest(), so I think this is the suitable place and no harm to the other activities.

With best regards,
Tuong Nguyen
0 Kudos