Hello Stefan,
I've played around with your code and also had a look into the linux kernel driver which contains some elonics code [1].
There the LNA gains have an offset of 3dB compared with rtl-sdr.
The absolute gain is insignificant. The dongle will convert an RF voltage to A/D converter bits and the number of mV per bit will change if there is an offset on gain values. I can not see that one is better than the other. Those who know the internals of the chip might want to set the scale offsets correctly because the different stages may actually have gain or cause attenuation. Such a strategy is not unambigous however. When the impedance level is changed we have to know whether dB refers to a power ratio or a voltage ratio.
In the rtl-sdr header is also a constant defined but not used, to switch to 5dB gain steps. I'm wondering how this fit's with your observations.
I have no idea.
I've read your blog entry and would like to evaluate the gain values of my device, but it is not clear to me what equipment is needed - I assume at least a 144 MHz oscillator with defined level.
You just need a signal that is stable in amplitude. Could be your local FM station or any signal generator in the range 55 to 1000 MHz. Probably higher, but I do not have generators above 1 GHz easy at hand so I have not verified that.
Regarding your changes to the gain setting function, fear they contain lots of bugs, but I agree it would be nice to have a function which make IF-gain setting easier.
Not bugs, but clumsy code. I tried to not change more than necessary...
The elonics code also contains a more stuff to configure the auto gain. Maybe this is interesting for rtl-sdr too.
In general purpose SDR we do not want any kind of auto gain.
Those who want to use the builtin decoders have a different situation.
Regards
Leif / SM5BSZ
Regards
Stefan
[1] https://github.com/tmair/DVB-Realtek-RTL2832U-2.2.2-10tuner-mod_kernel-3.0.0...
Am 05.07.2012 13:27, schrieb Leif Asbrink:
I changed the numbers to get a reasonable agreement with the gain values I observed on the dongles I have.
I did not care to match the gain setting to the real gain better than within 3 dB (the gain step size in Linrad.) The reason is that I assume that the routines from osmocom will be changed and that other softwares that support rtl dongles will allow gain setting in a reasonable way and that the performance will become similar to the current Linrad performance. When that happens I will rewrite Linrad to use the library as intended.
I see two alternatives, there could be lna gain as well as IF gain as separate controls.
The other alternative would be a single gain control, but in that case both lna and if gain have to be controlled. The first few gain reduction steps have to be on the IF because the most common problem is close range interference and the improved dynamic range is useful. (In case the lna gets blocked one should install a filter.)
Regards
Leif / SM5BSZ
On Thu, 05 Jul 2012 02:06:31 +0200 la@tfc-server.de wrote:
The gain setting is clumsy
If it only was your gain setting function, but no, even your gain values for the lna are just plain wrong. I just have to ask: Why? What made you "improve" them?