I fixed the problem. The top_block on bbn_80211b_tx_port was not being properly initialized.
It seems to be working now, but when I use 8 samples per data bit instead of 4 I randomly got the following error: usrp2::tx_raw: FIXME: short packet: 7 items (56 bytes) Does anyone know what this mean? I'm sending the working code. 2009/4/2 Tiago Rogério Mück <ti...@lisha.ufsc.br> > Hi all, > > I'm trying to port the tx code to the usrp2 based on Colby's branch and i'm > having some problems. The program freezes when the 3rd packet is being sent. > > The program uses a gr.message_source to buffer the packets and convert them > into a data flow to the modulator, and the problem is that, for some reason, > the data flow isn't flowing and the packets are accumulating in the > msg_source. Since the msg_source's queue size is 2, the method to add the > 3rd packet to the queue blocks because the queue is full. > > I didn't figured out whats the problem with my code. The bbn80211b_test.py > woks, so the problem is probably related to the connection of the modulator > block with the usrp2 sink or to the configuration of the usrp2. > > I'm sending the files i have modified. > > 2009/3/31 Colby Boyer <csbo...@berkeley.edu> > > Hi all, >> >> I created a branch on the cgran server for the usrp2 code. If anyone is >> interested in still using the usrp with the hier_block2, just dont use the >> rx/tx.py files. The rest of the files should work with the usrp1. >> >> Cheers, >> Colby >> >> >> On Mon, Mar 30, 2009 at 3:58 PM, George Nychis <gnyc...@cmu.edu> wrote: >> >>> Hi all, >>> >>> CGRAN's trac has a core dumping issue that I still have not figured out >>> how to address yet. So, if you're using the wiki and get blank pages or a >>> 500 internal server error, sorry. I've been trying to sort it out, but no >>> luck yet: >>> http://www.gossamer-threads.com/lists/trac/users/40954 >>> >>> It should not affect the svn server though. >>> >>> - George >>> >>> >>> 2009/3/30 Colby Boyer <csbo...@berkeley.edu> >>> >>>> The cgran server seems to be down. I'll let you know when I am able to >>>> get an account. >>>> >>>> On Mon, Mar 30, 2009 at 8:36 AM, Colby Boyer <colby.bo...@gmail.com>wrote: >>>> >>>>> Sure. I will try to get a cgran account and upload my code to their >>>>> SVN. It would then be easy to see the changes I made. >>>>> >>>>> >>>>> On Mon, Mar 30, 2009 at 2:21 AM, Costantini, Andrea <costant...@ftw.at >>>>> > wrote: >>>>> >>>>>> Hi Colby, >>>>>> >>>>>> I am glad that I am not the only one trying to port the code. >>>>>> I guess you are in a more advanced state. I wasn't even able to run >>>>>> the test.py. ;-) >>>>>> >>>>>> Would you like to share your modified code (even if it is not >>>>>> finished)? so that I try to understand your modifications. >>>>>> >>>>>> Best Regards, >>>>>> Andrea >>>>>> >>>>>> P.S. For the USRP2 api, I usually compare the USRP2 and USRP swig code >>>>>> (e.g. usrp2.py and usrp_swig.py). >>>>>> >>>>>> >>>>>> Colby Boyer wrote: >>>>>> >>>>>>> Hi Andrea, >>>>>>> >>>>>>> I am also working to port the 802.11b code to the USRP2. I have >>>>>>> finished converting the code to hier_block2, and the bbn_80211b_test.py >>>>>>> script works correctly and it can send packets in simulation. I am >>>>>>> currently >>>>>>> working on modifying the rx, and tx files to connect to the USRP2, but >>>>>>> been >>>>>>> struggling to make progress. I have not had much luck finding any >>>>>>> documentation for the USRP2 function calls, so I am sorta lost on what >>>>>>> to >>>>>>> change in rx, tx and tx transmit path files. Does anyone have any links >>>>>>> to >>>>>>> the usrp2 api? >>>>>>> >>>>>>> I would be more than happy to share the modifications I made (built >>>>>>> largly upon Douglas's work) with rest of the GNU radio community. >>>>>>> >>>>>>> Regards, >>>>>>> Colby Boyer >>>>>>> >>>>>>> >>>>>>> >>>>> >>>> >>>> _______________________________________________ >>>> Discuss-gnuradio mailing list >>>> Discuss-gnuradio@gnu.org >>>> http://lists.gnu.org/mailman/listinfo/discuss-gnuradio >>>> >>>> >>> >> >> _______________________________________________ >> Discuss-gnuradio mailing list >> Discuss-gnuradio@gnu.org >> http://lists.gnu.org/mailman/listinfo/discuss-gnuradio >> >> >
#!/usr/bin/env python # # 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. # # 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. # from gnuradio import gr, gru, blks2 from gnuradio import usrp2 from gnuradio import eng_notation from gnuradio.eng_option import eng_option from bbn_80211b_pkt import * from optparse import OptionParser import random import time import struct import sys n2s = eng_notation.num_to_str class bbn_80211b_transmit_path(gr.top_block): def __init__(self, interp_rate, spb, use_barker, interface="", mac_addr=None): gr.top_block.__init__(self) self.normal_gain = 28000 self.u = usrp2.sink_32fc(interface, mac_addr) dac_rate = self.u.dac_rate(); self._spb = spb self._interp=int(interp_rate) self.u.set_interp(self._interp) # transmitter self.packet_transmitter = bbn_80211b_mod_pkts(spb=spb, alpha=0.5, gain=self.normal_gain, use_barker=use_barker) self.connect(self.packet_transmitter, self.u) #self.set_gain(self.u.gain_max()) # set max Tx gain def set_freq(self, target_freq): """ Set the center frequency we're interested in. @param target_freq: frequency in Hz @rypte: bool Tuning is a two step process. First we ask the front-end to tune as close to the desired frequency as it can. Then we use the result of that operation and our target_frequency to determine the value for the digital up converter. Finally, we feed any residual_freq to the s/w freq translater. """ tr = self.u.set_center_freq(target_freq) if tr == None: sys.stderr.write('Failed to set center frequency\n') raise SystemExit, 1 return tr def set_gain(self, gain): self.gain = gain self.u.set_gain(gain) def send_pkt(self, payload='', eof=False): return self.packet_transmitter.send_pkt(payload, eof) def spb(self): return self._spb def interp(self): return self._interp # ///////////////////////////////////////////////////////////////////////////// # main # ///////////////////////////////////////////////////////////////////////////// def main(): def send_pkt(payload='', eof=False): return tb.send_pkt(payload, eof) parser = OptionParser (option_class=eng_option) parser.add_option("-e", "--interface", type="string", default="eth0", help="use specified Ethernet interface [default=%default]") parser.add_option("-m", "--mac-addr", type="string", default="", help="use USRP2 at specified MAC address [default=None]") parser.add_option("-f", "--freq", type="eng_float", default=2.4e9, help= \ "set Tx and Rx frequency to FREQ [default=%default]", metavar="FREQ") parser.add_option("-S", "--spb", type="int", default=8, help="set samples/baud [default=%default]") parser.add_option("-i", "--interp", type="int", default=32, help= "set fpga interpolation rate to INTERP [default=%default]") parser.add_option("-r", "--reps", type="int", default=9999, help= "Number of packets to send [default=%default]") parser.add_option("-b", "--barker", action="store_true", default=False, help="Use Barker Spreading [default=%default]") (options, args) = parser.parse_args () if len(args) != 0: parser.print_help() sys.exit(1) if options.freq < 1e6: options.freq *= 1e6 # build the graph tb = bbn_80211b_transmit_path(options.interp, options.spb, options.barker, options.interface, options.mac_addr) tr = tb.set_freq(options.freq) usrp = tb.u print "" print "Network interface: ", options.interface print "USRP2 address: ", usrp.mac_addr() print "Using TX d'board id 0x%04X" % (usrp.daughterboard_id(),) print "Tx baseband frequency: ", n2s(tr.baseband_freq) print "Tx DUC frequency: ", n2s(tr.dxc_freq) print "Tx residual frequency: ", n2s(tr.residual_freq) print "Tx interpolation rate: ", usrp.interp() print "Samples per data bit: ", tb.spb() if options.barker == True: print "Using Barker spreading" tb.start() # start flow graph # generate and send packets n = 0 fp = open('getty.txt') lines = fp.readlines() payload = "Hello world" i = 0; #while i < len(lines): # payload = payload + lines[i] # i = i + 1 print "" print "" print "DATA:" print "" print payload print "" while n < options.reps: print "Sending pkt ", n send_pkt(payload, False); n = n + 1 time.sleep(1) send_pkt(eof=True) tb.wait() # wait for it to finish if __name__ == '__main__': try: main() except KeyboardInterrupt: raise SystemExit
_______________________________________________ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org http://lists.gnu.org/mailman/listinfo/discuss-gnuradio