From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Parse USB RAW

Community,

 

I need to display [pseudo] real-time output from a device in our lab.  The device communicates via USB (raw) and comes with a very basic software- which only writes data to a file.  I need to write a VI to display this data on a monitor, real-time.  I'm running into a couple of issues (note: drivers have been properly installed).

 

1) I have had no luck parsing the USB data using VISA.  My issue is a VI problem; the hardware is properly configured.

2) Alternatively, I downloaded a compatible VCP (virtual COM port) driver and tried using the Instrument I/O Assistant, but have received various errors.

2.1) Most of the time, my run times out (even setting the timeout to 2+ min)

2.2) Twice I have received data (image attached), but the information is illegible and another error is generated (but it has been explained)

3) It is worth noting that the device apparently reports values approximately every 1 minute.

 

Any help is most definitely appreciated.

 

Addendum: I have not been able to find a software engineer at the company that is familiar with the transfer protocol.

 

Running LabVIEW v.8.6 on XP SP3

 

parsing data errro

0 Kudos
Message 1 of 7
(3,576 Views)

Vuccj7,

 

This is Alexander with National Instruments.  It doesn't look like your device is communicating at all with LabVIEW and the data you are receiving is null.  USB operates along side other communication types such as serial & parallel.  These communications are all governed through NI-VISA (Virtual Instrument Software Architecture) calls, which can be 'dumbed down' when using the Instrument I/O Assitant.

 

If you have successfully installed the USB instrument & VCP drivers, and are able to both view the device in Device Manager and receive data using the third party program, then you should be able to communicate with the device using NI products.  However, this is cannot be guaranteed since not all devices are supported by NI.  Drivers for a variety of third party products can be found on the Instrument Driver Network.

 

When connecting to instruments, it is best to start troubleshooting at the source rather than from LabVIEW.  I would first recommend opening Measurement & Automation Explorer, and ensuring the device is present in the 'Devices and Interfaces' tree.  Clicking on the COM Device, then selecting 'Open VISA Test Panel' will allow you to connect directly with your device (shown below).

 

InstrumentConnectionTest.PNG

 

Using the manufacturer's specifications and the VISA Test Panel, you should be able to test the communication between the USB device and LabVIEW.  Once a solid connection is established in the VISA Test Panel, I would recommend using VISA calls in LabVIEW to communicate with your device.

 

Regards,

 

Alexander M

Applications Engineer

National Instruments

0 Kudos
Message 2 of 7
(3,537 Views)

Alexander, thank you for your help.


I installed the driver, it is functional in MAX, and I can communicate with the VISA Interactive Control panel.  I know the pipe type is bulk and the bulk_in_pipe value is 81, bulk_out_pipe is 2.

 

Using the VISA functions, I was receiving a cryptic output (image below); which is why I tried using a compatible COM driver.

 

Can the read buffer string (in attached image) be translated or does it indicate incompatibility?

 

Thanks,

 

usb visa error.PNG

0 Kudos
Message 3 of 7
(3,519 Views)

Vuccj7,

 

It looks like there are still communication issues, but no need to give up hope yet.  The error out you are receiving (seen in the picture) is interesting.  Nevertheless, I found a resource titled How Can I Communicate With a Device Using NI-VISA USB RAW Mode that should be able to point you in the right direction.

 

Regards,

 

Alexander M

Applications Engineer

National Instruments

0 Kudos
Message 4 of 7
(3,508 Views)

I followed all of the steps on the page you provided (creating the .inf file, etc.), having first set up my device using this guide.  Though, I had not yet explored the viUsbControlOut/In functions noted on your link.  I used this post (Nugget: 2 of n) to help decipher the bmRequestType, bRequest values, etc.  

 

The VISA test panel has 3 tabs: template, basic i/o, and interface i/o.  When using the viGetAttribute (subtab of template), I can read values for all attributes.  

 

The Basic i/o (subtab viRead) provided some interesting data.  When viewing ASCII characters, the string is mostly "." (without the quotes) with sparse alphanumeric characters.  The mixed ASCII/hex buffer string reads: "\x11'\x00\x00\ ..." and the hex only reads: "11 60 00 00 00 ... 00 fe 00 00 ... 00 fe ..."

 

I am unable to generate any buffer string using the viUsbControlOut/In functions (per direction of Nugget: 2 of n above), but instead receive error Return Status of BFFF003D and BFFF003E (with NI discussion explanation here).

 

Though despair lingers, I did find some documentation that might be of use.  Again, thanks to Nugget: 2 of n (many kudos!), I was pointed to the USB logging freeware Snoopy Pro.  Attached is the log file for the USB device in question.  I think sequences 1-4 may provide hidden clues to this challenge, and the remainder are mostly repeated samples.  If the log file does not post correctly, or if you cannot read it, I can upload a .xlsx format.

 

Regards,

0 Kudos
Message 5 of 7
(3,500 Views)

Using suggestions from this NI discussion, I changed read buffer from the USB RAW vi from a string to a hex display.

 

post4.PNG

 

The only other information I have is that this is an FTDI chip and the usb data structure documentation is not of much use (attached).

0 Kudos
Message 6 of 7
(3,488 Views)

It looks like you are getting data, now you will need to figure out how to interpret the data according to your manufacturer's specifications.

 

Alexander M

 

National Instruments

Applications Engineer

0 Kudos
Message 7 of 7
(3,471 Views)