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.

Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

communication with a USB RAW Device

Hi everyone, I am new with programming VISA.  As part of my first few tasks, I am learning to establish a USB communication with instruments. From the little research I have done so far, I found that there are two classes of USB devices, the USB INSTR and USB RAW. I have no problem communicating with the USB INSTR device I have got. However, I have not been able to establish a successful communication with my USB RAW device. My first attempt to communicate with this device after installing the driver was by means of the NI MAX. ON querying the device to get its identity, the NI MAX returned an error that reads “VISA: (Hex 0xBFFF0015) Timeout expired before operation completed”.

Can anyone please advise me on what to do to clear this read problem? I have attached a snap shot of the NI MAX window showing the error message.

0 Kudos
Message 1 of 11
(5,172 Views)
Why do you think the idn query is supported? Do you have the RAW details from the vendor or are you just making this up?

What sort of usb driver came with the device? There are considerably more usb classes than 2 and creating a RAW driver should be considered a last desperate attempt to communicate and only if the vendor provides the necessary information.
0 Kudos
Message 2 of 11
(5,170 Views)

Thanks for the response. I do not have the RAW information from the device vendor. I was working based on the understanding I had from the literature I read. I understood from that literature that USB devices that are not compatible with USBTMC fall under the USB RAW class.

 

I think I would take a look at the RAW information of my USB device to see what the vedor has to say about it.

0 Kudos
Message 3 of 11
(5,132 Views)

Please, further suggestion is welcomed from anyone who can help. Thanks

0 Kudos
Message 4 of 11
(5,131 Views)
I don't know where you would have read that there are only two usb classes. Your usb keyboard, mouse, monitor, are not usbtmc or raw.

Please answer the question about the driver that came with the device. Windows device manager will help but you have to first undo everything you did with the wizard.
0 Kudos
Message 5 of 11
(5,127 Views)

I got the information about the two classes of VISA Resources supported by NI-VISA from http://www.ni.com/white-paper/4478/en/.

 

Because my instrument was not automatically recognised by NI-VISA, I have assumed that it would be a USB RAW device. I know my assumption might not be correct, that is why I am asking for help from people who are more knowledgeable than me in this subject. I was working based on the information I have.

 

Regarding the question about the driver that came along with the device, I am yet to get the driver for the device as it was passed to me without a driver.

 

Please let me know the procedure to follow to undo what I have already done.

 

 

Thanks

0 Kudos
Message 6 of 11
(5,119 Views)
That white paper only covers usb communication with VISA and does not cover at all usb devices that emulate a serial port or other common classes such as hid. There is absolutely no requirement that you use VISA.

You can use a system restore point or delete the inf and complied version of it.

If you did not receive a driver, it's possible it uses one of the classes that comes with Windows. What is the make and model of the device?
0 Kudos
Message 7 of 11
(5,114 Views)

I realize this thread is a few months old now, but I am having the exact same issue. I have a USB RAW device for which I created a VISA device driver. All is good with the device driver. The code on the MCU simply echoes any data on the OUT Bulk endpoint back to the IN bulk endpoint. Very simple. 

 

I couldn't figure out why in the world I would send out a message packet and it would take 2 seconds before I got a response. The MCU is running plenty fast. I knew that wasn't the issue. In fact, using a different program, I could send data to the OUT EP and get it back immediately on the IN EP. The MCU is not the problem. So I poked around and discovered some behavior I did not expect with the VISA read and write VIs. The Timeout Property Node of the USB RAW interface was set at 2000ms. That was mighty coincidental with my above observation. Then I found that if I tweaked the timeout to be 10000ms, it would take 10000ms to get the data echoed back. If I changed it to 10ms, I got the data back almost immediately.

 

I should also point out that it didn't matter how much data I sent to the out EP. For example, if I sent out 64 bytes (my max MCU buffer size) and requested only 32 using the read VI I still had to wait for the timeout period to expire to get only 32 bytes back.

 

This is not at all how I expect the timeout property to work. I should get an error if I don't get data within the specified timeout period. If I do get data, there should be no error. Unfortunately, based upon how things seem to be working, it is necessary to poll the VISA read function repeatedly to get the data. Of course if there is no data a timeout would occur. So it is necessary to clear the error. If there is data, I can process it.

 

This seems to me like the wrong way to be doing things. Anyone have any suggestions? I am attaching a VI Snippet so you can see what I did.

0 Kudos
Message 8 of 11
(4,783 Views)

Please refer to this Link.. (Hex 0xBFFF0015)

 


A timeout error is generally indicative of a different problem.  Check the command strings sent to the VISA Read and Write calls and ensure that they are written in the proper syntax for your instrument.



Thank you & Best regards
syrpimp

=======================================================
“You must continue to gain expertise, but avoid thinking like an expert." -Denis Waitley
0 Kudos
Message 9 of 11
(4,772 Views)

Do you get the correct data back?

 

Also, what's going on in your "Write Large Pkt USB" Sub-VI?  Your timeout could be happening on the output just as likely as the input.

0 Kudos
Message 10 of 11
(4,757 Views)