Dustin Maas wrote:
Hello Doug,
Just thought I'd check and see if you had put together a list of
changes for updating the BBN code yet. Even an incomplete list would
be helpful.
Many thanks,
Dustin
You're in luck - I just back back from some traveling, and have managed
to gather up a patch. However - this is a patch to the version from the
U of Utah, SPAN Lab version
(http://span.ece.utah.edu/pmwiki/pmwiki.php?n=Main.80211bReceiver) -
which does the despreading in the FPGA (which therefore disables that
part of the flowgraph in the python code). So if you want a patch versus
the original BBN code, you'll need to back those changes out (maybe
doing a reverse patch from the Utah version?). In any event, I'll have
time in the next few weeks to return to this, if you need help figuring
out what I did (the hier2 conversion wasn't too complicated).
The unified diff is attached.
Doug
--
Doug Geiger
Research Assistant
Communications and Signal Processing Lab
Oklahoma State University
http://cspl.okstate.edu
[EMAIL PROTECTED]
[EMAIL PROTECTED]
diff -ruN orig/bbn_80211b_pkt.py hier2/bbn_80211b_pkt.py
--- orig/bbn_80211b_pkt.py 2008-09-22 15:24:36.000000000 -0500
+++ hier2/bbn_80211b_pkt.py 2008-09-22 15:24:26.000000000 -0500
@@ -24,6 +24,8 @@
# Boston, MA 02111-1307, USA.
#
+# Converted to use hier_block2
+
from math import pi
import Numeric
@@ -39,13 +41,13 @@
# xPSK mod/demod with packets as i/o
# /////////////////////////////////////////////////////////////////////////////
-class bbn_80211b_mod_pkts(gr.hier_block):
+class bbn_80211b_mod_pkts(gr.hier_block2):
"""
PSK modulator that is a GNU Radio source.
Send packets by calling send_pkt
"""
- def __init__(self, fg, msgq_limit=2, pad_for_usrp=True, *args, **kwargs):
+ def __init__(self, msgq_limit=2, pad_for_usrp=True, *args, **kwargs):
"""
Hierarchical block for PSK modulation.
@@ -68,7 +70,7 @@
self.xpsk_mod = bbn_80211b.bbn_80211b_mod(fg, *args, **kwargs)
fg.connect(self.pkt_input, self.xpsk_mod)
- gr.hier_block.__init__(self, fg, None, self.xpsk_mod)
+ gr.hier_block2.__init__(self, None, self.xpsk_mod)
def send_pkt(self, payload='', eof=False):
"""
@@ -105,14 +107,14 @@
self.pkt_input.msgq().insert_tail(msg)
-class bbn_80211b_demod_pkts(gr.hier_block):
+class bbn_80211b_demod_pkts(gr.hier_block2):
"""
PSK demodulator that is a GNU Radio sink.
The input is complex baseband. When packets are demodulated, they
are passed to the app via the callback. """
- def __init__(self, fg, callback=None, spb=8, alpha=0.5, *args, **kwargs):
+ def __init__(self, callback=None, spb=8, alpha=0.5, *args, **kwargs):
"""
Hierarchical block for PSK demodulation.
@@ -132,7 +134,7 @@
pkt_queue=self._rcvd_pktq,
*args, **kwargs)
- gr.hier_block.__init__(self, fg, self.bit_receiver, None)
+ gr.hier_block2.__init__(self, self.bit_receiver, None)
self._watcher = _queue_watcher_thread(self._rcvd_pktq, callback)
class _queue_watcher_thread(_threading.Thread):
diff -ruN orig/bbn_80211b.py hier2/bbn_80211b.py
--- orig/bbn_80211b.py 2008-09-22 15:24:36.000000000 -0500
+++ hier2/bbn_80211b.py 2008-09-22 15:24:26.000000000 -0500
@@ -10,6 +10,10 @@
# Agency (DARPA) and the Department of the Interior National Business
# Center under agreement number NBCHC050166.
#
+# For implementation of a full bandwidth 802.11b receiver, it's been
+# Modified by Mohammad H. Firooz, SPAN Lab.,
+# University of Utah, UT-84112, in 2008.
+#
# This file is part of GNU Radio
#
# GNU Radio is free software; you can redistribute it and/or modify
@@ -39,9 +43,9 @@
# mPSK mod/demod with steams of bytes as data i/o
# /////////////////////////////////////////////////////////////////////////////
-class bbn_80211b_mod(gr.hier_block):
+class bbn_80211b_mod(gr.hier_block2):
- def __init__(self, fg, spb, alpha, gain, use_barker=0):
+ def __init__(self, spb, alpha, gain, use_barker=0):
"""
Hierarchical block for RRC-filtered PSK modulation
modulation.
@@ -103,12 +107,12 @@
fg.connect(self.chunks2symbols,self.tx_filter)
# Initialize base class
- gr.hier_block.__init__(self, fg, self.scrambler, self.tx_filter)
+ gr.hier_block2.__init__(self, self.scrambler, self.tx_filter)
bbn.crc16_init()
-class bbn_80211b_demod(gr.hier_block):
- def __init__(self, fg, pkt_queue, spb, alpha, use_barker=0,
+class bbn_80211b_demod(gr.hier_block2):
+ def __init__(self, pkt_queue, spb, alpha, use_barker=0,
check_crc=True):
# RRC data filter
ntaps = 2 * spb - 1
@@ -130,12 +134,18 @@
self.slicer = bbn.slicer_cc(spb, 16);
self.demod = bbn.dpsk_demod_cb();
self.descramble = bbn.scrambler_bb(False);
+ print "CRC Check is ", check_crc;
self.plcp = bbn.plcp80211_bb(pkt_queue, check_crc);
- fg.connect(self.rx_filter, self.slicer);
- fg.connect(self.slicer, self.demod);
- fg.connect((self.demod, 0), (self.plcp, 0));
- fg.connect((self.demod, 1), (self.plcp, 1));
+ self.amp = gr.multiply_const_cc(1);
- gr.hier_block.__init__(self, fg, self.rx_filter, self.plcp)
+ #fg.connect(self.rx_filter, self.slicer);
+ #fg.connect(self.slicer, self.demod);
+ self.connect(self, self.amp, self.demod)
+ self.connect((self.demod, 0), (self.plcp, 0))
+ self.connect((self.demod, 1), (self.plcp, 1))
+ self.connect(self.plcp, self)
+
+ #gr.hier_block.__init__(self, fg, self.rx_filter, self.plcp)
+ gr.hier_block2.__init__(self, None,
gr.io_signature(1,1,gr.sizeof_gr_complex),
gr.io_signature(1,1,gr.sizeof_gr_complex))
bbn.crc16_init()
diff -ruN orig/bbn_80211b_rx.py hier2/bbn_80211b_rx.py
--- orig/bbn_80211b_rx.py 2008-09-22 15:24:36.000000000 -0500
+++ hier2/bbn_80211b_rx.py 2008-09-22 15:25:23.000000000 -0500
@@ -7,6 +7,10 @@
# Agency (DARPA) and the Department of the Interior National Business
# Center under agreement number NBCHC050166.
#
+# For implementation of a full bandwidth 802.11b receiver, it's been
+# Modified by Mohammad H. Firooz, SPAN Lab.,
+# University of Utah, UT-84112, in 2008.
+#
# This file is part of GNU Radio
#
# GNU Radio is free software; you can redistribute it and/or modify
@@ -68,11 +72,11 @@
return (0, 0)
-class usrp_rx(gr.hier_block):
- def __init__(self, fg, decim=8, rx_subdev_spec=None, width_16=False,
+class usrp_rx(gr.hier_block2):
+ def __init__(self, which=0, decim=8, rx_subdev_spec=None, width_16=False,
verbose=False, gain=None, freq=None):
- # build the graph
- self.u = usrp.source_c(decim_rate=decim)
+ # build the graph"
+ self.u = usrp.source_c(which, decim_rate=decim,
fpga_filename="usrp_std_d2.rbf")
if rx_subdev_spec is None:
rx_subdev_spec = pick_subdevice(self.u)
@@ -115,20 +119,23 @@
if verbose:
print "desired freq = ", freq
- print "baseband frequency", r.baseband_freq
- print "dxc frequency", r.dxc_freq
+ #print "baseband frequency", r.baseband_freq
+ #print "dxc frequency", r.dxc_freq
- gr.hier_block.__init__(self, fg, None, self.u)
+ gr.hier_block2.__init__(self, "USRP RX", gr.io_signature(0,0,0),
gr.io_signature(1,2,gr.sizeof_gr_complex))
-class app_flow_graph(gr.flow_graph):
+class app_flow_graph(gr.top_block):
def __init__(self):
- gr.flow_graph.__init__(self)
+ gr.top_block.__init__(self)
parser = OptionParser(option_class=eng_option)
parser.add_option("-R", "--rx-subdev-spec", type="subdev",
default=None,
help="select USRP Rx side A or B (default=first one
with a daughterboard)")
- parser.add_option("-d", "--decim", type="int", default=16,
+ parser.add_option("-w", "--which", type="int", default=0,
+ help="select which USRP (0, 1, ...) default is
%default",
+ metavar="NUM")
+ parser.add_option("-d", "--decim", type="int", default=8,
help="set fgpa decimation rate to DECIM
[default=%default]")
parser.add_option("-f", "--freq", type="eng_float", default=2.4e9,
help="set frequency to FREQ", metavar="FREQ")
@@ -154,19 +161,15 @@
parser.print_help()
sys.exit(1)
- self.u = usrp_rx(self, options.decim, options.rx_subdev_spec,
- options.width_16, options.verbose, options.gain,
- options.freq)
+ self.u = usrp_rx(which=options.which, decim=options.decim,
rx_subdev_spec=options.rx_subdev_spec,
+ width_16=options.width_16, verbose=options.verbose,
gain=options.gain,
+ freq=options.freq)
if options.verbose:
print "Samples per data bit = ", options.spb
- self.bit_receiver = bbn_80211b_demod_pkts(self, spb=options.spb,
- alpha=0.5,
- callback=rx_callback,
- use_barker=options.barker,
- check_crc=
- not options.no_crc_check)
+ self.bit_receiver = bbn_80211b_demod_pkts(callback=rx_callback,
spb=options.spb,alpha=0.5,
+
use_barker=options.barker,check_crc=not options.no_crc_check)
self.connect(self.u, self.bit_receiver)
diff -ruN orig/.svn/entries hier2/.svn/entries
--- orig/.svn/entries 2008-09-25 08:26:51.000000000 -0500
+++ hier2/.svn/entries 2008-09-25 08:26:51.000000000 -0500
@@ -2,7 +2,7 @@
dir
17
-svn+ssh://[EMAIL PROTECTED]/svn/Jerboa/trunk/patches/orig
+svn+ssh://[EMAIL PROTECTED]/svn/Jerboa/trunk/patches/hier2
svn+ssh://[EMAIL PROTECTED]/svn/Jerboa
@@ -20,8 +20,8 @@
-2008-09-22T20:24:36.000000Z
-778de4439a02cc58bde15119e6454ce8
+2008-09-22T20:24:26.000000Z
+b08059b479b4a3dc5d23c5d5862c3e7b
2008-09-25T13:26:51.037428Z
17
douggeiger
@@ -33,8 +33,8 @@
-2008-09-22T20:24:36.000000Z
-14f396b5eb7888d76089cc5f7f713c9d
+2008-09-22T20:24:26.000000Z
+3b1e543fbb3e35d8b46c04bde1b95795
2008-09-25T13:26:51.037428Z
17
douggeiger
@@ -46,8 +46,8 @@
-2008-09-22T20:24:36.000000Z
-d09557ac32df6ac55f1f2496723a5c91
+2008-09-22T20:25:23.000000Z
+d7548ee400c3134fedcf709c25d31c0f
2008-09-25T13:26:51.037428Z
17
douggeiger
diff -ruN orig/.svn/text-base/bbn_80211b_pkt.py.svn-base
hier2/.svn/text-base/bbn_80211b_pkt.py.svn-base
--- orig/.svn/text-base/bbn_80211b_pkt.py.svn-base 2008-09-22
15:24:36.000000000 -0500
+++ hier2/.svn/text-base/bbn_80211b_pkt.py.svn-base 2008-09-22
15:24:26.000000000 -0500
@@ -24,6 +24,8 @@
# Boston, MA 02111-1307, USA.
#
+# Converted to use hier_block2
+
from math import pi
import Numeric
@@ -39,13 +41,13 @@
# xPSK mod/demod with packets as i/o
# /////////////////////////////////////////////////////////////////////////////
-class bbn_80211b_mod_pkts(gr.hier_block):
+class bbn_80211b_mod_pkts(gr.hier_block2):
"""
PSK modulator that is a GNU Radio source.
Send packets by calling send_pkt
"""
- def __init__(self, fg, msgq_limit=2, pad_for_usrp=True, *args, **kwargs):
+ def __init__(self, msgq_limit=2, pad_for_usrp=True, *args, **kwargs):
"""
Hierarchical block for PSK modulation.
@@ -68,7 +70,7 @@
self.xpsk_mod = bbn_80211b.bbn_80211b_mod(fg, *args, **kwargs)
fg.connect(self.pkt_input, self.xpsk_mod)
- gr.hier_block.__init__(self, fg, None, self.xpsk_mod)
+ gr.hier_block2.__init__(self, None, self.xpsk_mod)
def send_pkt(self, payload='', eof=False):
"""
@@ -105,14 +107,14 @@
self.pkt_input.msgq().insert_tail(msg)
-class bbn_80211b_demod_pkts(gr.hier_block):
+class bbn_80211b_demod_pkts(gr.hier_block2):
"""
PSK demodulator that is a GNU Radio sink.
The input is complex baseband. When packets are demodulated, they
are passed to the app via the callback. """
- def __init__(self, fg, callback=None, spb=8, alpha=0.5, *args, **kwargs):
+ def __init__(self, callback=None, spb=8, alpha=0.5, *args, **kwargs):
"""
Hierarchical block for PSK demodulation.
@@ -132,7 +134,7 @@
pkt_queue=self._rcvd_pktq,
*args, **kwargs)
- gr.hier_block.__init__(self, fg, self.bit_receiver, None)
+ gr.hier_block2.__init__(self, self.bit_receiver, None)
self._watcher = _queue_watcher_thread(self._rcvd_pktq, callback)
class _queue_watcher_thread(_threading.Thread):
diff -ruN orig/.svn/text-base/bbn_80211b.py.svn-base
hier2/.svn/text-base/bbn_80211b.py.svn-base
--- orig/.svn/text-base/bbn_80211b.py.svn-base 2008-09-22 15:24:36.000000000
-0500
+++ hier2/.svn/text-base/bbn_80211b.py.svn-base 2008-09-22 15:24:26.000000000
-0500
@@ -10,6 +10,10 @@
# Agency (DARPA) and the Department of the Interior National Business
# Center under agreement number NBCHC050166.
#
+# For implementation of a full bandwidth 802.11b receiver, it's been
+# Modified by Mohammad H. Firooz, SPAN Lab.,
+# University of Utah, UT-84112, in 2008.
+#
# This file is part of GNU Radio
#
# GNU Radio is free software; you can redistribute it and/or modify
@@ -39,9 +43,9 @@
# mPSK mod/demod with steams of bytes as data i/o
# /////////////////////////////////////////////////////////////////////////////
-class bbn_80211b_mod(gr.hier_block):
+class bbn_80211b_mod(gr.hier_block2):
- def __init__(self, fg, spb, alpha, gain, use_barker=0):
+ def __init__(self, spb, alpha, gain, use_barker=0):
"""
Hierarchical block for RRC-filtered PSK modulation
modulation.
@@ -103,12 +107,12 @@
fg.connect(self.chunks2symbols,self.tx_filter)
# Initialize base class
- gr.hier_block.__init__(self, fg, self.scrambler, self.tx_filter)
+ gr.hier_block2.__init__(self, self.scrambler, self.tx_filter)
bbn.crc16_init()
-class bbn_80211b_demod(gr.hier_block):
- def __init__(self, fg, pkt_queue, spb, alpha, use_barker=0,
+class bbn_80211b_demod(gr.hier_block2):
+ def __init__(self, pkt_queue, spb, alpha, use_barker=0,
check_crc=True):
# RRC data filter
ntaps = 2 * spb - 1
@@ -130,12 +134,18 @@
self.slicer = bbn.slicer_cc(spb, 16);
self.demod = bbn.dpsk_demod_cb();
self.descramble = bbn.scrambler_bb(False);
+ print "CRC Check is ", check_crc;
self.plcp = bbn.plcp80211_bb(pkt_queue, check_crc);
- fg.connect(self.rx_filter, self.slicer);
- fg.connect(self.slicer, self.demod);
- fg.connect((self.demod, 0), (self.plcp, 0));
- fg.connect((self.demod, 1), (self.plcp, 1));
+ self.amp = gr.multiply_const_cc(1);
- gr.hier_block.__init__(self, fg, self.rx_filter, self.plcp)
+ #fg.connect(self.rx_filter, self.slicer);
+ #fg.connect(self.slicer, self.demod);
+ self.connect(self, self.amp, self.demod)
+ self.connect((self.demod, 0), (self.plcp, 0))
+ self.connect((self.demod, 1), (self.plcp, 1))
+ self.connect(self.plcp, self)
+
+ #gr.hier_block.__init__(self, fg, self.rx_filter, self.plcp)
+ gr.hier_block2.__init__(self, None,
gr.io_signature(1,1,gr.sizeof_gr_complex),
gr.io_signature(1,1,gr.sizeof_gr_complex))
bbn.crc16_init()
diff -ruN orig/.svn/text-base/bbn_80211b_rx.py.svn-base
hier2/.svn/text-base/bbn_80211b_rx.py.svn-base
--- orig/.svn/text-base/bbn_80211b_rx.py.svn-base 2008-09-22
15:24:36.000000000 -0500
+++ hier2/.svn/text-base/bbn_80211b_rx.py.svn-base 2008-09-22
15:25:23.000000000 -0500
@@ -7,6 +7,10 @@
# Agency (DARPA) and the Department of the Interior National Business
# Center under agreement number NBCHC050166.
#
+# For implementation of a full bandwidth 802.11b receiver, it's been
+# Modified by Mohammad H. Firooz, SPAN Lab.,
+# University of Utah, UT-84112, in 2008.
+#
# This file is part of GNU Radio
#
# GNU Radio is free software; you can redistribute it and/or modify
@@ -68,11 +72,11 @@
return (0, 0)
-class usrp_rx(gr.hier_block):
- def __init__(self, fg, decim=8, rx_subdev_spec=None, width_16=False,
+class usrp_rx(gr.hier_block2):
+ def __init__(self, which=0, decim=8, rx_subdev_spec=None, width_16=False,
verbose=False, gain=None, freq=None):
- # build the graph
- self.u = usrp.source_c(decim_rate=decim)
+ # build the graph"
+ self.u = usrp.source_c(which, decim_rate=decim,
fpga_filename="usrp_std_d2.rbf")
if rx_subdev_spec is None:
rx_subdev_spec = pick_subdevice(self.u)
@@ -115,20 +119,23 @@
if verbose:
print "desired freq = ", freq
- print "baseband frequency", r.baseband_freq
- print "dxc frequency", r.dxc_freq
+ #print "baseband frequency", r.baseband_freq
+ #print "dxc frequency", r.dxc_freq
- gr.hier_block.__init__(self, fg, None, self.u)
+ gr.hier_block2.__init__(self, "USRP RX", gr.io_signature(0,0,0),
gr.io_signature(1,2,gr.sizeof_gr_complex))
-class app_flow_graph(gr.flow_graph):
+class app_flow_graph(gr.top_block):
def __init__(self):
- gr.flow_graph.__init__(self)
+ gr.top_block.__init__(self)
parser = OptionParser(option_class=eng_option)
parser.add_option("-R", "--rx-subdev-spec", type="subdev",
default=None,
help="select USRP Rx side A or B (default=first one
with a daughterboard)")
- parser.add_option("-d", "--decim", type="int", default=16,
+ parser.add_option("-w", "--which", type="int", default=0,
+ help="select which USRP (0, 1, ...) default is
%default",
+ metavar="NUM")
+ parser.add_option("-d", "--decim", type="int", default=8,
help="set fgpa decimation rate to DECIM
[default=%default]")
parser.add_option("-f", "--freq", type="eng_float", default=2.4e9,
help="set frequency to FREQ", metavar="FREQ")
@@ -154,19 +161,15 @@
parser.print_help()
sys.exit(1)
- self.u = usrp_rx(self, options.decim, options.rx_subdev_spec,
- options.width_16, options.verbose, options.gain,
- options.freq)
+ self.u = usrp_rx(which=options.which, decim=options.decim,
rx_subdev_spec=options.rx_subdev_spec,
+ width_16=options.width_16, verbose=options.verbose,
gain=options.gain,
+ freq=options.freq)
if options.verbose:
print "Samples per data bit = ", options.spb
- self.bit_receiver = bbn_80211b_demod_pkts(self, spb=options.spb,
- alpha=0.5,
- callback=rx_callback,
- use_barker=options.barker,
- check_crc=
- not options.no_crc_check)
+ self.bit_receiver = bbn_80211b_demod_pkts(callback=rx_callback,
spb=options.spb,alpha=0.5,
+
use_barker=options.barker,check_crc=not options.no_crc_check)
self.connect(self.u, self.bit_receiver)
_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio