]> sigrok.org Git - libsigrok.git/commitdiff
rigol-ds: Fix reading data from internal memory
authorValentin Ochs <redacted>
Thu, 11 Jun 2020 14:12:25 +0000 (16:12 +0200)
committerUwe Hermann <redacted>
Wed, 24 Jun 2020 21:56:01 +0000 (23:56 +0200)
According to the programming manual, one should issue

    :WAV:RES
    :WAV:BEG

before reading data from internal memory. Without this, the wrong data
will be returned.

src/hardware/rigol-ds/protocol.c

index 6d8abc1ee3a4f521a917fdfe6ee206c85f482ade..02a484f32935d6cecf0a8a6e0e9807437a514224 100644 (file)
@@ -493,6 +493,11 @@ SR_PRIV int rigol_ds_channel_start(const struct sr_dev_inst *sdi)
                                        devc->data_source == DATA_SOURCE_LIVE ?
                                                ":WAV:MODE NORM" :":WAV:MODE RAW") != SR_OK)
                        return SR_ERR;
+
+               if (devc->data_source != DATA_SOURCE_LIVE) {
+                       if (rigol_ds_config_set(sdi, ":WAV:RES") != SR_OK)
+                               return SR_ERR;
+               }
                break;
        }
 
@@ -651,9 +656,12 @@ SR_PRIV int rigol_ds_receive(int fd, int revents, void *cb_data)
                                return TRUE;
                }
 
-               if (devc->model->series->protocol >= PROTOCOL_V3)
+               if (devc->model->series->protocol >= PROTOCOL_V3) {
+                       if (rigol_ds_config_set(sdi, ":WAV:BEG") != SR_OK)
+                               return TRUE;
                        if (sr_scpi_send(sdi->conn, ":WAV:DATA?") != SR_OK)
                                return TRUE;
+               }
 
                if (sr_scpi_read_begin(scpi) != SR_OK)
                        return TRUE;