30#ifndef SiglentSCPIOscilloscope_h
31#define SiglentSCPIOscilloscope_h
52#define WAVEDESC_SIZE 346
57#define WAVEFORM_SIZE (14 * 1000 * 1000)
59#define c_digiChannelsPerBus 8
73 std::string converse(
const char* fmt, ...);
74 void sendOnly(
const char* fmt, ...);
77 void IdentifyHardware();
78 void DetectBandwidth();
79 void SharedCtorInit();
83 void ParseFirmwareVersion();
84 uint64_t GetMaxPoints();
85 uint64_t GetAcqPoints();
86 uint64_t GetDigitalAcqPoints();
104 virtual void SetChannelCoupling(
size_t i, OscilloscopeChannel::CouplingType type)
override;
114 virtual void SetChannelOffset(
size_t i,
size_t stream,
float offset)
override;
118 virtual bool CanInvert(
size_t i)
override;
119 virtual void Invert(
size_t i,
bool invert)
override;
125 virtual void Start()
override;
127 virtual void Stop()
override;
150 MODEL_SIGLENT_SDS800X_HD,
151 MODEL_SIGLENT_SDS1000,
152 MODEL_SIGLENT_SDS1000X_HD,
153 MODEL_SIGLENT_SDS2000XE,
154 MODEL_SIGLENT_SDS2000XP,
155 MODEL_SIGLENT_SDS2000X_HD,
156 MODEL_SIGLENT_SDS3000X_HD,
157 MODEL_SIGLENT_SDS5000X,
158 MODEL_SIGLENT_SDS6000L,
159 MODEL_SIGLENT_SDS6000A,
160 MODEL_SIGLENT_SDS6000PRO,
161 MODEL_SIGLENT_SDS7000A,
173 Model GetModelID() {
return m_modelid; }
178 virtual std::set<InterleaveConflict> GetInterleaveConflicts()
override;
248 virtual std::vector<std::string>
GetADCModeNames(
size_t channel)
override;
249 virtual size_t GetADCMode(
size_t channel)
override;
250 virtual void SetADCMode(
size_t channel,
size_t mode)
override;
270 void PushFloat(std::string path,
float f);
279 ChannelMode GetChannelMode();
281 void PrepareAcquisition();
283 std::string GetPossiblyEmptyString(
const std::string& property);
285 int ReadWaveformBlock(uint32_t maxsize,
char* data,
bool hdSizeWorkaround =
false, std::function<
void(
float)> progress =
nullptr);
287 char wavedescs[MAX_ANALOG][WAVEDESC_SIZE],
bool* analogEnabled,
bool* digitalEnabled,
bool& anyAnalogEnabled,
bool& anyDigitalEnabled);
289 void RequestWaveforms(
bool* enabled, uint32_t num_sequences,
bool denabled);
290 time_t ExtractTimestamp(
unsigned char* wavedesc,
double& basetime);
292 std::vector<WaveformBase*> ProcessAnalogWaveform(
const char* data,
295 uint32_t num_sequences,
301 std::vector<SparseDigitalWaveform*> ProcessDigitalWaveform(
const char* data,
304 uint32_t num_sequences,
311 unsigned int m_analogChannelCount;
312 unsigned int m_digitalChannelCount;
313 unsigned int m_analogAndDigitalChannelCount;
314 size_t m_digitalChannelBase;
317 Protocol m_protocolId;
320 int m_ubootMajorVersion;
321 int m_ubootMinorVersion;
322 int m_fwMajorVersion;
323 int m_fwMinorVersion;
324 int m_fwPatchVersion;
325 int m_fwPatchRevision;
330 bool m_hasFunctionGen;
331 bool m_hasFastSampleRate;
332 int m_memoryDepthOption;
333 bool m_hasI2cTrigger;
334 bool m_hasSpiTrigger;
335 bool m_hasUartTrigger;
338 bool m_requireSizeWorkaround;
344 bool m_triggerOneShot;
345 bool m_triggerForced;
348 std::map<size_t, float> m_channelVoltageRanges;
349 std::map<size_t, float> m_channelOffsets;
350 std::map<size_t, float> m_channelDigitalThresholds;
351 std::map<int, bool> m_channelsEnabled;
352 bool m_sampleRateValid;
353 int64_t m_sampleRate;
354 bool m_memoryDepthValid;
355 int64_t m_memoryDepth;
356 bool m_triggerOffsetValid;
357 int64_t m_triggerOffset;
358 bool m_maxPointsValid;
359 uint64_t m_maxPoints;
360 bool m_acqPointsValid;
361 uint64_t m_acqPoints;
362 bool m_digitalAcqPointsValid;
363 uint64_t m_digitalAcqPoints;
364 std::map<size_t, int64_t> m_channelDeskew;
365 Multimeter::MeasurementTypes m_meterMode;
366 bool m_meterModeValid;
367 std::map<size_t, bool> m_probeIsActive;
368 std::map<size_t, bool> m_awgEnabled;
369 std::map<size_t, float> m_awgDutyCycle;
370 std::map<size_t, float> m_awgRange;
371 std::map<size_t, float> m_awgOffset;
372 std::map<size_t, float> m_awgFrequency;
373 std::map<size_t, FunctionGenerator::WaveShape> m_awgShape;
374 std::map<size_t, FunctionGenerator::OutputImpedance> m_awgImpedance;
383 bool m_highDefinition;
388 std::vector<OscilloscopeChannel*> m_digitalChannels;
391 static std::string GetDriverNameInternal();
Trigger when a signal stops toggling for some amount of time.
Definition: DropoutTrigger.h:44
Simple edge trigger.
Definition: EdgeTrigger.h:44
A single channel of a function generator.
Definition: FunctionGeneratorChannel.h:45
WaveShape
Predefined waveform shapes.
Definition: FunctionGenerator.h:55
OutputImpedance
Nominal output impedance for a function generator channel.
Definition: FunctionGenerator.h:259
Trigger on a glitch meeting certain width criteria.
Definition: GlitchTrigger.h:46
A single channel on an oscilloscope.
Definition: OscilloscopeChannel.h:49
TriggerMode
Definition: Oscilloscope.h:411
Trigger on a pulse meeting certain width criteria.
Definition: PulseWidthTrigger.h:44
Runt trigger - trigger when a pulse of a given width crosses one threshold but not the second.
Definition: RuntTrigger.h:46
An SCPI-based function generator.
Definition: SCPIFunctionGenerator.h:38
An SCPI-based oscilloscope.
Definition: SCPIOscilloscope.h:38
Abstraction of a transport layer for moving SCPI data between endpoints.
Definition: SCPITransport.h:47
Definition: SiglentSCPIOscilloscope.h:63
virtual int64_t GetTriggerOffset() override
Gets the trigger offset.
Definition: SiglentSCPIOscilloscope.cpp:3382
virtual OutputImpedance GetFunctionChannelOutputImpedance(int chan) override
Gets the currently selected output impedance for a function generator output (if supported)
Definition: SiglentSCPIOscilloscope.cpp:5515
void PullSlewRateTrigger()
Reads settings for a slew rate trigger from the instrument.
Definition: SiglentSCPIOscilloscope.cpp:4118
virtual void SetFunctionChannelOffset(int chan, float offset) override
Sets the DC offset for a function generator output.
Definition: SiglentSCPIOscilloscope.cpp:5038
virtual void SetDigitalThreshold(size_t channel, float level) override
Gets the threshold for a digital input.
Definition: SiglentSCPIOscilloscope.cpp:3770
virtual unsigned int GetInstrumentTypes() const override
See what features we have.
Definition: SiglentSCPIOscilloscope.cpp:691
virtual bool SetInterleaving(bool combine) override
Configures the scope to combine channels.
Definition: SiglentSCPIOscilloscope.cpp:3557
void PushWindowTrigger(WindowTrigger *trig)
Pushes settings for a window trigger to the instrument.
Definition: SiglentSCPIOscilloscope.cpp:4765
virtual void SetChannelVoltageRange(size_t i, size_t stream, float range) override
Sets the range of the current channel configuration.
Definition: SiglentSCPIOscilloscope.cpp:2565
virtual DigitalBank GetDigitalBank(size_t channel) override
Gets the bank containing a given channel.
Definition: SiglentSCPIOscilloscope.cpp:3689
virtual std::vector< uint64_t > GetSampleDepthsNonInterleaved() override
Get the legal memory depths for this scope in all-channels mode.
Definition: SiglentSCPIOscilloscope.cpp:2668
virtual void PullTrigger() override
Updates m_trigger with any changes made from the instrument side.
Definition: SiglentSCPIOscilloscope.cpp:3795
virtual void SetFunctionChannelShape(int chan, WaveShape shape) override
Sets the waveform shape for a function generator output.
Definition: SiglentSCPIOscilloscope.cpp:5272
virtual void SetSampleDepth(uint64_t depth) override
Sets the sample depth of the scope.
Definition: SiglentSCPIOscilloscope.cpp:2908
virtual void SetFunctionChannelOutputImpedance(int chan, OutputImpedance z) override
Sets the currently selected output impedance for a function generator output (if supported)
Definition: SiglentSCPIOscilloscope.cpp:5530
void PullTriggerSource(Trigger *trig, std::string triggerModeName, bool isUart)
Reads the source of a trigger from the instrument.
Definition: SiglentSCPIOscilloscope.cpp:3884
void GetTriggerSlope(EdgeTrigger *trig, std::string reply)
Processes the slope for an edge or edge-derived trigger.
Definition: SiglentSCPIOscilloscope.cpp:4312
void PushDropoutTrigger(DropoutTrigger *trig)
Pushes settings for a dropout trigger to the instrument.
Definition: SiglentSCPIOscilloscope.cpp:4484
virtual int64_t GetDeskewForChannel(size_t channel) override
Gets the deskew setting for a channel.
Definition: SiglentSCPIOscilloscope.cpp:3458
virtual unsigned int GetMeasurementTypes()
See what measurement capabilities we have.
Definition: SiglentSCPIOscilloscope.cpp:682
virtual bool IsDigitalThresholdConfigurable() override
Checks if digital input threshold is configurable or fixed.
Definition: SiglentSCPIOscilloscope.cpp:3713
virtual void SetChannelDisplayName(size_t i, std::string name) override
Sets the hardware display name for a channel. This is an arbitrary user-selected string.
Definition: SiglentSCPIOscilloscope.cpp:1391
virtual void SetChannelBandwidthLimit(size_t i, unsigned int limit_mhz) override
Sets the bandwidth limit for an input channel.
Definition: SiglentSCPIOscilloscope.cpp:1284
void PushRuntTrigger(RuntTrigger *trig)
Pushes settings for a runt trigger to the instrument.
Definition: SiglentSCPIOscilloscope.cpp:4615
virtual bool CanInvert(size_t i) override
Checks if a channel is capable of hardware polarity inversion.
Definition: SiglentSCPIOscilloscope.cpp:1333
virtual void Stop() override
Stops triggering.
Definition: SiglentSCPIOscilloscope.cpp:2388
virtual void SetFunctionChannelActive(int chan, bool on) override
Turns a function generator channel on or off.
Definition: SiglentSCPIOscilloscope.cpp:4956
virtual std::vector< WaveShape > GetAvailableWaveformShapes(int chan) override
Query the set of available pre-defined waveforms for this generator.
Definition: SiglentSCPIOscilloscope.cpp:4861
virtual float GetDigitalThreshold(size_t channel) override
Gets the threshold for a digital input.
Definition: SiglentSCPIOscilloscope.cpp:3724
virtual void SetChannelOffset(size_t i, size_t stream, float offset) override
Sets the offset for a given channel.
Definition: SiglentSCPIOscilloscope.cpp:2494
virtual float GetFunctionChannelDutyCycle(int chan) override
Gets the duty cycle for a function generator output.
Definition: SiglentSCPIOscilloscope.cpp:4977
virtual bool IsADCModeConfigurable() override
Returns true if the ADC is configurable, false if it can only run in one mode.
Definition: SiglentSCPIOscilloscope.cpp:3570
virtual std::string GetChannelDisplayName(size_t i) override
Gets the hardware display name for a channel. This is an arbitrary user-selected string.
Definition: SiglentSCPIOscilloscope.cpp:1429
void PullDropoutTrigger()
Reads settings for a dropout trigger from the instrument.
Definition: SiglentSCPIOscilloscope.cpp:3896
virtual void DetectAnalogChannels()
Figures out how many analog channels we have, and add them to the device.
Definition: SiglentSCPIOscilloscope.cpp:560
virtual void ForceTrigger() override
Forces a single acquisition as soon as possible.
Definition: SiglentSCPIOscilloscope.cpp:2418
virtual uint32_t GetInstrumentTypesForChannel(size_t i) const override
Returns a bitfield describing the set of instrument types that a given channel supports.
Definition: SiglentSCPIOscilloscope.cpp:699
virtual Oscilloscope::TriggerMode PollTrigger() override
Checks the curent trigger status.
Definition: SiglentSCPIOscilloscope.cpp:1491
virtual void SetADCMode(size_t channel, size_t mode) override
Sets the ADC mode for a channel.
Definition: SiglentSCPIOscilloscope.cpp:3616
virtual void EnableTriggerOutput() override
Enables the trigger output, configuring a shared auxiliary port for this purpose if needed.
Definition: SiglentSCPIOscilloscope.cpp:3316
void PushCondition(const std::string &path, Trigger::Condition cond)
Pushes settings for a trigger condition under a .Condition field.
Definition: SiglentSCPIOscilloscope.cpp:4790
std::map< std::string, std::string > ParseCommaSeparatedNameValueList(std::string str, bool forwardMap=true)
Parses a name-value set expressed as pairs of comma separated values.
Definition: SiglentSCPIOscilloscope.cpp:5076
virtual void PushTrigger() override
Pushes changes made to m_trigger to the instrument.
Definition: SiglentSCPIOscilloscope.cpp:4371
virtual float GetChannelOffset(size_t i, size_t stream) override
Gets the offset, in volts, for a given channel.
Definition: SiglentSCPIOscilloscope.cpp:2453
void PushSlewRateTrigger(SlewRateTrigger *trig)
Pushes settings for a slew rate trigger to the instrument.
Definition: SiglentSCPIOscilloscope.cpp:4646
virtual uint64_t GetSampleRate() override
Gets the current sampling rate (in Hz) of this scope.
Definition: SiglentSCPIOscilloscope.cpp:2772
virtual std::vector< uint64_t > GetSampleRatesInterleaved() override
Get the legal sampling rates (in Hz) for this scope in combined-channels mode.
Definition: SiglentSCPIOscilloscope.cpp:2656
virtual void Invert(size_t i, bool invert) override
Enables hardware polarity inversion for a channel, if supported.
Definition: SiglentSCPIOscilloscope.cpp:1339
virtual float GetFunctionChannelFrequency(int chan) override
Gets the frequency for a function generator output.
Definition: SiglentSCPIOscilloscope.cpp:5046
virtual std::vector< uint64_t > GetSampleDepthsInterleaved() override
Get the legal memory depths for this scope in combined-channels mode.
Definition: SiglentSCPIOscilloscope.cpp:2747
virtual void Start() override
Starts the instrument in continuous trigger mode.
Definition: SiglentSCPIOscilloscope.cpp:2328
virtual double GetChannelAttenuation(size_t i) override
Gets the probe attenuation for an input channel.
Definition: SiglentSCPIOscilloscope.cpp:1119
virtual void EnableChannel(size_t i) override
Turn a channel on, given the index.
Definition: SiglentSCPIOscilloscope.cpp:774
virtual void SetFunctionChannelDutyCycle(int chan, float duty) override
Sets the duty cycle for a function generator output.
Definition: SiglentSCPIOscilloscope.cpp:4992
virtual float GetFunctionChannelAmplitude(int chan) override
Gets the amplitude for a function generator output.
Definition: SiglentSCPIOscilloscope.cpp:5000
virtual bool IsChannelEnabled(size_t i) override
Checks if a channel is enabled in hardware.
Definition: SiglentSCPIOscilloscope.cpp:711
virtual void StartSingleTrigger() override
Arms the trigger for a single acquistion.
Definition: SiglentSCPIOscilloscope.cpp:2357
virtual unsigned int GetChannelBandwidthLimit(size_t i) override
Gets the bandwidth limit for an input channel.
Definition: SiglentSCPIOscilloscope.cpp:1245
void PullWindowTrigger()
Reads settings for a window trigger from the instrument.
Definition: SiglentSCPIOscilloscope.cpp:4269
virtual size_t GetADCMode(size_t channel) override
Gets the ADC mode for a channel.
Definition: SiglentSCPIOscilloscope.cpp:3584
Trigger::Condition GetCondition(std::string reply)
Parses a trigger condition.
Definition: SiglentSCPIOscilloscope.cpp:4353
void PullRuntTrigger()
Reads settings for a runt-pulse trigger from the instrument.
Definition: SiglentSCPIOscilloscope.cpp:4057
virtual void SetUseExternalRefclk(bool external) override
Configures the instrument's clock source.
Definition: SiglentSCPIOscilloscope.cpp:3321
virtual bool CanEnableChannel(size_t i) override
Determines if a channel can be enabled.
Definition: SiglentSCPIOscilloscope.cpp:822
virtual void DisableChannel(size_t i) override
Turn a channel off, given the index.
Definition: SiglentSCPIOscilloscope.cpp:828
virtual void SetFunctionChannelAmplitude(int chan, float amplitude) override
Sets the amplitude for a function generator output.
Definition: SiglentSCPIOscilloscope.cpp:5015
void PushEdgeTrigger(EdgeTrigger *trig, const std::string trigType)
Pushes settings for an edge trigger to the instrument.
Definition: SiglentSCPIOscilloscope.cpp:4512
virtual bool AcquireData() override
Pull data from the instrument.
Definition: SiglentSCPIOscilloscope.cpp:1941
virtual float GetFunctionChannelOffset(int chan) override
Gets the DC offset for a function generator output.
Definition: SiglentSCPIOscilloscope.cpp:5023
virtual std::vector< std::string > GetTriggerTypes() override
Gets a list of triggers this instrument supports.
Definition: SiglentSCPIOscilloscope.cpp:4821
virtual std::vector< OscilloscopeChannel::CouplingType > GetAvailableCouplings(size_t i) override
Gets the set of legal coupling values for an input channel.
Definition: SiglentSCPIOscilloscope.cpp:937
virtual bool IsTriggerArmed() override
Checks if the trigger is currently armed.
Definition: SiglentSCPIOscilloscope.cpp:1486
virtual std::vector< DigitalBank > GetDigitalBanks() override
Gets the digital channel banks for this instrument.
Definition: SiglentSCPIOscilloscope.cpp:3669
virtual std::vector< uint64_t > GetSampleRatesNonInterleaved() override
Get the legal sampling rates (in Hz) for this scope in all-channels mode.
Definition: SiglentSCPIOscilloscope.cpp:2593
virtual float GetDigitalHysteresis(size_t channel) override
Gets the hysteresis for a digital input.
Definition: SiglentSCPIOscilloscope.cpp:3718
void PullEdgeTrigger()
Reads settings for an edge trigger from the instrument.
Definition: SiglentSCPIOscilloscope.cpp:3950
virtual bool IsInverted(size_t i) override
Checks if hardware polarity inversion is enabled for a channel.
Definition: SiglentSCPIOscilloscope.cpp:1363
virtual bool IsInterleaving() override
Checks if the scope is currently combining channels.
Definition: SiglentSCPIOscilloscope.cpp:3503
void BulkCheckChannelEnableState()
Optimized function for checking channel enable status en masse with less round trips to the scope.
Definition: SiglentSCPIOscilloscope.cpp:1590
virtual bool HasFunctionRiseFallTimeControls(int chan) override
Determines if the function generator allows control over rise/fall times.
Definition: SiglentSCPIOscilloscope.cpp:5510
unsigned int m_maxBandwidth
Maximum bandwidth we support, in MHz.
Definition: SiglentSCPIOscilloscope.h:341
virtual bool GetFunctionChannelActive(int chan) override
Returns true if the function generator channel's output is enabled.
Definition: SiglentSCPIOscilloscope.cpp:4926
virtual void SetSampleRate(uint64_t rate) override
Sets the sample rate of the scope, in Hz.
Definition: SiglentSCPIOscilloscope.cpp:3268
void ForceHDMode(bool mode)
Forces 16-bit transfer mode on/off when for HD models.
Definition: SiglentSCPIOscilloscope.cpp:5554
virtual bool IsDigitalHysteresisConfigurable() override
Checks if digital input hysteresis is configurable or fixed.
Definition: SiglentSCPIOscilloscope.cpp:3708
void PullPulseWidthTrigger()
Reads settings for an edge trigger from the instrument.
Definition: SiglentSCPIOscilloscope.cpp:4000
virtual WaveShape GetFunctionChannelShape(int chan) override
Gets the waveform shape for a function generator output.
Definition: SiglentSCPIOscilloscope.cpp:5119
virtual std::vector< std::string > GetADCModeNames(size_t channel) override
Gets the names of the ADC modes for the bank a given channel is located in.
Definition: SiglentSCPIOscilloscope.cpp:3575
virtual float GetChannelVoltageRange(size_t i, size_t stream) override
Gets the range of the current channel configuration.
Definition: SiglentSCPIOscilloscope.cpp:2524
virtual void SetFunctionChannelFrequency(int chan, float hz) override
Sets the frequency for a function generator output.
Definition: SiglentSCPIOscilloscope.cpp:5061
virtual void SetChannelAttenuation(size_t i, double atten) override
Sets the probe attenuation used for an input channel.
Definition: SiglentSCPIOscilloscope.cpp:1153
virtual void SetTriggerOffset(int64_t offset) override
Sets the trigger offset.
Definition: SiglentSCPIOscilloscope.cpp:3350
virtual void SetChannelCoupling(size_t i, OscilloscopeChannel::CouplingType type) override
Sets the coupling used for an input channel.
Definition: SiglentSCPIOscilloscope.cpp:1037
virtual uint64_t GetSampleDepth() override
Gets the current sample depth of this scope.
Definition: SiglentSCPIOscilloscope.cpp:2874
void AddDigitalChannels(unsigned int count)
Creates digital channels for the oscilloscope.
Definition: SiglentSCPIOscilloscope.cpp:533
virtual OscilloscopeChannel::CouplingType GetChannelCoupling(size_t i) override
Gets the coupling used for an input channel.
Definition: SiglentSCPIOscilloscope.cpp:984
virtual void FlushConfigCache() override
Instruments are allowed to cache configuration settings to reduce round trip queries to the device.
Definition: SiglentSCPIOscilloscope.cpp:641
void PushUartTrigger(UartTrigger *trig)
Pushes settings for a UART trigger to the instrument.
Definition: SiglentSCPIOscilloscope.cpp:4663
virtual OscilloscopeChannel * GetExternalTrigger() override
Returns the external trigger input channel, if we have one.
Definition: SiglentSCPIOscilloscope.cpp:636
void PushPulseWidthTrigger(PulseWidthTrigger *trig)
Pushes settings for a pulse width trigger to the instrument.
Definition: SiglentSCPIOscilloscope.cpp:4587
virtual std::vector< unsigned int > GetChannelBandwidthLimiters(size_t i) override
Gets the set of available bandwidth limiters for an input channel.
Definition: SiglentSCPIOscilloscope.cpp:1199
virtual void SetDigitalHysteresis(size_t channel, float level) override
Sets the hysteresis for a digital input.
Definition: SiglentSCPIOscilloscope.cpp:3765
virtual void SetDeskewForChannel(size_t channel, int64_t skew) override
Sets the deskew setting for a channel.
Definition: SiglentSCPIOscilloscope.cpp:3429
void PullUartTrigger()
Reads settings for a UART trigger from the instrument.
Definition: SiglentSCPIOscilloscope.cpp:4181
Slew rate trigger - trigger when an edge rate meets the specified conditions.
Definition: SlewRateTrigger.h:46
Abstract base class for oscilloscope / logic analyzer trigger inputs.
Definition: Trigger.h:46
Condition
Conditions for triggers that perform logical comparisons of values.
Definition: Trigger.h:69
Trigger when a UART sees a certain data pattern.
Definition: UartTrigger.h:56
Window trigger - detect when the signal leaves a specified range.
Definition: WindowTrigger.h:46