Can someone please help and tell me what is wrong with my code. My idea
is
to create a sine wave->modulate->demodulate->display on scope. I get the
following error below. Can some explain why? Also is my idea of my
flow
graph a correct way to see if I get back the signal that was created?
Thanks
Ismael
RuntimeError: iir_filter_ffd(14): insufficient connected output ports (1
needed, 0 connected)
“”"
Transmit 1 signal.
Outputs SSB (USB) signals on side A and side B at frequencies
specified on command line.
Side B is 350 + 440 Hz tones.
“”"
from gnuradio import gr
from gnuradio.eng_notation import num_to_str, str_to_num
from gnuradio import usrp
from gnuradio import audio
from gnuradio import blks2
from gnuradio.eng_option import eng_option
from optparse import OptionParser
from usrpm import usrp_dbid
from gnuradio.wxgui import stdgui2, scopesink2, form, slider
import wx
import math
import sys
class dialtone_signal1(gr.hier_block2):
“”"
tone (440 Hz).
“”"
def init(self, sample_rate):
gr.hier_block2.init(self, “dialtone_signal1”,
gr.io_signature(0, 0, gr.sizeof_float),
Input signature
gr.io_signature(1, 1, gr.sizeof_float))
Output signature
src1 = gr.sig_source_f (sample_rate, # sample rate
gr.GR_SIN_WAVE, # waveform type
440, # frequency
1.0, # amplitude
0) # DC Offset
self.connect(src1,self)
class my_top_block(stdgui2.std_top_block):
def __init__(self, frame, panel, vbox, argv):
stdgui2.std_top_block.__init__(self, frame, panel, vbox, argv)
self.frame = frame
self.panel = panel
usage="%prog: [options] side-A-tx-freq side-B-tx-freq"
parser = OptionParser (option_class=eng_option, usage=usage)
parser.add_option(“-T”, “–tx-subdev-spec”, type=“subdev”,
default=None,
help=“select USRP Tx side A or B”)
parser.add_option(“-r”, “–sample-rate”, type=“eng_float”,
default=48000,
help=“set sample rate to RATE (48000)”)
parser.add_option(“-O”, “–audio-output”, type=“string”,
default=“”,
help=“pcm output device name. E.g., hw:0,0 or
/dev/dsp”)
parser.add_option(“-n”, “–frame-decim”, type=“int”, default=1,
help=“set oscope frame decimation factor to n
[default=1]”)
parser.add_option(“-v”, “–v-scale”, type=“eng_float”,
default=1000,
help=“set oscope initial V/div to SCALE
[default=%default]”)
parser.add_option(“-t”, “–t-scale”, type=“eng_float”,
default=49e-6,
help=“set oscope initial s/div to SCALE
[default=50us]”)
(options, args) = parser.parse_args ()
sample_rate = int(options.sample_rate)
self.audio_rate = 320e3 // 10
print “Enter Carrier frequency: (XXX.X)”
freq= float(raw_input())*1e6
self.source1 = dialtone_signal1(sample_rate)
dst = audio.sink (sample_rate, options.audio_output)
self.modulator = blks2.wfm_tx(self.audio_rate, 320e3)
self.demodulator = blks2.wfm_rcv(320e3,int(self.audio_rate))
self.scope = scopesink2.scope_sink_c(panel, sample_rate=48e3,
frame_decim=options.frame_decim,
v_scale=options.v_scale,
t_scale=options.t_scale,
num_inputs=1)
self.connect(self.source1,self.modulator,self.demodulator,self.scope)
vbox.Add(self.scope.win, 10, wx.EXPAND)
def set_freq(self, target_freq):
“”"
Set the center frequency we’re interested in.
@param side: 0 = side A, 1 = side B
@param target_freq: frequency in Hz
@rtype: bool
Tuning is a two step process. First we ask the front-end to
tune as close to the desired frequency as it can. Then we use
the result of that operation and our target_frequency to
determine the value for the digital up converter.
"""
print "Tuning side A to %sHz" % num_to_str(target_freq)
r = self.u.tune(self.subdev.which(), self.subdev, target_freq)
if r:
print " r.baseband_freq =", num_to_str(r.baseband_freq)
print " r.dxc_freq =", num_to_str(r.dxc_freq)
print " r.residual_freq =", num_to_str(r.residual_freq)
print " r.inverted =", r.inverted
print " OK"
return True
else:
print " Failed!"
return False
if name == ‘main’:
try:
app = stdgui2.stdapp(my_top_block, “USRP O’scope”, nstatus=1)
app.MainLoop()
except KeyboardInterrupt:
pass
View this message in context:
http://old.nabble.com/Help-with-Code-tp30366569p30366569.html
Sent from the GnuRadio mailing list archive at Nabble.com.