Discussion:
Question about rtlsdr_set_freq_correction()
Malcolm Robb
2014-07-09 16:56:05 UTC
Permalink
Hi,
First post, hope I don't break any rules. I've a question about the rtlsdr_set_freq_correction() function.

I've used SDRSharp to fine tune my dongle to a local Airfield ATIS broadcast, and like many others in our group come up with an error of around 50ppm. So I can use rtlsdr_set_freq_correction() in my application to fine tune the RF center frequency. However, there is only one crystal in the dongle (28.8MHz) and that crystal generates both the RF frequency and the digital sampling frequency. So presumably if the RF frequency is 50ppm off, then so is the digital sampling frequency.

My question is : Does the rtlsdr_set_freq_correction() function correct both the RF frequency (set by rtlsdr_set_center_freq()) and the sampling frequency (set by rtlsdr_set_sample_rate()) , or just the RF?

The reason this matters is that I use the sampling frequency to timestamp signals recovered from the raw samples, and 50ppm error is enough to mess up the results.

Cheers
Malcolm
Sylvain Munaut
2014-07-09 17:20:05 UTC
Permalink
Hi,
Post by Malcolm Robb
I've used SDRSharp to fine tune my dongle to a local Airfield ATIS broadcast, and like many others in our group come up with an error of around 50ppm. So I can use rtlsdr_set_freq_correction() in my application to fine tune the RF center frequency. However, there is only one crystal in the dongle (28.8MHz) and that crystal generates both the RF frequency and the digital sampling frequency. So presumably if the RF frequency is 50ppm off, then so is the digital sampling frequency.
My question is : Does the rtlsdr_set_freq_correction() function correct both the RF frequency (set by rtlsdr_set_center_freq()) and the sampling frequency (set by rtlsdr_set_sample_rate()) , or just the RF?
It should correct both.

At least there is dedicated code for this (commit
a48f48e3b181d7bdb72345d61977f7bea0292f2d).
Whether this actually works or how well it works is another issue :p

Cheers,

Sylvain
Steve Markgraf
2014-07-09 17:34:12 UTC
Permalink
Hi Malcolm,
Post by Malcolm Robb
My question is : Does the rtlsdr_set_freq_correction() function
correct both the RF frequency (set by rtlsdr_set_center_freq()) and
the sampling frequency (set by rtlsdr_set_sample_rate()) , or just
the RF?
The RTL2832 allows to fine-tune the output frequency of the
resampler by writing a correction value to a register.

A call of rtlsdr_set_freq_correction() corrects both the RF frequency
and the sampling frequency by calling the internal function
rtlsdr_set_sample_freq_correction() which calculates a correction value
and writes it to the aforementioned register.

Regards,
Steve
lists
2014-07-10 05:39:30 UTC
Permalink
On Wed, 9 Jul 2014 16:56:05 +0000
Post by Malcolm Robb
Hi,
First post, hope I don't break any rules. I've a question about the
rtlsdr_set_freq_correction() function.
I've used SDRSharp to fine tune my dongle to a local Airfield ATIS
broadcast, and like many others in our group come up with an error of
around 50ppm. So I can use rtlsdr_set_freq_correction() in my
application to fine tune the RF center frequency. However, there is
only one crystal in the dongle (28.8MHz) and that crystal generates
both the RF frequency and the digital sampling frequency. So
presumably if the RF frequency is 50ppm off, then so is the digital
sampling frequency.
My question is : Does the rtlsdr_set_freq_correction() function
correct both the RF frequency (set by rtlsdr_set_center_freq()) and
the sampling frequency (set by rtlsdr_set_sample_rate()) , or just
the RF?
The reason this matters is that I use the sampling frequency to
timestamp signals recovered from the raw samples, and 50ppm error is
enough to mess up the results.
Cheers
Malcolm
http://www.evrytania.com/lte-tools/78-default-category/77-lte-cell-scanner
This program uses the local LTE cell as a reference, good to 5ppm, well
if you have LTE. It runs, though I never used it to tweak the rtlsdr
since I do mode-s (with the Malcom Robb version of dump1090 no less)
and the error in mode-s center frequency is far worse than the dongle.

The program works, albeit slowly, but you are only going to find the
700MHz LTE cells due to the limited range of the dongle.

Note I ran this on my notebook PC, not a Beagle or PI. This doesn't
mean it won't work on a small arm computer, but rather I never tried it.

You would probably have to temperature test this to see if correction
makes any sense. That is, run the LTE program with the dongle at
different temperatues and see how the correction factor changes.

Loading...