I have an application where I have to start and stop the USRP2
multiple times at various points, but I’ve been having trouble getting
it to work. I traced it down to see that when the stop control message
is sent, the host never processes the reply pack from the USRP2. Using
Wireshark, I can see that this packet is being sent. After the failure
of the stop command, the remaining commands to restart the USRP2 and
set its parameters fail.
To make this easier to debug, I found out that the simple program
below exercises the problem nicely. To see the failures, I just print
out the success message from “usrp2::impl::stop_rx_streaming” and from
“usrp2::impl::start_rx_streaming” (in /usrp2/host/lib/usrp2_impl.cc).
This is what happens:
The first stop_rx_streaming comes during the initialization of the
USRP2 to make sure its not streaming yet.
Strangely (or maybe not; I can think of a some good reasons for this
behavior), when you set the “rate” variable to above 300 to slow down
the transmissions, everything works fine. At rate=200 it’s flaky;
sometimes it works and sometimes it doesn’t. So there seems to be some
timing issue involved.
I’ve been looking and feel like I’m getting close to an answer, but it
keeps escaping me. Any ideas on what’s causing this?
from gnuradio import gr, usrp2
rate = 100 src = usrp2.source_32fc("eth1", "") src.set_decim(rate) src.set_center_freq(10e6) snk = gr.null_sink(gr.sizeof_gr_complex) self.connect(src, snk)
tb = usrp2_test()
tb.start() tb.stop() tb.wait() tb.start() tb.stop() tb.wait()
if name == “main”: