LA-mode IQ capture: per-tone CSI from Jaguar silicon, offline H(k) tools, SDR notch validation#266
Merged
Merged
Conversation
…ols, SDR notch validation (#150) One shared module (src/LaCapture) ports phydm's logic-analyzer ADC capture to all three generations: the baseband DMAs a raw sample bus into the top of the TX packet buffer, host-read through the 0x0140-page window. MAC half (0x7c0 trigger/poll/readback) is identical across families; the BB half is two register dialects (11AC 0x95c/0x8fc, JGR3 0x1ce4/0x1cf4/0x1c3c) carried by per-chip LaRegs. Wired as a research method on each device class + rxdemo env knobs (DEVOURER_LA_CAPTURE, USB and PCIe paths), with BbDbgportReader-grade safety: full register snapshot/restore, liveness checks, sticky wedge latch. Hardware-bisected deviations from the vendor flow: the manual REG trigger edge (0x7c0[5]) must be pulsed after the dump-enable bit or the capture never completes; dbg_port routing selects the sampled bus and 0 is dead (ADC pairing is dma0+0x880 / dma1+0xa80); 0x0106 TXFF debug access is restored instead of leaked. Sample packing established empirically (tests/la_cw_score.sh, B210 CW at known offsets): one complex sample per 64-bit word, 12-bit two's complement, I=[11:0] Q=[23:12] (qi12_l) on every chip, at the configured rate; JGR3 carries the second RX path in the high dword — a coherent two-chain capture per trigger. tools/la_decode.py scores candidate layouts; tools/la_csi.py locates the L-LTF (STF-rejecting), refines CFO over the repetition train, and FFTs to per-tone H(k) mag/phase, with a synthetic 2-tap-channel ctest (la_csi_math). Validation: tests/la_capture_smoke.sh 3/3 on 8822BU / 8814AU / 8821C / 8822CU / 8822EU, plus the 8821CE over PCIe (8 ms MMIO readback vs ~2 s USB); 8812A/8821A report la.nosupport (0x7c0 never latches — the silicon lacks the block, matching PHYDM_IC_SUPPORT_LA_MODE). tests/la_sdr_crosscheck.sh validates H(k) against SDR ground truth via a notch protocol — the B210 transmits an L-LTF train with an asymmetric tone set zeroed and the chip's estimate must reproduce it (8822BU: 21-31 dB depth, clean-tone ripple 1.2 dB). Chip-vs-SDR |H(k)| correlation was measured and rejected as a methodology: receivers at different antennas see independent fading (~0 correlation, both sides self-consistent). Known J3 caveat: ~8 dB adjacent-tone leakage floor on both paths (common LO); features two or more tones wide resolve at 15-23 dB. Closes #150 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #150.
What
phydm's LA (logic-analyzer / ADC-sampling) mode is the debug escape hatch that DMAs a raw baseband sample bus into the top of the TX packet buffer, host-readable through the
0x0140-page +0x8000window. An offline FFT of a captured L-LTF is the full per-tone channel estimate H(k) — this PR productizes that path on all three Jaguar generations, turning any supported dongle into a one-shot per-subcarrier channel sounder. Full write-up:docs/la-capture.md.src/LaCapture.{h,cpp}— one shared module (NhmReader pattern: per-chipLaRegs, one algorithm). MAC half (0x7c0trigger/poll/finish + readback) identical across families; BB half in two dialects (11AC0x95c/0x8fc, JGR30x1ce4/0x1cf4/0x1c3c). BbDbgportReader-grade safety: every touched register snapshot/restored, liveness checks between phases, sticky wedge latch with the documented recovery ladder.la_capture()on all three device classes (dynamic_cast pattern, not onIRtlDevice), incl. 8821C cut-A LA-clock gating and the 8812A/8821A no-block probe path.DEVOURER_LA_CAPTURE=<trig>/<rate>M/dma<N>/port:0xNNN[...]+_OUT/_MAX/_DELAY_MS, on both the USB and PCIe demo paths;DVLAdump file +la.capture/la.timeout/la.nosupport/la.wedgedevents.tools/la_decode.py(layout unpack/score/plot),tools/la_csi.py(L-LTF locate with STF rejection, multi-period CFO refine, GI-backoff FFT → per-tone H(k) mag/phase; synthetic 2-tap-channel selftest wired as thela_csi_mathctest, numpy-less runners skip).Hardware findings the vendor code hides
0x7c0[5]0→1) must be pulsed after the dump-enable bit — the vendor's order never completes on real silicon.dma_typealone doesn't select a live bus: the dbg-port value routes it, anddbg_port=0is dead. ADC pairing:dma0+0x880(path A),dma1+0xa80(path B).tests/la_cw_score.sh): one complex sample per 64-bit word, 12-bit two's complement, I=[11:0], Q=[23:12] (qi12_l) on every chip — the naive order is spectrally inverted. JGR3 additionally carries the second RX path in the high dword: a coherent two-chain capture per trigger.0x7c0never latches) — matchingPHYDM_IC_SUPPORT_LA_MODE, now detected explicitly instead of returning stale TXFF bytes.Validation (all bench-run)
la.nosupportSDR cross-validation (
tests/la_sdr_crosscheck.sh): the B210 transmits an L-LTF train with an asymmetric tone set zeroed; the chip's H(k) must reproduce the notch at exactly those tones. 8822BU: 21–31 dB depth on all six tones, clean-tone ripple 1.2 dB. The issue's original chip-vs-SDR |H(k)|-correlation idea was measured and rejected: receivers at different antennas see independent fading (~0 correlation while both sides are self-consistent); thecomparesubcommand survives as that diagnostic. Known J3 caveat (documented): ~8 dB adjacent-tone leakage floor on both RX paths (common LO); features ≥2 tones wide resolve at 15–23 dB.ctest19/19 incl. the newla_csi_math; full build and Jaguar1-only subset build verified clean.🤖 Generated with Claude Code