Beispiel #1
0
    def __init__(self, address, options):
        gr.top_block.__init__(self)

        # Extract the initial options
        self.frequency = options.frequency
        self.filename  = options.filename
        self.decim     = options.decim
        self.gain      = options.gain
        self.address   = address

        # Set up and initialize the MSDD receiver
        self.port = 10001 # required port
        self.src = msdd.source_c(0, 1, self.address, self.port)
        self.src.set_decim_rate(self.decim)
        self.src.set_desired_packet_size(0, 1460)
        self.src.set_pga(0, self.gain)
        self.src.set_rx_freq(0, self.frequency)

        # Display some info
        print "Min PGA: ", self.src.pga_min()
        print "Max PGA: ", self.src.pga_max()
        print "PGA:     ", self.src.pga(0)
        print "Decim:   ", self.src.decim_rate()
        print "Freq:    ", self.src.rx_freq(0)
        
        # Build a file sink to save the info for post analysis
        self.snk = gr.file_sink(gr.sizeof_gr_complex, self.filename)

        # Connect the reciever source to file sink
        self.connect(self.src, self.snk)
Beispiel #2
0
    def __init__(self, address, options):
        gr.top_block.__init__(self)

        # Extract the initial options
        self.frequency = options.frequency
        self.filename = options.filename
        self.decim = options.decim
        self.gain = options.gain
        self.address = address

        # Set up and initialize the MSDD receiver
        self.port = 10001  # required port
        self.src = msdd.source_c(0, 1, self.address, self.port)
        self.src.set_decim_rate(self.decim)
        self.src.set_desired_packet_size(0, 1460)
        self.src.set_pga(0, self.gain)
        self.src.set_rx_freq(0, self.frequency)

        # Display some info
        print "Min PGA: ", self.src.pga_min()
        print "Max PGA: ", self.src.pga_max()
        print "PGA:     ", self.src.pga(0)
        print "Decim:   ", self.src.decim_rate()
        print "Freq:    ", self.src.rx_freq(0)

        # Build a file sink to save the info for post analysis
        self.snk = gr.file_sink(gr.sizeof_gr_complex, self.filename)

        # Connect the reciever source to file sink
        self.connect(self.src, self.snk)
Beispiel #3
0
    def _setup_source(self):
        # build graph
        self._port = 10001
        self.src = msdd.source_c(0, 1, self._address, self._port)
        self.src.set_decim_rate(self._decim)
        self.src.set_desired_packet_size(0, 1460)

        self.set_gain(self._rx_gain)
        self.set_freq(self._rx_freq)
Beispiel #4
0
    def _setup_source(self):
        # build graph
        self._port = 10001
        self.src = msdd.source_c(0, 1, self._address, self._port)
        self.src.set_decim_rate(self._decim)
        self.src.set_desired_packet_size(0, 1460)

        self.set_gain(self._rx_gain)
        self.set_freq(self._rx_freq)
Beispiel #5
0
    def __init__(self, frame, panel, vbox, argv):
        stdgui2.std_top_block.__init__(self, frame, panel, vbox, argv)

        parser = OptionParser(option_class=eng_option)
        #        parser.add_option("-R", "--rx-subdev-spec", type="subdev", default=None,
        #                          help="select MSDD Rx side A or B (default=A)")
        parser.add_option("-f",
                          "--freq",
                          type="eng_float",
                          default=100.1e6,
                          help="set frequency to FREQ",
                          metavar="FREQ")
        parser.add_option("-g",
                          "--gain",
                          type="eng_float",
                          default=40,
                          help="set gain in dB (default is midpoint)")
        #        parser.add_option("-V", "--volume", type="eng_float", default=None,
        #                          help="set volume (default is midpoint)")
        #        parser.add_option("-O", "--audio-output", type="string", default="",
        #                          help="pcm device name.  E.g., hw:0,0 or surround51 or /dev/dsp")

        (options, args) = parser.parse_args()
        if len(args) != 0:
            parser.print_help()
            sys.exit(1)

        self.frame = frame
        self.panel = panel

        self.vol = 0
        self.gain_range = (10, 70, .5)
        self.state = "FREQ"
        self.freq = 0
        msdd_decim = 2

        # build graph
        self.fft_size = 8192
        self.sample_rate = 200
        self.u = msdd.source_c(0, 1, "10.45.4.44", 10000)
        self.u.set_decim_rate(4)
        self.u.set_desired_packet_size(0, 1460 * 100)

        #self.u.set_decim_rate(msdd_decim)
        #        usrp_rate = adc_rate / msdd_decim           # 320 kS/s
        #        chanfilt_decim = 1
        #        demod_rate = usrp_rate / chanfilt_decim
        #        audio_decimation = 10
        #        audio_rate = demod_rate / audio_decimation  # 32 kHz
        #
        #        if options.rx_subdev_spec is None:
        #            options.rx_subdev_spec = pick_subdevice(self.u)
        #
        #        self.u.set_mux(usrp.determine_rx_mux_value(self.u, options.rx_subdev_spec))
        #        self.subdev = usrp.selected_subdev(self.u, options.rx_subdev_spec)
        #        print "Using RX d'board %s" % (self.subdev.side_and_name(),)
        #
        #
        #        chan_filt_coeffs = optfir.low_pass (1,           # gain
        #                                            usrp_rate,   # sampling rate
        #                                            80e3,        # passband cutoff
        #                                            115e3,       # stopband cutoff
        #                                            0.1,         # passband ripple
        #                                            60)          # stopband attenuation
        #        #print len(chan_filt_coeffs)
        #        chan_filt = gr.fir_filter_ccf (chanfilt_decim, chan_filt_coeffs)
        #
        #        self.guts = blks2.wfm_rcv (demod_rate, audio_decimation)
        #
        #        self.volume_control = gr.multiply_const_ff(self.vol)
        #
        #        # sound card as final sink
        #        audio_sink = audio.sink (int (audio_rate),
        #                                 options.audio_output,
        #                                 False)  # ok_to_block

        # now wire it all together
        #self.connect (self.u, chan_filt, self.guts, self.volume_control, audio_sink)

        self._build_gui(vbox)

        if options.gain is None:
            # if no gain was specified, use the mid-point in dB
            #g = self.subdev.gain_range()
            g = self.gain_range
            options.gain = float(g[0] + g[1]) / 2
#
#        if options.volume is None:
#            g = self.volume_range()
#            options.volume = float(g[0]+g[1])/2
#
#        if abs(options.freq) < 1e6:
#            options.freq *= 1e6

# set initial values
#
        self.set_gain(options.gain)
        #        self.set_vol(options.volume)
        if not (self.set_freq(options.freq)):
            self._set_status_msg("Failed to set initial frequency")
        print "Frequency: ", self.u.rx_freq(0)
Beispiel #6
0
    def __init__(self,frame,panel,vbox,argv):
        stdgui2.std_top_block.__init__ (self,frame,panel,vbox,argv)

        parser=OptionParser(option_class=eng_option)        
#        parser.add_option("-R", "--rx-subdev-spec", type="subdev", default=None,
#                          help="select MSDD Rx side A or B (default=A)")
        parser.add_option("-f", "--freq", type="eng_float", default=100.1e6,
                          help="set frequency to FREQ", metavar="FREQ")
        parser.add_option("-g", "--gain", type="eng_float", default=40,
                          help="set gain in dB (default is midpoint)")
#        parser.add_option("-V", "--volume", type="eng_float", default=None,
#                          help="set volume (default is midpoint)")
#        parser.add_option("-O", "--audio-output", type="string", default="",
#                          help="pcm device name.  E.g., hw:0,0 or surround51 or /dev/dsp")

        (options, args) = parser.parse_args()
        if len(args) != 0:
            parser.print_help()
            sys.exit(1)
        
        self.frame = frame
        self.panel = panel
        
        self.vol = 0
        self.gain_range = (10, 70, .5)
        self.state = "FREQ"
        self.freq = 0
        msdd_decim = 2

        # build graph
        self.fft_size = 8192
        self.sample_rate = 200
        self.u = msdd.source_c(0, 1, "10.45.4.44", 10000)
        self.u.set_decim_rate(4)
        self.u.set_desired_packet_size(0, 1460*100)        


        #self.u.set_decim_rate(msdd_decim)
#        usrp_rate = adc_rate / msdd_decim           # 320 kS/s
#        chanfilt_decim = 1
#        demod_rate = usrp_rate / chanfilt_decim
#        audio_decimation = 10
#        audio_rate = demod_rate / audio_decimation  # 32 kHz
#
#        if options.rx_subdev_spec is None:
#            options.rx_subdev_spec = pick_subdevice(self.u)
#
#        self.u.set_mux(usrp.determine_rx_mux_value(self.u, options.rx_subdev_spec))
#        self.subdev = usrp.selected_subdev(self.u, options.rx_subdev_spec)
#        print "Using RX d'board %s" % (self.subdev.side_and_name(),)
#
#
#        chan_filt_coeffs = optfir.low_pass (1,           # gain
#                                            usrp_rate,   # sampling rate
#                                            80e3,        # passband cutoff
#                                            115e3,       # stopband cutoff
#                                            0.1,         # passband ripple
#                                            60)          # stopband attenuation
#        #print len(chan_filt_coeffs)
#        chan_filt = gr.fir_filter_ccf (chanfilt_decim, chan_filt_coeffs)
#
#        self.guts = blks2.wfm_rcv (demod_rate, audio_decimation)
#
#        self.volume_control = gr.multiply_const_ff(self.vol)
#
#        # sound card as final sink
#        audio_sink = audio.sink (int (audio_rate),
#                                 options.audio_output,
#                                 False)  # ok_to_block
        
        # now wire it all together
        #self.connect (self.u, chan_filt, self.guts, self.volume_control, audio_sink)

        self._build_gui(vbox)

        if options.gain is None:
            # if no gain was specified, use the mid-point in dB
            #g = self.subdev.gain_range()
            g = self.gain_range
            options.gain = float(g[0]+g[1])/2
#
#        if options.volume is None:
#            g = self.volume_range()
#            options.volume = float(g[0]+g[1])/2
#            
#        if abs(options.freq) < 1e6:
#            options.freq *= 1e6

        # set initial values
#
        self.set_gain(options.gain)
#        self.set_vol(options.volume)
        if not(self.set_freq(options.freq)):
            self._set_status_msg("Failed to set initial frequency")
        print "Frequency: ", self.u.rx_freq(0)