Re: [Discuss-gnuradio] pll refout vs carriertracking

2006-08-15 Thread Henryk Plötz
Moin,

Am Thu, 13 Jul 2006 13:44:50 -0400 schrieb Robert McGwier:

> 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.

In the meantime the docs have been updated so that carriertracking is
described to be mixing the input with the recovered carrier. Yet, the
code is still unchanged (e.g. carriertracking and refout still do
exactly the same). This took me several hours to figure out.

Attached is a trivial patch to fix that.

-- 
Henryk Plötz
Grüße aus Berlin
~~~ Un-CDs, nein danke! http://www.heise.de/ct/cd-register/ ~~~
~ Help Microsoft fight software piracy: Give Linux to a friend today! ~
Index: gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.cc
===
--- gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.cc	(Revision 3290)
+++ gnuradio-core/src/lib/general/gr_pll_carriertracking_cc.cc	(Arbeitskopie)
@@ -107,7 +107,7 @@
 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);
+optr[i] = iptr[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())


pgpx1QSZXhw6N.pgp
Description: PGP signature
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] pll refout vs carriertracking

2006-07-13 Thread Robert McGwier
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 Ettus wrote:

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





--
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



___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] pll refout vs carriertracking

2006-07-13 Thread Matt Ettus

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



___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] pll refout vs carriertracking

2006-07-13 Thread Robert McGwier
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



Matt Ettus wrote:


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




___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio





___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] pll refout vs carriertracking

2006-07-12 Thread Matt Ettus


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:

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 Swiger wrote:


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;
}




___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio

  








___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] pll refout vs carriertracking

2006-07-10 Thread Robert McGwier
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 Swiger wrote:

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;
}




___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio

  



--
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



___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


[Discuss-gnuradio] pll refout vs carriertracking

2006-07-10 Thread Charles Swiger
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;
}




___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio