Reconcile SDRPlay gains with SoapySDR abstractions#26
Reconcile SDRPlay gains with SoapySDR abstractions#26dlaw wants to merge 3 commits intopothosware:masterfrom
Conversation
SDRPlay's "RFGR" is actually a mode selector for the front-end LNA. It does *not* have units of dB. (In fact, it is frequency-dependent.) As a result, the default gain allocation algorithm does not apply and only IFGR should be used for adjusting the overall system gain.
SoapySDR gains are expected to be positive for increased amplification. The cleanest way to handle this is to treat the SDRPlay gain reduction value as the negative of the SoapySDR IF gain.
The SDRPlay LNA state is a setting which is: 1. Not actually a gain in dB 2. Not adjusted by automatic gain control We will always show it as a setting (e.g. a CubicSDR menu option). Users can enable the LNA_STATE_AS_GAIN build option if they wish for it to be duplicated as a SoapySDR gain (the "RF gain").
|
Thanks for pointing out the problems with the gains/attenuations @dlaw A few months ago we had a possibly similar discussion with @SDRplay and @vsonnier (see here: cjcliffe/CubicSDR#825), where I ended up creating a branch I think that, in light of your observations, we should resume that discussion together to see what the others have to say. This will also give me some time to complete the other changes related to #23 that I am currently working on. Franco |
|
Thanks for the pointers! I was not aware of #10 and cjcliffe/CubicSDR#825. Obviously my proposal here is redundant with the work that has been done on the I do have a few proposed tweaks to Once that is done, perhaps we can open a pull request for The other major difference between this PR and I will close this PR in favor of #27, which reconciles my proposed changes with Cheers! |
Good morning and a happy new year to all!
This PR is an attempt to reconcile the unusual SDRPlay gains with the standard SoapySDR abstractions as cleanly as possible. It solves pothosware/SoapySDRPlay2#44. This is a port of pothosware/SoapySDRPlay2#61 to the new version 3 driver.
(The first commit is a solution to pothosware/SoapySDRPlay2#60; I also opened a separate PR #25 with just that commit.)
A brief summary of the changes:
SoapySDR and various SoapySDR clients expect that a larger gain results in more amplification. However, SDRPlay exposes a gain reduction, resulting in backwards controls and/or unstable AGC loops in generic SoapySDR clients. The solution is to define the gain to be equal to the negative of the gain reduction. For example, if a radio has an IF gain reduction range of 20 to 59 dB, this will now be exposed as an IF gain with a range of -20 to -59 dB.
A slightly thornier issue is that the "RF gain reduction" setting is not actually a gain setting in dB, but rather a mode selection for the front-end LNA. Semantically, it belongs in the settings and not in the gains. However, for the convenience of users who prefer to have the LNA setting available as a gain, a build option is provided. As with the IF gain, RF gain reduction values are negated so that larger values result in greater amplification.
I have built and tested this PR with the SDRPlay driver version 3.07 and an RSP1A on Debian Linux.
References: