Howto tune RF frequency in blocks?

Hi,

I wonder if it is possible to tune the RF frequency in blocks written in
c++.

In python, statements as the follow are used to tune the frequency of RF
board.
r = u.tune(0, subdev, freq)

I want to adjust the receiver’s RF according that of the
transmitter automatically with some frequency offset estimation methods
before doing communication. I guess it’s better to do the adjustment in
DSP
blocks.

Thanks!

On Mon, Jul 10, 2006 at 06:16:59PM +0800, 2 1 wrote:

transmitter automatically with some frequency offset estimation methods
before doing communication. I guess it’s better to do the adjustment in DSP
blocks.

Thanks!

Yes, handle the freq offset adjustment in s/w. Depending on the
receiver, you’re
going to have a finite step size anyway.

Eric

Thanks, Eric. Would you please tell me the exact C++ functions which do
the
tuning?
Is there any C++ class relating the usrp class in python?

hanwen

2006/7/10, Eric B. [email protected]:

On Tue, Jul 11, 2006 at 10:03:11AM +0800, hanwen wrote:

Thanks, Eric. Would you please tell me the exact C++ functions which do the
tuning?

You can shift the frequency by multiplying by a complex exponential.

    # Local oscillator
    lo = gr.sig_source_c (if_rate,        # sample rate
                          gr.GR_SIN_WAVE, # waveform type
                          lo_freq,        # frequency
                          1.0,            # amplitude
                          0)              # DC Offset
    mixer = gr.multiply_cc ()

    fg.connect(src, (mixer, 0))
    fg.connect(lo, (mixer, 1))
fg.connect(mixer, <next-block-downstream>)

Or you could use one of the pll blocks.
$ ls -l gnuradio-core/src/lib/general/gr_pll.h

Is there any C++ class relating the usrp class in python?

Yes, but not exactly. Some of the functionality is implemented in
pure python. The C++ part is in
usrp/host/lib/usrp_{basic,standard}.{h,cc}

Eric