Author Topic: WinUSB bugs?  (Read 18109 times)

lcpoon

  • Frequent Contributor
  • ****
  • Posts: 58
WinUSB bugs?
« 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?

lcpoon

  • Frequent Contributor
  • ****
  • Posts: 58
Re: WinUSB bugs?
« Reply #1 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).

lcpoon

  • Frequent Contributor
  • ****
  • Posts: 58
Re: WinUSB bugs?
« Reply #2 on: April 16, 2012, 04:34:10 am »
See attached file for more details.

[attachment deleted by admin]

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: WinUSB bugs?
« Reply #3 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

lcpoon

  • Frequent Contributor
  • ****
  • Posts: 58
Re: WinUSB bugs?
« Reply #4 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.

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: WinUSB bugs?
« Reply #5 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

lcpoon

  • Frequent Contributor
  • ****
  • Posts: 58
Re: WinUSB bugs?
« Reply #6 on: April 16, 2012, 08:41:16 pm »
It works. I make use of bytesRead information to get rid of unwanted data. Thanks.

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: WinUSB bugs?
« Reply #7 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