Fm_tx_2_daughterboards problem

Hi everyone,

I am currently using gnuradio- I am trying to adjust, then it just send out one signal on side A.
The code is like this.

class example_signal_0(gr.hier_block2):
def init(self, sample_rate):
gr.hier_block2.init(self, “example_signal_0”,
gr.io_signature(0, 0, 0),
gr.io_signature(1, 1,

    src = gr.sig_source_c (sample_rate,    # sample rate
                           gr.GR_SIN_WAVE, # waveform type
                           600,            # frequency
                           1.0,            # amplitude
                           0)              # DC Offset

    self.connect(src, self)

class my_top_block(gr.top_block):
def init(self):
usage="%prog: [options] tx-freq0 tx-freq1"
parser = OptionParser (option_class=eng_option, usage=usage)
parser.add_option("-a", “–args”, type=“string”, default="",
parser.add_option("", “–spec”, type=“string”, default=None,
help=“Subdevice of UHD device where appropriate”)
parser.add_option("-A", “–antenna”, type=“string”,
help=“select Rx Antenna where appropriate”)
parser.add_option("-s", “–samp-rate”, type=“eng_float”,
help=“set sample rate [default=%default]”)
parser.add_option("-g", “–gain”, type=“eng_float”,
help=“set gain in dB (default is midpoint)”)
(options, args) = parser.parse_args ()

    if len(args) != 1:
        raise SystemExit
        freq0 = str_to_num(args[0])

    # Set up USRP to transmit on both daughterboards
    d = uhd.find_devices(uhd.device_addr(options.args))
    uhd_type = d[0].get('type')
    stream_args = uhd.stream_args('fc32', channels=range(1))
    self.u = uhd.usrp_sink(device_addr=options.args,

    # Set up USRP system based on type
    if(uhd_type == "usrp1"):
        # I try all of the usrp's subdev_spec, but it still doesn't
        # work.
        tr0 = uhd.tune_request(freq0)

    # Use the tune requests to tune each channel
    self.set_freq(tr0, 0)
    self.usrp_rate  = options.samp_rate
    dev_rate = self.u.get_samp_rate()

    # build two signal sources, interleave them, amplify and
    # connect them to usrp
    sig0 = example_signal_0(self.usrp_rate)
    intl = gr.interleave(gr.sizeof_gr_complex)
    self.connect(sig0, (intl, 0))

    # Correct for any difference in requested and actual rates
    rrate = self.usrp_rate / dev_rate
    resamp = blks2.pfb_arb_resampler_ccf(rrate)

    # and wire them up
    self.connect(intl, resamp, self.u)
    if options.gain is None:
        # if no gain was specified, use the mid-point in dB
        g = self.u.get_gain_range()
        options.gain = float(g.start()+g.stop())/2.0
    self.set_gain(options.gain, 0)

    # Set the subdevice spec
        self.u.set_subdev_spec(options.spec, 0)

    # Set the antenna
        self.u.set_antenna(options.antenna, 0)
def set_freq(self, target_freq, chan):
    r = self.u.set_center_freq(target_freq, chan)

    print "Tuning channel %s to %sHz" % \
        (chan,  self.u.get_center_freq(0))

    if r:
        return True
        print "  Set Frequency Failed!"
    return False

def set_gain(self, gain, chan):
    self.u.set_gain(gain, chan)

if name == ‘main’:
except KeyboardInterrupt:


I ran with following command:
python -a type=usrp1 -s 3200000 222064000

What I got:

linux; GNU C++ version 4.6.1; Boost_104601; UHD_003.004.000-unknown

– Opening a USRP1 device…
– Using FPGA clock rate of 64.000000MHz…
Tuning channel 0 to 222064000.0Hz

gr_fir_ccf: using SSE

I connected my usrp1 to Spectrum Analyzer, but I didn’t get any signal
from usrp.

I appreciate any help. Thank you very very much.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs