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: 

Getting timeout checking AcquisitionStatus using tkdpo4k driver for DPO4034 scope

I'm interfacing through TCP/IP with multiple oscopes and Keithley multimeters (using GPIB extender) with C#. Each scope is controlled in a separate thread class, and is using the tkdpo4k ivi driver and Measurement Studio generated .NET wrapper (PInvoke). The goal for the scope to capture single waveform pulses, so I'm using the InitiateAcquisition(), then polling with AcquisitionStatus() until the status flag goes from 0 to 1, indicating that the acquisition is complete. Then I use FetchWaveformMeasurement() to retrieve the waveform(s).

 

This software has been running for weeks at a time without issue, until recently. Now I'm getting periodic Timeouts (0xBFFF0015) on the AcquisitionStatus call, which is happening only on 1 scope (out of 4). I replaced the oscope, thinking it was going bad, but then a different scope began exhibiting the same problem (maybe they're all going bad... but I'm not convinced of that yet).

 

I'm looking for suggestions on similar experiences and/or how to handle these errors. I'm not sure if it is network traffic or that I'm polling the scope too fast or something else.

 

My software disconnects and reconnects to the scope when this error occurs, which works, but seems unnecessary if this timeout is to be expected. I've just changed my code to look for the timeout error and ignore (retry), so I'm testing this approach. But then I got a 0xBFFF003E error, indicating I/O Error the next time I issued the InitiateAcquisition() call. I had to issue a Reset command (on my GUI) to clear this up.

 

So for a second question... what is the best way to clear the 0xBFFF003E error without resetting and reconfiguring my scope settings? Let me know what other info I can provide on the problems.

 

Thanks in advance for any help or ideas.

 

Sincerely,

Dave T.

0 Kudos
Message 1 of 10
(4,639 Views)

Two suggestions:

What about timing conflicts on the bus with the keitley calls? You need something like gpibspy to find out, but it influences the process.

And second, how good is your cabling?

greetings from the Netherlands
0 Kudos
Message 2 of 10
(4,629 Views)

Thanks very much for the reply and suggestions.

 

I've disabled all Keithley calls as well as control of the other oscopes. I'm now controlling only the oscope that is giving occasional timeouts. All cabling has been changed out as well.

 

Same results. Things work for a few minutes then I get a Timeout (0xBFFF0015). Following the timeout, I get IO Error (0xBFFF003E) and Invalid Protocol (0xBFFF0079). I am using NI Spy to capture the calls, which I attached. The timeout happens at line 3013.

 

I'm still wondering if it's the scope or if some errors such as these should be expected and there's a way to clear it and continue. If so, please let me know.

 

I'm using tkdpo4k version 1.1 and NI-VISA 4.1.

 

Thanks very much,

-Dave

 

 

0 Kudos
Message 3 of 10
(4,592 Views)

I switched the interface to USB and I'm not getting the problems.

 

-Dave

0 Kudos
Message 4 of 10
(4,579 Views)

I would be very interested in knowing if others have had similar problems using ethernet, but not having the problems on USB, which is the case for me. I'm checking with Tektronix on whether they believe it is a problem with the ethernet module on this particular scope.

 

I would also like to get some ideas on what commands to send that will clear or recover from the IO Error (0xBFFF003E) and Invalid Protocol (0xBFFF0079) based off of the NI-Spy capture I attached earlier.

 

Thanks very much,

-Dave

0 Kudos
Message 5 of 10
(4,567 Views)

Hey Dave,

 

The BFFF003E error comes from the VISA Write IRP_MJ_FLUSH_BUFFER request causing an INVALID DEVICE REQUEST response from the device. By default, each VISA Read and Write is followed by a VISA Flush call. You can change the VISA Buffer setting to keep VISA from executing the flush call to avoid this error.

If you call the VISA Set I/O Buffer function at the beginning of your application (after the VISA Open, before any reads or writes) and set the mask to 48 (16 + 32, where 16 is the mask for receive buffer and 32 is the mask for transmit buffer) and the size to some value between 4k and the largest amount of data you ever expect to read or write, that will cause the flush command to not be executed.
However, if you do not call this function, VISA will segment all writes into 500 millisecond chunks and call flush after every write. By telling VISA that you will never use more than 4k or the value to which you set the size, VISA in turn will not call the flush.

I will look into why an error would be generated when using ethernet and not USB.

 

Thank you,

Ryan

National Instruments
Applications Engineer
0 Kudos
Message 6 of 10
(4,541 Views)

Ryan,

Thanks very much for the reply and for looking into the problem.

 

In looking at the C code for the tkdpo4k driver, it appears that the driver is setting the I/O buffers to 4k and the modes to VI_FLUSH_ON_ACCESS. I see this in the first few lines of the Ni Spy capture output that I posted earlier. These values seem to be hard-coded in the driver and not exported. Please let me know if these are settings that I can change using the driver. Again, I'm accessing using C# (.NET).

 

I exported the first 10 lines of the NI-Spy capture that shows how my scope session was started (I think the first 6 are the ones I am interested in):

 

1. viOpenDefaultRM (0x0520D1A0)

Process ID: 0x00000D90 Thread ID: 0x00000770

Start Time: 13:16:37.821 Call Duration 00:00:00.000

Status: 0 (VI_SUCCESS)

2. viOpen (0x0520D1A0, "TCPIP0::192.168.0.113::inst0::INSTR", 0, 0, 0x0520D220)

Process ID: 0x00000D90 Thread ID: 0x00000770

Start Time: 13:16:37.821 Call Duration 00:00:00.031

Status: 0 (VI_SUCCESS)

3. viSetAttribute (TCPIP0::192.168.0.113::in...(0x0520D220), TMO_VALUE, 5000)

Process ID: 0x00000D90 Thread ID: 0x00000770

Start Time: 13:16:37.852 Call Duration 00:00:00.000

Status: 0 (VI_SUCCESS)

4. viSetBuf (TCPIP0::192.168.0.113::in...(0x0520D220), 3, 4000)

Process ID: 0x00000D90 Thread ID: 0x00000770

Start Time: 13:16:37.852 Call Duration 00:00:00.000

Status: 0 (VI_SUCCESS)

5. viSetAttribute (TCPIP0::192.168.0.113::in...(0x0520D220), WR_BUF_OPER_MODE, 1)

Process ID: 0x00000D90 Thread ID: 0x00000770

Start Time: 13:16:37.852 Call Duration 00:00:00.000

Status: 0 (VI_SUCCESS)

6. viSetAttribute (TCPIP0::192.168.0.113::in...(0x0520D220), RD_BUF_OPER_MODE, 1)

Process ID: 0x00000D90 Thread ID: 0x00000770

Start Time: 13:16:37.852 Call Duration 00:00:00.000

Status: 0 (VI_SUCCESS)

7. viGetAttribute (TCPIP0::192.168.0.113::in...(0x0520D220), INTF_TYPE, 6)

Process ID: 0x00000D90 Thread ID: 0x00000770

Start Time: 13:16:37.852 Call Duration 00:00:00.000

Status: 0 (VI_SUCCESS)

8. viQueryf (TCPIP0::192.168.0.113::in...(0x0520D220), "*IDN?", "%256[^.]")

Process ID: 0x00000D90 Thread ID: 0x00000770

Start Time: 13:16:37.852 Call Duration 00:00:00.032

Status: 0 (VI_SUCCESS)

9. Formatted viWrite (TCPIP0::192.168.0.113::in...(0x0520D220), "*IDN?", 5, 5)

Process ID: 0x00000D90 Thread ID: 0x00000770

Start Time: 13:16:37.852 Call Duration 00:00:00.000

Status: 0 (VI_SUCCESS)

10. Formatted viRead (TCPIP0::192.168.0.113::in...(0x0520D220), "TEKTRONIX,DPO4034,B02...", 4000, 46)

Process ID: 0x00000D90 Thread ID: 0x00000770

Start Time: 13:16:37.852 Call Duration 00:00:00.032

Status: 0 (VI_SUCCESS)

 

I'm still not convinced that I'm not having some hardware issues some of my oscopes, perhaps the ethernet module. They don't all exhibit this problem and they are all being controlled by the same application code. I'll make sure to update if the Tektronix tech support can verify.

 

Also, I am acquiring 10,000 data points per waveform acquistion (fetch call). The USB interface seems to be working beautifully.

 

Thanks again for the help,

-Dave

0 Kudos
Message 7 of 10
(4,535 Views)
Hey Dave, 

I looked in the programming manual. There is a Device Clear function (DCL) that you can use to clear the output queue and reset the scope. I am currently looking into the driver configuration issue that you've posted. Have you read the Programming Manual? It has a lot of useful info in it.

 

Thank you,

Ryan
National Instruments
Applications Engineer
0 Kudos
Message 8 of 10
(4,521 Views)

Ryan,

Thanks for the link, but I did have the programming manual and the Device Clear function (DCL) was something that I tried before coming to the forum.

 

However, once the problem (timeout) occured, I kept receiving the Invalid Protocol error each time I sent the DCL and didn't pursue it further. It sounds like the right thing to do, so I will look into that again. I want to get another capture from NI-Spy and analyze the sequence of VISA calls using the DCL. Maybe I was just missing something. Well, I'm out on vacation for a week, so it will be a little bit before I get back to this.

 

thanks so much for your continued help,

-Dave

0 Kudos
Message 9 of 10
(4,512 Views)

Hi Dave,

 

It sounds as if the connection is being dropped, and if that is the case the only way to clear the error is to disconnect and reconnect.   Have you tried to slow your communications down to ensure that you are not communicating too fast?  

Caleb W

National Instruments

0 Kudos
Message 10 of 10
(4,402 Views)