Discussion:
Getting an VISANS timeout error even though VISA Status is 0
(too old to reply)
David Hary
2008-08-12 01:40:06 UTC
Permalink
I have an application that runs well on my development system but consistently fails at the user site giving out timeout errors even though the user experiences no time outs. Indeed, VISA returns a success status. Yet, it raises timeout exceptions such as in this segment from my trace log:
 
DefaultSource, Verbose, 8, Setting timeout to 30000, "CONNECT", 2008-08-12 00:47:21Z, 2077539389311920DefaultSource, Information, 0, GPIB0::26::INSTR termination character set to 10, "CONNECT", 2008-08-12 00:47:21Z, 2077539630487436DefaultSource, Verbose, 8, Checking GPIB0::26::INSTR message available, "FR, CONNECT", 2008-08-12 00:47:21Z, 2077539636730532DefaultSource, Verbose, 8, Flushing read GPIB0::26::INSTR buffer, "FR, CONNECT", 2008-08-12 00:47:21Z, 2077539673800216DefaultSource, Error, 2, Flushing read GPIB0::26::INSTR buffer failed: NationalInstruments.VisaNS.VisaException: Timeout expired before operation completed.  VISA error code -1073807339 (0xBFFF0015), ErrorTimeout   at NationalInstruments.VisaNS.Internal.ErrorChecker.CheckStatusAndThrow(Int32 status, VisaHandle visaObject)   at NationalInstruments.VisaNS.Session.CheckStatusAndThrow(Int32 status)   at NationalInstruments.VisaNS.Session.BufferedReaderService.NationalInstruments.VisaNS.Internal.IBufferedReader.Scan(String scanSpecifier, Int32& count, StringBuilder receiver)   at NationalInstruments.VisaNS.MessageBasedSessionReader.CommonReadString(String scanString, Int32 count)   at NationalInstruments.VisaNS.MessageBasedSessionReader.ReadLine()   at isr.Visa.MessageBasedReader.ReadLine()   at isr.Visa.GpibSession.ReadLine()   at isr.Visa.Ieee4882.Instrument.ReadString()   at isr.Visa.Ieee4882.Instrument._flushRead(). VISA status=Success, "FR, CONNECT", 2008-08-12 00:47:21Z, 2077539717184364DefaultSource, Verbose, 8, Flushing GPIB0::26::INSTR write buffers, "FW, CONNECT", 2008-08-12 00:47:21Z, 2077539723797900DefaultSource, Verbose, 8, , "WRITE, FW, CONNECT", 2008-08-12 00:47:21Z, 2077539731761192DefaultSource, Error, 2, Flushing GPIB0::26::INSTR write buffers failed: NationalInstruments.VisaNS.VisaException: Timeout expired before operation completed.  VISA error code -1073807339 (0xBFFF0015), ErrorTimeout   at NationalInstruments.VisaNS.Internal.ErrorChecker.CheckStatusAndThrow(Int32 status, VisaHandle visaObject)   at NationalInstruments.VisaNS.Session.CheckStatusAndThrow(Int32 status)   at NationalInstruments.VisaNS.Session.BufferedWriterService.NationalInstruments.VisaNS.Internal.IBufferedWriter.WriteLine()   at NationalInstruments.VisaNS.MessageBasedSessionWriter.WriteLine()   at isr.Visa.MessageBasedWriter.WriteLine(String queryCommand)   at isr.Visa.GpibSession.WriteLine(String queryCommand)   at isr.Visa.Ieee4882.Instrument.WriteLine(String value)   at isr.Tsp.TspVisaIO.WriteLine(String value)   at isr.Visa.Ieee4882.Instrument._flushWrite(). VISA status=Success, "WRITE, FW, CONNECT", 2008-08-12 00:47:21Z, 2077539742753448
The first exception above is raised on the session Message Based Reader ReadLine() command.
 
Note that I check for message available before issuing read. 
 
Note also that VISA NS returns a status code of success:   VISA status=Success (this is what I log above)
 
The second exception is raised after I try to clear the write buffers using the Message Based Writer command: WriteLine()
 
Here too VISA reports success.
 
Note also that the above segment executes in less than one second whereas the time out is set to 30 seconds. 
 
The user runs VISA 4.3 runtime.  I am using NationaInstruments.VisaNS 8.1.20.222.
 
I would be most grateful for some clues as to how to fu
Sputnikrent
2008-08-12 17:40:11 UTC
Permalink
Hi David, Could you please verify what version of NI-VISA you have installed on your development machine? You can do this by going to Measurement and Automation Explorer &gt; Software &gt; NI-VISA. The version number will appear on the right pane.Also, could you please take NI-Spy captures of the application working on the development machine, as well as on the target machine? There are instructions <a href="http://digital.ni.com/public.nsf/allkb/8D890EC09B15C05A86256E6F007E3E86" target="_blank">here </a>that discuss how to do this. Please upload the .spy files here so we can take a look and compare the two. Does the application itself behave any differently? How do these timeouts manifest in terms of the way your application runs?
David Hary
2008-08-12 20:40:25 UTC
Permalink
Hi Rasheel,
&nbsp;
Thank you for the quick reply.
&nbsp;
I have uploaded the user and developer files.
&nbsp;
I use NI VISA 4.1 on the development system.
&nbsp;
The timeouts do not manifest any odd behavior.
&nbsp;
David
&nbsp;


User.spy:
http://forums.ni.com/attachments/ni/90/1348/1/User.spy


Development.spy:
http://forums.ni.com/attachments/ni/90/1348/2/Development.spy
David Hary
2008-08-12 23:40:19 UTC
Permalink
Dear Rasheel,
&nbsp;
I added another capture from using an application that does not&nbsp;exhibit the time out or bad setup errors..
&nbsp;
I use the same application on my development system as well.&nbsp;
&nbsp;
So, in summary, we have two applications running at the user site that are also running at the developer site.&nbsp;&nbsp; Both work fine at the developer site.&nbsp; One application works fine on the user site while the other produces timeout and bad setup errors.&nbsp;
&nbsp;
Best
&nbsp;
David
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;


Capture_TSB.spy:
http://forums.ni.com/attachments/ni/90/1349/1/Capture_TSB.spy
Sputnikrent
2008-08-13 19:40:12 UTC
Permalink
Hi David,&nbsp;The spy capture shows the exact same commands being sent to the device, but the device is behaving differently.&nbsp;Could you please verify that the device that on both machines are the exact same? Could there possibly be an issue with the device at the user site?&nbsp;Also, could you try to uninstall the NI-VISA runtime on the user site, and install version 4.1 (same version as development machine)? This will ensure consistency when trying to troubleshoot this issue.
David Hary
2008-08-14 23:10:08 UTC
Permalink
Hi Rasheel,&nbsp;Problem soved.&nbsp; &nbsp;I found that the user GPIB interfect from CEC was using version 7.&nbsp; Upgrading to Version 8 fixed the problem.&nbsp;Could you, however, let me know what are the causes for the following errors on the deveopment machine that were reported by NI-Spy (lines 135,6)?&nbsp;&gt; 135.&nbsp; viUninstallHandler (GPIB0::27::INSTR (0x04A1CF40), IO_COMPLETION, NULL, NULL)
&gt; Process ID: 0x00001410&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Thread ID: 0x000001B4
&gt; Start Time: 11:16:09.449&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Call Duration 00:00:00.000
&gt; Status: 0xBFFF0028 (VI_ERROR_HNDLR_NINSTALLED)&gt; 136.&nbsp; viUninstallHandler (GPIB0::27::INSTR (0x04A1CF40), SERVICE_REQ, NULL, NULL)
&gt; Process ID: 0x00001410&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Thread ID: 0x000001B4
&gt; Start Time: 11:16:09.449&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Call Duration 00:00:00.000
&gt; Status: 0xBFFF0028 (VI_ERROR_HNDLR_NINSTALLED)Thanks&nbsp;David&nbsp;&nbsp;&nbsp;
Meghan R
2008-08-15 16:40:22 UTC
Permalink
Hello David, &nbsp;It looks like you are not passing any valid handlers in your viUninstallHandler command.&nbsp; Calling viUninstallHandler removes the specified handler from the list of
active handlers on the given session.&nbsp; You can see the exact error information for your error in the picture below.&nbsp;&nbsp;<img src="Loading Image..." border="0"> &nbsp;Useful information can be found in the manual:&nbsp; <a href="http://www.ni.com/pdf/manuals/370132c.pdf" target="_blank">VISA Programmers Reference Manual </a>Pages 5-146 &amp; 7 &nbsp;Have a great day!&nbsp;Meghan RApplications EngineerNational Instruments Message Edited by Meghan R on 08-15-2008 11:39 AM


ScreenHunter_01 Aug. 15 11.33.gif:
http://forums.ni.com/ni/attachments/ni/90/1357/1/ScreenHunter_01 Aug. 15 11.33.gif
Loading...