Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Agilent 532xx Counter driver bug ?

Solved!
Go to solution

For a special measurement I have so set gatetime to 120 s. Then you have to expect that the measurement needs at least  120 seconds. So I'am calling ag532xx_Read() with 125s timeout (ag532xx_Read (_tmp1, 125000, &_tmp12);) . That doesn't seem to work.

Debugging into driver shows that it sets AG532XX_ATTR_OPC_TIMEOUT to 125000, but in  ag532xx_WaitForOPCCallback() the viQueryf(io, "*OPC?", "%hd", &opcDone) times out after 5 seconds and returns with a BFFF0015 error, which is then remapped to AG532XX_ERROR_MAX_TIME_EXCEEDED in ag532xx_Read().

Might it be that there is some Code, that should set the timeout for the viQuery(), is missing in WaitForOPCCallback() ?

 

PS: The driver source identifies itself as:

/*****************************************************************************
 *  Agilent 532xx Frequency Universal Counter Instrument Driver                              
 *  LabWindows/CVI Instrument Driver                                    
 *  Original Release:  July 25, 2011                                 
 *  By: hfeng,                              
 *      PH. 021-50509810                          
 *                                                                          
 *  Modification History:                                                   
 *                                                                          
 *       July 25, 2011 - Instrument Driver Created.                 
 *                                                                          
 ***********************************************************************

0 Kudos
Message 1 of 5
(5,232 Views)

Answering myself.: Changing ag532xx_WaitForOPCCallback() from

 

static ViStatus _VI_FUNC ag532xx_WaitForOPCCallback (ViSession vi, ViSession io)
{
    ViStatus    error = VI_SUCCESS;
    ViInt32     opcTimeout;
    ViBoolean   opcDone = VI_FALSE;

    checkErr( Ivi_GetAttributeViInt32 (vi, VI_NULL, AG532XX_ATTR_OPC_TIMEOUT,
                                       0, &opcTimeout));

 

 viCheckErr(viQueryf(io, "*OPC?", "%hd", &opcDone));
 

Error:
    viDiscardEvents (io, VI_EVENT_SERVICE_REQ, VI_QUEUE);

    return error;
}   

 

to

static ViStatus _VI_FUNC ag532xx_WaitForOPCCallback (ViSession vi, ViSession io)
{
    ViStatus    error = VI_SUCCESS;
    ViInt32     opcTimeout,oldVISATimeout;
    ViBoolean   opcDone = VI_FALSE;

    checkErr( Ivi_GetAttributeViInt32 (vi, VI_NULL, AG532XX_ATTR_OPC_TIMEOUT,
                                       0, &opcTimeout));

 viCheckErr(viGetAttribute (io, VI_ATTR_TMO_VALUE, &oldVISATimeout));
 viCheckErr(viSetAttribute (io, VI_ATTR_TMO_VALUE, opcTimeout));
   
 viCheckErr(viQueryf(io, "*OPC?", "%hd", &opcDone));
 viCheckErr(viSetAttribute (io, VI_ATTR_TMO_VALUE, oldVISATimeout)); 

Error:
    viDiscardEvents (io, VI_EVENT_SERVICE_REQ, VI_QUEUE);

    return error;
}   

 

seems to fix the problem for me.  Is this the right fix for the problem or does it just hide the real bug ?

 

Message 2 of 5
(5,219 Views)

hey mkossmann,

 

if you are pogrammin a serial device through the VISA layer ( using GPIB) , the use of SCPI commands are required.

But when your selfmade fix does work it is fine as well.

 

Regards

 

Roman Imhoff

0 Kudos
Message 3 of 5
(5,192 Views)

*OPC? is definitely a standard SCPI command, which  has to be implemented in all SCPI compliant devices ( see chapter 4.1.1 of http://www.ivifoundation.org/docs/SCPI-99.PDF).

0 Kudos
Message 4 of 5
(5,186 Views)
Solution
Accepted by topic author mkossmann

The WaitForOPCCallback function timeout value remained unchanged after setting AG532XX_ATTR_OPC_TIMEOUT attribute.  Thank you mkossmann for pointing this out.

We have made this change to the source and will try to rebuild and release the installer before the end of the week.

Message 5 of 5
(5,179 Views)