xxxxx@gmail.com wrote:
Thanks for the reply. I meant 3 strikes as 3 times retry of the same packet if the packet encounters an error. I am sending the data to the device in a bulk out pipe asynchronously using WinUsb_Writepipe command. I used Lecroy to get the trace of the USB packets. In one particular case, my software pushed/ queueud 3 USB transfers of size 4816968(A), 40(B), and 4827744 (C). For the first transfer the host breaks into 512 bytes packets and sends to device, when it is sending the 8192th packet of 512 bytes, the ACK from Device gets lost, then Host sends 3 pings continously, and device ACK it but looks like the host is not seeing the ACKs and it drops (not sending) the Current transfer(A). The Last PID in the transfer A is DATA1. The WinUsb_GetOverlappedResult fails and return numbers ofbytes transmitted as 2097152. The host controller sends the second(B) transfer with the same PID(DATA1, lecroy shows as data toggle error) but device acknowledges it, and host s/w proceeds to the next packet C. My device has a FIFO and it realzes the comamnds are not proper Incomplete A is appended with B, and then wiith C.
Your transfers are too large. Windows does not support transfers larger
than about 3MB on a high-speed device. Check this knowledge base
article, which is on my FAQ list:
http://support.microsoft.com/kb/832430
Try breaking your transfers up into chunks of 1048576 bytes (make sure
it’s an even multiple of 512). My guess is that will solve your problem.
I’m not aware of any “three strikes and you’re out” policy in the USB
protocol at all. A bulk operation should retry until the sun burns out,
unless the device leaves the bus.
Having explained the problem, Now my first Question. Is there any way that i can stop the Host not to send any more data after the first error transmission(i.e at A)?.
A 5MB transfer is going to take more than 150ms to execute. As I see
it, there’s really no point in submitting multiple requests
simultaneously. Why don’t you just wait until the first one succeeds
before submitting the second? That would solve the problem, wouldn’t it?
Once tranmission fails, i call WinUSB_AbortPipe Call, and all the submitted transfers fails with WinUSB_GetOverlappedResult as zero and the getlasterror shows ERROR_OPERATION_ABORTED(995) code and my data structure shows these are for 40 bytes packet(B) and 2097152(C) bytes packets. But i do see those packets wire. The packets are not really aborted. But Windows says it is aborted. Why is that?.
“Abort pipe” is a low-level operation that aborts any requests
outstanding on the pipe. It’s possible that, because your first
transfer was so large, WinUSB hadn’t actually submitted the second and
third transfers yet, so they weren’t aborted. I’m making that up,
however. I’m not sure.
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.