Exemplo n.º 1
0
def main():
    gr.enable_realtime_scheduling()
    tb = gr.top_block ()
    src = gr.file_source(gr.sizeof_gr_complex, "transmit-data.dat", True)
    parser = OptionParser(option_class=eng_option, conflict_handler="resolve")
    (options, args) = parser.parse_args ()
    d = {'verbose': True, 'discontinuous': False, 'samples_per_symbol': 2, 'usrpx': None, 'interp': INTERP, 'fusb_block_size': 0, 'megabytes': 1.0, 'rx_freq': 2.475e9, 'size': 1500, 'show_tx_gain_range': False, 'log': False, 'tx_subdev_spec': None, 'fusb_nblocks': 0, 'lo_offset': None, 'tx_gain': TXGAIN, 'which': 0, 'modulation': 'gmsk', 'excess_bw': 0.34999999999999998, 'bt': 0.34999999999999998, 'interface': 'eth0', 'freq': None, 'bitrate': 100000.0, 'from_file': None, 'tx_freq': 2475000000.0, 'mac_addr': '', 'tx_amplitude': 0.1, 'gray_code': True}
    for i, j in d.items():
        setattr(options, i, j)

    u = usrp_options.create_usrp_sink(options)
    dac_rate = u.dac_rate()
    if options.verbose:
        print 'USRP Sink:', u
    (_bitrate, _samples_per_symbol, _interp) = \
                    pick_tx_bitrate(options.bitrate, 2, \
                                    options.samples_per_symbol, options.interp, dac_rate, \
                                    u.get_interp_rates())

    u.set_interp(_interp)
    u.set_auto_tr(True)

    if not u.set_center_freq(options.tx_freq):
        print "Failed to set Rx frequency to %s" % (eng_notation.num_to_str(options.tx_freq))
        raise ValueError, eng_notation.num_to_str(options.tx_freq)
    
    m = gr.multiply_const_cc(CONSTANT)
    tb.connect(src, m, u)


    tb.run()
Exemplo n.º 2
0
 def _setup_sink(self, options):
     self.sink = usrp_options.create_usrp_sink(options)
     dac_rate = self.sink.dac_rate()
     if options.verbose:
         print 'USRP Sink:', self.sink
     self._interp = options.interp
     self.sink.set_interp(self._interp)
     self._sample_rate = options.sample_rate
     self.sink.set_samp_rate(self._sample_rate)
     self.sink.set_auto_tr(True)
     self._bandwidth = options.bandwidth
     self.sink.set_bandwidth(self._bandwidth)
     if not self.sink.set_center_freq(options.tx_freq):
         print "Failed to set Tx frequency to %s" % (eng_notation.num_to_str(options.tx_freq))
         raise ValueError, eng_notation.num_to_str(options.tx_freq)
Exemplo n.º 3
0
    def _setup_usrp_sink(self, options):
        """
        Creates a USRP sink, determines the settings for best bitrate,
        and attaches to the transmitter's subdevice.
        """
        self.u = usrp_options.create_usrp_sink(options)
        dac_rate = self.u.dac_rate()
        if options.verbose:
            print 'USRP Sink:', self.u
        (self._bitrate, self._samples_per_symbol, self._interp) = \
                        pick_tx_bitrate(options.bitrate, self._modulator_class.bits_per_symbol(), \
                                        options.samples_per_symbol, options.interp, dac_rate, \
                                        self.u.get_interp_rates())

        self.u.set_interp(self._interp)
        self.u.set_auto_tr(True)

        if not self.u.set_center_freq(options.tx_freq):
            print "Failed to set Rx frequency to %s" % (eng_notation.num_to_str(options.tx_freq))
            raise ValueError, eng_notation.num_to_str(options.tx_freq)