Using the USB sample code of the RL-ARM library on MCB2300 develoment board. Started with the mass storage device example and modified for our application.
Is this example valid to USB specification? In particular concerned about flow control. I'm not clear if flow control in hw or sw or both. If not hardware, do these examples implement proper flow control? Our application may get some data and send time processing before reading more data.
Did you set timeout on the bulk pipe?
WinUsb_SetPipePolicy msdn.microsoft.com/.../aa476450.aspx PIPE_TRANSFER_TIMEOUT If the caller specifies a policy of PIPE_TRANSFER_TIMEOUT in PolicyType, WinUsb_SetPipePolicy sets the pipe transfer timeout policy parameter to the value that the caller specifies in Value.
The pipe transfer timeout policy parameter specifies the time-out interval, in milliseconds. The host cancels transfers that do not complete within the time-out interval. A value of zero means that transfers do not time out.
By default, the time-out value is zero, and the host never cancels a transfer because of a time-out. The Value parameter must point to a ULONG variable.
Tsuneo
Yes I did find this and yes that was exactly the problem.
So I'm getting close here, but...
My device now receives packets from the host, however it eventually hangs up anywhere after receiving 10-100 USB packets. I traced it to the Keil USB sample code (UsbHw.c) in the read operation. As part of a read it calls a funtion (WrCmd) to send a Clear Buffer command to the USB hardware so we can receive more packets. Part of the Clear Buffer command is to wait for the command buffer empty flag to be set. This sometimes never happens.
Any ideas?
Paul