Ports
May 20, 2013, 03:45:35 am *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: SMF - Just Installed!
 
   Home   Help Search Login Register  
Welcome to the PORTS Forum. Please post your questions, answers, and comments relating to USB and other hardware interfaces in the appropriate forums below. - Jan
Pages: [1]
  Print  
Author Topic: WinUSB bugs?  (Read 1033 times)
lcpoon
Member
***
Posts: 40


« on: April 16, 2012, 03: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?
Logged
lcpoon
Member
***
Posts: 40


« Reply #1 on: April 16, 2012, 03: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).
Logged
lcpoon
Member
***
Posts: 40


« Reply #2 on: April 16, 2012, 03:34:10 am »

See attached file for more details.
Logged
Jan Axelson
Administrator
Frequent Contributor
*****
Posts: 1625


WWW
« Reply #3 on: April 16, 2012, 09: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
Logged
lcpoon
Member
***
Posts: 40


« Reply #4 on: April 16, 2012, 10: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.
Logged
Jan Axelson
Administrator
Frequent Contributor
*****
Posts: 1625


WWW
« Reply #5 on: April 16, 2012, 10: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
Logged
lcpoon
Member
***
Posts: 40


« Reply #6 on: April 16, 2012, 07:41:16 pm »

It works. I make use of bytesRead information to get rid of unwanted data. Thanks.
Logged
Jan Axelson
Administrator
Frequent Contributor
*****
Posts: 1625


WWW
« Reply #7 on: April 16, 2012, 09:48:27 pm »

Glad you got it working. I'll try to remember to fix that on the next update.

Jan
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!