# Question regarding frequency offset correction

**URL:** <https://www.ruby-forum.com/t/question-regarding-frequency-offset-correction/230956>\
**Category:** GNU Radio\
**Created:** [July 14, 2014, 6:16pm UTC](https://www.ruby-forum.com/t/question-regarding-frequency-offset-correction/230956 "2014-07-14T18:16:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![addis\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c4cdca/32.png) [@addis\_a](https://www.ruby-forum.com/u/addis_a)\
**Post date:** [July 14, 2014, 6:16pm UTC](https://www.ruby-forum.com/t/question-regarding-frequency-offset-correction/230956/1 "2014-07-14T18:16:26Z")

</div>

Hi all,

In many applications very good synchronization of carrier and sampling  
frequencies is required.  
Available sources of signal not always have good clock reference. One of  
the examples is cheap RTL SDR receiver based on a DVB-T dongle.  
Without any additional effort to correct frequency offset it is  
impossible to decode GPS or GSM transmissions with such receivers.

The frequency offset cannot be calibrated once as it changes with time  
and temperature. Good way to fight with it is to implement some  
correction algorithm that continuously computes frequency offset  
estimates and applies correction by:

- performing frequency shifting and re-sampling in software,
- or changing some hardware parameter that enables tuning of the  
frequency of an internal oscillator (like ‘ppm’ option in RTL SDR  
source).

My question: is it possible to build working frequency correction with  
available GNU Radio blocks? Can you point some successful example? Or if  
not - can you share some ideas how it can be done? I’m especially  
interested in situations where frequency offset correction and  
estimation are in separate blocks i.e:

```
                    ______freq. offset_________
                    | |
                    v |

```

|sig.source|–\>|freq.offset|–\>(processing)–\>|freq. offset|  
|correction | |estimation |

–  
Best Regards,  
Piotr K.

---

<div class="post-metadata">

**Author:** ![Perper](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e79b87/32.png) [@Perper](https://www.ruby-forum.com/u/Perper)\
**Post date:** [July 14, 2014, 7:03pm UTC](https://www.ruby-forum.com/t/question-regarding-frequency-offset-correction/230956/2 "2014-07-14T19:03:34Z")

</div>

On Mon, Jul 14, 2014 at 12:14 PM, Perper [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> and temperature. Good way to fight with it is to implement some  
> estimation are in separate blocks i.e:  
> Piotr K.

​Hello Piotr,

You could take a look at the OFDM RX example. Look at the Schmidl-Cox  
​block. It performs timing as well as coarse-grained frequency offset  
estimation. Once this estimation is done, correction is a simple matter  
of  
derotation. The OFDM RX example has all of this.

Good luck.

best,  
aditya

---

<div class="post-metadata">

**Author:** ![Perper](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e79b87/32.png) [@Perper](https://www.ruby-forum.com/u/Perper)\
**Post date:** [July 14, 2014, 7:14pm UTC](https://www.ruby-forum.com/t/question-regarding-frequency-offset-correction/230956/3 "2014-07-14T19:14:55Z")

</div>

On 07/14/2014 01:01 PM, Aditya D. wrote:

> ```
> One of
> frequency of an internal oscillator (like 'ppm' option in RTL SDR
> | |
> 
> ```
> 
> ​Hello Piotr,

Also offset artefacts vary by modulation in use. For example in WBFM,  
you can use residual DC-offset in the demodulated audio as a proxy  
for frequency offset and use that to drive correction machinery.

But with other modulations, the approach is different.

---

<div class="post-metadata">

**Author:** ![Perper](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e79b87/32.png) [@Perper](https://www.ruby-forum.com/u/Perper)\
**Post date:** [July 14, 2014, 7:37pm UTC](https://www.ruby-forum.com/t/question-regarding-frequency-offset-correction/230956/4 "2014-07-14T19:37:36Z")

</div>

Hi Piotr,  
there’s various control loop based offset correction, look for the PLL  
and FLL examples.  
There’s a feedback loop base class in GNU Radio for monolithic  
correction. For the frequency correction estimate feedback, you could  
easily use a message bus, that will occasionally inform the upstream  
frequency correction block.

Greetings,  
Marcus
