> If it's actually acquiring the correct amount data but reporting the > wrong length I wonder if it's reporting the number of samples post-trigger ? Interesting idea! It really looks it has something to do with it:
Case 1: --samples 20k --triggers CH0=r,CH1=0,CH2=0 --wait-trigger sigrok-cli complain: "Device only sent 11504 samples." The file has 43018 B, starts and ends with "FRAME-BEGIN\n", and "FRAME-END\n", respectively and the first sample is '00000011 00000000' (not valid trigger). The position of the "FRAME-END\n" string is 43008 divided by two (two bytes per sample) equals to 21504, which is somehow related to the sigrok-cli complain. Case 2: --samples 1m --triggers CH0=r,CH1=0,CH2=0 --wait-trigger sigrok-cli complain: "Device only sent 501513 samples." Here the data start with sample '00000000 00000000', the valid trigger ('00000001 00000000') occurs at position 92, and position of "FRAME-END\n" string is 2003116, so (2003116-92)/2+1 = 1001513. Case 3: --samples 20k # no trigger requested No complain by sigrok-cli! The data contain 21595 samples. But what it all means I have no idea. On pátek 8. srpna 2025 17:29:17, středoevropský letní čas Adrian Godwin wrote: > These devices don't generally trigger in the normal sense - the processor > at the acquisition is slow but has an efficient DMA engine. If it has a > trigger function at all it's likely to be at the PC end. > > If it's actually acquiring the correct amount data but reporting the > wrong length I wonder if it's reporting the number of samples post-trigger ? > > > On Fri, Aug 8, 2025 at 12:59 PM Radek Machulka <radek.machu...@gmail.com> > > wrote: > > Reducing sample rate to 1 MHz did not help. The USB is connected to PCIe > > with: > > Link Width: 4x, Link Speed: 8.0 GT/s. Original SW gives expected results > > on > > much slower machine. > > > > Also I take back the problem with triggering. I thought the data would > > start > > with the first sample matching the triggers, but that is not case even for > > the > > official SW, as there is (random?) number of samples before that. So it is > > more likely I do not really understand how triggers work. But again > > triggering > > is not really that important for me. > > > > Finally, I tried different firmware, however only the one extracted from > > v3.5.7 actually works (the later ones are identical). > > > > From all the tests it looks though, that the data are acquired correctly, > > i.e. > > there are no missing samples, so the only issue seams to be the length, > > when > > if 1e6 samples is requested, the sigrok-cli will claim to get only 501516, > > while the data actually contains 1001499. The factor of two and the > > difference > > around 1500 is typical. > > > > > > On pátek 8. srpna 2025 9:55:36, středoevropský letní čas Adrian Godwin > > > > wrote: > > > Yes, I meant for diagnostic purposes. > > > You may be able to increase the speed by changing the USB card from a > > > single lane PCI express to a 2-lane card. > > > > > > On Thu, Aug 7, 2025 at 9:55 PM Radek Machulka <radek.machu...@gmail.com> > > > > > > wrote: > > > > Thank you for the suggestions. I should have mentioned that I tried > > > > two > > > > different PCs, one with linux and one with windows. Unfortunately, > > > > reducing > > > > the sample rate is not an option for my application, however I can try > > > > just > > > > to see if it helps. > > > > > > > > On Thu, Aug 7, 2025, 20:33 Adrian Godwin <artgod...@gmail.com> wrote: > > > >> I don't have that model, but on other USB devices such as the Saleae > > > >> (using their own drivers) I have found that the capture performance > > > >> is > > > >> dependent on your PC's USB and PCI performance. > > > >> > > > >> Test it at lower sample rates to see if that makes a difference. > > > >> > > > >> > > > >> On Thu, Aug 7, 2025 at 2:57 PM Radek Machulka < > > > > radek.machu...@gmail.com> > > > > > >> wrote: > > > >>> Dear all, > > > >>> > > > >>> I am having difficulties with my Kingst LA 5016 logic analyzer with > > > >>> sigrok- > > > >>> cli, as it will not acquire requested number of samples. > > > >>> > > > >>> As a consequence (at least I believe it is a consequence of > > > > unexpectedly > > > > > >>> short > > > >>> data), I may get bunch of other errors during saving such data into > > > >>> files > > > >>> (both CSV and binary), ranging from empty files up to > > > > SIGSEGV/SIGABRT. > > > > > >>> There > > > >>> can also be "FRAME-BEGIN\n", "FRAME-END\n" in both CSV and binary > > > > files. > > > > > >>> Sometimes both, sometimes only one, sometimes none. > > > >>> > > > >>> There can be situations when the acquisition does not start at all, > > > > or > > > > > >>> when > > > >>> the acquisition ends, however the device (judging based on its LED) > > > >>> seams to > > > >>> keep acquiring. The single acquisitions (the ones long enough to be > > > >>> noticeable) take significantly more time with respect to official SW > > > >>> (not real > > > >>> issue, just an observation). > > > >>> > > > >>> The triggering looks also bit off, as the data clearly start away > > > > from > > > > > >>> requested triggers. Without triggering, the behavior is the same > > > > (again > > > > > >>> here, > > > >>> no real issue, I can live without the triggering). > > > >>> > > > >>> I use the nightly build, and the acquisition is initiated like this: > > > >>> > > > >>> sigrok-cli-NIGHTLY-x86_64-debug.AppImage --driver kingst-la2016 > > > >>> --channels > > > >>> CH0,CH1,CH2 --config samplerate=500m --samples 100m --triggers > > > >>> CH0=r,CH1=0,CH2=0 --wait-trigger --output-format binary > > > >>> --output-file > > > >>> 100...@500mhz.bin > > > >>> > > > >>> with (typical) following output: > > > >>> > > > >>> Device only sent 50001534 samples. > > > >>> > > > >>> In this particular case, the final file contains neither requested > > > >>> 1M > > > >>> nor > > > >>> announced 50001534 but 100001591 samples. > > > >>> > > > >>> With CSV format, the errors may look something like this: > > > >>> > > > >>> sr: output/csv: Expecting 4194304 samples, got 877880 > > > >>> sr: output/csv: Expecting 4194304 samples, got 879391 > > > >>> Device only sent 500001567 samples. > > > >>> > > > >>> or: > > > >>> > > > >>> sr: output/csv: Expecting 500058 samples, got 501513 > > > >>> Device only sent 501513 samples. > > > >>> > > > >>> > > > >>> Here is complete output from the sigrok-cli with loglevel 5: > > > >>> > > > >>> sigrok-cli-NIGHTLY-x86_64-debug.AppImage --driver kingst-la2016 > > > >>> --channels > > > >>> CH0,CH1,CH2 --config samplerate=500m --samples 10m --triggers > > > >>> CH0=r,CH1=0,CH2=0 --wait-trigger --output-format binary > > > >>> --output-file > > > >>> 1...@500mhz.bin --loglevel 5 > > > >>> > > > >>> sr: [00:00.000757] log: libsigrok loglevel set to 5. > > > >>> sr: [00:00.000833] backend: libsigrok 0.6.0-git-f06f788/4:0:0. > > > >>> sr: [00:00.001455] backend: Libs: glib 2.64.6 (rt: 2.64.6/6406:6), > > > > zlib > > > > > >>> 1.2.11, libzip 1.5.1, minilzo 2.10, libserialport 0.1.1/1:0:1 (rt: > > > >>> 0.1.1/1:0:1), libusb-1.0 1.0.29.11953 API 0x01000107, hidapi 0.9.0, > > > >>> bluez > > > >>> 5.53, libftdi 1.4, librevisa 0.0.20130812. > > > >>> sr: [00:00.001479] backend: Host: x86_64-pc-linux-gnu, > > > >>> little-endian. > > > >>> sr: [00:00.001488] backend: SCPI backends: TCP, RPC, serial, VISA, > > > >>> USBTMC. > > > >>> sr: [00:00.001495] backend: Firmware search paths: > > > >>> sr: [00:00.001521] backend: - > > > >>> /tmp/.mount_sigrokaBeLBF/usr/share/sigrok- > > > >>> firmware > > > >>> sr: [00:00.001534] backend: - > > > >>> /home/rad/.local/share/sigrok-firmware > > > >>> sr: [00:00.001549] backend: - > > > >>> /__w/sigrok-build/sigrok-build/sr/share/sigrok- > > > >>> firmware > > > >>> sr: [00:00.001558] backend: - > > > >>> /home/rad/.local/share/flatpak/exports/share/ > > > >>> sigrok-firmware > > > >>> sr: [00:00.001566] backend: - > > > >>> /var/lib/flatpak/exports/share/sigrok-firmware > > > >>> sr: [00:00.001579] backend: - /usr/local/share/sigrok-firmware > > > >>> sr: [00:00.001589] backend: - /usr/share/sigrok-firmware > > > >>> sr: [00:00.002111] backend: Sanity-checking all drivers. > > > >>> sr: [00:00.002136] backend: Sanity-checking all input modules. > > > >>> sr: [00:00.002141] backend: Sanity-checking all output modules. > > > >>> sr: [00:00.002155] backend: Sanity-checking all transform modules. > > > >>> srd: libsigrokdecode loglevel set to 5. > > > >>> sr: [00:00.006477] kingst-la2016: USB enum found 77a1:01a2 at path > > > >>> usb/1-2, > > > >>> 1.24. > > > >>> sr: [00:00.006984] kingst-la2016: USB PID 01a2, MCU firmware > > > >>> 'kingst- > > > >>> la-01a2.fw'. > > > >>> sr: [00:00.008011] kingst-la2016: Manufacture date bytes 24 08 db > > > >>> f7. > > > >>> sr: [00:00.008028] kingst-la2016: Manufacture date: 2024-08. > > > >>> sr: [00:00.009537] kingst-la2016: EEPROM magic bytes 0c f3 00 00 0c > > > > f3 > > > > > >>> 10 ef. > > > >>> sr: [00:00.009554] kingst-la2016: Using secondary magic 0xc (0x10). > > > >>> sr: [00:00.009574] kingst-la2016: Model 'LA5016', 16 channels, max > > > >>> 500MHz. > > > >>> sr: [00:00.009593] kingst-la2016: FPGA bitstream file > > > > 'kingst-la5016a2- > > > > > >>> fpga.bitstream'. > > > >>> sr: [00:00.009603] kingst-la2016: Checking operation of the FPGA > > > >>> bitstream. > > > >>> sr: [00:00.011098] kingst-la2016: FPGA registers dump: bitstream > > > > check > > > > > >>> sr: [00:00.011114] kingst-la2016: 0000 ed 85 00 00 00 00 07 00 > > > > 00 00 > > > > > >>> 00 00 > > > >>> 00 00 00 00 > > > >>> sr: [00:00.011127] kingst-la2016: 0010 e9 8d 5b 00 c7 c6 2d 00 > > > > 50 f9 > > > > > >>> 24 01 > > > >>> 00 00 00 00 > > > >>> sr: [00:00.011146] kingst-la2016: 0020 00 00 00 00 00 00 00 00 > > > > 00 00 > > > > > >>> 00 00 > > > >>> 00 00 00 00 > > > >>> sr: [00:00.011168] kingst-la2016: 0030 00 00 00 00 00 00 00 00 > > > > 00 00 > > > > > >>> 00 00 > > > >>> 00 00 00 00 > > > >>> sr: [00:00.011189] kingst-la2016: 0040 00 00 00 00 00 00 00 00 > > > > 00 00 > > > > > >>> 00 00 > > > >>> 00 00 00 00 > > > >>> sr: [00:00.011213] kingst-la2016: 0050 00 00 00 00 00 00 00 00 > > > > 00 00 > > > > > >>> 00 00 > > > >>> 00 00 00 00 > > > >>> sr: [00:00.011239] kingst-la2016: 0060 00 00 00 00 00 00 00 00 > > > > 00 00 > > > > > >>> 00 00 > > > >>> 00 00 00 00 > > > >>> sr: [00:00.011264] kingst-la2016: 0070 00 00 00 00 00 00 00 00 > > > > 00 00 > > > > > >>> 00 00 > > > >>> 00 00 00 00 > > > >>> sr: [00:00.011458] kingst-la2016: FPGA register: run state 0x85ed. > > > >>> sr: [00:00.011564] kingst-la2016: FPGA register: PWM enable 0x00. > > > >>> sr: [00:00.011576] kingst-la2016: Could re-use current FPGA > > > > bitstream. > > > > > >>> No > > > >>> upload required. > > > >>> sr: [00:00.082222] kingst-la2016: Run state: 0x85ed (idle). > > > >>> sr: [00:00.082337] kingst-la2016: Device should be initialized. > > > >>> sr: [00:00.082455] hwdriver: Scan found 1 devices (kingst-la2016). > > > >>> sr: [00:00.082785] device: kingst-la2016: Opening device instance. > > > >>> sr: [00:00.082871] kingst-la2016: PWM config, app spec, ch 0, en 0, > > > > freq > > > > > >>> 1000.0, duty 50.0. > > > >>> sr: [00:00.082916] kingst-la2016: PWM config, reg 0x0070, freq > > > > 200000, > > > > > >>> duty > > > >>> 100000. > > > >>> sr: [00:00.082934] kingst-la2016: PWM config, enable all 0x00, cfg > > > > 0x01. > > > > > >>> sr: [00:00.082952] kingst-la2016: PWM config, disabling before param > > > >>> change. > > > >>> sr: [00:00.083097] kingst-la2016: PWM config, app spec, ch 1, en 0, > > > > freq > > > > > >>> 100000.0, duty 50.0. > > > >>> sr: [00:00.083118] kingst-la2016: PWM config, reg 0x0078, freq 2000, > > > >>> duty > > > >>> 1000. > > > >>> sr: [00:00.083134] kingst-la2016: PWM config, enable all 0x00, cfg > > > > 0x02. > > > > > >>> sr: [00:00.083149] kingst-la2016: PWM config, disabling before param > > > >>> change. > > > >>> sr: [00:00.083318] hwdriver: sr_config_set(): key 30000 (samplerate) > > > > sdi > > > > > >>> 0x55c4276db750 cg NULL -> uint64 500000000 > > > >>> sr: [00:00.083361] hwdriver: sr_config_list(): key 30014 > > > > (triggermatch) > > > > > >>> sdi > > > >>> 0x55c4276db750 cg NULL -> [1, 2, 3, 4] > > > >>> sr: [00:00.083402] hwdriver: sr_config_list(): key 50001 > > > > (limit_samples) > > > > > >>> sdi > > > >>> 0x55c4276db750 cg NULL -> (uint64 0, uint64 10000000000) > > > >>> sr: [00:00.083434] hwdriver: sr_config_set(): key 50001 > > > > (limit_samples) > > > > > >>> sdi > > > >>> 0x55c4276db750 cg NULL -> uint64 10000000 > > > >>> sr: [00:00.083477] session: Checking trigger: > > > >>> sr: [00:00.083489] session: Stage 0 match on channel CH0, match 3 > > > >>> sr: [00:00.083504] session: Stage 0 match on channel CH1, match 1 > > > >>> sr: [00:00.083519] session: Stage 0 match on channel CH2, match 1 > > > >>> sr: [00:00.083544] session: Using thread-default main context. > > > >>> sr: [00:00.083555] session: Starting. > > > >>> sr: [00:00.083568] hwdriver: kingst-la2016: Starting acquisition. > > > >>> sr: [00:00.083629] kingst-la2016: Set threshold voltage 1.40V. > > > >>> sr: [00:00.083644] kingst-la2016: Duty cycle values: R56 0x021f, R79 > > > >>> 0x00f2. > > > > > >>> sr: [00:00.083888] kingst-la2016: Set trigger config: > > enabled-channels > > > > > >>> 0x0007, > > > >>> triggering-channels 0x0007, level-triggered 0x0006, high/falling > > > > 0x0000. > > > > > >>> sr: [00:00.084155] kingst-la2016: Set sample config: 500000kHz (div > > > > 1), > > > > > >>> 10000000 samples. > > > >>> sr: [00:00.084169] kingst-la2016: Capture ratio 50%, count 5000000, > > > > mem > > > > > >>> 134217728. > > > >>> sr: [00:00.084636] session: bus: Received SR_DF_HEADER packet. > > > >>> cli: Received SR_DF_HEADER. > > > >>> sr: [00:00.084682] hwdriver: sr_config_get(): key 30000 (samplerate) > > > > sdi > > > > > >>> 0x55c4276db750 cg NULL -> uint64 500000000 > > > >>> sr: [00:00.171745] kingst-la2016: Acquisition completion seen > > > >>> (hardware). > > > >>> sr: [00:00.173252] kingst-la2016: FPGA registers dump: acquisition > > > >>> complete > > > >>> sr: [00:00.173276] kingst-la2016: 0000 ed 85 00 00 00 00 07 00 > > > > 00 00 > > > > > >>> 00 00 > > > >>> 00 00 00 00 > > > >>> sr: [00:00.173301] kingst-la2016: 0010 1f 28 09 00 e1 93 04 00 > > > > 30 4d > > > > > >>> 1d 00 > > > >>> 00 00 00 00 > > > >>> sr: [00:00.173325] kingst-la2016: 0020 00 00 00 00 00 00 00 00 > > > > 00 00 > > > > > >>> 00 00 > > > >>> 00 00 00 00 > > > >>> sr: [00:00.173348] kingst-la2016: 0030 00 00 00 00 00 00 00 00 > > > > 00 00 > > > > > >>> 00 00 > > > >>> 00 00 00 00 > > > >>> sr: [00:00.173372] kingst-la2016: 0040 00 00 00 00 00 00 00 00 > > > > 00 00 > > > > > >>> 00 00 > > > >>> 00 00 00 00 > > > >>> sr: [00:00.173404] kingst-la2016: 0050 00 00 00 00 00 00 00 00 > > > > 00 00 > > > > > >>> 00 00 > > > >>> 00 00 00 00 > > > >>> sr: [00:00.173426] kingst-la2016: 0060 00 00 00 00 00 00 00 00 > > > > 00 00 > > > > > >>> 00 00 > > > >>> 00 00 00 00 > > > >>> sr: [00:00.173447] kingst-la2016: 0070 00 00 00 00 00 00 00 00 > > > > 00 00 > > > > > >>> 00 00 > > > >>> 00 00 00 00 > > > >>> sr: [00:00.173462] session: bus: Received SR_DF_FRAME_BEGIN packet. > > > >>> cli: Received SR_DF_FRAME_BEGIN. > > > >>> sr: [00:00.173873] kingst-la2016: Capture info: n_rep_packets: > > > >>> 0x0009281f/ > > > >>> 600095, before_trigger: 0x000493e1/300001, write_pos: > > > >>> 0x001d4d30/1920304. > > > >>> sr: [00:00.173897] kingst-la2016: Want to read 120019 xfer-packets > > > >>> starting > > > >>> from pos 0. > > > >>> sr: [00:00.173984] kingst-la2016: Will read from 0x00000000, > > > > 0x001d4d30 > > > > > >>> bytes. > > > >>> sr: [00:00.174964] kingst-la2016: Acquisition data download started. > > > >>> sr: [00:00.188764] kingst-la2016: receive_transfer(): status > > > >>> LIBUSB_SUCCESS / > > > >>> LIBUSB_TRANSFER_COMPLETED received 524288 bytes. > > > >>> sr: [00:00.224622] kingst-la2016: 1396016 more bytes to download > > > >>> from > > > >>> the > > > >>> device. > > > >>> sr: [00:00.224648] kingst-la2016: Total samples after chunk: > > > >>> 2730633. > > > >>> sr: [00:00.225892] kingst-la2016: receive_transfer(): status > > > >>> LIBUSB_SUCCESS / > > > >>> LIBUSB_TRANSFER_COMPLETED received 524288 bytes. > > > >>> sr: [00:00.242821] session: bus: Received SR_DF_LOGIC packet > > > >>> (8388608 > > > >>> bytes, > > > >>> unitsize = 2). > > > >>> cli: Received SR_DF_LOGIC (8388608 bytes, unitsize = 2). > > > >>> sr: [00:00.269931] session: bus: Received SR_DF_LOGIC packet > > > >>> (1611430 > > > >>> bytes, > > > >>> unitsize = 2). > > > >>> cli: Received SR_DF_LOGIC (1611430 bytes, unitsize = 2). > > > >>> sr: [00:00.273715] session: bus: Received SR_DF_TRIGGER packet. > > > >>> cli: Received SR_DF_TRIGGER. > > > >>> sr: [00:00.273755] kingst-la2016: Trigger position after 5000019 > > > >>> samples, > > > >>> 10.000038ms. > > > >>> sr: [00:00.280391] kingst-la2016: 871728 more bytes to download from > > > > the > > > > > >>> device. > > > >>> sr: [00:00.280425] kingst-la2016: Total samples after chunk: > > > >>> 5461322. > > > >>> sr: [00:00.281429] kingst-la2016: receive_transfer(): status > > > >>> LIBUSB_SUCCESS / > > > >>> LIBUSB_TRANSFER_COMPLETED received 524288 bytes. > > > >>> sr: [00:00.304977] kingst-la2016: 347440 more bytes to download from > > > > the > > > > > >>> device. > > > >>> sr: [00:00.305014] kingst-la2016: Total samples after chunk: > > > >>> 8191930. > > > >>> sr: [00:00.305414] kingst-la2016: receive_transfer(): status > > > >>> LIBUSB_SUCCESS / > > > >>> LIBUSB_TRANSFER_COMPLETED received 347440 bytes. > > > >>> sr: [00:00.314484] session: bus: Received SR_DF_LOGIC packet > > > >>> (8388608 > > > >>> bytes, > > > >>> unitsize = 2). > > > >>> cli: Received SR_DF_LOGIC (8388608 bytes, unitsize = 2). > > > >>> sr: [00:00.340218] kingst-la2016: Download finished, flushing > > > >>> session > > > >>> feed > > > >>> queue. > > > >>> sr: [00:00.340246] session: bus: Received SR_DF_LOGIC packet > > > >>> (1614402 > > > >>> bytes, > > > >>> unitsize = 2). > > > >>> cli: Received SR_DF_LOGIC (1614402 bytes, unitsize = 2). > > > > > >>> sr: [00:00.342387] kingst-la2016: Total samples after chunk: > > 10001524. > > > > > >>> sr: [00:00.342422] kingst-la2016: Download finished, post > > > >>> processing. > > > >>> sr: [00:00.343317] kingst-la2016: receive_transfer(): status > > > >>> LIBUSB_TRANSFER_CANCELLED received 0 bytes. > > > >>> sr: [00:00.344157] kingst-la2016: receive_transfer(): status > > > >>> LIBUSB_TRANSFER_CANCELLED received 0 bytes. > > > >>> sr: [00:00.344240] kingst-la2016: receive_transfer(): status > > > >>> LIBUSB_TRANSFER_CANCELLED received 0 bytes. > > > >>> sr: [00:00.344304] kingst-la2016: receive_transfer(): status > > > >>> LIBUSB_TRANSFER_CANCELLED received 0 bytes. > > > >>> sr: [00:00.344360] kingst-la2016: receive_transfer(): status > > > >>> LIBUSB_TRANSFER_CANCELLED received 0 bytes. > > > >>> sr: [00:00.344409] kingst-la2016: receive_transfer(): status > > > >>> LIBUSB_TRANSFER_CANCELLED received 0 bytes. > > > >>> sr: [00:00.344463] kingst-la2016: receive_transfer(): status > > > >>> LIBUSB_TRANSFER_CANCELLED received 0 bytes. > > > >>> sr: [00:00.345475] session: bus: Received SR_DF_FRAME_END packet. > > > >>> cli: Received SR_DF_FRAME_END. > > > >>> sr: [00:00.345538] session: bus: Received SR_DF_END packet. > > > >>> cli: Received SR_DF_END. > > > >>> Device only sent 5001505 samples. > > > >>> sr: [00:00.349949] kingst-la2016: Download finished, done post > > > >>> processing. > > > >>> sr: [00:00.349987] usb: usb_source_finalize > > > >>> sr: [00:00.350061] session: Stopped. > > > >>> sr: [00:00.350096] hwdriver: Cleaning up all drivers. > > > >>> sr: [00:00.350413] kingst-la2016: Closing device on 1.24 (logical) / > > > >>> usb/1-2 > > > >>> (physical) interface 0. > > > >>> _______________________________________________ > > > >>> sigrok-devel mailing list > > > >>> sigrok-devel@lists.sourceforge.net > > > >>> https://lists.sourceforge.net/lists/listinfo/sigrok-devel
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ sigrok-devel mailing list sigrok-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sigrok-devel