03-11-2013 03:23 AM
We are trying to use the ag2k3k IVI driver to control a DSO-X 3034A. ( with latest firmware V2.20)
There are two major problems when using that driver.
The driver uses :DIG to start acquisitions for measurements.
That's fine if the signal fulfills the trigger conditions, which were setup before. But we have have to measure a signal from a possibly defective DUT. So we cannot guarantee that the trigger condition is fulfilled. In that case, Agilents documentation (programming guide chapter "Aquiring a waveform",attached) states, that you have to do a "device clear" to clean up/stop the aquisition properly. Otherwise the remote interface may timeout. To demonstrate what this means I've attached an IO-Trace log ( just sending a :DIG and a :STOP a a few *IDN? with the VISA test panel) The driver neither does that clean up by doing a viClear() internally nor does it provide a VI to do that manually.
If you are using the lowlevel aquistion functions there is no VI to decide if an aquisition has finished.
There is agx2k3k_AcquisitionStatus(). This returns 1 if :ACQ:COND? returns 100. And does it allways because you can set :ACQ:COND only to 100 according to the scopes documentation. So it is quie useless. You have to do something like an *OPC? query instead. Maybe provide a VI for the internally used agx2k3k_WaitForOPC() function
The driver nsource identifies itself as :
/********************************************************************************
* Copyright 2011-2012, National Instruments, Corporation. All Rights Reserved. *
********************************************************************************/
/*****************************************************************************
* Agilent 2000 and 3000 X-Series Oscilloscopes Instrument Driver
* LabWindows/CVI Instrument Driver
* Original Release: 24. June 2011
* By: Chenchen Zhou, National Instruments
*
* Modification History:
*
* 2011-06-24 - Instrument Driver Created.
* 2011-12-05 - [czhou] Update the error checking code in
* agx2k3k_ReadWaveformMeasurement function.
* 2012-09-01 - [hfeng] Add support for new models:MSO-X 3102A, MSO-X 3104A,
* DSO-X 3102A, DSO-X 3104A
* New functionality in power group, search group, demo
* group, trigger group, function group, Serial Bus group,
* marker group, WGEN group
*****************************************************************************/
03-14-2013 01:55 AM
Hi mkossmann,
For your first problem, actually NI driver provides a "Abort.vi" to stop the aquisition. You can use this VI to stop the aquisition manually.
As for your second problem, you are right about agx2k3k_AcquisitionStatus() function, it's useless to decide if an aquisition has finished. We need to use *OPC instead.
NI will release an update driver about ag2k3k in 2 or 3 weeks which provides a *OPC query VI as you suggested. You can use the new driver by then.
03-14-2013 02:32 AM
Hi mkossmann,
I may misunderstanded your first problem.
It's not ":STOP" but "viClear()" that this IVI driver lacks, is this what you meant?
03-14-2013 02:59 AM
The Abort VI sends a :STOP to the device. According to Agilents documentation, that stops an acquisition started with :RUN, but if you use :DIG to start the acquisition you will need a "device clear". ( Quote from programmers guide: "To halt a :DIGitize in progress, use the device clear command")
The attached log ( Timeout.zip in my first message) from NI IO-Trace clearly demonstrates that problem. The first *IDN? shows that communication is working, Then a :DIG ( without trigger condition) and a :STOP.
After that even a *IDN? query doesn't work any more. Only doing a device clear with viClear() revives the instrument.
Suggesting OPC for solving the second problem was wrong. That also returns 1 if the aquisition is not started/triggered.
Querying Bit 3 of Operation Status Condition Register is the documented thing to do. However it doesn't seem to work when :DIG is used to start the aquisition. Then the this query just times out. Don't know if that has to be considered as a firmware bug .
PS:just read your second post: Yes, you misunderstood me.
03-14-2013 04:19 AM - edited 03-14-2013 04:25 AM
This is a reimplementation for agx2k3k_AcquisitionStatus() querying bit 3 of OPER:COND as suggested in Agilents documentation. This works for me, if the scope was set to single trigger mode before with agx2k3k_ConfigureInitiateContinuous (Handle_SCOPE, VI_FALSE);
ViStatus _VI_FUNC agx2k3k_AcquisitionStatus (ViSession vi,
ViInt32 *statusRef)
{
ViStatus error = VI_SUCCESS;
ViInt32 status = AGX2K3K_VAL_ACQ_STATUS_UNKNOWN;
checkErr( Ivi_LockSession (vi, VI_NULL));
if (statusRef == VI_NULL)
viCheckParm( IVI_ERROR_INVALID_PARAMETER, 2, "Null address for Status");
if (!Ivi_Simulating (vi)) // call only when locked
{
ViSession io = Ivi_IOSession (vi); // call only when locked
ViInt32 state = 0;
checkErr( Ivi_SetNeedToCheckStatus (vi, VI_TRUE));
viCheckErr( viQueryf (io, ":OPER:COND?", "%d", &state));
if ((state & 0x8) == 0x8 ) // Running bit set
status = AGX2K3K_VAL_ACQ_IN_PROGRESS;
else
status = AGX2K3K_VAL_ACQ_COMPLETE;
}
else
{
status = AGX2K3K_VAL_ACQ_COMPLETE;
}
Error:
*statusRef = status;
Ivi_UnlockSession (vi, VI_NULL);
return error;
}
03-14-2013 04:44 AM
Seems the instrument won't respond to any command after DIG is sent. We'll check this issue with Agilent ASAP.
Regard to the first problem, NI will provide a viClear() interface in the next update driver.
03-19-2013 05:09 AM
Got answer from agilent. Actually we could know whether an acquisition has been finished.
The first way is to query *OPC? with a long enough timeout for the :DIG operation to complete. But I think this method is not what you want.
The second method is to use viReadSTB():
Send:
*ESE 1 – Mask the Standard Event Register output to send only the OPC bit to the Status Byte Register.
*CLS – Clear the status model
:DIG
*OPC – Set the OPC bit in the Event Status Register when the digitize is done.
Use viReadSTB() to read the Status Byte Register, if bit 5 in the Status Byte Register goes true, the acquisition is finished.