This project transforms a Raspberry Pi 5 (BCM2712/RP1 architecture) and a Siglent SDS800X HD oscilloscope into a high-speed, hardware-triggered Multichannel Data Acquisition (DAQ) system. By coupling a custom zero-copy Linux Kernel Module (rpi_fast_irq) with multithreaded SCPI network communication over TCP, the system captures physical trigger events from the oscilloscope's "Trigger Out" BNC port with nanosecond precision.
Designed for high-performance physics and electronics experiments, the suite features real-time logging, massive burst sequence extraction (up to 500,000 wfm/s), and live GUI histograms powered by the CERN ROOT Framework.
- Hardware-Synchronous Triggering: Eliminates user-space polling jitter. The physical Trigger Out signal generates a kernel-level interrupt on an isolated CPU core, stamping the event time at Ring 0 via
ktime_get_ns(). - Zero-Copy Memory Mapping: The kernel module shares a lock-free ring buffer directly with the C++ user-space applications via
mmap(vmalloc_user), guaranteeing deterministic microsecond latency. - Multi-Threaded I/O Offloading: Critical acquisition loops are decoupled from SCPI network parsing and disk I/O or X11 GUI rendering, preventing network timeouts from dropping hardware triggers.
- IEEE 488.2 Binary Block Parsing: Waveform data is extracted in its native binary format rather than ASCII, maximizing throughput and preserving lossless 16-bit word precision.
The suite is divided into command-line data loggers and ROOT-integrated graphical analyzers.
- Binaries:
pmode.x(CLI Logger),pmode_root.x(Live GUI) - Workflow: The oscilloscope operates in Single-Shot mode (
TRMD SINGLE). Upon receiving a hardware trigger, the software enforces a 300ms DSP settling delay, fetches the calculated measurements via SCPI, and immediately re-arms the oscilloscope. - Use Case: Continuous, real-time logging where immediate data availability is required and event rates are low (< 3 Hz).
- Binaries:
smode.x(CLI Logger),smode_root.x(Batch GUI) - Workflow: Leverages the Siglent's hardware Sequence mode (
ACQ:SEQ ON). The RPi5 strictly counts hardware interrupts. Once a target capacity or a timeout (-t) is reached, the acquisition is safely stopped, and the data is bulk-downloaded via History Mode (for scalars) or direct Sequence RAM extraction (for raw vectors). - Use Case: High-frequency transients or particle detection where dead-time must be zero. Captures bursts at the oscilloscope's maximum trigger rate.
- Connect the Oscilloscope to the Raspberry Pi 5 via Gigabit Ethernet.
- Connect the Oscilloscope's Trigger Out / Pass-Fail BNC to a logic level shifter (3.3V safe).
- Connect the shifted logic signal to GPIO 17 on the RPi5.
To ensure hard real-time performance, isolate CPU 3 on the RPi5:
- Append
isolcpus=3to/boot/firmware/cmdline.txt. - Reboot the system.
ROOT applications (pmode_root.x, smode_root.x) must not be run with sudo to prevent X11/Wayland display server crashes. Grant user access to the IRQ device:
sudo chmod 666 /dev/rp1_gpio_irq(Tip: Add a udev rule to persist this permission across reboots).
Build the kernel module first:
cd Kernel_module
make
sudo insmod rpi_fast_irq.koCompile the user-space applications (requires g++ and CERN ROOT):
cd Polling_mode && make
cd ../Sequence_mode && make
cd ../Polling_mode_histo && make
cd ../Sequence_mode_histo && makeAll modes feature an interactive fallback. If you launch an executable without parameters, it will prompt you for the IP address and bounds dynamically.
Log Peak-to-Peak and Maximum voltages, and dump the raw waveform for each event:
./pmode.x PKPK MAX WAVE -ip 192.168.1.100 -o experiment_1.datPlot a real-time updating histogram of Minimum voltage with dynamic binning:
./pmode_root.x MIN -ip 192.168.1.100Force strict axis boundaries and fixed bins:
./pmode_root.x PKPK -ip 192.168.1.100 -min 0.0 -max 5.0 -bin 1000Capture an extreme burst of scalar measurements using a 60-second timeout:
./smode.x AMPL -ip 192.168.1.100 -t 60 -o burst_ampl.datDump the raw vector memory blocks for offline processing:
./smode.x WAVE -ip 192.168.1.100 -t 30 -o raw_capture.waveAccumulate Sequence triggers and update the ROOT histogram in batches every 10 seconds:
./smode_root.x TOP -ip 192.168.1.100 -t 10 -min -1.0 -max 3.3analyze_scpi.C: A ROOT macro to perform post-acquisition statistical analysis and generate 1-sigma distributions from the generated.datfiles.root -l 'analyze_scpi.C("experiment_1.dat")'wave_parser.py: A Python script (included in theSequence_modedirectory) to decode the massive binary.wavedumps. It parses the hardware preamble (VDIV, OFFSET, CODE) and maps the 16-bit raw ADC integers back into absolute voltage readings and timestamps.
This project is licensed under the GNU Affero General Public License v3 (AGPLv3).
See the LICENSE file for full details.