Pll refout vs carriertracking

All - Do I understand correctly that gr.pll_carriertracking_cc() is
supposed to downconvert to DC? I don’t see it doing that, and can’t
see in the work functions where that magic would be accomplished.

Just want to make sure I’m building the most efficient graph possible.
I tried both in an existing AM detector with a 7.5KHz IF and both work
just the same with an external mixer.


refout:

int
gr_pll_refout_cc::work (int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
const gr_complex *iptr = (gr_complex *) input_items[0];
gr_complex *optr = (gr_complex *) output_items[0];

float error;
float t_imag, t_real;
int size = noutput_items;

while (size-- > 0) {
error = phase_detector(*iptr++,d_phase);

d_freq = d_freq + d_beta * error;
d_phase = mod_2pi(d_phase + d_freq + d_alpha * error);

if (d_freq > d_max_freq)
  d_freq = d_max_freq;
else if (d_freq < d_min_freq)
  d_freq = d_min_freq;
gr_sincosf(d_phase,&t_imag,&t_real);
*optr++ = gr_complex(t_real,t_imag);

}
return noutput_items;
}


carriertracking:

int
gr_pll_carriertracking_cc::work (int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
const gr_complex *iptr = (gr_complex *) input_items[0];
gr_complex *optr = (gr_complex *) output_items[0];

float error;
float t_imag, t_real;

for (int i = 0; i < noutput_items; i++){
error = phase_detector(iptr[i],d_phase);

d_freq = d_freq + d_beta * error;
d_phase = mod_2pi(d_phase + d_freq + d_alpha * error);

if (d_freq > d_max_freq)
  d_freq = d_max_freq;
else if (d_freq < d_min_freq)
  d_freq = d_min_freq;
gr_sincosf(d_phase,&t_imag,&t_real);
optr[i] = gr_complex(t_real,t_imag);
d_locksig = d_locksig * (1.0 - d_alpha) + d_alpha*(iptr[i].real() *

t_real + iptr[i].imag() * t_imag);

if ((d_squelch_enable) && !lock_detector())
  optr[i] = 0;

}
return noutput_items;
}

You are correct. pll_carriertracking_cc returns the recovered carrier.
Sending to baseband is then done by a complex multiply block, don’t
forget the conjugation.

Bob

Charles S. wrote:

refout:
float t_imag, t_real;
else if (d_freq < d_min_freq)

gr_sincosf(d_phase,&t_imag,&t_real);

Discuss-gnuradio mailing list
[email protected]
Discuss-gnuradio Info Page


AMSAT VP Engineering. Member: ARRL, AMSAT-DL, TAPR, Packrats,
NJQRP/AMQRP, QRP ARCI, QCWA, FRC. ARRL SDR Wrk Grp Chairman
“An expert is a man who has made all the mistakes which can be
made in a very narrow field.” Niels Bohr

Bob –

I think we have a problem with carriertracking – it was supposed to mix
the input signal down, and output that, but it looks like it just
outputs the reference, like refout.

Charles –
To detect AM, you can:

1 - take output of pll_refout_cc, take its complex conjugate and complex
multiply that by the input signal. The audio you want is in the real
output. The imaginary output should only have noise. If the RMS value
of both is about the same you don’t have lock, or the signal is very
noisy.

-OR-

2 - Fix pll_carriertracking_cc to do what I said in 1, above, since that
is what it was supposed to do.

Matt

Robert McGwier wrote:

I did that on purpose. There are myriad instances where you want the
recovered carrier or tone but not have the complex input mixed to the
“new zero”. If you want a recovery and baseband, I suggest that
rather than do an if test, we make a new module that is track and mix.

Yes, but that is what refout is for. Right now refout and
carriertracking do the exact same thing.

Matt

Sorry. I missed what you referred to in the early email. I misread
it. I agree that refout and carriertracking should not be doing the
same thing. I will look at it.

Bob

Matt E. wrote:

Matt


AMSAT VP Engineering. Member: ARRL, AMSAT-DL, TAPR, Packrats,
NJQRP/AMQRP, QRP ARCI, QCWA, FRC. ARRL SDR Wrk Grp Chairman
“An expert is a man who has made all the mistakes which can be
made in a very narrow field.” Niels Bohr

I did that on purpose. There are myriad instances where you want the
recovered carrier or tone but not have the complex input mixed to the
“new zero”. If you want a recovery and baseband, I suggest that rather
than do an if test, we make a new module that is track and mix.

Bob


Discuss-gnuradio mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio