PORTS Forum

Ports and Interfaces => USB => Topic started by: lcpoon on April 16, 2012, 04:26:05 am

Title: WinUSB bugs?
Post by: lcpoon on April 16, 2012, 04:26:05 am
I send a command to the uC 3 times and used SysNucleus USBTrace to monitor the USB activities. The uC consistently returns "Rev: A (16th April 2012)".

Using WinUSB VB codes, I found out that the return message contains rubbish data concatenated with the desired data. The problem is that the rubbish data keeps changing. How to solve this?
Title: Re: WinUSB bugs?
Post by: lcpoon on April 16, 2012, 04:28:54 am
The problem only occurs in Window 7. I have the program running in Windows XP and no problem at all (no rubbish data concatenated with the desired data).
Title: Re: WinUSB bugs?
Post by: lcpoon on April 16, 2012, 04:34:10 am
See attached file for more details.

[attachment deleted by admin]
Title: Re: WinUSB bugs?
Post by: Jan Axelson on April 16, 2012, 10:55:59 am
A hardware protocol analyzer will show what is happening on the bus. If you don't have an analyzer, use a monitor program, watch variables, etc., or whatever debugging tools you have to find out what the device is sending.

Jan
Title: Re: WinUSB bugs?
Post by: lcpoon on April 16, 2012, 11:15:09 am
Actually I am using USB Trace to log all the USB events as attached. The device is sending "Rev: A (16th April 2012). It is the VB program that gives incorrect output.
Title: Re: WinUSB bugs?
Post by: Jan Axelson on April 16, 2012, 11:26:01 am
In the call to

deleg.EndInvoke(receivedDataBuffer, bytesRead, success, ar)

bytesRead is the number of bytes read. Anything after that is whatever was in the application's buffer.

Jan
Title: Re: WinUSB bugs?
Post by: lcpoon on April 16, 2012, 08:41:16 pm
It works. I make use of bytesRead information to get rid of unwanted data. Thanks.
Title: Re: WinUSB bugs?
Post by: Jan Axelson on April 16, 2012, 10:48:27 pm
Glad you got it working. I'll try to remember to fix that on the next update.

Jan