Driver Development Kit (DDK)

cancel
Showing results for 
Search instead for 
Did you mean: 

Getting an VISANS timeout error even though VISA Status is 0

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, 2077539389311920
DefaultSource, Information, 0, GPIB0::26::INSTR termination character set to 10, "CONNECT", 2008-08-12 00:47:21Z, 2077539630487436
DefaultSource, Verbose, 8, Checking GPIB0::26::INSTR message available, "FR, CONNECT", 2008-08-12 00:47:21Z, 2077539636730532
DefaultSource, Verbose, 8, Flushing read GPIB0::26::INSTR buffer, "FR, CONNECT", 2008-08-12 00:47:21Z, 2077539673800216
DefaultSource, 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, 2077539717184364
DefaultSource, Verbose, 8, Flushing GPIB0::26::INSTR write buffers, "FW, CONNECT", 2008-08-12 00:47:21Z, 2077539723797900
DefaultSource, Verbose, 8, , "WRITE, FW, CONNECT", 2008-08-12 00:47:21Z, 2077539731761192
DefaultSource, 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 further explore this issue.  We have been at it for a few days already and are not seeing any light at the end of this tunnel.
 
David
 
 
 
 
 
0 Kudos
Message 1 of 7
(8,884 Views)
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 > Software > 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 here 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?
Rasheel
0 Kudos
Message 2 of 7
(8,871 Views)
Hi Rasheel,
 
Thank you for the quick reply.
 
I have uploaded the user and developer files.
 
I use NI VISA 4.1 on the development system.
 
The timeouts do not manifest any odd behavior.
 
David
 
Download All
0 Kudos
Message 3 of 7
(8,864 Views)
Dear Rasheel,
 
I added another capture from using an application that does not exhibit the time out or bad setup errors..
 
I use the same application on my development system as well. 
 
So, in summary, we have two applications running at the user site that are also running at the developer site.   Both work fine at the developer site.  One application works fine on the user site while the other produces timeout and bad setup errors. 
 
Best
 
David
 
 
 
 
 
0 Kudos
Message 4 of 7
(8,855 Views)

Hi David,

 

The spy capture shows the exact same commands being sent to the device, but the device is behaving differently.

 

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?

 

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.

Rasheel
0 Kudos
Message 5 of 7
(8,849 Views)

Hi Rasheel,

 

Problem soved. 

 

I found that the user GPIB interfect from CEC was using version 7.  Upgrading to Version 8 fixed the problem.

 

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)?

 

> 135.  viUninstallHandler (GPIB0::27::INSTR (0x04A1CF40), IO_COMPLETION, NULL, NULL)
> Process ID: 0x00001410         Thread ID: 0x000001B4
> Start Time: 11:16:09.449       Call Duration 00:00:00.000
> Status: 0xBFFF0028 (VI_ERROR_HNDLR_NINSTALLED)

> 136.  viUninstallHandler (GPIB0::27::INSTR (0x04A1CF40), SERVICE_REQ, NULL, NULL)
> Process ID: 0x00001410         Thread ID: 0x000001B4
> Start Time: 11:16:09.449       Call Duration 00:00:00.000
> Status: 0xBFFF0028 (VI_ERROR_HNDLR_NINSTALLED)

Thanks

 

David

 

 

 

0 Kudos
Message 6 of 7
(8,834 Views)

Hello David,

 

It looks like you are not passing any valid handlers in your viUninstallHandler command.  Calling viUninstallHandler removes the specified handler from the list of
active handlers on the given session.  You can see the exact error information for your error in the picture below.

 

 

 

Useful information can be found in the manual:  VISA Programmers Reference Manual Pages 5-146 & 7

 

Have a great day!

 

Meghan R

Applications Engineer

National Instruments

Message Edited by Meghan R on 08-15-2008 11:39 AM
0 Kudos
Message 7 of 7
(8,827 Views)