Skip to content

libm2sdr: re-apply RX QEC K_exp loop gain after RX LO retune#146

Merged
enjoy-digital merged 1 commit into
enjoy-digital:mainfrom
simonerni:pr/libm2sdr-rx-qec-kexp
Jul 13, 2026
Merged

libm2sdr: re-apply RX QEC K_exp loop gain after RX LO retune#146
enjoy-digital merged 1 commit into
enjoy-digital:mainfrom
simonerni:pr/libm2sdr-rx-qec-kexp

Conversation

@simonerni

Copy link
Copy Markdown
Contributor

Problem

The AD9361 driver default RX quadrature-tracking loop gain (K_exp = 0x15) leaves
the loop effectively inert: ~25 dBc image rejection, a 3.5–7 % EVM floor. On
wideband receive this corrupts PDSCH/LDPC — the image is coherent, so HARQ
combining can't recover it. 0x0a converges to ~40–43 dBc.

Each RX LO retune re-runs the AD9361 quad cal, which reverts K_exp to the inert
default, so the fix has to be re-applied after every retune, not just at init.

Change

After ad9361_set_rx_lo_freq() in m2sdr_set_frequency(), call a small helper
that writes CALIBRATION_CONFIG_2/3 with K_EXP_PHASE/K_EXP_AMPLITUDE.
M2SDR_QEC_KEXP overrides the value (default 0x0a; stable across 0x020x0a).

Testing

test-libm2sdr, analyze-libm2sdr (cppcheck clean), ASan/UBSan, Soapy build — all
pass. Measured ~25 → ~40–43 dBc image rejection on hardware, removing the wideband
EVM floor.

The AD9361 driver default RX quadrature-tracking loop gain (K_exp=0x15) leaves
the loop effectively inert: ~25 dBc image rejection, a 3.5-7% EVM floor that
corrupts wideband PDSCH LDPC. 0x0a converges to ~40-43 dBc. Each RX LO retune
re-runs the AD9361 quad cal and reverts K_exp to the inert default, so re-apply
it after ad9361_set_rx_lo_freq. M2SDR_QEC_KEXP overrides the value.
@enjoy-digital

Copy link
Copy Markdown
Owner

Thanks @simonerni!

@enjoy-digital
enjoy-digital merged commit a3ccc3e into enjoy-digital:main Jul 13, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants