Ejemplo n.º 1
0
def main():
    gr.enable_realtime_scheduling()
    parser = OptionParser(option_class=eng_option, conflict_handler="resolve")
    (options, args) = parser.parse_args ()
    d = {'verbose': True, 'samples_per_symbol': 2, 'usrpx': None, 'excess_bw': 0.34999999999999998, 'fusb_block_size': 0, 'log': False, 'costas_alpha': 0.14999999999999999, 'bitrate': 100000.0, 'decim': DECIM, 'omega_relative_limit': 0.0050000000000000001, 'fusb_nblocks': 0, 'which': 0, 'rx_subdev_spec': None, 'freq_error': 0.0, 'lo_offset': None, 'modulation': 'gmsk', 'gain_mu': None, 'interface': 'eth0', 'freq': None, 'rx_freq': 2.475e9, 'rx_gain': RXGAIN, 'tx_freq': 2440000000.0, 'mu': 0.5, 'mac_addr': '', 'show_rx_gain_range': True, 'gray_code': True, 'tx_subdev_spec' : None, 'tx_gain' : None, 'show_tx_gain_range': False}
    for i, j in d.items():
        setattr(options, i, j)

    u = usrp_options.create_usrp_source(options)
    adc_rate = u.adc_rate()
    if options.verbose:
        print 'USRP Source:', u
    (_bitrate, _samples_per_symbol, _decim) = \
                    pick_rx_bitrate(options.bitrate, 2, \
                                    options.samples_per_symbol, options.decim, adc_rate,  \
                                    u.get_decim_rates())

    u.set_decim(_decim)

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

    tb = gr.top_block()
    dst = gr.vector_sink_s ()
    dump = gr.file_sink(gr.sizeof_gr_complex, 'packet.dat')
    tb.connect(u, dump)
    tb.run()
Ejemplo n.º 2
0
    def _setup_usrp_source(self, options):
        self.u = usrp_options.create_usrp_source(options)
        adc_rate = self.u.adc_rate()

        self.u.set_decim(self._decim)

        (self._bitrate, self._samples_per_symbol, self._decim) = \
                        pick_rx_bitrate(self._bitrate, self._demod_class.bits_per_symbol(), \
                                        self._samples_per_symbol, self._decim, adc_rate,  \
                                        self.u.get_decim_rates())

        self.u.set_decim(self._decim)
        self.set_auto_tr(True)                 # enable Auto Transmit/Receive switching
Ejemplo n.º 3
0
    def _setup_usrp_source(self, options):
        self.u = usrp_options.create_usrp_source(options)
        adc_rate = self.u.adc_rate()
        if options.verbose:
            print 'USRP Source:', self.u
        (self._bitrate, self._samples_per_symbol, self._decim) = \
                        pick_rx_bitrate(options.bitrate, self._demod_class.bits_per_symbol(), \
                                        options.samples_per_symbol, options.decim, adc_rate,  \
                                        self.u.get_decim_rates())

        self.u.set_decim(self._decim)

        if not self.u.set_center_freq(options.rx_freq):
            print "Failed to set Rx frequency to %s" % (eng_notation.num_to_str(options.rx_freq))
            raise ValueError, eng_notation.num_to_str(options.rx_freq)
Ejemplo n.º 4
0
    def _setup_usrp_source(self, options):
        self.u = usrp_options.create_usrp_source(options)
        adc_rate = self.u.adc_rate()
        if options.verbose:
            print 'USRP Source:', self.u
        (self._bitrate, self._samples_per_symbol, self._decim) = \
                        pick_rx_bitrate(options.bitrate, self._demod_class.bits_per_symbol(), \
                                        options.samples_per_symbol, options.decim, adc_rate,  \
                                        self.u.get_decim_rates())

        self.u.set_decim(self._decim)

        if not self.u.set_center_freq(options.rx_freq):
            print "Failed to set Rx frequency to %s" % (
                eng_notation.num_to_str(options.rx_freq))
            raise ValueError, eng_notation.num_to_str(options.rx_freq)
Ejemplo n.º 5
0
    def _setup_usrp_source(self):
        self.u = usrp.source_c (fusb_block_size=self._fusb_block_size,
                                fusb_nblocks=self._fusb_nblocks)
        adc_rate = self.u.adc_rate()

        # derive values of bitrate, samples_per_symbol, and decim from desired info
        (self._bitrate, self._samples_per_symbol, self._decim) = \
            pick_rx_bitrate(self._bitrate, self._demod_class.bits_per_symbol(), \
                            self._samples_per_symbol, self._decim, adc_rate)

        self.u.set_decim_rate(self._decim)

        # determine the daughterboard subdevice we're using
        if self._rx_subdev_spec is None:
            self._rx_subdev_spec = usrp.pick_rx_subdevice(self.u)
        self.subdev = usrp.selected_subdev(self.u, self._rx_subdev_spec)

        self.u.set_mux(usrp.determine_rx_mux_value(self.u, self._rx_subdev_spec))
Ejemplo n.º 6
0
    def _setup_usrp_source(self):
        self.u = usrp.source_c(self._which,
                               fusb_block_size=self._fusb_block_size,
                               fusb_nblocks=self._fusb_nblocks)
        adc_rate = self.u.adc_rate()

        # derive values of bitrate, samples_per_symbol, and decim from desired info
        (self._bitrate, self._samples_per_symbol, self._decim) = \
            pick_rx_bitrate(self._bitrate, self._demod_class.bits_per_symbol(), \
                            self._samples_per_symbol, self._decim, adc_rate)

        self.u.set_decim_rate(self._decim)

        # determine the daughterboard subdevice we're using
        if self._rx_subdev_spec is None:
            self._rx_subdev_spec = usrp.pick_rx_subdevice(self.u)
        self.subdev = usrp.selected_subdev(self.u, self._rx_subdev_spec)

        self.u.set_mux(
            usrp.determine_rx_mux_value(self.u, self._rx_subdev_spec))