discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] question of dual transmitter/receiver


From: YouheiFujii
Subject: Re: [Discuss-gnuradio] question of dual transmitter/receiver
Date: Mon, 26 Jul 2010 22:11:20 +0900
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; ja; rv:1.9.1.11) Gecko/20100711 Thunderbird/3.0.6

Hi,

Thank you for your advice.

>It seems you have two daughterboards on one USRP1, and you want to communicate with these two daughterboards.
Yes, that's right.

I want to use my dual-db program in /usr/share/example/digital.
I saw "fm_tx_2_daughterboards.py", but that program isn't use digital's py-files and modules.

When I search, I saw the function "set_mux".
I tried use "set_mux", but I didn't do that well.

If does anyone have experience of making program which on dual-db on 1-USRP1,
please give me advice.

I have to do well in few days ;-


Thanks,
youhei

(2010/07/26 21:55), Fisheep wrote:
Hi,

It seems you have two daughterboards on one USRP1, and you want to
communicate with these two daughterboards.
Maybe you could take a look at fm_tx_2_daughterboards.py first(in
/gnuradio-examples/python/usrp/.).
> From your code, I think you didn't modify the USRP setting that causes your
code fail.

Hope that helps,

Fisheep



YouheiFujii wrote:
Hi all,

I'd like to ask some questions about dual transmitter/receiver on USRP1.

I want to make dual transmitter/receiver
by remodeling benchmark_tx/rx.py.

In detail,
I want to use two daughterboard (two FLEX400) on one USRP1.
The pair of side-A transmit and receive on 412MHz,
and the pair of side-B transmit and receive on 420MHz.


   USRP1(tx only)        USRP1(rx only)
   +------------+        +------------+
   |            |        |            |
   |db1:        | 420MHz |db1:        |
   | FLEX400(A)------------FLEX400(A) |
   |            |        |            |
   |db2:        |        |db2:        |
   | FLEX400(B)------------FLEX400(B) |
   |            | 412MHz |            |
   +------------+        +------------+


Now I made tx-node's program like attachment file,
and execute this file.
-----
$ sudo python dual_tx.py -f 412M
-----

However, I got the following error.
-----
user:/usr/share/gnuradio/examples/digital$ sudo python dual_tx.py -f 412M
{'verbose': False, 'discontinuous': False, 'samples_per_symbol': 2,
'usrpx': None, 'interp': None, 'fusb_block_size': 0, 'megabytes': 1.0,
'rx_freq': 412000000.0, 'size': 1500, 'show_tx_gain_range': False,
'log': False, 'tx_subdev_spec': (0, 0), 'fusb_nblocks': 0, 'lo_offset':
None, 'tx_gain': None, 'which': 0, 'modulation': 'gmsk', 'excess_bw':
0.34999999999999998, 'bt': 0.34999999999999998, 'interface': 'eth0',
'freq': None, 'bitrate': 100000.0, 'from_file': None, 'tx_freq':
420000000, 'mac_addr': '', 'tx_amplitude': 0.25, 'gray_code': True}
gr_fir_fff: using SSE
Requested TX Bitrate: 100k Actual Bitrate: 125k
@@@@@
{'verbose': False, 'discontinuous': False, 'samples_per_symbol': 2,
'usrpx': None, 'interp': None, 'fusb_block_size': 0, 'megabytes': 1.0,
'rx_freq': 412000000.0, 'size': 1500, 'show_tx_gain_range': False,
'log': False, 'tx_subdev_spec': (1, 0), 'fusb_nblocks': 0, 'lo_offset':
None, 'tx_gain': None, 'which': 0, 'modulation': 'gmsk', 'excess_bw':
0.34999999999999998, 'bt': 0.34999999999999998, 'interface': 'eth0',
'freq': None, 'bitrate': 100000.0, 'from_file': None, 'tx_freq':
412000000, 'mac_addr': '', 'tx_amplitude': 0.25, 'gray_code': True}
usrp_open_interface:usb_claim_interface: failed interface 1
could not claim interface 1: Device or resource busy
usrp_basic_tx: can't open tx interface
Traceback (most recent call last):
   File "dual_tx.py", line 150, in<module>
     main()
   File "dual_tx.py", line 109, in main
     tb = my_top_block(mods[options.modulation], options)
   File "dual_tx.py", line 54, in __init__
     self.txpath_b = usrp_transmit_path.usrp_transmit_path(modulator,
options)
   File "/usr/share/gnuradio/examples/digital/usrp_transmit_path.py",
line 67, in __init__
     self._setup_usrp_sink(options)
   File "/usr/share/gnuradio/examples/digital/usrp_transmit_path.py",
line 76, in _setup_usrp_sink
     self.u = usrp_options.create_usrp_sink(options)
   File "/usr/share/gnuradio/examples/digital/usrp_options.py", line 119,
in create_usrp_sink
     gain=options.tx_gain,
   File "/usr/share/gnuradio/examples/digital/generic_usrp.py", line 199,
in __init__
     _generic_usrp_base.__init__(self, **kwargs)
   File "/usr/share/gnuradio/examples/digital/generic_usrp.py", line 57,
in __init__
     elif usrpx == '1' or self._subdev_spec: self._setup_usrpx(USRP1_TYPE)
   File "/usr/share/gnuradio/examples/digital/generic_usrp.py", line 76,
in _setup_usrpx
     if self._type == USRP1_TYPE: self._setup_usrp1()
   File "/usr/share/gnuradio/examples/digital/generic_usrp.py", line 229,
in _setup_usrp1
     fusb_nblocks=self._fusb_nblocks)
   File "/usr/lib/python2.6/dist-packages/gnuradio/usrp/usrp_swig.py",
line 2412, in sink_c
     return _usrp_swig.sink_c(*args, **kwargs)
RuntimeError: can't open usrp
user:/usr/share/gnuradio/examples/digital$
-----


I think, I couldn't make two txpath.
(I can make "txpath_a", but can't make "txpath_b")
But we can make two path ( txpath and rxpath) in tunnel.py.
Why I can't make two txpath like this way?

I can't  make dual transmit path like this way.

Does anyone has some idea to make ?
If you know, please tell me dual transmit path technique.


Thanks,
youhei



#!/usr/bin/env python
#
# Copyright 2005,2006,2007,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.
#

from gnuradio import gr, gru, modulation_utils
from gnuradio import usrp
from gnuradio import eng_notation
from gnuradio.eng_option import eng_option
from optparse import OptionParser

import random, time, struct, sys

# from current dir
import usrp_transmit_path

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

class my_top_block(gr.top_block):
     def __init__(self, modulator, options):
         gr.top_block.__init__(self)

         # options setting for side A
         options.tx_subdev_spec = (0,0)
         options.tx_freq = 420000000
         print options
         self.txpath_a = usrp_transmit_path.usrp_transmit_path(modulator,
options)
         print "@@@@@"

         # options setting for side B
         options.tx_subdev_spec = (1,0)
         options.tx_freq = 412000000
         print options
         self.txpath_b = usrp_transmit_path.usrp_transmit_path(modulator,
options)
         print "@@@@@"

         self.connect(self.txpath_a)
         self.connect(self.txpath_b)


#
/////////////////////////////////////////////////////////////////////////////
#                                   main
#
/////////////////////////////////////////////////////////////////////////////

def main():

     def rx_callback(ok, payload):
         print "ok = %r, payload = '%s'" % (ok, payload)

     mods = modulation_utils.type_1_mods()

     parser = OptionParser(option_class=eng_option,
conflict_handler="resolve")
     expert_grp = parser.add_option_group("Expert")

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

     parser.add_option("-s", "--size", type="eng_float", default=1500,
                       help="set packet size [default=%default]")
     parser.add_option("-M", "--megabytes", type="eng_float", default=1.0,
                       help="set megabytes to transmit [default=%default]")
     parser.add_option("","--discontinuous", action="store_true",
default=False,
                       help="enable discontinous transmission (bursts of 5
packets)")
     parser.add_option("","--from-file", default=None,
                       help="use file for packet contents")

     usrp_transmit_path.add_options(parser, expert_grp)

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

     (options, args) = parser.parse_args ()

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

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

     if options.from_file is not None:
         source_file = open(options.from_file, 'r')

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

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

     tb.start()                       # start flow graph


     # generate and send packets
     nbytes = int(1e6 * options.megabytes)
     n = 0
     pktno = 0
     pkt_size = int(options.size)

     while n<  nbytes:
         if options.from_file is None:
             data = (pkt_size - 2) * chr(pktno&  0xff)
         else:
             data = source_file.read(pkt_size - 2)
             if data == '':
                 break;

         payload = struct.pack('!H', pktno&  0xffff) + data

         tb.txpath_a.send_pkt(payload) #0724#
         tb.txpath_b.send_pkt(payload) #0724#

         n += len(payload)
         sys.stderr.write('.')
         if options.discontinuous and pktno % 5 == 4:
             time.sleep(1)
         pktno += 1

     tb.txpath_a.send_pkt_a(eof=True) #0724#
     tb.txpath_b.send_pkt_b(eof=True) #0724#

     tb.wait()                       # wait for it to finish

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

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






reply via email to

[Prev in Thread] Current Thread [Next in Thread]