Instrument Control (GPIB, Serial, VISA, IVI)

Showing results for 
Search instead for 
Did you mean: 
Reply

VISA ErrorTimeout on a Tcpipsocket.querry("*IDN?") using .NET VISA library

Solved!
Go to Solution

VISA ErrorTimeout on a Tcpipsocket.querry("*IDN?") using .NET VISA library

I've an LXI instrument that I can connect to using the Agilent IO Suite using the same VISA address (see address used below) or through the instrument's webpage (an LXI instrument).  However, when I try to connect to it through a C# application via VISA API call.  I'd get:

"VI_ERROR_TMO: A timeout occurred  VISA error code -1073807339 (0xBFFF0015), ErrorTimeout".  

 

The instrument has an VISA address: TCPIP0::10.12.177.59::4446:Smiley FrustratedOCKET

 

Snippet of the C# code:

resourceString = "TCPIP0::10.12.177.59::4446:Smiley FrustratedOCKET";

TcpipSocket tcpSock = (TcpipSocket)ResourceManager.GetLocalManager().Open(resourceString);
if (tcpSession != null)
  string str = tcpSock.Query("*IDN?");  // I got timeout exception here

 

This code works for other instrument that uses the inst0 remote address type and TcpipSession.  Only the TcpipSocket has issue here.

 

Thanks for your help.

0 Kudos
Message 1 of 7 (2,712 Views)
Reply
0 Kudos

Re: VISA ErrorTimeout on a Tcpipsocket.querry("*IDN?") using .NET VISA library

khung,

 

The Knowledge Base article Why do I Receive Timeout Error -1073807339 on VISA Read or Write? may help you trouble shoot your issue, as it directly addresses the error code you are getting.

 

Thanks,

KyleP
Applications Engineer
National Instruments
0 Kudos
Message 2 of 7 (2,696 Views)
Reply
0 Kudos

Re: VISA ErrorTimeout on a Tcpipsocket.querry("*IDN?") using .NET VISA library

Based on the doc, The inquiry can be timed out.  I found from the NI-VISA documentation, the default VI_ATTR_TMO_VALUE is set to 2000 msecs.  The *IDN? query is short.  I used the Agilent IO Suite app and I can get the instrument's ID back through *IDN? query in split second - as soon as I pushed the "Identify Instrument" button.  The Agilent IO Suite provide space to enter the IP address of the instrument and SOCKET#. (please see attached screenshot)  So I don't think it's the timeout value issue.

 

I also ran the NI-VISA sample code from my PC (ni4882273.exe) installation, the

..\National Instruments\NI-VISA\Examples\DotNET3.5\SimpleReadWrite\cs\SimpleReadWrite.2008.csproj sample app which allows me to use IP address and a socket to communicate to the remote instrument.  The sample app also yielded the same timeout error as an exception (see attached screenshot).  There seems to be a common issue here.

 

 

0 Kudos
Message 3 of 7 (2,687 Views)
Reply
0 Kudos

Re: VISA ErrorTimeout on a Tcpipsocket.querry("*IDN?") using .NET VISA library

Using NI-SPY, I saw that the *IDN? message (msg#17) went out, viRead actually read back the instrument's identification (msg#18).  The problem is that this viRead came back with "Timeout expired before operation completed." error code "0xBFFF0015 (VI_ERROR_TMO)" hence the error I'm seeing. Now the TMO_VALUE has been set to 20sec (20000) seen on msg#16.  This didn't do the trick.  In fact, the viRead msg came back within split of a second after the *IDN? viWrite (please see the time stamps on the NI-SPY trace attached).  I'm not sure why viRead was timing out.  Thanks for your help.

0 Kudos
Message 4 of 7 (2,678 Views)
Reply
0 Kudos
Highlighted

Re: VISA ErrorTimeout on a Tcpipsocket.querry("*IDN?") using .NET VISA library

Which instrument are you using and how are you connecting to it?

KyleP
Applications Engineer
National Instruments
0 Kudos
Message 5 of 7 (2,658 Views)
Reply
0 Kudos

Re: VISA ErrorTimeout on a Tcpipsocket.querry("*IDN?") using .NET VISA library

You'll get a timeout if your termination character is not read. What is the instrument sending and what do you see?
0 Kudos
Message 6 of 7 (2,655 Views)
Reply
0 Kudos
Solution
Accepted by topic author khung
‎08-27-2015 06:09 PM

Re: VISA ErrorTimeout on a Tcpipsocket.querry("*IDN?") using .NET VISA library

Yes, the read operation was looking for the "\n" terminator that it didn't find and timed out.  I've to change the VISA MessageBasedSession.TerminationCharacterEnabled = true and it works.  Thanks.

Message 7 of 7 (2,641 Views)