discuss-gnuradio
[Top][All Lists]
Advanced

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

[Discuss-gnuradio] Updated 802.11b code


From: Douglas Geiger
Subject: [Discuss-gnuradio] Updated 802.11b code
Date: Mon, 17 Nov 2008 17:09:49 -0600
User-agent: Thunderbird 2.0.0.17 (Windows/20080914)

I've finally gotten back around to messing with the 802.11b code - and getting it working with hier_block2. I seem to have gotten stuck with an error regarding insufficient output ports, and I've forgotten how I tracked down the source of this error before. So I'm attaching my current code, along with the error in hopes that someone can point me in the right direction:
The error:
sudo ./bbn_80211b_rx.py -f 2412e6 -d 4 -b -v
Bits Per Encoded Sample = 8
adc frequency =  64000000
decimation frequency =  4
input_rate =  16000000
gain =  45.0
desired freq =  2412000000.0
Samples per data bit =  8
CRC Check is  True
Traceback (most recent call last):
 File "./bbn_80211b_rx.py", line 182, in <module>
   main ()
 File "./bbn_80211b_rx.py", line 178, in main
   app.start()
File "/usr/local/lib/python2.5/site-packages/gnuradio/gr/top_block.py", line 45, in start
   self._tb.start()
File "/usr/local/lib/python2.5/site-packages/gnuradio/gr/gnuradio_swig_py_runtime.py", line 1461, in start
   return _gnuradio_swig_py_runtime.gr_top_block_sptr_start(*args)
RuntimeError: bbn_dpsk_demod_cb(5): insufficient connected output ports (1 needed, 0 connected)

My version of bbn_80211b.py is attached, and it uses the UofUtah/SPAN firmware to do the despreading in the FPGA (bbn_80211b_rx.py is essentially unchanged except to use hier_block2 and gr.topblock).

Any help is appreciated,
 Doug

--
Doug Geiger
Research Assistant
Communications and Signal Processing Lab
Oklahoma State University
http://cspl.okstate.edu
address@hidden
address@hidden

#!/usr/bin/env python

# 802.11 style bpsk modulation and demodulation.  
#
#
# Copyright 2005 Free Software Foundation, Inc.
#
# Copyright (c) 2006 BBN Technologies Corp.  All rights reserved.
# Effort sponsored in part by the Defense Advanced Research Projects
# 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
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, 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., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
# 

# See gnuradio-examples/python/xpsk for examples

from gnuradio import gr
from gnuradio import bbn
from math import pi
import Numeric

# /////////////////////////////////////////////////////////////////////////////
#            mPSK mod/demod with steams of bytes as data i/o
# /////////////////////////////////////////////////////////////////////////////

class bbn_80211b_mod(gr.hier_block2):

    def __init__(self, spb, alpha, gain, use_barker=0):
        """
        Hierarchical block for RRC-filtered PSK modulation
        modulation.

        The input is a byte stream (unsigned char) and the
        output is the complex modulated signal at baseband.

        @param fg: flow graph
        @type fg: flow graph
        @param spb: samples per baud >= 2
        @type spb: integer
        @param alpha: Root-raised cosine filter excess bandwidth
        @type alpha: float
        """
        gr.hier_block2.__init__(self, "80211b Modulator", 
gr.io_signature(1,1,gr.sizeof_gr_complex),gr.io_signature(1,1,gr.sizeof_gr_complex))
        if not isinstance(spb, int) or spb < 2:
            raise TypeError, "sbp must be an integer >= 2"
        self.spb = spb
        self.bits_per_chunk = 1

        ntaps = 2 * spb - 1
        alpha = 0.5

        # turn bytes into symbols
        self.bytes2chunks = gr.packed_to_unpacked_bb(self.bits_per_chunk,
                                                     gr.GR_MSB_FIRST)

        constellation = ( (),
                          ( -1-0j,1+0j ),
                          ( 0.707+0.707j,-0.707-0.707j ),
                          ( 0.707+0j,-0.707-0.707j ),
                          ( -1+0j,-1j, 1j, 1+0j),
                          ( 1+0j,0+1j,-1+0j,0-1j ),
                          ( 0+0j,1+0j ),
                          )

        self.chunks2symbols = gr.chunks_to_symbols_bc(constellation[2])
        self.scrambler = bbn.scrambler_bb(True)
        self.diff_encode = gr.diff_encoder_bb(2);

        self.barker_taps = bbn.firdes_barker(spb)

        # Form Raised Cosine filter
        self.rrc_taps = gr.firdes.root_raised_cosine(
                4 * gain,       # gain  FIXME may need to be spb
                spb,            # sampling freq
                1.0,            # symbol_rate
                alpha,
                ntaps)

        if use_barker:
            self.tx_filter = gr.interp_fir_filter_ccf(spb, self.barker_taps)
        else:
            self.tx_filter = gr.interp_fir_filter_ccf(spb, self.rrc_taps)

        # Connect
        self.connect(self,self.scrambler, self.bytes2chunks)
        self.connect(self.bytes2chunks, self.diff_encode)
        self.connect(self.diff_encode, self.chunks2symbols)
        self.connect(self.chunks2symbols,self.tx_filter,self)

        # Initialize base class
        bbn.crc16_init()


class bbn_80211b_demod(gr.hier_block2):
    def __init__(self, pkt_queue, spb, alpha,  use_barker=0,
                 check_crc=True):
        # RRC data filter
        gr.hier_block2.__init__(self, "80211b Demod", 
gr.io_signature(1,1,gr.sizeof_gr_complex), gr.io_signature(0,0,0))
        #ntaps = 2 * spb - 1

        #self.rrc_taps = gr.firdes.root_raised_cosine(
        #       1,              # gain  FIXME may need to be spb
        #       spb,             # sampling freq
        #       1.0,            # symbol_rate
        #       alpha,
        #        ntaps)

        #self.barker_taps = bbn.firdes_barker(spb)

        #if use_barker == 1:
        #    self.rx_filter = gr.fir_filter_ccf(1, self.barker_taps)
        #else:
        #    self.rx_filter = gr.fir_filter_ccf(1, self.rrc_taps)

        #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);

        self.amp = gr.multiply_const_cc(1);

        #fg.connect(self.rx_filter, self.slicer);
        #fg.connect(self.slicer, self.demod);
        #self.connect(self, self.amp)
        #self.connect(self.amp, self.demod)
        self.connect(self,self.demod,self.plcp)
        #self.connect((self.demod, 0), (self.plcp, 0))
        self.connect((self.demod, 1), (self.plcp, 1))

        #gr.hier_block.__init__(self, fg, self.rx_filter, self.plcp)
        bbn.crc16_init()


reply via email to

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