Phase is shifting slowly between two RTL-SDRs in sync
-
- Posts: 4
- Joined: Fri Jan 22, 2016 10:47 pm
Phase is shifting slowly between two RTL-SDRs in sync
Hi,
I've connected two RTL-SDRs together coherently as described here http://www.rtl-sdr.com/passive-radar-du ... l-rtl-sdr/ .
The strange thing I observe is that the first time I start them I will observe a slowly increasing phase shift between the two devices. I'm correlating the signals multiple times over time. This indicates that their frequencies are not exactly the same.. If I stop the script and restart the script, this strange phase shift usually (but not always) disappears, and it works perfectly and can run for a long time without any phase shift appearing, and I can use it for measurements.
I'm setting up the devices the same way using GNU radio and osmosdr:
def setup_device(dev):
dev.set_freq_corr(0, 0)
dev.set_dc_offset_mode(0, 0)
dev.set_iq_balance_mode(0, 0)
dev.set_gain_mode(False, 0)
dev.set_gain(10, 0)
dev.set_if_gain(0, 0)
dev.set_bb_gain(0, 0)
dev.set_antenna("", 0)
dev.set_bandwidth(0, 0)
dev.set_sample_rate(samp_rate)
dev.set_center_freq(freq,0)
Can some of you suggest what I may be missing? Is there anything in the RTL2832 or the tuner chip that prevents the frequency from being exactly the same even when the reference clock is the same ? :s This is really frustrating since I can't make some sense out of it. I've confirmed that I'm not loosing any samples.
Cheers
Ruben
I've connected two RTL-SDRs together coherently as described here http://www.rtl-sdr.com/passive-radar-du ... l-rtl-sdr/ .
The strange thing I observe is that the first time I start them I will observe a slowly increasing phase shift between the two devices. I'm correlating the signals multiple times over time. This indicates that their frequencies are not exactly the same.. If I stop the script and restart the script, this strange phase shift usually (but not always) disappears, and it works perfectly and can run for a long time without any phase shift appearing, and I can use it for measurements.
I'm setting up the devices the same way using GNU radio and osmosdr:
def setup_device(dev):
dev.set_freq_corr(0, 0)
dev.set_dc_offset_mode(0, 0)
dev.set_iq_balance_mode(0, 0)
dev.set_gain_mode(False, 0)
dev.set_gain(10, 0)
dev.set_if_gain(0, 0)
dev.set_bb_gain(0, 0)
dev.set_antenna("", 0)
dev.set_bandwidth(0, 0)
dev.set_sample_rate(samp_rate)
dev.set_center_freq(freq,0)
Can some of you suggest what I may be missing? Is there anything in the RTL2832 or the tuner chip that prevents the frequency from being exactly the same even when the reference clock is the same ? :s This is really frustrating since I can't make some sense out of it. I've confirmed that I'm not loosing any samples.
Cheers
Ruben
-
- Site Admin
- Posts: 2835
- Joined: Mon Nov 19, 2012 11:54 pm
Re: Phase is shifting slowly between two RTL-SDRs in sync
I'm not too well versed in using the dongles this way, but from what I've seen in discussions is that the shift is partly due to 'dithering'. Keenerds drivers seem to have a way to turn this off. Also another source of drift is because it is not possible to synchronise USB samples.
Have a look at how the guy in this post solved it http://www.rtl-sdr.com/an-rtl-sdr-phase ... on-finder/
Have a look at how the guy in this post solved it http://www.rtl-sdr.com/an-rtl-sdr-phase ... on-finder/
-
- Posts: 4
- Joined: Fri Jan 22, 2016 10:47 pm
Re: Phase is shifting slowly between two RTL-SDRs in sync
Thanks a lot for leading me the right way. I turned off the dithering on both devices by patching with this: https://github.com/keenerd/rtl-sdr/comm ... 804a063bfd and making sure priv->disable_dither is set to 1 when loading it via the GR osmosdr interface. After doing this, I don't observe any phase drift anymore.
Cheers!
Cheers!
-
- Site Admin
- Posts: 2835
- Joined: Mon Nov 19, 2012 11:54 pm
Re: Phase is shifting slowly between two RTL-SDRs in sync
Excellent, glad to hear that the dithering solved it.
Just curious, are you not seeing any issues due to the inability to sync samples from the USB packets? I think many people have issues with that and it can only be solved with an external reference signal. Perhaps your application is immune to this desync somehow though.
Just curious, are you not seeing any issues due to the inability to sync samples from the USB packets? I think many people have issues with that and it can only be solved with an external reference signal. Perhaps your application is immune to this desync somehow though.
-
- Posts: 4
- Joined: Fri Jan 22, 2016 10:47 pm
Re: Phase is shifting slowly between two RTL-SDRs in sync
I get sample sync from the two devices by initially running a cross
correlation with the devices tuned into a known FM broadcast station.
I've implemented a gnuradio-block to do this for me automatically and
then adjust the input streams accordingly afterwards. I will share
this one when it's robust enough.
I would expect the dithering to cause random fluctuations of the
phase, but in this case there is a constant drift only one way. I'm
not sure I understand why this happens. And also why does it sometimes not happen..
correlation with the devices tuned into a known FM broadcast station.
I've implemented a gnuradio-block to do this for me automatically and
then adjust the input streams accordingly afterwards. I will share
this one when it's robust enough.
I would expect the dithering to cause random fluctuations of the
phase, but in this case there is a constant drift only one way. I'm
not sure I understand why this happens. And also why does it sometimes not happen..
-
- Site Admin
- Posts: 2835
- Joined: Mon Nov 19, 2012 11:54 pm
Re: Phase is shifting slowly between two RTL-SDRs in sync
So in the end disabling dithering didn't completely fix it? I think the guy in the link I posted found that he needed to periodically resyncs the streams with a reference signal.
Go on the ##rtlsdr channel in IRC at freenode, there are a few experts there who might be able to provide insight.
Go on the ##rtlsdr channel in IRC at freenode, there are a few experts there who might be able to provide insight.
-
- Posts: 4
- Joined: Fri Jan 22, 2016 10:47 pm
Re: Phase is shifting slowly between two RTL-SDRs in sync
> So in the end disabling dithering didn't completely fix it?
It DID fix it completely!
I haven't been clear enough then. I just found it a little bit strange that it was necessary to turn off the dithering. I wasn't expecting the dithering to have this effect.
When I've tuned the initial sample and phase offset, it can run for a long time without any need to retune it. It works very well!
Thanks for your help!
Cheers
It DID fix it completely!

When I've tuned the initial sample and phase offset, it can run for a long time without any need to retune it. It works very well!
Thanks for your help!
Cheers
Re: Phase is shifting slowly between two RTL-SDRs in sync
Hi man,
It has been longtime you worked on this dither process (since 2016). I followed the link mentioned but not really helpful.
Can you review the process of disabling the dither for us? (if possible, a step by step configuration)
Thank you!
ES
It has been longtime you worked on this dither process (since 2016). I followed the link mentioned but not really helpful.
Can you review the process of disabling the dither for us? (if possible, a step by step configuration)
Thank you!
ES
saltmakrell wrote: ↑Tue Jan 26, 2016 8:43 pm> So in the end disabling dithering didn't completely fix it?
It DID fix it completely!I haven't been clear enough then. I just found it a little bit strange that it was necessary to turn off the dithering. I wasn't expecting the dithering to have this effect.
When I've tuned the initial sample and phase offset, it can run for a long time without any need to retune it. It works very well!
Thanks for your help!
Cheers
-
- Site Admin
- Posts: 2835
- Joined: Mon Nov 19, 2012 11:54 pm
Re: Phase is shifting slowly between two RTL-SDRs in sync
If you don't want dithering you can just use the KerberosSDR drivers now https://github.com/rtlsdrblog/rtl-sdr-kerberos
No point turning it off unless you're doing coherent stuff, or have some other advanced experiment.
No point turning it off unless you're doing coherent stuff, or have some other advanced experiment.