Files
radar_system/data_acq_and_processing/kamil_adc_collector
2026-10-06 12:32:26 +03:00
..
2026-10-06 12:32:26 +03:00
2026-10-06 12:32:26 +03:00
2026-06-11 13:02:02 +03:00
2026-10-06 12:32:26 +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. KamilAdcService in python_app/hardware_full/kamil_adc reads and processes that stream for python_app.scripts.kamil_adc_raw_producer.

This is the data source for radar.model == "kamil_adc", paired with the Python kamil_adc_raw_producer. LibreVNA acquisition uses Python drivers.

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.

In switch-aware mode, SwitchSequencer drives the RF switches, 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. The Python reader drops dirty sweeps; the collector repeats that combination without another switch transition. The collector uses the common H7992 driver and run_config loader, with its own include set and build/kamil/ object tree.

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", unless --skip-build is set. The Linux build uses the repository's common sources and vendored headers and links with -pthread -ldl -lutil; no installed L-Card SDK is needed to build it.

Runtime

The collector loads the proprietary libx502api.so / libe502api.so at run time via dlopen, so those libraries must be discoverable by the dynamic loader. 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 tty:<path> from radar.kamil_adc.tty_path.

When both RF switches use driver_mode: "native", the producer also passes config:<path> to the collector. After each sweep boundary, the collector emits an 8-byte combo tag [0x00C0, input_pos, output_pos, dirty] (four little-endian 16-bit words). The producer accepts only clean sweeps for the requested combo. Otherwise, the producer selects and settles the switches itself; the collector runs without config:<path> and emits no combo tags. Calibration captures also use this Python-controlled path.