Re: [Discuss-gnuradio] Modifications in benchmark_rx.py for USRP2

2009-03-04 Thread Smith L.

Hi Tom,


I tried it out but its not working. I am always getting an S which means
overrun. I am attaching the all the files that I have used to make USRP2
work as receiver. I have made no changes to benchmark_tx.py as it is used
for USRP1 and its working correctly.

benchmark_rx.py:


#!/usr/bin/env python
#
# Copyright 2005,2006,2007 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, gru, modulation_utils
from gnuradio import usrp2
from gnuradio import eng_notation
from gnuradio.eng_option import eng_option
from optparse import OptionParser

import random
import struct
import sys

# from current dir
from receive_path_usrp2 import receive_path
import fusb_options

#import os
#print os.getpid()
#raw_input('Attach and press enter: ')

class my_top_block(gr.top_block):
def __init__(self, demodulator, rx_callback, options):
gr.top_block.__init__(self)
self.rxpath = receive_path(demodulator, rx_callback, options) 
self.connect(self.rxpath)

#
/
#   main
#
/

global n_rcvd, n_right

def main():
global n_rcvd, n_right

n_rcvd = 0
n_right = 0

def rx_callback(ok, payload):
global n_rcvd, n_right
(pktno,) = struct.unpack('!H', payload[0:2])
n_rcvd += 1
if ok:
n_right += 1

print "ok = %5s  pktno = %4d  n_rcvd = %4d  n_right = %4d" % (
ok, pktno, n_rcvd, n_right)


demods = modulation_utils.type_1_demods()

# Create Options Parser:
parser = OptionParser (option_class=eng_option,
conflict_handler="resolve")
expert_grp = parser.add_option_group("Expert")

parser.add_option("-m", "--modulation", type="choice",
choices=demods.keys(), 
  default='gmsk',
  help="Select modulation from: %s [default=%%default]"
% (', '.join(demods.keys()),))

receive_path.add_options(parser, expert_grp)

for mod in demods.values():
mod.add_options(expert_grp)

fusb_options.add_options(expert_grp)
(options, args) = parser.parse_args ()

if len(args) != 0:
parser.print_help(sys.stderr)
sys.exit(1)

if options.rx_freq is None:
sys.stderr.write("You must specify -f FREQ or --freq FREQ\n")
parser.print_help(sys.stderr)
sys.exit(1)


# build the graph
tb = my_top_block(demods[options.modulation], rx_callback, options)

r = gr.enable_realtime_scheduling()
if r != gr.RT_OK:
print "Warning: Failed to enable realtime scheduling."

tb.start()# start flow graph
tb.wait() # wait for it to finish

if __name__ == '__main__':
try:
main()
except KeyboardInterrupt:
pass


receive_path.py:


#!/usr/bin/env python
#
# Copyright 2005,2006,2007 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, gru, blks2
from gnuradio import usrp2
from gnuradio import eng_notation
import copy
import sys

# from current dir
from pick_bitrate import pick_rx_bitrate

#
/
#  receive path
#
/

class receive_path(gr.hier_block2):
def __init__(self, demod_class, rx_callback, options):

gr.hier_block2.__init__(self, "rec

Re: [Discuss-gnuradio] Modifications in benchmark_rx.py for USRP2

2009-03-01 Thread Tom Rondeau

Smith L. wrote:

Hi,

I have been trying to use USRP2 as a receiver and USRP1 as a transmitter.
The benchmark_tx.py file is working well for USRP1 but I did some
modifications to benchmark_rx.py so that it can work on USRP2. But it didnt
worked out. Can anyone help me with this modifcations so that I can
establish communication between USRP1 and USRP2. Thanks in advance.
  


You have to watch out for the different sample rates. When you set the 
sample rate in benchmark_tx/rx, it finds the closest sampling rate it 
can get through the interpolation/decimation factor in the USRP. Since 
the USRP and USRP2 have different speed DACs/ADCs, the exact values are 
going to be different.


Run both with the -v option to see what the actual sample rate both the 
tx and rx side are using. To fix this, either try to find a rate that 
works for both USRP and USRP2, or, and this is a better solution, use a 
blks2.rational_resampler_ccf to resample to achieve closer sampling 
rates in both tx and rx.


Tom



___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] Modifications in benchmark_rx.py for USRP2

2009-02-27 Thread Douglas Geiger
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Smith L. wrote:
> Hi,
> 
> I have been trying to use USRP2 as a receiver and USRP1 as a transmitter.
> The benchmark_tx.py file is working well for USRP1 but I did some
> modifications to benchmark_rx.py so that it can work on USRP2. But it didnt
> worked out. Can anyone help me with this modifcations so that I can
> establish communication between USRP1 and USRP2. Thanks in advance. 

 I was finally able to dig up the versions I used a while back for this.
I don't recall if the transmit side really worked, but the receive-side
certainly should.
 You'll want to copy/rename the original receive_path.py and
transmit_path.py, and replace them with the usrp2-versions, and
tunnel_usrp2.py can be used as-is (although - again, I'm not certain the
transmit-portion was working - although it gave no obvious errors).
 Good luck!
 Doug

- --
Doug Geiger
Research Assistant
Communications and Signal Processing Lab
Oklahoma State University
http://cspl.okstate.edu
douglas.gei...@okstate.edu
doug.gei...@ieee.org
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJqCZKgfOzzR5bXIgRAhVSAKCmAaKtVuMUI/9UQLKBS0hMrqlvNwCcCZDM
PCqWb+2faS6AxOj2nq8AU7Y=
=Unal
-END PGP SIGNATURE-
#!/usr/bin/env python
#
# Copyright 2005,2006,2007 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, gru, blks2
from gnuradio import usrp2
from gnuradio import eng_notation
import copy
import sys

# from current dir
from pick_bitrate import pick_rx_bitrate

# /
#  receive path
# /

class receive_path(gr.hier_block2):
def __init__(self, demod_class, rx_callback, options):

gr.hier_block2.__init__(self, "receive_path",
gr.io_signature(0, 0, 0), # Input signature
gr.io_signature(0, 0, 0)) # Output signature

options = copy.copy(options)# make a copy so we can destructively 
modify

self._interface  = options.interface   # the USRP board 
attached
self._mac_addr   = options.mac_addr
self._verbose= options.verbose
self._rx_freq= options.rx_freq # receiver's center 
frequency
self._rx_gain= options.rx_gain # receiver's gain
#self._rx_subdev_spec = options.rx_subdev_spec  # daughterboard to 
use
self._bitrate= options.bitrate # desired bit rate
self._decim  = options.decim   # Decimating rate 
for the USRP (prelim)
self._samples_per_symbol = options.samples_per_symbol  # desired 
samples/symbol
self._fusb_block_size= options.fusb_block_size # usb info for USRP
self._fusb_nblocks   = options.fusb_nblocks# usb info for USRP

self._rx_callback   = rx_callback  # this callback is fired when 
there's a packet available
self._demod_class   = demod_class  # the demodulator_class we're 
using

if self._rx_freq is None:
sys.stderr.write("-f FREQ or --freq FREQ or --rx-freq FREQ must be 
specified\n")
raise SystemExit

# Set up USRP source; also adjusts decim, samples_per_symbol, and 
bitrate
self._setup_usrp_source()

g = self.u.gain_range()
if options.show_rx_gain_range:
print "Rx Gain Range: minimum = %g, maximum = %g, step size = %g" \
  % (g[0], g[1], g[2])

self.set_gain(options.rx_gain)

self.set_auto_tr(True) # enable Auto Transmit/Receive 
switching

# Set RF frequency
ok = self.set_freq(self._rx_freq)
if not ok:
print "Failed to set Rx frequency to %s" % 
(eng_notation.num_to_str(self._rx_freq))
raise ValueError, eng_notation.num_to_str(self._rx_freq)

# copy the final answers back into options for use by demodulator
options.samples_per_symbol = self._samples_per_symbol
options.bitrate = self._bitrate
 

[Discuss-gnuradio] Modifications in benchmark_rx.py for USRP2

2009-02-26 Thread Smith L.

Hi,

I have been trying to use USRP2 as a receiver and USRP1 as a transmitter.
The benchmark_tx.py file is working well for USRP1 but I did some
modifications to benchmark_rx.py so that it can work on USRP2. But it didnt
worked out. Can anyone help me with this modifcations so that I can
establish communication between USRP1 and USRP2. Thanks in advance. 
-- 
View this message in context: 
http://www.nabble.com/Modifications-in-benchmark_rx.py-for-USRP2-tp22234620p22234620.html
Sent from the GnuRadio mailing list archive at Nabble.com.



___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio