Attached here is a copy of my digital bert codes ..
Sincerely
Bonee soibam
---------- Forwarded message ----------
From: Bonee Soibam <[email protected]>
Date: Sat, Sep 10, 2011 at 5:16 PM
Subject: Problems regarding using UHD Digital-bert codes
To: [email protected]
Hi ,
I have been trying to use the examples given in
/home/aravind/gnuradio/gnuradio-examples/python/digital-bert . esp the
uhd_benchmark_tx.py . here are a few changes that i made to the existing
code ..
__________________________________________________________________________________________________________________________________-
#setup usrp
self._setup_usrp(options.ip,
interp,
options.gain,
options.freq)
self.connect(self._transmitter, self._usrp)
def _setup_usrp(self, ip, interp, gain, freq):
# Setup single usrp sink
self._uhd = uhd.single_usrp_sink(device_addr="",
io_type=uhd.io_type.COMPLEX_FLOAT32,
num_channels=1
)
# Tune to center frequency
tr = self._usrp.set_center_freq(freq,0)
if not (tr):
print "Failed to tune to center frequency!"
else:
print "Actual Intermediate frequency:",
n2s(self._usrp.get_center_freq())
# Set Tx Gain
self._uhd.set_gain(gain,1)
print "Gain d'board: ",n2s(self._usrp.get_gain()), "dB"
____________________________________________________________________________________________________________________________
but i am getting error as mentioned : -
Traceback (most recent call last):
File "./uhd_benchmark_tx.py", line 113, in <module>
tb = tx_bpsk_block(options)
File "./uhd_benchmark_tx.py", line 56, in __init__
options.freq)
File "./uhd_benchmark_tx.py", line 70, in _setup_usrp
tr = self._usrp.set_center_freq(freq,0)
File "/usr/local/lib/python2.6/dist-packages/gnuradio/gr/top_block.py",
line 94, in __getattr__
return getattr(self._tb, name)
AttributeError: 'gr_top_block_sptr' object has no attribute '_usrp'
aravind@COE-2X85V91:~/gnuradio/gnuradio-examples/python/uhd-digital-bert$
_______________________________________________________________________________________________________________________
i included an From gnuradio import uhd statement to top_block.py also .
but i am still getting getting the same error .
I waould like your guidance , because i have been trying to make this
example work for weeks .
Yours sincerely
Bonee Soibam
#!/usr/bin/env python
#
# Copyright 2008 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# GNU Radio is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
#
from gnuradio import gr, eng_notation, uhd,usrp
from gnuradio.eng_option import eng_option
from optparse import OptionParser
from transmit_path import transmit_path
import sys
import uhd_options
_dac_rate = 128e6
n2s = eng_notation.num_to_str
class tx_bpsk_block(gr.top_block):
def __init__(self, options):
gr.top_block.__init__(self, "tx_mpsk")
self._transmitter = transmit_path(options.sps,
options.excess_bw,
options.amplitude)
if_rate = options.rate*options.sps
interp = int(_dac_rate/if_rate)
print "Modulation:", n2s(options.rate), "bits/sec"
print "TX IF rate:", n2s(if_rate), "samples/sec"
print "USRP interpolation:", interp
print "DAC amplitude:", options.amplitude
#setup usrp
self._setup_usrp(options.ip,
interp,
options.gain,
options.freq)
self.connect(self._transmitter, self._usrp)
#COMPLEX_FLOAT32
def _setup_usrp(self, ip, interp, gain, freq):
# Setup single usrp sink
self._uhd = uhd.usrp_sink(device_addr="",
io_type=uhd.io_type.COMPLEX_FLOAT32,
num_channels=1
)
# Tune to center frequency
tr = self._uhd.set_center_freq(freq)
if not (tr):
print "Failed to tune to center frequency!"
else:
print "Actual Intermediate frequency:", n2s(freq)
# Set Tx Gain
self._uhd.set_gain(gain,0)
print "Gain d'board: ",n2s(self._usrp.get_gain()), "dB"
def get_options():
parser = OptionParser(option_class=eng_option)
parser.add_option("--ip", "--device_addr", type="string", default="addr=192.168.10.2",
help="device address", metavar="ip")
parser.add_option("-g", "--gain", type="eng_float", default=None,
help="set Tx gain ")
parser.add_option("-f", "--freq", type="eng_float", default=None,
help="set frequency to FREQ", metavar="FREQ")
parser.add_option("-a", "--amplitude", type="eng_float", default=500,
help="set Tx amplitude (0-32767) (default=%default)")
parser.add_option("-r", "--rate", type="eng_float", default=500e3,
help="Select modulation symbol rate (default=%default)")
parser.add_option("", "--sps", type="int", default=2,
help="Select samples per symbol (default=%default)")
parser.add_option("", "--excess-bw", type="eng_float", default=0.35,
help="Select RRC excess bandwidth (default=%default)")
(options, args) = parser.parse_args()
if len(args) != 0:
parser.print_help()
sys.exit(1)
if options.freq == None:
print "Must supply frequency as -f or --freq"
sys.exit(1)
return (options, args)
if __name__ == "__main__":
(options, args) = get_options()
tb = tx_bpsk_block(options)
try:
tb.run()
except KeyboardInterrupt:
pass
_______________________________________________
Discuss-gnuradio mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio