librtlsdr
librtlsdr copied to clipboard
R820t tuner fixes
These changes improve the R820T tuner code to calculate the VCO/PLL parameters more precisely. The old code rounded the reference frequency to the nearest kHz and did some slightly dodgy hand-rolled long division.
These changes empirically reduce the tuning error from approx +/- 750Hz to approx +/- 200Hz. This is good enough to also fix some odd behaviour with applying frequency corrections, where for some PPM + frequency combinations, changing PPM by +/-1 would have no effect because the underlying tuner imprecision mapped both frequencies to the same PLL settings.
Tested on a generic RTL2832U with R820T tuner only.
Before-and-after graphs for the changes.
This data was generated by a modified version of kalibrate which accepts a manual tuning offset. For a fixed GSM signal you would expect that tuning 1Hz higher would move the measured signal 1Hz lower; anything different is tuner error or oscillator drift. You can see a little oscillator drift in these graphs, but most of it is clearly tuner error.


Hey I'm really intrigued by these changes, but like I commented on pull-request #7, it looks like this project doesn't use pull-requests for contributions :(.
I already posted to the osmocom list about this - the pull request is just a useful place to collect the changes
+1 looks useful
@mutability Can you resend that to mailing list? That is important as hell!
That ship sailed long ago; I have moved on to other projects. If you'd like to use this PR as a starting point for trying to get something merged upstream, that's fine.