Commit Graph

5608 Commits

Author SHA1 Message Date
Gerhard Sittig 1c5d5905a4 scpi-pps: add R&S HMP2000 model specs
Re-use HMP4000 options and channel groups, only keep separate channel
specs for HMP2000 devices. HMP2030 has three identical 32V/5A channels.
HMP2020 has one 10A channel and one 5A channel.
2021-02-02 21:09:54 +01:00
Gerhard Sittig 7320ce5ecc scpi-pps: adjust R&S HMP4000 current resolution for 10A channels
Specs published by R&S suggest that 10A channels support 0.2mA resolution,
while only 5A channels resolve to 0.1mA (up to 1A full scale, 1mA above 1A).
2021-02-02 21:07:29 +01:00
v1ne 3cc9e21573 ols: Clean up: Replace hand-rolled byte order conversion with existing macros 2021-01-06 10:45:28 +01:00
v1ne f8fd84208d ols: Refactor: Extract trigger setup into private place
This copies the code verbatim from one place to another in preparation to adding
support for complex triggers.
2021-01-06 10:45:28 +01:00
v1ne 50b15953fe ols: Make external clock setting queriable
... and thus selectable in PulseView.
2021-01-06 10:45:28 +01:00
v1ne f20c39d933 ols: Add option to use the falling edge of the external clock 2021-01-06 10:45:28 +01:00
v1ne c36a7d84ca ols: Clear "disabled groups" flags before setting them
This fixes a bug where the channel group setting would not be overwritten in a
new run, but instead the channel group settings of both runs would be merged
together.
2021-01-06 10:45:28 +01:00
v1ne 29f15d52cb ols: Display actual expanded sample instead of the raw sample
While the raw sample is the actual received data, the expanded sample is the
crucial data I as a developer am interested in seeing. At least if I assume that
the sample expansion works.
2021-01-06 10:45:28 +01:00
v1ne aad6b9de5f ols: Clean up: Prefix private function for consistency 2021-01-06 10:45:28 +01:00
Gerhard Sittig ba1fb5e926 doc: update README.devices for Meterman 38XR (RS232 button) 2021-01-05 18:17:45 +01:00
Peter Skarpetis 4c29bba1f0 dmm/mm38xr: introduce DMM packet parser for Meterman 38XR
Introduce a DMM packet parser in src/dmm/ and register it with the
serial-dmm device driver. This adds support for the Meterman 38XR
multimeter.

[ gsi: style adjustment, raise awareness during maintenance ]
2021-01-05 08:13:23 +01:00
Gerhard Sittig 3fa436bb48 serial-dmm: move Mastek items after Metex in the model database
Keep the alpha-sort order in the list of supported chips and models.
2021-01-05 08:10:21 +01:00
Frank Stettner 8fb9afcacd arachnid-labs-re-load-pro: Fix for get voltage and current while in acquisition.
[ gsi: moved intruction order to unify with other cond signalling code paths ]
2021-01-04 16:02:00 +01:00
Gerhard Sittig f93bf8ba02 dmm/bm52x: unbreak build when serial comm is not available
Make another code path in the Brymen BM52x packet parser optional which
snuck in earlier and broke compilation when serial_comm dependencies are
not met.

Ideally the src/dmm/ parser code would not get built at all in that
case, but building a parser with reduced functionality and not using it
later because its callers are conditional is as good, and is what other
DMM packet parsers did in the past.

How to reproduce:

  $ configure --without-libserialport --without-libhidapi --without-libbluez
  $ make
2020-12-29 18:31:38 +01:00
Ralf 6065d660e0 fx2lafw: Unbreak SR_CONF_LIMIT_SAMPLES for large values (above 2**32)
Capture does not stop for sample count values which exceed the range of
a 32bit type variable. Adjust the data type to 64bit.

How to reproduce: 8MSa/s * 600s -> 4,800,000,000 samples

  $ sigrok-cli -d fx2lafw -o capture.sr --config samplerate=8M --time 600000

[ gsi: rephrased the commit message ]
2020-12-25 13:02:07 +01:00
Gerhard Sittig aa8e4959e2 ftdi-la: work around missing USB strings during device probe
Some FTDI chip based products ship with EEPROM content which makes
libftdi fail to lookup the USB strings, which breaks the scan for the
device's presence. The previous implementation was strict and only
accepted the absence of a serial number. This implementation also copes
when vendor and model cannot be gathered from the device, and provides
fallback values based on VID:PID numbers.

Also factor out a magic number for string lengths. Stick with dynamic
allocation since 3x 32bytes would be rather huge a local stack use, and
future maintenance might bump that string length again.

[ gsi: magic number in one spot, bounded string assignment, style nits ]

Submitted-By: Christo Crause <christo.crause@gmail.com>
2020-12-25 12:47:01 +01:00
Niklas Thorne d7ce5452ac asix-sigma: parse serial numbers as unsigned values
This unbreaks device detection on 32bit platforms.
2020-11-28 08:01:31 +01:00
Niklas Thorne 30903c4043 strutil: introduce sr_atoul_base() conversion helper (non-decimal)
Introduce a text to number conversion routine which supports non-decimal
bases and optional suffixes, but returns unsigned results and thus covers
a larger range of values. This kind of amends commit 97aa41e9b5 which
introduced the sr_atol_base() routine.
2020-11-17 17:51:02 +01:00
Gerhard Sittig 3decd3b1f0 driver_list: unbreak list of builtin drivers for LTO configurations
Check for the availability of the "no_reorder" linker attribute, which
keeps the list of builtin drivers in shape on LTO enabled build setups.
Keep backwards compatibility for platforms which lack support for the
"no_reorder" attribute. Phrase the implementation such that other
keywords as well as user provided external specs are possible.

This resolves bug #1433.

Submitted-By: Ivan Mironov <mironov.ivan@gmail.com>
2020-11-05 05:20:42 +01:00
Gerhard Sittig efce57da32 libsigrok-internal.h: add u64be endianess writer
Add endianess aware writer for uint64_t data in BE format. This is
motivated by the Codethink Interrogizer.
2020-10-26 19:50:33 +01:00
Gerhard Sittig 6bee394dee serial-dmm: add support for the Brymen BM820s family
The BM820s series uses the same 10000 counts protocol as BM520s does,
but lacks the capability of recording measurements. Re-use the bm52x
DMM packet parser, but don't register the config get/set/list and
acquisition start callbacks.

It turns out that the packet request and packet validity check routines
need to be individual, since 0x82 is used instead of 0x52 as a magic
number in some places. Fortunately the complex payload parser is shared
among BM520s and BM820s series. This was tested with a BM829s meter.
2020-10-22 21:25:34 +02:00
Gerhard Sittig 0931639a12 dmm/bm52x: add support for recorded measurements (memory data sets)
Extend the BM52x packet parser, add config get/set/list code to handle
the data source property. Either let the common serial-dmm code run the
acquisition of live readings, or locally retrieve the selected "session
page" and forward its measurements to the session bus. These separate
code paths are required because the protocol differs a lot between these
modes, a totally different set of requests and responses is involved,
response interpretation logic is impossible to share between live and
recorded measurements.
2020-10-22 21:25:34 +02:00
Gerhard Sittig 9a1a7dc283 brymen-dmm: remove obsolete driver (support has moved to serial-dmm)
The DMM support for Brymen BM850s has moved to src/dmm/ and became
part of the serial-dmm driver. Remove the now obsolete brymen-dmm/
source code.
2020-10-22 21:25:34 +02:00
Gerhard Sittig 27186edacf dmm/bm85x: introduce DMM packet parser for Brymen BM850(a/s)
Implement a DMM packet parser for the BM850s protocol. This involves
variable length responses, which recently became a common serial-dmm
feature. Register the new parser under the "brymen-bm85x" device name.
This obsoletes the brymen-dmm driver which announces as "brymen-bm857".
This implementation was tested with the BM859s meter.

The text to number conversion with precision detection resolves the
last remaining issue of bug #1611.
2020-10-22 21:25:34 +02:00
Gerhard Sittig 91ab2f6475 strutil: add text to float conversion which also gets precision from text
Provide a common string helper routine which converts input text to a
double precision floating point number, and also gets its precision in
the process.
2020-10-22 21:25:34 +02:00
Gerhard Sittig 070668a0fd serial-dmm: more DMM parser callbacks (open, var length, config, start)
Extend the serial-dmm driver's common infrastructure to support more
per-parser (per-model) specific extensions. Add support for variable
length packets (motivated by BM85x), and pass the packet length to
parsers which accept it. Add callbacks which run after the COM port got
opened (motivated by BM85x). Add support for additional configuration
get/set/list properties (motivated by BM52x), including a hook into the
acquisition start and a state container which is owned by the parser.

Device specific acquisition start can check its local state which can
store the result of previous config get/set requests, and can arrange
for a different receive routine to execute (motivated by BM52x). The
default code path will execute serial-dmm's receive routine which keeps
invoking the DMM's packet parser for each registered display.

Prefer double precision values in the new parser callbacks. Also fixup
some data type issues: Use unsigned types for length and size specs as
well as timeouts, don't promote false booleans to NULL pointers, reduce
malloc() argument redundancy. Rephrase some instruction grouping and
update comments to simplify future maintenance. Get the current time
just once for improved consistency in the packet re-request code path.
Rename identifiers in the data reception path to improve readability.
2020-10-22 21:25:34 +02:00
Gerhard Sittig 1a7adeac29 serial: extend stream detect for variable length packet checkers
The previous implementation of the packet detection in a serial stream
assumed that all packets are of equal length which is known in advance.
Extend the packet validity check interface such that caller provided
callbacks can either decide that the input is valid or invalid (terminal
decision), or request more receive data before a decision can be made
(deferral, coverring variable length packets, with a minimum size to
cover the header before a length becomes available and the total packet
length is known).

This commit extends the API, and adjusts the call sites to not break the
compilation. Actual variable length checkers are yet to be done. Improve
readability while we are here: Better reflect the purpose and units of
variables in their identifiers. Tweak diagnostics messages, update
inline and doxygen comments.
2020-10-22 21:25:02 +02:00
Gerhard Sittig 2cb4204c6f input/vcd: fix a divide by zero bug in the analog-only case
When the input data exclusively contained analog data, then creation of
the submit buffer for logic data caused a division by zero. Fix the
create_feed() routine.
2020-10-22 19:29:58 +02:00
Gerhard Sittig ec30291701 input/vcd: suggest downsampling to users for reduced resource consumption
Naive creation of VCD files with inappropriately fine timescale specs
results in excessive resource consumption due to libsigrok's assumption
of a constant rate stream of sample data. A workaround is available and
documented, but users need to become much more aware.

Implement a reliable check for wasteful input data situations which
depends on the reception of _all_ input data, and can only alert users
late after potentially spending lots of time and assuming that available
resources allow completion of the import. Users could miss that check's
outcome.

Also implement early checks which (necessarily) are based on weaker
conditions, to already raise user's awareness while data import still is
executing. Phrase these early checks as computationally inexpensive as
possible, to not affect the main task of data import too much. Avoid
false positives by balancing the desire for early emission of messages
and picking appropriate conditions to test for.

This commit implements the foundation for early estimates and reliable
terminal checks, as well as the emission of messages which support users
and allow a more effective use of the file format. The specific limits
and tested conditions still may benefit from more tuning in the future.

The input module logic in this commit emits an information for harmless
cases, and emits warnings for "severe" cases where default option values
or incomplete user specs result in several orders of magnitude higher
resource consumption than necessary. GUI users may not notice, but the
library cannot help that given the current infrastructure -- the library
stricly does as the application tells it to, according to user input.

The best use is to run the CLI's --show feature on VCD files of unknown
content, to get an idea how to most appropriately configure a subsequent
file import. An alternative is to open the VCD file before import, check
the timescale in the header and the last two timestamps, to get an rough
estimate of a useful downsample factor.

This is motivated by but does not resolve bug 1624.
2020-10-18 21:19:27 +02:00
Gerhard Sittig 358105152a input/vcd: unbreak U and - values for single bit input data
The previous implementation already mapped L/H/U/- literals for input
data values to the 0/1/0/0 logic levels which sigrok can handle. But
missed these literals in the condition which dispatches real/integer,
bit vector, and single bit data types. Which made VCD import fail for
some of the files in the SpinalWorkshop repo.

Extend the test condition for single bit values. This unbreaks the
import of the Apb3TimerTester.vcd and ApbPwmTester.vcd files, which
contained phrases like these:

  ...
  $var reg 1 % io_apb_pwrite $end
  ...
  #0
  bUUUUUUUU !
  b0 "
  0#
  1$
  U%

and

  ...
  $var reg 8 # io_apb_paddr[7:0] $end
  $var reg 1 $ io_apb_pwrite $end
  ...
  #0
  b0 !
  0"
  b-------- #
  -$
  b-------------------------------- %
  b00000000000000000000000000000000 &
  1'
2020-10-18 21:19:07 +02:00
Soeren Apel a3fe36d01e configure: Add optional TI-RPC dependency, unbreak VXI communication.
Recent glibc-2.26 no longer provides support for SunRPC, and libsigrok's
build support failed to detect the presence of libtirpc in that case.

  https://wiki.gentoo.org/wiki/Glibc_2.26_porting_notes/RPC_implementation

Extend the check, use either SunRPC or TI-RPC. Which re-enables VXI on
recent setups. This resolves bug #1473.
2020-10-09 18:50:58 +02:00
Timo Kokkonen b1eb94bbef rigol-dg: Add device/firmware specific quirks support.
DG800/DG900 units seems to have issues with counter implementation:
- About 1 second delay is needed after enabling or disabling the counter.
  Otherwise unit stops responding properly (start seeing USB errors).
- Second channel and counter cannot be enabled simultaneously.
2020-10-06 22:04:42 +02:00
Gerhard Sittig 92cd85149a itech-it8500: avoid "new" as a variable identifier
Strictly speaking the "new" identifier is not a reserved word. Still
it's good practice not to use it for variables in C language sources.
Rename variables to "old_bit" and "new_bit" for consistency.
2020-10-06 22:02:20 +02:00
Gerhard Sittig 8c8fff4773 itech-it8500: declaration nits
Rearrange the order of declarations in the protocol.h header. Start with
packet layout, continue with requests (commands), then responses (status),
before the device context and the set of routines.

Rename the status codes to STS_* in contrast to CMD_* codes. Use an enum
for different byte values, leave defines for packet sizes et al. Phrase
bit fields in terms of bit numbers not byte values.

Total nit: Change the breaks in the long list of add_source() args. Keep
event type and timeout together, similar to callback and its data.
2020-10-06 22:02:20 +02:00
Gerhard Sittig 78b07caf11 itech-it8500: rephrase config get/set/list, reflect error paths
Explicitly "break the flow" when internal status gathering fails, to
reflect that an error path is taken and the config call will fail. The
conditional assignment of response data in case of success could be
slightly misleading (it was to me during review).

Eliminate a goto which kind of circumvented the optional transmission of
a request to the device. Instead test whether a command was filled in to
determine whether a command needs to get sent.
2020-10-06 22:02:20 +02:00
Timo Kokkonen f21b6983e8 itech-it8500: ITECH IT8500 series DC electronic load driver.
This driver supports ITECH IT8500 series electronic loads:
 IT8511+, IT8511A+,
 IT8512+, IT8512A+, IT8512B+, IT8512C+, IT8512H+,
 IT8513A+, IT8513B+, IT8513C+, IT8514C+, IT8514B+, IT8516C+

Additionally BK Precision 8500 series loads (models 8500, 8502, 8510,
8512, 8514, 8518, 8520, 8522, 8524 & 8526) should work as well.
As ITECH is the OEM manufacturer for these BK Brecision models.
2020-10-06 22:02:20 +02:00
Timo Kokkonen c16effaedc itech-it8500: Initial driver skeleton. 2020-10-06 22:02:20 +02:00
Timo Kokkonen 34ce5b0439 hwdriver: New entries for DC Load "CW" (Power) and "CR" (Resitance) modes.
Added following new entries:
	- SR_CONF_POWER
	- SR_CONF_POWER_TARGET
	- SR_CONF_RESISTANCE_TARGET
2020-10-06 22:02:20 +02:00
Gerhard Sittig d7838e4804 dmm/metex14: unbreak packet request helper return code
Return SR_OK in case of successful transmission of a packet request. The
previous implementation passed the serial layer's verbatim return value,
which was non-negative non-null (read: above zero) in case of success,
which is none of the expected return codes of a packet request routine.

This amends commit 379e95c587 and completes the adjustment which was
started in commit a4be2b327b. The issue has gone unnoticed in the past
since it took not effect. The serial-dmm caller only tested for negative
return values.
2020-10-06 20:59:27 +02:00
Gerhard Sittig 1f8ef363cb README.devices: add JTAGulator section for Logic Analyzer mode
Manual activity is required to enable the SUMP protocol support on the
JTAGulator. Link to the vendor's wiki article for users' convenience.
2020-10-06 20:32:04 +02:00
Gerhard Sittig cd11e33c5d input/csv: trim cell content before conversion
Trailing whitespace in CSV cells broke the text to number conversion.
Trim the text content of cells before processing it. This is useful and
actually essential for data cells, and does not harm titles in header
lines, neither will it affect column format specs.

How to reproduce:

  $ echo ' 3.14 , 2' | \
    sigrok-cli -i - -I csv:header=false:column_formats=2a
  sr: input/csv: Cannot parse analog text  3.14  in column 1 in line 1.
2020-10-04 20:00:16 +02:00
Timo Kokkonen d999f2b61e rigol-dg: Fix reading current output signal duty cycle value.
Reading output signal duty cycle value didn't always work, since it relied
on old (cached) information about the currently active waveform. Changed to
always query channel status so this won't happen anymore.
2020-10-04 13:00:59 +02:00
Timo Kokkonen 9ce14905cb rigol-dg: Add Rigol DG800 and DG900 series support.
This adds support for all Rigol DG800/DG900 series models.

DG800 series: DG811, DG812, DG821, DG822, DG831, DG832
DG900 series: DG952, DG972, DG992
2020-10-04 13:00:35 +02:00
Timo Kokkonen feeafbc003 udev: Add Rigol DG800 and DG900 series VID/PID. 2020-10-04 13:00:28 +02:00
Gerhard Sittig a4be2b327b pce-322a: unbreak send_command() return code
Data was sent to the serial port, and the non-zero positive write length
was mistaken as an error, since it did not match the SR_OK code's value.
This snuck in with commit 379e95c587 in 2017-08.

Rephrase the check for successful serial writes in the pce-322a driver.
Pass on error codes from the serial layer in verbatim form. Check for
the exact expected write length and derive SR_ERR_IO upon mismatch. Do
return SR_OK upon success.

Reported-By: Michael Ströder <michael@stroeder.com>
Tested-By: Michael Ströder <michael@stroeder.com>
2020-10-03 07:20:00 +02:00
Gerhard Sittig 5a0303474c rigol-dg: reduce redundancy in malloc() calls
No need to duplicate the data type, just allocate enough memory to
hold the variable's value. Shuffle the order of items in the array
size calculation (number of items times the size of an item).
2020-09-28 09:11:02 +02:00
Timo Kokkonen 4c98253dba udev: Add Rigol DG1000z Series VID/PID. 2020-09-28 09:11:02 +02:00
Timo Kokkonen 02feeb30b9 rigol-dg: Initial Rigol DG1000z driver implementation.
This implements support for Rigol DG1000z series digital signal
generators. Driver provides basic control via channel groups
("1", and "2"). Acquisition returns data from the built-in
frequency counter.

Supported models: DG1022Z, DG1032Z, DG1062Z

[ gsi: added some coding style adjustment ]
2020-09-28 09:08:37 +02:00
Timo Kokkonen 068db0fbe6 rigol-dg: Initial driver skeleton. 2020-09-28 09:03:37 +02:00
Timo Kokkonen 63eec38073 hwdriver: Add SR_CONF_DUTY_CYCLE & SR_CONF_PHASE. 2020-09-28 09:02:52 +02:00