# Tracking PLL phase error

**URL:** <https://www.ruby-forum.com/t/tracking-pll-phase-error/231603>\
**Category:** GNU Radio\
**Created:** [August 18, 2014, 6:54pm UTC](https://www.ruby-forum.com/t/tracking-pll-phase-error/231603 "2014-08-18T18:54:36Z")\
**Posts on this page:** 2\
**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:** [August 18, 2014, 6:54pm UTC](https://www.ruby-forum.com/t/tracking-pll-phase-error/231603/1 "2014-08-18T18:54:36Z")

</div>

Hello,

I’m using the gr::analog::pll\_carriertracking\_cc() block to track a very  
stable signal of which I don’t know the exact frequency and of which I  
want to detect (small!) phase oscillations.

In my tests I discovered that the tracked signal has a residual phase  
modulation that I would not expect to find. I tried a simple test, very  
similar to the qa test for the block, and indeed I found that even for a  
constant frequency input signal the output has some residual phase  
oscillations. The amplitude of the oscillations depends on the pll  
bandwidth and on the frequency of the input signal, of the order of mrad  
for this examples (qa\_pll\_carriertracking.py).

I need to get rid of those oscillations because they mask the phase  
signal I want to measure. I’m going to investigate the issue further,  
but does anyone have an idea about where those may come from? I suspect  
the digital oscillator may introduce some numeric error that may explain  
them, but they seem quite big…

Cheers,  
Daniele

---

<div class="post-metadata">

**Author:** ![Daniele\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/74df32/32.png) [@Daniele\_N](https://www.ruby-forum.com/u/Daniele_N)\
**Post date:** [August 19, 2014, 7:24pm UTC](https://www.ruby-forum.com/t/tracking-pll-phase-error/231603/2 "2014-08-19T19:24:53Z")

</div>

> oscillations. The amplitude of the oscillations depends on the pll  
> bandwidth and on the frequency of the input signal, of the order of mrad  
> for this examples (qa\_pll\_carriertracking.py).
> 
> I need to get rid of those oscillations because they mask the phase  
> signal I want to measure. I’m going to investigate the issue further,  
> but does anyone have an idea about where those may come from?

Just a guess; try changing

pll\_carriertracking\_cc\_impl::phase\_detector()

to use atan2() or atan2f() instead of gr::fast\_atan2f().  
It should be better, but will probably be slower.

gr::fast\_atan2f() is a lookup with linear interpolation:

" \* [fast\_atan2f] calculates the arc tangent with an

- average error of +/- 0.045 degrees.  
\*/"

0.045 degrees is 0.785 milliradians, I think.

Regards,  
Andy
