discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss-gnuradio] switch between rx and tx


From: Dong Wang
Subject: [Discuss-gnuradio] switch between rx and tx
Date: Fri, 1 Feb 2013 15:38:33 -0500

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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]