Andreas Sandberg [Sun, 29 Sep 2019 21:48:52 +0000 (22:48 +0100)]
fluke-dmm: Cleanup Fluke 28x QM handling
The code that parses QM responses from Fluke 28x DMMs uses a long
series of if-else statements to determine the type of measurement
reported by the device. Rewrite this to use a conversion table that
contains a mapping between DMM units and Sigrok's internal units.
strutil: Add a helper to get the precision of a float
There are a few different instruments where the precision of a
measurement can be determined from the number of decimals in the
reported floats. Add a helper to determine this.
The implemented version of sr_count_digits performs more stringent
error checking than the original version in
sr_atod_ascii_digits. There are two reasons for this: First, we can no
longer rely on atod failing if the provided value is invalid. Second,
there are exotic float formats accepted by atod that we don't support
and we don't want to be in a situation where atod accepts a value and
count digits returns an incorrect value.
Marc Schink [Thu, 12 Sep 2024 12:18:20 +0000 (14:18 +0200)]
bindings/python: Use implicit namespaces
The use of 'namespace_packages' is deprecated [1] and for Python >= 3.3,
implicit/native namespaces should be used. There are no incompatibilities
as we require Python >= 3.8. More details can be found in [2] and [3].
Ralf [Thu, 22 Oct 2020 16:37:21 +0000 (18:37 +0200)]
rigol-dg: Add some more waveforms for MSO5000
Known issue: Read-back of parameters does not work.
Caused by changing :SOUR:APPL to :SOUR:FUNC, because APPL only
supports NOIS, PULS, RAMP, SIN, SQU, USER.
When MSO5000 is configured to a different waveform, there is no answer at all.
sr: [00:00.051760] scpi_vxi: Successfully sent SCPI command: 'SOUR1:APPL?'.
sr: [00:02.056361] scpi_vxi: Device read failed for 192.168.1.250 with error 15
g-user [Tue, 8 Feb 2022 21:24:32 +0000 (22:24 +0100)]
zeroplus-logic-cube: Add external clock settings
Enables the "external clock mode" in the Zeroplus LAP-C Logic
Cube driver (falling and rising edge) so that this mode also can be used in
sigrok-cli and pulseview
Mike McCauley [Tue, 28 Jun 2022 00:51:29 +0000 (10:51 +1000)]
serial-dmm: Add support for Digitech QM1576 serial protocol parser
The protocol is described at https://www.airspayce.com/mikem/QM1578/protocol.txt
You can use this decoder with libsigrok and Digitech QM1578 via ESP32 Bluetooth-Serial converter available from the author at: https://www.airspayce.com/mikem/QM1578/QM1578BluetoothClient.ino which connects to the QM1578 over Bluetooth LE, fetches the data stream and sends it on the serial port to the host, where this driver can read it with this command for example:
Ken Taylor [Sat, 7 Oct 2023 09:02:12 +0000 (02:02 -0700)]
openbench-logic-sniffer: Properly set samplerate range
Driver does query max_samplerate from SUMP metadata,
but previously replied to SR_CONF_SAMPLERATE with fixed
1Hz-200MHz range. Update to use max_samplerate as top
of range.
May fix http://sigrok.org/bugzilla/show_bug.cgi?id=1465
Some output modules, like srzip, calculate unitsize from maximum number of
channels in the session; and throw an error if the actual datastream uses
bigger size. Remove hardcoded value of 4 and calculate it from maximum number
of channels, supported by the device. Other driver seem to do the same.
This fixes "Unexpected unit size" saving a capture, made by an OLS device with
small number of channels.
The bug was found by using gillham's Arduino analyzer
(https://github.com/gillham/logic_analyzer), which supports a maximum of 8
channels. According to the error message, srzip expected unitsize == 1.
Marc Schink [Wed, 7 Feb 2024 15:15:31 +0000 (16:15 +0100)]
Add SR_CONF_INVERTED
Many device such as oscilloscopes, signal and delay generators are
capable to invert signals or change their polarity.
Add a new configuration to implement such a feature. The term 'inverted'
is chosen in favor of 'polarity' because the former can be unambiguously
represented by a boolean value.
Gerhard Sittig [Mon, 1 Jan 2024 13:37:50 +0000 (14:37 +0100)]
output/csv: use intermediate time_t var, silence compiler warning
There are platforms where timeval and time_t disagree on the width of
the data type of the field which holds seconds. Passing a pointer to an
unexpected type results in warnings (and probably unreliable execution).
Assign the value which is gotten from a timeval to an intermediate
time_t variable, so that the ctime() invocation becomes portable.
Properly use %zu for size_t, and %PRIu64 for uint64_t data types. This
silences build warnings which previously went unnoticed because their
occurance depends on the target platform.
Gerhard Sittig [Fri, 29 Dec 2023 11:39:05 +0000 (12:39 +0100)]
output/srzip: reduce text line length, remove "dead code"
Move an instruction to reduce its text line length. Also happens to put
the calculation of remaining buffer space and the current write position
in closer proximity, improving maintainability in the process.
Remove an assignment after appending to the archive and before iterating
the input samples loop again. Eliminates code that never took effect.
The value gets determined at the loop body's start anyway.
Gerhard Sittig [Fri, 29 Dec 2023 11:32:45 +0000 (12:32 +0100)]
output/srzip: accept arbitrary input and output unit sizes
Commit c03aaf342c3f introduced a check and refused to store sample data
when the feed would not exactly match an expected width that was derived
from the device's or input's total count of logic channels. Earlier
versions assumed the match but never checked (immediately forwarded
session feed content to the ZIP archive). Existing applications may not
be prepared to process the resulting archive where meta data and samples
disagree on essential properties. The fatal condition aborted execution,
which was perceived as a regression. A message was added later to
communicate that the condition was hit, but its WARN severity was
misleading, and its meaning still was obscure to users.
This commit extends the reception of sample data in the session feed and
its accumulation in the local buffer before ZIP archive appends. Any
combination of input and output unit sizes are accepted. It's perfectly
legal for sources to not communicate data for disabled channels, as well
as to communicate wider data images than strictly necessary to simplify
their support for a variety of input formats or device models. Details
are available to users at higher log levels (INFO). Default levels only
communicate fatal conditions (which should be implementation flaws now
exclusively).
The issue reproduces especially well with input formats that are rather
flexible, or device drivers which support a range of devices with many
configurations or models of differing capabilities. The issue was most
recently reported for the OLS driver and an Arduino SUMP firmware. Given
how many input modules and device drivers can feed into a few output
modules, it's assumed that addressing the general issue in a common
location is preferrable over local adjustment of individual input
modules or device drivers. Adjusting both places doesn't harm either,
increases overall robustness.
The implementation results in a negligable runtime overhead for the
regular case of matching unit sizes (a few integer checks). And an
acceptable overhead when the session feed is wider than the srzip
archive's unit size (multiple memcpy() calls where previously was only
one which would have been incorrect without the consistency check). The
code path which needs to apply padding to the output is most expensive,
but the implementation is only as expensive as it needs to be. The added
cost only occurs in the case of mismatches, which were not handled at
all before this change. The combination of extensive diagnostics and
internal consistency checks shall increase robustness and help during
future maintenance.
Gerhard Sittig [Fri, 29 Dec 2023 11:24:06 +0000 (12:24 +0100)]
output/srzip: rename variables for samples counts
The srzip output module deals with a number of samples that are of a
given width (unit size). Rename variables to better tell item counts
from byte counts. See a word diff for review.
Gerhard Sittig [Fri, 29 Dec 2023 11:17:31 +0000 (12:17 +0100)]
output/srzip: rename variable for archive unit size
The srzip output module needs to deal with two unit sizes. One that got
derived from the device's or input's logic channels' total count, and
will end up being used in the ZIP archive. And one which is seen when
the session feed provides sample data.
Rename the identifier to reflect this distinction. See a word diff for
the essence of the change.
Also rephrase the zip_append_queue() invocation for improved
readability. Use line breaks to illustrate parameter sets which are
related, and separate them from other parameters which are unrelated.
Gerhard Sittig [Thu, 21 Dec 2023 20:24:33 +0000 (21:24 +0100)]
greatfet: feed the session with constant width sample data
Rename identifiers to tell the sigrok session feed's width and the width
of sample data in device firmware communication apart. Always feed the
session with sample data of a width which corresponds to the device's
channels count. Some output modules and applications may not be prepared
to handle different cases.
Gerhard Sittig [Thu, 21 Dec 2023 20:22:43 +0000 (21:22 +0100)]
tests: adjust test coverage for power of two and input value 0
An input value 0 for the sr_next_power_of_two() routine is not invalid
any longer. Remove the test case that is expected to fail. Add a regular
case to cover that code path instead.
Gerhard Sittig [Thu, 21 Dec 2023 20:20:55 +0000 (21:20 +0100)]
strutil: support special case in power of two calculation
The sr_next_power_of_two() helper routine rejected input value 0
(an index), considered this case invalid. It is not, requires 1 bit
to hold the value. Return a "power of two" value of 1 for that input,
callers expect that result.
Gerhard Sittig [Mon, 27 Nov 2023 18:12:11 +0000 (19:12 +0100)]
hantek-dso: eliminate the "forced trigger" option value
Commit c93f113879a0 introduced a hack on top of an unfortunate choice.
It seems counter intuitive to open code a default trigger source on an
arbitrary channel, and have users override it with the "forced" value
to _not_ use a trigger.
The normal approach would be to specify a trigger when a trigger should
be used, and to not specify a trigger when no trigger should be used.
Eliminate the "forced" choice in the trigger_sources[] list. Start with
a not-set value. Accept when a value is specified (a "genuine" choice).
Don't bother adding support to "un-set" the previously specified choice.
This leaves the intuitive support for trigger specs that shall be used,
and only uses triggers when they were specified. Does not provide means
to "un-set" an earlier specified trigger config as the implementation
did before the 2023-09 change, which would be the 2021-02 status.
If the approach implemented here should be considered undesirable, then
a "none" option value should be introduced, something that much better
communicates to users what's happening and what the consequence of a
config choice would be.
This commit also adjusts the "ugh" code path which differed from the
"capture empty" code path. Fixes a resource leak in the config set path.
The "set trigger source" and "set trigger and samplerate" commands don't
agree on the phrase for the trigger source in the wire format. But have
been doing that before the forced trigger introduction, behaviour
remains unchanged here.
Gerhard Sittig [Sun, 29 Oct 2023 16:40:16 +0000 (17:40 +0100)]
greatfet: support capture of the upper pin bank (first pin 8)
Present all 16 channels to users. By default lower channels are enabled
and upper channels are disabled. Support the configuration where users
capture upper channels after disabling lower channels. Device firmware
provides the "first pin" feature and only communicates pin states for
the upper bank to the host.
This mode of operation can be useful to inspect different signal sets
without physically moving probes. Upper bank capture combines well with
higher rates at lower pin counts.
This implementation in theory also covers 16 channel captures, though
the firmware does not officially support multi-bank captures. Emit a
warning when this setup gets detected, but don't refuse operation and
attempt a best effort capture.
This commit also improves reliability in paths where failed acquisition
starts shutdown the operation, before another request gets serviced.
Gerhard Sittig [Sun, 29 Oct 2023 16:37:59 +0000 (17:37 +0100)]
greatfet: don't print misleading "unknown" libusb error text
Only lookup libusb error messages for negative return values which
communicate error codes. Positive return values are transmission counts
and are not an error.
The "UNKNOWN" messages only were seen at higher log levels. Users were
not affected by the issue.
Gerhard Sittig [Fri, 6 Oct 2023 16:09:58 +0000 (18:09 +0200)]
greatfet: first operational GreatFET One driver implementation
This sigrok driver for the GreatFET One device as a logic analyzer is
based on https://github.com/Qyriad/libsigrok and was massaged to use
common infrastructure where appropriate, and adjust coding style to
match the sigrok.org project's code base.
This implementation supports the acquisition of 8 channels at rates up
to 40.8MHz, and higher rates up to 204MHz for reduced channel counts.
Soft triggers are not supported in this implementation, ideally common
support would cover this more transparently in the future.
Tested with v2021.2.1 firmware as available via 'pip install greatfet'.
Support for 16 channels is prepared but disabled by default. Requires
firmware support which is not officially available.
Marek Vasut [Sat, 28 Oct 2023 07:12:48 +0000 (09:12 +0200)]
ols: Get GString content from proper API calls
Use the g_string_free() routine's return value instead of pulling the
string content out of the buffer structure bypassing the library's API.
This improves portability and readability, also happens to silence an
"ignoring return value" warning which is seen with GCC 13.2.0.
See https://docs.gtk.org/glib/method.String.free.html#return-value for
a discussion of the g_string_free() return value.
Gerhard Sittig [Tue, 17 Oct 2023 19:28:16 +0000 (21:28 +0200)]
output/srzip: decorate read pointer as const for awareness
Recipients of sample data as received from the data feed should consider
this data read-only, they are handed a reference to a message which is
also sent to other recipients.
Add the 'const' decoration in the output/srzip module to raise awareness
during future maintenance.
Gerhard Sittig [Tue, 17 Oct 2023 19:25:00 +0000 (21:25 +0200)]
yokogawa-dlm: silence compiler warning (passing an empty array)
Rephrase the config_list() routine such that it does not attempt to
access the first item in an empty array. Be explicit about the digital
channel group's devopts being empty by design, add a comment.
The compiler warning could have been a false positive, but phrasing the
source code differently doesn't harm either, eliminates uncertainty.
Gerhard Sittig [Tue, 17 Oct 2023 19:22:32 +0000 (21:22 +0200)]
tests: implement strutil test cases for power-of-two calculation
Add the "calc" section to the strutil tests, and implement test cases
which cover the power-of-two calculation routine. Cover small values
which are the immediate use case and the motivation for introducing the
helper routine.
Introduce the sr_next_power_of_two() routine which determines how many
bits are required to store a value. Decorate it as SR_API because some
applications may want it, but more importantly to make it available to
the test suite.
Gerhard Sittig [Sun, 15 Oct 2023 10:07:16 +0000 (12:07 +0200)]
juntek-jds6600: speedup serial communication, reduce timeouts
Wire traffic captures for serial-over-USB communication between the host
and the signal generator suggests that: Device firmware's reponses are
immediate. The 115200 UART is the limiting factor, USB FS adds little.
Comment on these findings for later reference. Reduce timeouts and
remove delays where appropriate. This dramatically speeds up the scan
for the device, and subsequent communication. Identification and getting
the current configuration takes a total of 70ms after this change.