Hi,
I experience some problems with my USRP and the RFX2400. When I run a
simple program to capture data samples from the USRP it locks after
some time (minutes to hours). There is no crash, it just stops
receiving samples. I attached the code to this email so others can try
it out to see if it is my setup or not.
The program is very simple. It configures the USRP and sends the
samples to /dev/null. I modified the file sink to inclue a counter so
I can see if there are samples coming from the USRP or not. The diff
is here:
Index: gr_file_sink.cc
===================================================================
RCS file: /sources/gnuradio/gnuradio-core/src/lib/io/gr_file_sink.cc,v
retrieving revision 1.4
diff -r1.4 gr_file_sink.cc
57a58
d_counter = 0;
123a125,126
141a145,148
d_counter += 1;
if (d_counter % 10000 == 0){
fprintf(stdout, "count %d\n", d_counter), fflush(stdout);
}
I have the latest CVS/SVN version and use python 2.4.
Any ideas what could be wrong?
Thomas
#!/usr/bin/env python
from gnuradio import gr, eng_notation
from gnuradio import usrp
from gnuradio.eng_option import eng_option
from optparse import OptionParser
import math, struct, time
#from gnuradio.wxgui import stdgui, fftsink, scopesink
#import wx
start = 0
def pick_subdevice(u):
"""
The user didn't specify a subdevice on the command line.
If there's a daughterboard on A, select A.
If there's a daughterboard on B, select B.
Otherwise, select A.
"""
if u.db[0][0].dbid() >= 0: # dbid is < 0 if there's no d'board or a problem
return (0, 0)
if u.db[1][0].dbid() >= 0:
return (1, 0)
return (0, 0)
class stats(object):
def __init__(self):
self.npkts = 0
self.nright = 0
class rx_graph (gr.flow_graph):
st = stats()
def __init__(self):
gr.flow_graph.__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 ("-c", "--cordic-freq", type="eng_float", default=2475000000,
help="set Tx cordic frequency to FREQ", metavar="FREQ")
parser.add_option ("-r", "--data-rate", type="eng_float", default=2000000)
parser.add_option ("-f", "--filename", type="string",
default="rx.dat", help="write data to FILENAME")
parser.add_option ("-g", "--gain", type="eng_float", default=0,
help="set Rx PGA gain in dB [0,20]")
parser.add_option ("-N", "--no-gui", action="store_true", default=False)
(options, args) = parser.parse_args ()
print "cordic_freq = %s" % (eng_notation.num_to_str (options.cordic_freq))
# ----------------------------------------------------------------
self.data_rate = options.data_rate
self.samples_per_symbol = 2
self.usrp_decim = int (64e6 / self.samples_per_symbol / self.data_rate)
self.fs = self.data_rate * self.samples_per_symbol
payload_size = 128 # bytes
print "data_rate = ", eng_notation.num_to_str(self.data_rate)
print "samples_per_symbol = ", self.samples_per_symbol
print "usrp_decim = ", self.usrp_decim
print "fs = ", eng_notation.num_to_str(self.fs)
u = usrp.source_c (0, self.usrp_decim)
if options.rx_subdev_spec is None:
options.rx_subdev_spec = pick_subdevice(u)
u.set_mux(usrp.determine_rx_mux_value(u, options.rx_subdev_spec))
subdev = usrp.selected_subdev(u, options.rx_subdev_spec)
#u.set_rx_freq (0, -options.cordic_freq)
u.tune(0, subdev, options.cordic_freq)
u.set_pga(0, options.gain)
u.set_pga(1, options.gain)
self.u = u
self.file_sink = gr.file_sink(gr.sizeof_gr_complex, "/dev/null")
self.connect(self.u, self.file_sink)
def main ():
fg = rx_graph()
fg.start()
fg.wait()
if __name__ == '__main__':
# insert this in your test code...
import os
print 'Blocked waiting for GDB attach (pid = %d)' % (os.getpid(),)
raw_input ('Press Enter to continue: ')
main ()
_______________________________________________
Discuss-gnuradio mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio