Can someone please clarify my doubt for the given error . I am new to
gnuradio .
thanks
---------- Forwarded message ----------
From: Bonee Soibam <[email protected]>
Date: Mon, Sep 12, 2011 at 11:10 PM
Subject: Re: [Discuss-gnuradio] Fwd: Problems regarding using UHD
Digital-bert codes
To: "Marcus D. Leech" <[email protected]>
Hi Marcus ,
I have been trying to make this code work . since your last suggestion i
made some changes to my code and i am coming up with a new error .Its given
as follows : -
__________________________________________________________________________________
Uterminate called after throwing an instance of
'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::math::rounding_error>
>'
what(): Error in function boost::math::iround<d>(d): Value
-2.371723596288619e+52 can not be represented in the target integer type.
____________________________________________________________________________________
Steps i took to correct the current error :
1.i thought this was a boost library error , so i updated my boost library
but this could not solve my error .
2. i read up on a blog so i tried to check in with the variable type for
io_type . it turned out as int type so , i tried to change the io_type from
COMPLEX_FLOAT32 to COMPLEX_INT8 in my uhd_benchmark_tx.py and
uhd_options.py . and then it gave me a totally strange error .
3 . last option i tried was i experimented with a number of input parameters
like sps , bit rate , excess bandwidth and gain ..
______________________________________________________________________________________________
But it looks like i am not able to pin-point what exactly the Value parametr
is .. sometimes i gave some other numbers and the Value turnedout as INF ..
if this is a concept of Communications or something . can you please tell me
what exactly the Value is ..i tried really hard to figure out where this
calculation is going on , but i cant really find out
Is it because of addressing issues ?
I am currently working on USRP N200 , so its a RISC 32 bit microprocessor
and my ubuntu system is i686 , is it due to this reason or ?
Thank you again Marcus .
Yours sincerely \
Bonee Soibam
~~~
``The awful thing about getting it right the first time is that nobody
realizes how hard it was.''
n Sun, Sep 11, 2011 at 11:16 AM, Marcus D. Leech <[email protected]> wrote:
> **
> On 11/09/11 10:46 AM, Bonee Soibam wrote:
>
> Can someone help me out on this error .. Appreciate your help.
>
> ---------- 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
>
> So, generally, the error messages produced by a programming language are
> intended to give you a
> clue as to what's wrong. Granted, you kind of have to understand the
> programming language
> to some extent to make sense of them.
>
> In line 94, you call self._usrp.set_center_freq(....)
>
> But in fact, there is no object "_usrp" defined in your code, although
> there is a "_uhd" defined that is
> probably what was intended.
>
> In line 94, I'd change self._usrp.set_center_freq(....) to
> self._uhd.set_center_freq(....)
>
>
> --
> Principal Investigator
> Shirleys Bay Radio Astronomy Consortiumhttp://www.sbrac.org
>
>
> _______________________________________________
> Discuss-gnuradio mailing list
> [email protected]
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>
>
#!/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
from gnuradio.eng_option import eng_option
from optparse import OptionParser
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.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 "uhd interpolation:", interp
print "DAC amplitude:", options.amplitude
#setup uhd
self._setup_uhd(options.ip,
interp,
options.gain,
options.freq)
self.connect(self._transmitter, self._uhd)
#COMPLEX_FLOAT32
def _setup_uhd(self, ip, interp, gain, freq):
# Setup single uhd 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: ",(self._uhd.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
#
# 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.
#!/usr/bin/env python
from gnuradio import gr,uhd
from math import pi, log10
import cmath
class transmit_path(gr.hier_block2):
'''This transmits a BERT sequence of bits using filtered BPSK and
outputs the complex baseband waveform.'''
def __init__(self,
sps, # Samples per symbol
excess_bw, # RRC filter excess bandwidth (typically 0.35-0.5)
amplitude # DAC output level, 0-32767, typically 2000-8000
):
gr.hier_block2.__init__(self, "transmit_path",
gr.io_signature(0, 0, 0), # Input signature
gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature
# Create BERT data bit stream
self._bits = gr.vector_source_b([1,], True) # Infinite stream of ones
self._scrambler = gr.scrambler_bb(0x8a, 0x7f, 7) # CCSDS 7-bit scrambler
# Map to constellation
self._constellation = [-1+0j, 1+0j]
self._mapper = gr.chunks_to_symbols_bc(self._constellation)
# Create RRC with specified excess bandwidth
taps = gr.firdes.root_raised_cosine(sps*amplitude, # Gain
sps, # Sampling rate
1.0, # Symbol rate
excess_bw, # Roll-off factor
11*sps) # Number of taps
self._rrc = gr.interp_fir_filter_ccf(sps, # Interpolation rate
taps) # FIR taps
# Wire block inputs and outputs
self.connect(self._bits, self._scrambler, self._mapper, self._rrc, self)
#
# Copyright 2009 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.
#
_parser_to_groups_dict = dict()
class _parser_groups(object):
def __init__(self, parser):
self.usrpx_grp = parser.add_option_group("General USRP Options")
self.usrp1_grp = parser.add_option_group("USRP1 Specific Options")
self.usrp1exp_grp = parser.add_option_group("USRP1 Expert Options")
self.usrp2_grp = parser.add_option_group("USRP2 Specific Options")
self.usrp2exp_grp = parser.add_option_group("USRP2 Expert Options")
self.usrp_e_grp = parser.add_option_group("USRP_e100 Specific Options")
from gnuradio import uhd
from gnuradio import eng_notation
def _add_options(parser):
"""
Add options to manually choose between usrp, usrp2 or usrp-e
Add options for usb. Add options common to source and sink.
@param parser: instance of OptionParser
@return the parser group
"""
#cache groups so they dont get added twice on tranceiver apps
if not _parser_to_groups_dict.has_key(parser): _parser_to_groups_dict[parser] = _parser_groups(parser)
pg = _parser_to_groups_dict[parser]
#pick usrp1, usrp2, or usrp-e
pg.usrpx_grp.add_option("-t", "--devtype", type="string", default=None,
help="specify which usrp model: usrp1 for USRP, usrp2 for USRP2 or usrp-e for USRP_e100 [default=auto]")
pg.usrpx_grp.add_option("-n", "--name", type="string", default='',
help="select USRP board by name [default=%default]")
#fast usb options
pg.usrp1exp_grp.add_option("-B", "--fusb-block-size", type="int", default=0,
help="specify fast usb block size [default=%default]")
pg.usrp1exp_grp.add_option("-N", "--fusb-nblocks", type="int", default=0,
help="specify number of fast usb blocks [default=%default]")
#lo offset
pg.usrpx_grp.add_option("--lo-offset", type="eng_float", default=None,
help="set LO Offset in Hz [default=automatic].")
#usrp options
pg.usrp1_grp.add_option("-s", "--serial", type="string", default=None,
help="select USRP1 board by serial number[default=%default]")
#usrp2 options
pg.usrp2_grp.add_option("-a", "--ip-address", type="string", default=None,
help="Use USRP2 at specified Ethernet interface [default=%default]")
pg.usrp2exp_grp.add_option("", "--recv-buff-size", type="string", default=None,
help="Specify the desired socket receiver buffer size in bytes")
pg.usrp2exp_grp.add_option("", "--send-buff-size", type="string", default=None,
help="Specify the desired socket send buffer size in bytes")
return pg
def add_rx_options(parser):
"""
Add receive specific usrp options.
@param parser: instance of OptionParsergnuradio_core_runtime.p
"""
pg = _add_options(parser)
pg.usrp1_grp.add_option("-R", "--rx-subdev-spec", type="subdev", default=None,
help="select USRP Rx side A or B")
pg.usrpx_grp.add_option("--rx-gain", type="eng_float", default=10, metavar="GAIN",
help="set receiver gain in dB [default=midpoint]. See also --show-rx-gain-range")
pg.usrpx_grp.add_option("--show-rx-gain-range", action="store_true", default=False,
help="print min and max Rx gain available on selected daughterboard")
pg.usrpx_grp.add_option("-F", "--samprate", type="eng_float", default=None,
help="set samplerate rate to SAMPLERATE [default=%default]")
pg.usrpx_grp.add_option( "--rx2", action="store_true", default=False)
def create_usrp_source(options):
hint = ''
if options.devtype == 'usrp1':
hint = 'type=usrp1'
if options.name != '' : hint += (', name=' + options.name)
if options.serial : hint += (', serial=' + options.serial)
if options.devtype == 'usrp2':
hint = 'type=usrp2'
if options.name != '': hint += (', name=' + options.name)
if options.ip_address : hint += (', addr=' + options.ip_address)
if options.recv_buff_size:
hint += (', recv_buff_size=' + options.recv_buff_size)
if options.devtype == 'usrp-e':
hint = 'type=usrp-e'
print "receiver:", hint
u = uhd.single_usrp_source(hint,
io_type=uhd.io_type_t.COMPLEX_FLOAT32,
num_channels=1,)
if options.rx2:
u.set_antenna("RX2", 0)
else:
u.set_antenna("TX/RX", 0)
print "RX antenna:", u.get_antenna()
#print "RX IF bandwidth:", u.get_rx_bandwidth()
u.set_gain(options.rx_gain)
if options.show_rx_gain_range:
#print "Rx Gain Range: minimum = %g, maximum = %g, step size = %g"%tuple(u.get_gain_range()) #FIXME
print "Rx Gain Range:",u.get_gain_range()
print "Current Rx Gain:", u.get_gain()
return u
def add_tx_options(parser):
"""
Add transmit specific usrp options.
@param parser: instance of OptionParser
"""
pg = _add_options(parser)
pg.usrp1_grp.add_option("-T", "--tx-subdev-spec", type="subdev", default=None,
help="select USRP Rx side A or B")
pg.usrpx_grp.add_option("--tx-gain", type="eng_float", default=10, metavar="GAIN",
help="set transmitter gain in dB [default=midpoint]. See also --show-tx-gain-range")
pg.usrpx_grp.add_option("--show-tx-gain-range", action="store_true", default=False,
help="print min and max Tx gain available on selected daughterboard")
pg.usrpx_grp.add_option("-F", "--samprate", type="eng_float", default=None,
help="set samplerate rate to SAMPLERATE [default=%default]")
print("test")
def create_usrp_sink(options):
hint = ''
if options.devtype == 'usrp1':
hint = 'type=usrp1'
if options.name != '' : hint += (', name=' + options.name)
if options.serial : hint += (', serial=' + options.serial)
if options.devtype == 'usrp2':
hint = 'type=usrp2'
if options.name != '': hint += (', name=' + options.name)
if options.ip_address : hint += (', addr=' + options.ip_address)
if options.send_buff_size: hint += (', send_buff_size=' + options.send_buff_size)
if options.recv_buff_size:
hint += (', recv_buff_size=' + options.recv_buff_size)
if options.devtype == 'usrp-e':
hint = 'type=usrp-e'
print "sender:", hint
u = uhd.single_usrp_sink(hint,
io_type=uhd.io_type_t.COMPLEX_FLOAT32,
num_channels=1)
print "TX antenna:", u.get_antenna()
#print "RX IF bandwidth:", u.get_bandwidth()
u.set_gain(options.tx_gain)
if options.show_tx_gain_range:
print "Tx Gain Range:",u.get_gain_range()
#print tx_gain_range
print "Current TX gain",u.get_gain()
#print "Tx Gain Range: minimum = %g, maximum = %g, step size = %g"%tuple(tx_gain_range)
return u
_______________________________________________
Discuss-gnuradio mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio