Bug 1641 - Short sampling time
Summary: Short sampling time
Alias: None
Product: PulseView
Classification: Unclassified
Component: Acquisition (show other bugs)
Version: 0.4.1
Hardware: All Linux
: Normal major
Target Milestone: ---
Assignee: Nobody
Depends on:
Reported: 2020-11-19 22:55 CET by marko
Modified: 2020-11-27 17:41 CET (History)
1 user (show)


Note You need to log in before you can comment on or make changes to this bug.
Description marko 2020-11-19 22:55:17 CET
I am using Cypress FX2 on Raspberry Pi.

The problem is that actual sampling time is often much shorter than it should be.  For example, I am reading 11 channels with 8 MHz frequency and 100M samples.  Sampling time should be 13s, but actually sampling stops after 40ms to 800ms and its length is completely unpredictable.
Comment 1 Ralf 2020-11-20 10:16:16 CET
Can Raspberry PI handle 16MBytes/s continuously?
You can increase the log level (-l 5) and check the output for errors.

sigrok-cli is single threaded, AFAIK. You might want to try raw binary output to reduce the time needed for storing the data, because srzip format compresses the data.
Comment 2 marko 2020-11-20 11:12:44 CET
How can I switch to raw binary output?

Here is the log:

I am first getting:

sr: fx2lafw: receive_transfer(): status LIBUSB_SUCCESS / LIBUSB_TRANSFER_COMPLETED received 80384 bytes.
sr: session: bus: Received SR_DF_LOGIC packet (80384 bytes, unitsize = 2).

Then I get once:

sr: fx2lafw: receive_transfer(): status LIBUSB_TRANSFER_TIMED_OUT received 16384 bytes.
sr: session: bus: Received SR_DF_LOGIC packet (16384 bytes, unitsize = 2).

Then I am getting 65 times:

sr: fx2lafw: receive_transfer(): status LIBUSB_TRANSFER_TIMED_OUT received 0 bytes.

And finally I get:

sr: session: bus: Received SR_DF_END packet.
sr: usb: usb_source_finalize
sr: session: Stopped.
Comment 3 Ralf 2020-11-20 12:19:50 CET
sr: fx2lafw: receive_transfer(): status LIBUSB_SUCCESS / LIBUSB_TRANSFER_COMPLETED received 80384 bytes.

indicates buffer overflow and thus abort of capture

Binary output can be selected by "-O binary" (capital letter O)
Comment 4 marko 2020-11-20 12:55:35 CET
So if I understand right, buffer overflow can be avoided by binary output?

I tried to start pulseview from a command prompt

pulseview -O binary

and got

pulseview: invalid option -- 'O'
Comment 5 Ralf 2020-11-20 13:14:17 CET
PV is multi-threaded and stores captured data in RAM.
Output format is specified at save/export time.

sigrok-cli is single threaded afaik: capture, compress (srzip), save to disk.
Using binary output with sigrok-cli avoids the overhead of compressing data, which processes captured data faster and reduces the risk of buffer overflow.

The best you can try to get this setup working is to reduce system load, e.g. avoid updating PV view, accessing Ethernet, ...

Maybe it gives better results, if you run sigrok-cli from shell without X System.
Save the data to SD-Card (or RAM-Disk), not USB-Stick to save the bandwidth.
Comment 6 marko 2020-11-26 00:22:01 CET
I have tried the device on my PC, which is significantly faster than Raspberry Pi.  However even there 8MHz for up to 8 channels is best I can squeeze out of it.  I even run PulseView in Administrator mode (Windows).

Is there anything else that could help - maybe updating firmware on EEPROM, or even replacing K24C128 EEPROM with K24C256 or even K24C512?
Comment 7 marko 2020-11-26 17:03:18 CET
I also installed sigrok-cli and selected binary output.  It is about as stable as pulseview - no improvement.
Comment 8 Ralf 2020-11-26 19:49:25 CET
I guess the Windows driver (WinUSB) is the bottleneck in your PC setup.
My PC with Linux has no problems to capture with 24MHz (8 ch), while the same PC under Windows 10 hardly manages 8MHz

There is some information on the Wiki about FX2 devices under Windows:

With hints about performance issues:

Comment 9 marko 2020-11-27 17:41:58 CET
Thanks, that was helpful.  So my Raspberry Pi is too slow in terms of hardware and my PC is too slow in terms of operating system. :(

If someone comes with any new idea, please write it down.