PORTS Forum

Ports and Interfaces => USB => Topic started by: sudheerg_ on January 12, 2017, 04:32:04 am

Title: WinUSB Read Pipe
Post by: sudheerg_ on January 12, 2017, 04:32:04 am
Hi,

We are using WinUSB For reading from a custom device. When we connect to a laptop after running for some time the WinUSB ReadPipe function fails to read data from the device and the GetLastError reports the following value: 0x48F (ERROR_DEVICE_NOT_CONNECTED). But, if I had a look at device manager the device is populated there.

What is the best way to figure out what is going on. We are sending a lot of data over Bulk IN Endpoint around (614000 bytes for every 30mS).

Thank You for your time.

Best Regards,
GSR
Title: Re: WinUSB Read Pipe
Post by: Jan Axelson on January 12, 2017, 09:37:16 pm
Best is if you can connect a hardware-based protocol analyzer and watch what happens when you try to read data.

It's likely that the device is failing to respond to IN token packets with data or NAK.
Title: Re: WinUSB Read Pipe
Post by: sudheerg_ on January 12, 2017, 11:13:27 pm
Hi Jan,

Thank You for your reply and time.

I have Advisor T3, my understanding is it has a limitation of how much it can capture. I was not able to configure it to capture for infinite time.

Let me know if any one in this forum know how to configure it to capture for infinite duration. I have used spooled mode available in advisor T3, and I have sufficient hard disk space 700 GB, but the analyzer stops after capturing for some time.

Regards,
GSR
Title: Re: WinUSB Read Pipe
Post by: Jan Axelson on January 13, 2017, 01:28:03 pm
Not a pretty technique, but depending on how much time elapses before the fail and how much data you can store, you could stop and restart the analyzer periodically in hopes of catching the error.

Also probably not that useful, but you could try waiting until it fails, then start the analyzer and do another read. It's likely that the driver won't attempt anything on the bus, however.

Make sure your firmware is robust enough that the endpoint is always ready to either NAK or accept data.

If you can slow the transfers by adding delays and the problem goes away, that will tell you something.
Title: Re: WinUSB Read Pipe
Post by: sudheerg_ on April 20, 2017, 07:24:06 am
Some how we are able to find that there is a enumeration from Host to Target.

In what scenarios the Host can initiate USB Bus Reset to target.

I have verified WinUsb_GetPowerPolicy and for the parameter AUTO_SUSPEND it returns a value 0, means auto suspend is not enabled.

Any suggestions on how to debug this issue.
Title: Re: WinUSB Read Pipe
Post by: Jan Axelson on April 20, 2017, 09:14:36 pm
If enumeration succeeds, the device will appear in Device Manager.

The host can issue a reset whenever it wants. Typically, once enumeration is complete, the host would issue a reset only in an attempt to recover from repeated communication failures or other major bus problem.

To find out why you are getting a DEVICE_NOT_CONNECTED error, use whatever debugging tools you have to verify that the IN endpoint is always ready to either return NAK or send data on receiving an IN token packet.

_Immediately_ after sending data, the IN endpoint should be ready to return NAK or data in response to the next token packet.

If you can slow the transfers by adding delays between reads and the problem goes away, that will tell you it's a timing issue.