scpi-dmm: model and MQ dependent delay when switching functions
Some models are slow to switch meter functions to specific MQs. This was observed with 34405A and AC V/I modes, where USB connections timed out and suffered from pipe errors. Add an optional delay after "CONF:<mode> [<range>]" SCPI requests. The duration of the delay is per model, the use of the delay is per MQ on that model. The 200ms delay for 34405A was found by experimentation. Speaking about 34405A: Only the "INIT" request in temperature mode remains as an issue, which is not covered by this commit's approach.
This commit is contained in:
parent
b74cc88d32
commit
08f023fe97
|
@ -127,9 +127,9 @@ 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, FLAGS_NONE, },
|
||||
{ SR_MQ_VOLTAGE, SR_MQFLAG_AC, "VOLT:AC", "VOLT:AC ", NO_DFLT_PREC, FLAG_CONF_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, 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_CONTINUITY, 0, "CONT", "CONT", -1, FLAG_NO_RANGE, },
|
||||
|
@ -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, 0, FALSE,
|
||||
0, 200 * 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, FALSE,
|
||||
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, FALSE,
|
||||
2500 * 1000, 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, FALSE,
|
||||
2500 * 1000, 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, FALSE,
|
||||
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, FALSE,
|
||||
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, FALSE,
|
||||
1500 * 1000, 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, FALSE,
|
||||
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, 1e9, TRUE,
|
||||
0, 0, 1e9, TRUE,
|
||||
NULL, NULL, NULL,
|
||||
},
|
||||
};
|
||||
|
|
|
@ -150,6 +150,8 @@ SR_PRIV int scpi_dmm_set_mq(const struct sr_dev_inst *sdi,
|
|||
ret = sr_scpi_send(sdi->conn, command, mode);
|
||||
if (ret != SR_OK)
|
||||
return ret;
|
||||
if (item->drv_flags & FLAG_CONF_DELAY)
|
||||
g_usleep(devc->model->conf_delay_us);
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
@ -241,6 +243,8 @@ SR_PRIV int scpi_dmm_set_range_from_text(const struct sr_dev_inst *sdi,
|
|||
item->scpi_func_setup, is_auto ? "AUTO" : range);
|
||||
if (ret != SR_OK)
|
||||
return ret;
|
||||
if (item->drv_flags & FLAG_CONF_DELAY)
|
||||
g_usleep(devc->model->conf_delay_us);
|
||||
|
||||
return SR_OK;
|
||||
}
|
||||
|
|
|
@ -58,6 +58,7 @@ struct mqopt_item {
|
|||
#define NO_DFLT_PREC -99
|
||||
#define FLAGS_NONE 0
|
||||
#define FLAG_NO_RANGE (1 << 0)
|
||||
#define FLAG_CONF_DELAY (1 << 1)
|
||||
|
||||
struct scpi_dmm_model {
|
||||
const char *vendor;
|
||||
|
@ -71,6 +72,7 @@ struct scpi_dmm_model {
|
|||
const uint32_t *devopts;
|
||||
size_t devopts_size;
|
||||
unsigned int read_timeout_us; /* If zero, use default from src/scpi/scpi.c. */
|
||||
unsigned int conf_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