libm2sdr: re-apply RX QEC K_exp loop gain after RX LO retune#146
Merged
enjoy-digital merged 1 commit intoJul 13, 2026
Merged
Conversation
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.
Owner
|
Thanks @simonerni! |
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.
Problem
The AD9361 driver default RX quadrature-tracking loop gain (
K_exp = 0x15) leavesthe 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.
0x0aconverges to ~40–43 dBc.Each RX LO retune re-runs the AD9361 quad cal, which reverts
K_expto the inertdefault, so the fix has to be re-applied after every retune, not just at init.
Change
After
ad9361_set_rx_lo_freq()inm2sdr_set_frequency(), call a small helperthat writes
CALIBRATION_CONFIG_2/3withK_EXP_PHASE/K_EXP_AMPLITUDE.M2SDR_QEC_KEXPoverrides the value (default0x0a; stable across0x02–0x0a).Testing
test-libm2sdr,analyze-libm2sdr(cppcheck clean), ASan/UBSan, Soapy build — allpass. Measured ~25 → ~40–43 dBc image rejection on hardware, removing the wideband
EVM floor.