Hello,
I'm starting to play around with gnuradio and the USRP1. I have the
RFX400 daughterboard but only one antenna. I used the examples
usrp_wfm_rcv.py and usrp_nbfm_rcv.py for testing and it worked (I only
had to change the center frequencies for the use with the FRX400). For
emitting I used gnuradio-companion and the WBFM transmit block that also
worked fine. Now, I'm trying to set up a transceiver that uses for both
the receive and emit path the TX/RX antenna of the RFX400. I made a
first (simple) flowgraph using different classes for the Rx and Tx paths
(classes copied from working grc flowgraphs). I used the same parameters
than for the receiver and emitter alone but I set the transmit parameter
of the USRP sink to Auto T/R. Now, my plan is to remain in the reception
mode all the time and to switch to transmission mode only if I want to
speak. In order to do this, I added this code to my python script:
if __name__ == '__main__':
parser = OptionParser(option_class=eng_option, usage="%prog: [options]")
(options, args) = parser.parse_args()
tr = usrp_wbfm_receive_nogui()
tt = usrp_wbfm_emit_rfx400()
while 1:
tr.start()
raw_input('Press Enter to emit: ')
tr.stop()
tt.start()
raw_input('Press Enter to stop emitting ')
tt.stop()
And both the reception and transmission seem to work in first place. But
if I press Enter the second time, I get this error message:
RuntimeError: top_block::start: top block already running or wait() not
called after previous stop()
Assuming that it's impossible to restart a block after stopping it
without executing the wait() call, I added tr.wait() and tt.wait() after
the respective stop calls. But then I get another error message:
audio_alsa_sink[plughw:0,0]: snd_pcm_hw_params failed: File descriptor
in bad state
RuntimeError: check topology failed on audio_alsa_sink(1) using
ninputs=1, noutputs=0
It seems to be linked to the fact that the alsa driver won't switch back
to it's receive config after the transmission. Is there a possibility to
make my script work or am I doing it all the wrong way?
Thanks for your help
Mirko
PS: I've joined the complete code to show the context of my script
#!/usr/bin/env python
##################################################
# Gnuradio Python Flow Graph
# Title: USRP WBFM Receive no gui
# Author: Example
# Description: WBFM Receive with RFX400
# Generated: Thu May 20 11:44:32 2010
##################################################
from gnuradio import audio
from gnuradio import blks2
from gnuradio import gr
from gnuradio.eng_option import eng_option
from grc_gnuradio import usrp as grc_usrp
from optparse import OptionParser
class usrp_wbfm_receive_nogui(gr.top_block):
def __init__(self):
gr.top_block.__init__(self, "USRP WBFM Receive no gui")
##################################################
# Blocks
##################################################
self.audio_out = audio.sink(32000, "plughw:0,0", True)
self.u_source = grc_usrp.simple_source_c(which=0, side="A", rx_ant="TX/RX")
self.u_source.set_decim_rate(200)
self.u_source.set_frequency(433500000, verbose=True)
self.u_source.set_gain(20)
self.wfm_demod = blks2.wfm_rcv(
quad_rate=320000,
audio_decimation=10,
)
##################################################
# Connections
##################################################
self.connect((self.u_source, 0), (self.wfm_demod, 0))
self.connect((self.wfm_demod, 0), (self.audio_out, 0))
class usrp_wbfm_emit_rfx400(gr.top_block):
def __init__(self):
gr.top_block.__init__(self, "USRP WBFM transmit")
##################################################
# Blocks
##################################################
self.audio_out = audio.source(32000, "plughw:0,0", True)
self.multiply = gr.multiply_const_vcc((9000, ))
self.u_sink = grc_usrp.simple_sink_c(which=0, side="A")
self.u_sink.set_interp_rate(400)
self.u_sink.set_frequency(433500000, verbose=True)
self.u_sink.set_gain(0)
self.u_sink.set_enable(True)
self.wbfm_mod = blks2.wfm_tx(
audio_rate=32000,
quad_rate=320000,
tau=50e-6,
max_dev=75e3,
)
##################################################
# Connections
##################################################
self.connect((self.multiply, 0), (self.u_sink, 0))
self.connect((self.wbfm_mod, 0), (self.multiply, 0))
self.connect((self.audio_out, 0), (self.wbfm_mod, 0))
if __name__ == '__main__':
parser = OptionParser(option_class=eng_option, usage="%prog: [options]")
(options, args) = parser.parse_args()
tr = usrp_wbfm_receive_nogui()
tt = usrp_wbfm_emit_rfx400()
while 1:
#tr.start()
#raw_input('Press Enter to emit: ')
#tr.stop()
#tr.wait()
tt.start()
raw_input('Press Enter to stop emitting ')
tt.stop()
tt.wait()
tr.start()
raw_input('Press Enter to emit: ')
tr.stop()
tr.wait()
_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio