Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Tektronix AFG3022B do not want instrument reset on calling Initialize vi

Solved!
Go to solution

I installed the LV driver for a Tektronix AFG3022B signal generator, called tkafg3k.  I've been modifying some of the examples

provided and all seems to be well. However, I do NOT want to perform an instrument reset when I initialize the instrument...

done using tkafg3k Initialize.vi because the reset briefly switches off the voltage outputs and I cannot do that to the equipment

I am driving with the AFG3022B  There is a Reset(T) input to  tkafg3k Initialize.vi, but if I change it to a False I get this error :

 

Error -1073807339 occurred at VISA Read in tkafg3k Error Query.vi->tkafg3k Initialize.vi->tkafg3k_0.vi

Possible reason(s):

VISA:  (Hex 0xBFFF0015) Timeout expired before operation completed.

 

even in the simplest vi which just initializes and then closes the instrument. VISA resource name is correct.

Anyone know how I can get around this?

 

Thankstkafg3k error.PNG

0 Kudos
Message 1 of 18
(6,665 Views)

Hi Lizzied,

 

Thanks for posting on the forums.

 

After reading your post the first thing I did was search the error code. It seems it appears reasonably frequently. I have found an interesting KB that explains the error and how to get around it.

 

The error you see usually comes up when the VI has requested some data. If the data doesn't arrive or hasn't finished transferring then you get a timeout error. As it states in the KB its a good idea changing the default timeout period to more than 2000ms. I recommend going through the KB. I'd be interested to hear if it helps.

 

I have a few more questions....Is this the latest version of the driver?

 

If you change the constant on the initialize.vi what actually happens? I know the false constant caused you all sorts of problems. I know it is meant to essentially reset the instruments but have you tried running it to see exactly how it behaves? 

 

 

 

Kind Regards

Michael
NIUK Application Engineer
0 Kudos
Message 2 of 18
(6,624 Views)

Hi,

 

I tried to reproduce the issue with AFG3011 with firmware 3.2.0 with the different interfaces and did not see the issue.

0 Kudos
Message 3 of 18
(6,600 Views)

Hi Michael,

Thanks for your reply. I'll answer your questions in order.

 

I delved down into tkafg3k Initialize.vi, the Timeout period in the VISA property Node is set to 10000ms - so already

longer than the 2000ms recommended in the KB link you sent. So far I have not tried changing it.

 

I'm running LabVIEW 8.6 Professional Development System with Mathscript, NI-VISA 4.4, the driver information is:

**********

Instrument Driver Technology:  Plug and Play
Supported Language(s):  LabVIEW
Supported Model(s):  AFG3021, AFG3022, AFG3101, AFG3102, AFG3251, AFG3252, AFG3021B, AFG3022B,AFG3011
Model(s) Tested:  AFG3252, AFG3022B, AFG3011
Interface(s):  GPIB, Ethernet, USB
Firmware Revision Tested:  1.0.4, 3.0.0
Certified:  Yes
NI Supported:  Yes
Source Code Available:  Yes
Driver Revision:  1.3.2
Original Release Date:  11/21/2006
Current Revision Date:  03/14/2011

**********

 

I want to incorporate control on my AFG3022B into an existing vi I have which is controlling an experiment. I'm testing

the AFG alone to start. I want to drive the two channels with Sine waves at 100Hz, but 90 deg out of phase with

each other (can't find a way to set the phase but that's another problem!).  The Sine amplitudes will be set

on initialise, but the DC offset to each channel will be a variable at each loop iteration - based on feedback from

the experiment. Something like this: Please note True constant on the Reset input to tkafg3k Initialise vi which

is the default.

 

My instrument is switched on and outputting pre-defined voltages on each channel to the equipment I'm driving.

When I run attached vi, the instrument briefly resets which changes the wavefrom properties and turns off both

voltage outputs - I really need to avoid this. It then sets the waveforms in the attached vi correctly. All takes

about 1s, and I can run it many times changing waveform properties etc.

 

If I change the Reset input on tkafg3k Initialise vi to a False constant I get:

Error -1073807339 occurred at VISA Read in tkafg3k Error Query.vi->tkafg3k Close.vi->tkafg3k_1.vi

VISA:  (Hex 0xBFFF0015) Timeout expired before operation completed.

..the original error I posted about.

 

If I change it back to a True constant I get:

Error -1073807346 occurred at VISA Write in tkafg3k Error Query.vi->tkafg3k Configure Standard Waveform.vi->tkafg3k_1.vi

VISA:  (Hex 0xBFFF000E) The given session or object reference is invalid.

 

I then have to switch off/on the AFG before I can start running vi s again. So, I have run the vi many times and I can

see on its front panel exactly what the vi is doing to the instrument and when voltage outputs are switched on/off.

 

Any further help much appreciated, as this is taking far too long and it should be easy!

Regards,

Liz



 

 

0 Kudos
Message 4 of 18
(6,588 Views)

Hi,

 

I have cheated my way around this problem for now - see attachment - but I would still appreciate some help

with solving it in a sensible fashion.  In tkafg3k Initialize.vi, when Reset is set to F, another vi is run called

 _tkafg3k Default Instrument Setup.vi

I have now just set the False case to do nothing, so I avoid the problem, the instrument does not reset

before applying the waveforms I want.

 

The driver seems to come in two parts. There's tkafg3k.llb which has all of the vis that appear in the Functions

Palette. There's also  _tkafg3k.llb which only contains two vis which do not appear in Functions Palette, and one of them

is _tkafg3k Default Instrument Setup.vi which I have disabled in attached image.

 

My last problem is that there seems to be no way to set the phase of a waveform; as I said, I want two Sine waves

90 deg out of phase.

 

Regards,

Liz

 

Message 5 of 18
(6,553 Views)

lizzied,

 

It looks like everytime you change a setting on the AFG3022 you open and close your communications.  Try opening/initializing the communications before you start your main program loop and close the communications after the loop finishes running.  That's the way the driver was intended to be used.  Program will run better and you should be able to avoid glitches

0 Kudos
Message 6 of 18
(6,543 Views)

Wayne,

That's actually what I'm working towards, see attachment. This driver will be part of a big existing vi that has an

initialization stage before the main loop runs, and closes everything after.

However, I often run that big vi tens of times a day, so I still need to avoid having the instrument Reset every

time I run my master vi.

Thanks,

Liz

  

0 Kudos
Message 7 of 18
(6,528 Views)

Liz,

 

Based on your description of overall system, I think that you're on the right track.  Consider creating an Action Engine to handle the communications with the AFG3022.  Much easier to add to existing code.  Ben posted a nugget here about Action Engines.

0 Kudos
Message 8 of 18
(6,516 Views)

 


@lizzied wrote:

Wayne,

That's actually what I'm working towards, see attachment. This driver will be part of a big existing vi that has an

initialization stage before the main loop runs, and closes everything after.

However, I often run that big vi tens of times a day, so I still need to avoid having the instrument Reset every

time I run my master vi.

Thanks,

Liz

 


Your VI should NOT have the functions in parallel. GPIB communication simply does not work that way. You have to wire the functions sequentially. You could very well be causing instrument errors.

 

 

At some point, you should address the errors that you get. Setting the instrument defaults and doing an error query should not cause any problems. Have you run the functions by themselves?

0 Kudos
Message 9 of 18
(6,499 Views)

Sorry, I haven't made it clear but I'm communicating with the instrument via usb. It's got two channels,

hence my parallel use of the configure waveform vis, once for Channel 1 and once for Channel 2.

As far as I can tell it is doing what I want it to do.

The problem I have occurs when I do not want the instrument to Reset on Initialize. I cannot run

the _tkafg3k Default Instrument Setup.vi alone as it's a subvi of  tkafg3k Initialize.vi. if I want

to communicate with the instrument I must, at the very least, run the Initialize and Close vis right?

That's the vi in my first post. Not sure what else I can check .. 

 

0 Kudos
Message 10 of 18
(6,488 Views)