ngscopeclient / scopehal

Test and measurement hardware abstraction library and protocol decodes. This is the library only. Most users should use scopehal-apps.
BSD 3-Clause "New" or "Revised" License
207 stars 94 forks source link

Siglent binary waveforms are unsupported #721

Open dan-gies opened 1 year ago

dan-gies commented 1 year ago

System Info:

Glscopeclient version: 0.1-59ef026 OS: Windows 10 Oscilloscope: Siglent SDS6204A (offline, open from .BIN file)

Description:

I'm unable to open raw waveform binaries using glscopeclient: ERROR: Unknown vendor in file header.

Is this planned to be supported? I think this would be useful, since glscopeclient doesn't support >12.5Mpts live captures, and my scope has 500Mpts of memory depth.

dan-gies commented 1 year ago

Worth noting: Siglent provides a Bin2CSV converter, but it would be nice to import these waveforms natively. However, if this isn't trivial, the converter provides a workaround.

azonenberg commented 1 year ago

Do you have a link to a spec for the format, and can you share some example files?

Writing an import filter is pretty trivial (the Agilent/Keysight BIN importer is ~200 lines if you don't count the boilerplate for filter creation) but obviously we have to know how the files are structured. If not we might have to reverse engineer it.

dan-gies commented 1 year ago

The spec can be found here: https://siglentna.com/wp-content/uploads/dlm_uploads/2021/09/How-to-Extract-Data-from-the-Binary-File.pdf. The 6000 series isn't listed as supported by the document, but I'm hoping that the format is unchanged.

I'll need to grab a smaller binary - max upload is 25 MB.

dan-gies commented 1 year ago

I split the ch1 capture into 10M volumes using 7zip. If this is unwieldly, let me know. If so, I can get a smaller capture over lunch.

ch1-pt1.zip ch1-pt2.zip

hansemro commented 1 year ago

Here is a newer version of the siglent binary spec that specifies formats for SDS2000X HD, SDS5000, and SDS6000: https://www.siglenteu.com/wp-content/uploads/2021/08/How-to-Extract-Data-from-the-Binary-File.pdf

Despite the date in the link, this spec was updated in 2023.

hansemro commented 1 year ago

I am working on a python script to parse and visualize the waveform: https://gist.github.com/hansemro/4b8733cf5a217bcee7a5796f8eff2726

This script currently supports:

~Unfortunately, I have not yet found a method to identify the model from the bin file. For now, the model argument must be specified to get the correct code_per_div.~ Resolved: can pull code_per_div from bin file.

SDS6000A_1

SDS6000A_2

hansemro commented 1 year ago

The newer V2 spec (shown on page 29 of E02A: https://web.archive.org/web/20230730072643/https://www.siglenteu.com/wp-content/uploads/2021/08/How-to-Extract-Data-from-the-Binary-File.pdf) describes how to extract code_per_div from what was previously reserved section of data.

With this, I updated the script to no longer require model name!

hansemro commented 1 year ago

Updated script to support V4 waveform format, which includes support for most scopes running up-to-date firmware.

Fortunately V4 is not much different to V2, so we can greatly simplify the C++ implementation:

Waveform data includes any enabled math channels. Math channel data is inserted between analog and digital channel data.

hansemro commented 1 year ago

@dan-gies If you are still interested, here is a dev branch with experimental support for importing V2/V4 Siglent BIN waveforms: https://github.com/hansemro/scopehal/tree/siglent-bin-import-dev

Short preview of SiglentBINImportFilter, which currently supports analog channels only:

https://github.com/glscopeclient/scopehal/assets/40348686/ba5104f9-3104-4e92-b0d4-5cb92343f188

hansemro commented 1 year ago

Updated dev branch with support to import math and digital waveforms.

image