Oscilloscopes

From sigrok
Jump to navigation Jump to search

This page documents the config keys are various other info needed to write a libsigrok frontend for controlling oscilloscopes.

Frame-based

Generally oscilloscopes work by triggering on either the signal under measurement, or some external trigger. The device then measures as much as its internal buffer can hold. When the buffer is full, the device stops measurement and sends its buffer over to the libsigrok driver. This transfer represents a frame's worth of data. The driver converts this data to the libsigrok internal analog format and sends it out to the frontend like this:

Packet type Payload
SR_DF_FRAME_BEGIN
SR_DF_ANALOG analog data
SR_DF_ANALOG...
SR_DF_FRAME_END

The oscilloscope then restarts acquisition, sometimes after prodding by the driver. The data received from an oscilloscope is thus not contiguous from one frame to the next: in between there is a period where no measurements are done by the device.

Streaming

Some devices can act as continuously streaming oscilloscopes, with no framing involved. Notably FX2-based devices with an analog frontend, such as the Nexus-Computing OsciPrime, work this way.


Config keys

A libsigrok driver for an oscilloscope implements all or some subset of the following config keys.

SR_CONF_OSCILLOSCOPE

Denotes a device that can act as an oscilloscope, i.e. measure voltage over time on one or more analog channels, and send those measurements out to the frontend as analog values.

SR_CONF_LIMIT_FRAMES

Frame-based oscilloscopes implement this key set to the number of frames to capture and send out, between SR_DF_FRAME_BEGIN and SR_DF_FRAME_END packets.

It is only used to set this value; getting it will just return the previously set value. Defaults to 0, meaning continuously grab frames until told to stop.

Type uint64
Get Previously set value.
Set Number of frames to capture (default 0 = unlimited.)
List NA

SR_CONF_NUM_TIMEBASE

The number of divisions an oscilloscope has across its horizontal (time) axis. This corresponds to the areas marked off by the vertical lines on the graticule of the device's display. Even on headless oscilloscopes, this concept still exists; for example the SR_CONF_TIMEBASE setting is meaningless without this number.

Type int32
Get Static number, fixed per model.
Set NA
List NA

SR_CONF_TIMEBASE

The duration of sampling a single horizontal (time) division during acquisition. The number of divisions is returned by SR_CONF_NUM_TIMEBASE, so multiplying that number by this duration gives a measure of the effective samplerate of a single frame.

Type A tuple of (uint64, uint64) representing the timebase as (p, q) of a rational number.
Get Previously set value, or reasonable default for that device.
Set The new timebase.
List A list of supported timebases for this model, in the form of an array of the normal (p, q) type.