]> sigrok.org Git - libsigrok.git/commitdiff
rigol-ds: Add initial Rigol MSO5000 support.
authorSebastian Reichel <redacted>
Wed, 15 May 2019 20:20:55 +0000 (22:20 +0200)
committerSebastian Reichel <redacted>
Wed, 21 Aug 2019 12:54:12 +0000 (14:54 +0200)
This adds basic support for the Rigol MSO5000 series. It has
the same problems as the DS4000 series: Live capture provides
one digital channel per byte. Buffered memory returns the data
compressed (one byte has 8 digital channels), but the banks are
read separately. It's not possible to read uint16.

contrib/60-libsigrok.rules
src/hardware/rigol-ds/api.c
src/hardware/rigol-ds/protocol.c
src/hardware/rigol-ds/protocol.h
src/scpi/scpi_usbtmc_libusb.c

index 2e7b6b5993624e44141be546e01c7954bb3f9cdf..5936f7327dc4336947b9592d176b9cc1823718d0 100644 (file)
@@ -206,6 +206,9 @@ ATTRS{idVendor}=="1ab1", ATTRS{idProduct}=="0641", ENV{ID_SIGROK}="1"
 # Rigol DP800 series
 ATTRS{idVendor}=="1ab1", ATTRS{idProduct}=="0e11", ENV{ID_SIGROK}="1"
 
+# Rigol MSO5000 series
+ATTRS{idVendor}=="1ab1", ATTRS{idProduct}=="0515", ENV{ID_SIGROK}="1"
+
 # Rohde&Schwarz HMO series mixed-signal oscilloscope (previously branded Hameg) VCP/USBTMC mode
 ATTRS{idVendor}=="0aad", ATTRS{idProduct}=="0117", ENV{ID_SIGROK}="1"
 ATTRS{idVendor}=="0aad", ATTRS{idProduct}=="0118", ENV{ID_SIGROK}="1"
index ba23e31f1c1873224ecd7fb44d21cf954b60db11..6846068965c4b9a31aa13de4786ee57ade64f4d2 100644 (file)
@@ -183,6 +183,7 @@ enum series {
        DSO1000B,
        DS1000Z,
        DS4000,
+       MSO5000,
        MSO7000A,
 };
 
@@ -212,6 +213,8 @@ static const struct rigol_ds_series supported_series[] = {
                {50, 1}, {1, 1000}, 12, 1200, 12000000},
        [DS4000] = {VENDOR(RIGOL), "DS4000", PROTOCOL_V4, FORMAT_IEEE488_2,
                {1000, 1}, {1, 1000}, 14, 1400, 0},
+       [MSO5000] = {VENDOR(RIGOL), "MSO5000", PROTOCOL_V5, FORMAT_IEEE488_2,
+               {1000, 1}, {500, 1000000}, 10, 1000, 0},
        [MSO7000A] = {VENDOR(AGILENT), "MSO7000A", PROTOCOL_V4, FORMAT_IEEE488_2,
                {50, 1}, {2, 1000}, 10, 1000, 8000000},
 };
@@ -276,6 +279,12 @@ static const struct rigol_ds_model supported_models[] = {
        {SERIES(DS1000Z), "MSO1074Z-S", {5, 1000000000}, CH_INFO(4, true), std_cmd},
        {SERIES(DS1000Z), "MSO1104Z-S", {5, 1000000000}, CH_INFO(4, true), std_cmd},
        {SERIES(DS4000), "DS4024", {1, 1000000000}, CH_INFO(4, false), std_cmd},
+       {SERIES(MSO5000), "MSO5072", {1, 1000000000}, CH_INFO(2, true), std_cmd},
+       {SERIES(MSO5000), "MSO5074", {1, 1000000000}, CH_INFO(4, true), std_cmd},
+       {SERIES(MSO5000), "MSO5102", {1, 1000000000}, CH_INFO(2, true), std_cmd},
+       {SERIES(MSO5000), "MSO5104", {1, 1000000000}, CH_INFO(4, true), std_cmd},
+       {SERIES(MSO5000), "MSO5204", {1, 1000000000}, CH_INFO(4, true), std_cmd},
+       {SERIES(MSO5000), "MSO5354", {1, 1000000000}, CH_INFO(4, true), std_cmd},
        /* TODO: Digital channels are not yet supported on MSO7000A. */
        {SERIES(MSO7000A), "MSO7034A", {2, 1000000000}, CH_INFO(4, false), mso7000a_cmd},
 };
@@ -871,6 +880,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        struct sr_datafeed_packet packet;
        gboolean some_digital;
        GSList *l;
+       char *cmd;
 
        scpi = sdi->conn;
        devc = sdi->priv;
@@ -913,9 +923,14 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
                        }
                        if (ch->enabled != devc->digital_channels[ch->index]) {
                                /* Enabled channel is currently disabled, or vice versa. */
-                               if (rigol_ds_config_set(sdi,
-                                               devc->model->series->protocol >= PROTOCOL_V3 ?
-                                                       ":LA:DIG%d:DISP %s" : ":DIG%d:TURN %s", ch->index,
+                               if (devc->model->series->protocol >= PROTOCOL_V5)
+                                       cmd = ":LA:DISP D%d,%s";
+                               else if (devc->model->series->protocol >= PROTOCOL_V3)
+                                       cmd = ":LA:DIG%d:DISP %s";
+                               else
+                                       cmd = ":DIG%d:TURN %s";
+
+                               if (rigol_ds_config_set(sdi, cmd, ch->index,
                                                ch->enabled ? "ON" : "OFF") != SR_OK)
                                        return SR_ERR;
                                devc->digital_channels[ch->index] = ch->enabled;
index 26b492053b653a72a92d2dd3866a6db81e5405e7..3ea0cea8984a799b24cc47f00a4e31db1dc23e78 100644 (file)
@@ -370,6 +370,7 @@ SR_PRIV int rigol_ds_capture_start(const struct sr_dev_inst *sdi)
                break;
        case PROTOCOL_V3:
        case PROTOCOL_V4:
+       case PROTOCOL_V5:
                if (rigol_ds_config_set(sdi, ":WAV:FORM BYTE") != SR_OK)
                        return SR_ERR;
                if (devc->data_source == DATA_SOURCE_LIVE) {
@@ -382,7 +383,7 @@ SR_PRIV int rigol_ds_capture_start(const struct sr_dev_inst *sdi)
                        if (devc->model->series->protocol == PROTOCOL_V3) {
                                if (rigol_ds_config_set(sdi, ":WAV:MODE RAW") != SR_OK)
                                        return SR_ERR;
-                       } else if (devc->model->series->protocol == PROTOCOL_V4) {
+                       } else if (devc->model->series->protocol >= PROTOCOL_V4) {
                                num_channels = 0;
 
                                /* Channels 3 and 4 are multiplexed with D0-7 and D8-15 */
@@ -477,6 +478,7 @@ SR_PRIV int rigol_ds_channel_start(const struct sr_dev_inst *sdi)
                }
                break;
        case PROTOCOL_V4:
+       case PROTOCOL_V5:
                if (ch->type == SR_CHANNEL_ANALOG) {
                        if (rigol_ds_config_set(sdi, ":WAV:SOUR CHAN%d",
                                        ch->index + 1) != SR_OK)
@@ -736,7 +738,7 @@ SR_PRIV int rigol_ds_receive(int fd, int revents, void *cb_data)
                // TODO: For the MSO1000Z series, we need a way to express that
                // this data is in fact just for a single channel, with the valid
                // data for that channel in the LSB of each byte.
-               logic.unitsize = devc->model->series->protocol == PROTOCOL_V4 ? 1 : 2;
+               logic.unitsize = devc->model->series->protocol >= PROTOCOL_V4 ? 1 : 2;
                logic.data = devc->buffer;
                packet.type = SR_DF_LOGIC;
                packet.payload = &logic;
@@ -849,9 +851,12 @@ SR_PRIV int rigol_ds_get_dev_cfg(const struct sr_dev_inst *sdi)
                sr_dbg("Logic analyzer %s, current digital channel state:",
                                devc->la_enabled ? "enabled" : "disabled");
                for (i = 0; i < ARRAY_SIZE(devc->digital_channels); i++) {
-                       cmd = g_strdup_printf(
-                               devc->model->series->protocol >= PROTOCOL_V3 ?
-                                       ":LA:DIG%d:DISP?" : ":DIG%d:TURN?", i);
+                       if (devc->model->series->protocol >= PROTOCOL_V5)
+                               cmd = g_strdup_printf(":LA:DISP? D%d", i);
+                       else if (devc->model->series->protocol >= PROTOCOL_V3)
+                               cmd = g_strdup_printf(":LA:DIG%d:DISP?", i);
+                       else
+                               cmd = g_strdup_printf(":DIG%d:TURN?", i);
                        res = sr_scpi_get_bool(sdi->conn, cmd, &devc->digital_channels[i]);
                        g_free(cmd);
                        if (res != SR_OK)
index 86669b40de0ebbb6e5727d86340e136b4ad35604..a40c7ac178805e9225292fe07cc75a167d91daf5 100644 (file)
@@ -42,6 +42,7 @@ enum protocol_version {
        PROTOCOL_V2, /* DS1000 */
        PROTOCOL_V3, /* DS2000, DSO1000 */
        PROTOCOL_V4, /* DS1000Z */
+       PROTOCOL_V5, /* MSO5000 */
 };
 
 enum data_format {
index d09b35ffb42b165bd12880e123cf0aba42221f00..d45d1f4c8f2b01876230fb1b3ba3814008546238 100644 (file)
@@ -107,6 +107,7 @@ static struct usbtmc_blacklist blacklist_remote[] = {
        { 0x1ab1, 0x0588 }, /* Rigol DS1000 series */
        { 0x1ab1, 0x04b0 }, /* Rigol DS2000 series */
        { 0x1ab1, 0x04b1 }, /* Rigol DS4000 series */
+       { 0x1ab1, 0x0515 }, /* Rigol MSO5000 series */
        { 0x0957, 0x0588 }, /* Agilent DSO1000 series (rebadged Rigol DS1000) */
        { 0x0b21, 0xffff }, /* All Yokogawa devices */
        { 0xf4ec, 0xffff }, /* All Siglent SDS devices */