Forum: GNU Radio switch between rx and tx

Posted by Dong Wang (Guest)
on 2013-02-01 21:44
(Received via mailing list)
Hi everyone

I want to make a receiver that can send the received data back to the
transmitter.
So I defined my top block as follows:

class my_top_block(gr.top_block):
    def __init__(self, modulator, demodulator, rx_callback, options):
        gr.top_block.__init__(self)
    options.tx_freq=24e8
    options.rx_freq=25e8
    options.bitrate=5e5
    options.tx_gain=17.5
    options.rx_gain=49.5

        # Get the modulation's bits_per_symbol
        args = modulator.extract_kwargs_from_options(options)
        symbol_rate = options.bitrate /
modulator(**args).bits_per_symbol()

        self.sink = uhd_transmitter(options.args, symbol_rate,
                                    options.samples_per_symbol,
                                    options.tx_freq, options.tx_gain,
                                    options.spec, options.antenna,
                                    options.verbose)

        self.source = uhd_receiver(options.args, symbol_rate,
                                   options.samples_per_symbol,
                                   options.rx_freq, options.rx_gain,
                                   options.spec, options.antenna,
                                   options.verbose)
        options.samples_per_symbol = self.source._sps

        self.txpath = transmit_path(modulator, options)
        self.rxpath = receive_path(demodulator, rx_callback, options)

        self.connect(self.txpath, self.sink)
        self.connect(self.source, self.rxpath)


The problem is that if I define self.source after self.sink, I can only
receive data, while if I define self.sink after self.source, I can only
send data.
My device is USRP N210.

Best regards!

Dong Wang
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.