scpi-dmm: model and MQ dependent delay before measurement
Some models are slow to start a measurement acquisition in specific MQs (meter functions). An "*OPC?" query went unanswered after "INIT" was sent. This was observed on 34405A in temperature, frequency, resistance, AC voltage and current mode. Add an optional per-model measurement delay that is used when the MQ specifies that the delay is applicable. Because functions are changed rarely but measurements are taken many times, only the first reading is delayed while later readings are seen at the expected interval. Not delaying the first reading will result in device errors. sr: [00:00.875162] scpi_usbtmc: Successfully sent SCPI command: 'CONF?'. sr: [00:00.881666] scpi: Got response: '"FREQ +1.00000E+00,+1.00000E-05"', length 32. sr: [00:00.881700] scpi-dmm: dev_acquisition_start: Precision: '"FREQ +1.00000E+00,+1.00000E-05"' sr: [00:00.881840] scpi_usbtmc: Successfully sent SCPI command: '*OPC?'. sr: [00:00.883966] scpi: Got response: '1', length 1. sr: [00:00.884139] scpi_usbtmc: Successfully sent SCPI command: 'INIT'. sr: [00:01.884420] session: bus: Received SR_DF_HEADER packet. cli: Received SR_DF_HEADER. sr: [00:01.895260] scpi_usbtmc: Successfully sent SCPI command: '*OPC?'. sr: [00:02.895766] scpi_usbtmc: USBTMC bulk in transfer error: LIBUSB_ERROR_TIMEOUT. sr: [00:02.906302] scpi_usbtmc: Successfully sent SCPI command: '*OPC?'. sr: [00:02.910703] scpi_usbtmc: USBTMC invalid bulk in header. sr: [00:02.921244] scpi_usbtmc: USBTMC bulk out transfer error: LIBUSB_ERROR_PIPE. sr: [00:02.931802] scpi_usbtmc: Successfully sent SCPI command: '*OPC?'. sr: [00:02.932276] scpi: Got response: '1', length 1. sr: [00:02.932425] scpi_usbtmc: Successfully sent SCPI command: '*OPC?'. sr: [00:02.934790] scpi: Got response: '1', length 1. sr: [00:02.935155] scpi_usbtmc: Successfully sent SCPI command: 'CONF?'. sr: [00:02.941564] scpi: Got response: '"FREQ +1.00000E+00,+1.00000E-05"', length 32. sr: [00:00.173408] hwdriver: scpi-dmm: Starting acquisition. sr: [00:00.173569] scpi_usbtmc: Successfully sent SCPI command: '*OPC?'. sr: [00:00.334312] scpi: Got response: '1', length 1. sr: [00:00.334544] scpi_usbtmc: Successfully sent SCPI command: 'CONF?'. sr: [00:00.341070] scpi: Got response: '"RES +1.00000E+02,+1.00000E-03"', length 31. sr: [00:00.341307] scpi_usbtmc: Successfully sent SCPI command: '*OPC?'. sr: [00:00.343636] scpi: Got response: '1', length 1. sr: [00:00.343872] scpi_usbtmc: Successfully sent SCPI command: 'CONF?'. sr: [00:00.350093] scpi: Got response: '"RES +1.00000E+02,+1.00000E-03"', length 31. sr: [00:00.350157] scpi-dmm: dev_acquisition_start: Precision: '"RES +1.00000E+02,+1.00000E-03"' sr: [00:00.350342] scpi_usbtmc: Successfully sent SCPI command: '*OPC?'. sr: [00:00.352524] scpi: Got response: '1', length 1. sr: [00:00.352832] scpi_usbtmc: Successfully sent SCPI command: 'INIT'. sr: [00:00.352901] session: bus: Received SR_DF_HEADER packet. cli: Received SR_DF_HEADER. sr: [00:00.363675] scpi_usbtmc: Successfully sent SCPI command: '*OPC?'. sr: [00:01.364363] scpi_usbtmc: USBTMC bulk in transfer error: LIBUSB_ERROR_TIMEOUT. sr: [00:01.374904] scpi_usbtmc: Successfully sent SCPI command: '*OPC?'. sr: [00:02.375380] scpi_usbtmc: USBTMC bulk in transfer error: LIBUSB_ERROR_TIMEOUT. sr: [00:02.385872] scpi_usbtmc: Successfully sent SCPI command: '*OPC?'. sr: [00:03.232457] scpi_usbtmc: USBTMC invalid bulk in header. sr: [00:03.243003] scpi_usbtmc: USBTMC bulk out transfer error: LIBUSB_ERROR_PIPE. sr: [00:03.253464] scpi_usbtmc: Successfully sent SCPI command: '*OPC?'. sr: [00:03.256568] scpi: Got response: '1', length 1. sr: [00:03.256902] scpi_usbtmc: Successfully sent SCPI command: '*OPC?'. sr: [00:03.259440] scpi: Got response: '1', length 1. sr: [00:03.259713] scpi_usbtmc: Successfully sent SCPI command: 'CONF?'. sr: [00:03.266070] scpi: Got response: '"RES +1.00000E+08,+1.00000E+3"', length 30. sr: [00:03.266456] scpi_usbtmc: Successfully sent SCPI command: '*OPC?'. sr: [00:03.268501] scpi: Got response: '1', length 1. sr: [00:03.268961] scpi_usbtmc: Successfully sent SCPI command: 'READ?'. sr: [00:03.353589] scpi: Got response: '+9.90000000E+37 ', length 16. Declare a 2500ms measurement initiation delay for 34405A which was found by experimentation. This is huge but was found to be necessary. Of course all other meter functions are unaffected by this commit. As are the meters which specify no delay.
This commit is contained in:
parent
08f023fe97
commit
e90551c3f8
|
@ -127,16 +127,16 @@ static const struct scpi_command cmdset_owon[] = {
|
|||
|
||||
static const struct mqopt_item mqopts_agilent_34405a[] = {
|
||||
{ SR_MQ_VOLTAGE, SR_MQFLAG_DC, "VOLT:DC", "VOLT ", NO_DFLT_PREC, FLAGS_NONE, },
|
||||
{ SR_MQ_VOLTAGE, SR_MQFLAG_AC, "VOLT:AC", "VOLT:AC ", NO_DFLT_PREC, FLAG_CONF_DELAY, },
|
||||
{ SR_MQ_VOLTAGE, SR_MQFLAG_AC, "VOLT:AC", "VOLT:AC ", NO_DFLT_PREC, FLAG_CONF_DELAY | FLAG_MEAS_DELAY, },
|
||||
{ SR_MQ_CURRENT, SR_MQFLAG_DC, "CURR:DC", "CURR ", NO_DFLT_PREC, FLAGS_NONE, },
|
||||
{ SR_MQ_CURRENT, SR_MQFLAG_AC, "CURR:AC", "CURR:AC ", NO_DFLT_PREC, FLAG_CONF_DELAY, },
|
||||
{ SR_MQ_RESISTANCE, 0, "RES", "RES ", NO_DFLT_PREC, FLAGS_NONE, },
|
||||
{ SR_MQ_RESISTANCE, SR_MQFLAG_FOUR_WIRE, "FRES", "FRES ", NO_DFLT_PREC, FLAGS_NONE, },
|
||||
{ SR_MQ_CURRENT, SR_MQFLAG_AC, "CURR:AC", "CURR:AC ", NO_DFLT_PREC, FLAG_CONF_DELAY | FLAG_MEAS_DELAY, },
|
||||
{ SR_MQ_RESISTANCE, 0, "RES", "RES ", NO_DFLT_PREC, FLAG_MEAS_DELAY, },
|
||||
{ SR_MQ_RESISTANCE, SR_MQFLAG_FOUR_WIRE, "FRES", "FRES ", NO_DFLT_PREC, FLAG_MEAS_DELAY, },
|
||||
{ SR_MQ_CONTINUITY, 0, "CONT", "CONT", -1, FLAG_NO_RANGE, },
|
||||
{ SR_MQ_CAPACITANCE, 0, "CAP", "CAP ", NO_DFLT_PREC, FLAGS_NONE, },
|
||||
{ SR_MQ_VOLTAGE, SR_MQFLAG_DC | SR_MQFLAG_DIODE, "DIOD", "DIOD", -4, FLAG_NO_RANGE, },
|
||||
{ SR_MQ_TEMPERATURE, 0, "TEMP", "TEMP ", NO_DFLT_PREC, FLAG_NO_RANGE, },
|
||||
{ SR_MQ_FREQUENCY, 0, "FREQ", "FREQ ", NO_DFLT_PREC, FLAG_NO_RANGE, },
|
||||
{ SR_MQ_TEMPERATURE, 0, "TEMP", "TEMP ", NO_DFLT_PREC, FLAG_NO_RANGE | FLAG_MEAS_DELAY, },
|
||||
{ SR_MQ_FREQUENCY, 0, "FREQ", "FREQ ", NO_DFLT_PREC, FLAG_NO_RANGE | FLAG_MEAS_DELAY, },
|
||||
};
|
||||
|
||||
static const struct mqopt_item mqopts_agilent_34401a[] = {
|
||||
|
@ -204,7 +204,7 @@ SR_PRIV const struct scpi_dmm_model models[] = {
|
|||
1, 5, cmdset_agilent, ARRAY_AND_SIZE(mqopts_agilent_34405a),
|
||||
scpi_dmm_get_meas_agilent,
|
||||
ARRAY_AND_SIZE(devopts_generic_range),
|
||||
0, 200 * 1000, 0, FALSE,
|
||||
0, 200 * 1000, 2500 * 1000, 0, FALSE,
|
||||
scpi_dmm_get_range_text, scpi_dmm_set_range_from_text, NULL,
|
||||
},
|
||||
{
|
||||
|
@ -212,7 +212,7 @@ SR_PRIV const struct scpi_dmm_model models[] = {
|
|||
1, 6, cmdset_hp, ARRAY_AND_SIZE(mqopts_agilent_34405a),
|
||||
scpi_dmm_get_meas_agilent,
|
||||
ARRAY_AND_SIZE(devopts_generic),
|
||||
0, 0, 0, FALSE,
|
||||
0, 0, 0, 0, FALSE,
|
||||
NULL, NULL, NULL,
|
||||
},
|
||||
{
|
||||
|
@ -220,7 +220,7 @@ SR_PRIV const struct scpi_dmm_model models[] = {
|
|||
1, 6, cmdset_gwinstek, ARRAY_AND_SIZE(mqopts_gwinstek_gdm8200a),
|
||||
scpi_dmm_get_meas_gwinstek,
|
||||
ARRAY_AND_SIZE(devopts_generic),
|
||||
2500 * 1000, 0, 0, FALSE,
|
||||
2500 * 1000, 0, 0, 0, FALSE,
|
||||
NULL, NULL, NULL,
|
||||
},
|
||||
{
|
||||
|
@ -228,7 +228,7 @@ SR_PRIV const struct scpi_dmm_model models[] = {
|
|||
1, 6, cmdset_gwinstek, ARRAY_AND_SIZE(mqopts_gwinstek_gdm8200a),
|
||||
scpi_dmm_get_meas_gwinstek,
|
||||
ARRAY_AND_SIZE(devopts_generic),
|
||||
2500 * 1000, 0, 0, FALSE,
|
||||
2500 * 1000, 0, 0, 0, FALSE,
|
||||
NULL, NULL, NULL,
|
||||
},
|
||||
{
|
||||
|
@ -236,7 +236,7 @@ SR_PRIV const struct scpi_dmm_model models[] = {
|
|||
1, 6, cmdset_gwinstek_906x, ARRAY_AND_SIZE(mqopts_gwinstek_gdm906x),
|
||||
scpi_dmm_get_meas_agilent,
|
||||
ARRAY_AND_SIZE(devopts_generic),
|
||||
0, 0, 0, FALSE,
|
||||
0, 0, 0, 0, FALSE,
|
||||
NULL, NULL, NULL,
|
||||
},
|
||||
{
|
||||
|
@ -244,7 +244,7 @@ SR_PRIV const struct scpi_dmm_model models[] = {
|
|||
1, 6, cmdset_gwinstek_906x, ARRAY_AND_SIZE(mqopts_gwinstek_gdm906x),
|
||||
scpi_dmm_get_meas_agilent,
|
||||
ARRAY_AND_SIZE(devopts_generic),
|
||||
0, 0, 0, FALSE,
|
||||
0, 0, 0, 0, FALSE,
|
||||
NULL, NULL, NULL,
|
||||
},
|
||||
{
|
||||
|
@ -253,7 +253,7 @@ SR_PRIV const struct scpi_dmm_model models[] = {
|
|||
scpi_dmm_get_meas_agilent,
|
||||
ARRAY_AND_SIZE(devopts_generic),
|
||||
/* 34401A: typ. 1020ms for AC readings (default is 1000ms). */
|
||||
1500 * 1000, 0, 0, FALSE,
|
||||
1500 * 1000, 0, 0, 0, FALSE,
|
||||
NULL, NULL, NULL,
|
||||
},
|
||||
{
|
||||
|
@ -261,7 +261,7 @@ SR_PRIV const struct scpi_dmm_model models[] = {
|
|||
1, 6, cmdset_agilent, ARRAY_AND_SIZE(mqopts_agilent_34405a),
|
||||
scpi_dmm_get_meas_agilent,
|
||||
ARRAY_AND_SIZE(devopts_generic_range),
|
||||
0, 0, 0, FALSE,
|
||||
0, 0, 0, 0, FALSE,
|
||||
scpi_dmm_get_range_text, scpi_dmm_set_range_from_text, NULL,
|
||||
},
|
||||
{
|
||||
|
@ -269,7 +269,7 @@ SR_PRIV const struct scpi_dmm_model models[] = {
|
|||
1, 5, cmdset_owon, ARRAY_AND_SIZE(mqopts_owon_xdm2041),
|
||||
scpi_dmm_get_meas_gwinstek,
|
||||
ARRAY_AND_SIZE(devopts_generic),
|
||||
0, 0, 1e9, TRUE,
|
||||
0, 0, 0, 1e9, TRUE,
|
||||
NULL, NULL, NULL,
|
||||
},
|
||||
};
|
||||
|
@ -559,6 +559,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
|||
const struct mqopt_item *item;
|
||||
const char *command;
|
||||
char *response;
|
||||
gboolean do_mq_meas_delay;
|
||||
|
||||
scpi = sdi->conn;
|
||||
devc = sdi->priv;
|
||||
|
@ -595,6 +596,10 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
|
|||
return ret;
|
||||
}
|
||||
|
||||
do_mq_meas_delay = item->drv_flags & FLAG_MEAS_DELAY;
|
||||
if (do_mq_meas_delay && devc->model->meas_delay_us)
|
||||
g_usleep(devc->model->meas_delay_us);
|
||||
|
||||
sr_sw_limits_acquisition_start(&devc->limits);
|
||||
ret = std_session_send_df_header(sdi);
|
||||
if (ret != SR_OK)
|
||||
|
|
|
@ -59,6 +59,7 @@ struct mqopt_item {
|
|||
#define FLAGS_NONE 0
|
||||
#define FLAG_NO_RANGE (1 << 0)
|
||||
#define FLAG_CONF_DELAY (1 << 1)
|
||||
#define FLAG_MEAS_DELAY (1 << 2)
|
||||
|
||||
struct scpi_dmm_model {
|
||||
const char *vendor;
|
||||
|
@ -73,6 +74,7 @@ struct scpi_dmm_model {
|
|||
size_t devopts_size;
|
||||
unsigned int read_timeout_us; /* If zero, use default from src/scpi/scpi.c. */
|
||||
unsigned int conf_delay_us;
|
||||
unsigned int meas_delay_us;
|
||||
float infinity_limit; /* If zero, use default from protocol.c */
|
||||
gboolean check_opc;
|
||||
const char *(*get_range_text)(const struct sr_dev_inst *sdi);
|
||||
|
|
Loading…
Reference in New Issue