Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA viWrite() hangs and instrument locks up

Config:

NI USB-GPIB-HS on Win 7 SP1.  

VISA32.dll  

talking to an HP8164A

 

Issue:

Unpredictable timeouts and then lock up on a viWrite() call.  I had a large program that was stopping after various calls to viWrite() so I made a simple program that simply does the follwoing over and over again (NI I/O Trace shown):

 

viWrite (GPIB0::20 (0x020653F0), "*IDN?..", 7, 7)

viRead (GPIB0::20 (0x020653F0), "HEWLETT-PACKARD,HP816...", 20480, 48)

This will work for an unpredicatable number of times a then timeout on the viWrite() call with fewer than the 7 bytes returned.  Once it times out the instrument locks up and I can't get it to respond to further viWrites() (i.e. times out with 0 bytes returned).  The only way I can get the instrument back to operation is to restart it, which is very painful and basically makes the application unusable.

 

Does anyone know how to troubleshoot this problem?  Is there something I need to do after the viWrite() timeout to make the instrument responsive again?  I could handle the error condition in my code if I could get the instrument to respond again.

 

 

 

0 Kudos
Message 1 of 7
(5,334 Views)

There are a few things to start with:

#1 Do you have the latest VISA driver?

#2 Did you tried to use the same code on another instrument (to isolate HW from SW)?

#3 Did you connected this instrument on another workstation and run the code from there?

 

0 Kudos
Message 2 of 7
(5,308 Views)

#1 Yes I have the latest driver

#2 Just tried it connected to a different instrument and exact same code works perfectly, no lock-up, tens of thousands of cycles.  This suggests an issue with the instrument.  I have checked the connectors and I don't see any obvious issue, but the NI connector in general does seem a little looser than the typical GPIB cable.

#3 Didn't try that, based on the good results from #2

 

Interestingly enough, when locked up, it will still switch from manual to remote mode, just won't respond to the viWrite() commands.  Is there some kind of reset you have to call after a timeout in order to get things working again?

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

Just by looking at your second answer, this seems like a problem with the instrument itself…

Specifically for timeouts, the following links might be worth taking a look:

 

Default Timeout for VISA Read and Write Vis

http://digital.ni.com/public.nsf/allkb/E4F90AD24DEC9CC786256F4300605C02

 

Timeout Errors

http://www.ni.com/support/labview/visa/verr2.htm

 

Why Do I Receive Timeout Error -1073807339 on VISA Read or Write?

http://digital.ni.com/public.nsf/allkb/874B379E24C0A0D686256FCF007A6EA0

 

0 Kudos
Message 4 of 7
(5,289 Views)

Unfortunately longer timeout delay and delay between successive calls did not seem to help the problem at all.

0 Kudos
Message 5 of 7
(5,282 Views)

At this point I would suggest replacing the HP8164A, since everything points to either a HW/configuration problem; or check with the manufacturer of that instrument.

0 Kudos
Message 6 of 7
(5,267 Views)

Replacing the unit fixed the problem.  Thanks.

0 Kudos
Message 7 of 7
(5,232 Views)