Files
radar_system/data_acq_and_processing/kamil_adc_collector
2026-10-05 16:46:28 +03:00
..
2026-10-05 16:46:28 +03:00
2026-10-05 16:46:28 +03:00
2026-06-11 13:02:02 +03:00

Kamil ADC collector

Standalone acquisition binary for the L-Card E-502 ADC. It captures the dual-channel main + reference IQ stream and publishes it as 8-byte framed packets over a PTY, which the Python kamil_adc producer (python_app/hardware_full/kamil_adc) reads and processes.

This is the data source for radar.model == "kamil_adc"; it is the Kamil ADC counterpart to the C++ sweep_orchestrator used by LibreVNA devices.

Layout

Path Contents
src/ Collector implementation (main.cpp) and the PTY / capture-file writers.
include/ Headers for the writers plus switch_sequencer.h.
vendor/lcard/ L-Card X502/E502 SDK headers (x502api.h, e502api.h, lcard_pstdint.h), vendored verbatim so the collector builds with no external include path.

The sources started as a verbatim import of the original standalone tool, but are no longer identical to it: the collector now drives the RF switches itself (switch-aware mode, SwitchSequencer), stepping to the next combination inside the hardware idle gap between sweeps and flagging a sweep dirty when a readout backlog means the toggle could not have landed in that gap. It therefore reuses the orchestrator's switch drivers and the shared run_config loader, which is why its build has its own include set and its own build/kamil/ object tree.

The wire format towards the Python producer is unchanged.

Build

make kamil_adc_collector      # -> build/bin/kamil_adc_collector

It is not part of make all; start.sh builds it automatically when the active config selects radar.model == "kamil_adc". The build is self-contained: it needs only the vendored headers and links -ldl -lutil -lpthread.

Runtime

The collector loads the proprietary libx502api.so / libe502api.so at run time via dlopen, so those libraries must be on LD_LIBRARY_PATH. The Kamil ADC service prepends ~/.local/lib (their default install location) unless the config pins LD_LIBRARY_PATH in radar.kamil_adc.env.

The command-line arguments (capture profile, clocking, the do8_freq_ref reference overlay, etc.) are supplied by radar.kamil_adc.args in the run config; the service appends the generated tty:<path> argument.