On 06/03/2011 04:02 PM, Brenden Smith wrote:
Hello everyone, I am new to GNU Radio and the USRP2, but I have been playing around and have successfully made a FM receiver. I have a few questions:Any GigaBit card supported by Linux is supported by UHD/GnuRadio. Some are better than others--the cheaper ones tend to have poorer buffering and lousier interrupt-aggregation support, but at low bandwidths, it shouldn't be a problem.1) When I am receiving AM radio frequencies and demodulating them with the AM demod block I get no audio period, no static, nothing. The only thing I get is clicking when I try to up the volume to a point past what the sound card can play. Is there something silly I am missing that isn't allowing me to hear the AM radio: here is my block diagram:USRP2 Source ==> Throttle to 250k ==> Low Pass Filter (Decimation of 5 and a variable cutoff and width) ==> Rational Resampler (Decimation: 500, Interpolation 441) ==> AGC2 (Attack Rate: 100m, Decay Rate: 10u, Reference: 900m, Gain & Max Gain: 1) ==> Am Demod (Channel Rate 44.1k, Audio pass: 5k, Audio stop: 5.5k) ==> Multiply Const (volume adjust) ==> Audio Sink (Sample rate: 44.1kHz)2) I am intending to build a setup that includes a headless computer and the USRP2 packaged together, when looking at PCs what gigabit ethernet cards are supported (or is it any supported by the linux kernel), and if the clock speeds on the computer (in the buses, cpu, etc.) are as fast as or faster than the clock speed of the USRP2 I shouldn't run into any trouble processing the data, correct? I only ask to make sure before I order the computer.
But I'm afraid that you're badly confused about the CPU cycles required compared to the clock-rate of the USRP2.
Basically, the number of MIPS (Millions of Instructions Per Second) is proportional to:
bandwidth(samples/sec) X inherent-complexity-of-processingSo, for a signal that is 200Ksps (as the example I've attached), if you only needed to do one intrinsic CPU operation per sample, you'd need a 200KHz CPU. But, of course, you may end up executing hundreds to thousands of instructions for each sample, which is why the faster your CPU the better, although multiple-cores also helps in Gnu Radio, since it schedules blocks in parallel "threads", and this will often help. Furthermore, most CPUs these days, on average, complete more than one instruction per nominal clock cycle, so relating the CPU clock frequency to incoming sample rate is a very imprecise business indeed.
I've attached my rendition of a simple AM receiver which has a couple of "diagnostic" FFTs, audio output using the "plughw" ALSA device, and an audio output "scope". Use it in good health. The AGC2 parameters I used worked well for a similar receiver I did last summer for listening to narrowband 27MHz CB signals. This flow-graph drives the audio subsystem at 20KHz, derived from the 200KHz incoming sample rate from the USRP2. Using the "plughw" device will arrange for ALSA to do re-sampling internally, and eliminate the requirement to do that
in the flow-graph.Your flow-graph looks reasonably sane, but there's *NO* reason to put a throttle block in there at all--since the hardware at *both* ends of
your flow-graph will inherently "throttle" the stream. -- Marcus Leech Principal Investigator Shirleys Bay Radio Astronomy Consortium http://www.sbrac.org
bcband_am_receiver.grc
Description: application/gnuradio-grc
#!/usr/bin/env python ################################################## # Gnuradio Python Flow Graph # Title: Bcband Am Receiver # Generated: Fri Jun 3 20:06:49 2011 ################################################## from gnuradio import audio from gnuradio import eng_notation from gnuradio import gr from gnuradio import uhd from gnuradio import window from gnuradio.eng_option import eng_option from gnuradio.gr import firdes from gnuradio.wxgui import fftsink2 from gnuradio.wxgui import forms from gnuradio.wxgui import scopesink2 from grc_gnuradio import wxgui as grc_wxgui from optparse import OptionParser import wx class bcband_am_receiver(grc_wxgui.top_block_gui): def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="Bcband Am Receiver") _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png" self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY)) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 200e3 self.frequency = frequency = 680 ################################################## # Blocks ################################################## _frequency_sizer = wx.BoxSizer(wx.VERTICAL) self._frequency_text_box = forms.text_box( parent=self.GetWin(), sizer=_frequency_sizer, value=self.frequency, callback=self.set_frequency, label='frequency', converter=forms.float_converter(), proportion=0, ) self._frequency_slider = forms.slider( parent=self.GetWin(), sizer=_frequency_sizer, value=self.frequency, callback=self.set_frequency, minimum=500, maximum=1600, num_steps=200, style=wx.SL_HORIZONTAL, cast=float, proportion=1, ) self.Add(_frequency_sizer) self.wxgui_scopesink2_0 = scopesink2.scope_sink_f( self.GetWin(), title="Demod Audio", sample_rate=int(samp_rate/10), v_scale=0, v_offset=0, t_scale=0, ac_couple=False, xy_mode=False, num_inputs=1, trig_mode=gr.gr_TRIG_MODE_AUTO, y_axis_label="Counts", ) self.Add(self.wxgui_scopesink2_0.win) self.wxgui_fftsink2_0_0 = fftsink2.fft_sink_c( self.GetWin(), baseband_freq=0, y_per_div=10, y_divs=10, ref_level=50, ref_scale=2.0, sample_rate=samp_rate/10, fft_size=1024, fft_rate=5, average=True, avg_alpha=0.250, title="Pre-detector Bandpass", peak_hold=False, ) self.Add(self.wxgui_fftsink2_0_0.win) self.wxgui_fftsink2_0 = fftsink2.fft_sink_c( self.GetWin(), baseband_freq=frequency*1.0e3, y_per_div=10, y_divs=10, ref_level=50, ref_scale=2.0, sample_rate=samp_rate, fft_size=1024, fft_rate=5, average=True, avg_alpha=0.250, title="Input Band", peak_hold=False, ) self.Add(self.wxgui_fftsink2_0.win) self.uhd_usrp_source_0 = uhd.usrp_source( device_addr="addr=192.168.10.2", io_type=uhd.io_type.COMPLEX_FLOAT32, num_channels=1, ) self.uhd_usrp_source_0.set_subdev_spec("0:A", 0) self.uhd_usrp_source_0.set_samp_rate(samp_rate) self.uhd_usrp_source_0.set_center_freq(frequency*1.0e3, 0) self.uhd_usrp_source_0.set_gain(0, 0) self.gr_complex_to_mag_squared_0 = gr.complex_to_mag_squared(1) self.gr_agc2_xx_0 = gr.agc2_ff(0.05, 0.05, 0.3, 1.0, 1.0) self.band_pass_filter_1 = gr.fir_filter_fff(1, firdes.band_pass( 1, samp_rate/10, 50, 5000, 250, firdes.WIN_HAMMING, 6.76)) self.band_pass_filter_0 = gr.fir_filter_ccf(10, firdes.band_pass( 1, samp_rate, -3.0e3, 3.0e3, 300, firdes.WIN_HAMMING, 6.76)) self.audio_sink_0 = audio.sink(int(samp_rate/10), "plughw:0,0", False) ################################################## # Connections ################################################## self.connect((self.uhd_usrp_source_0, 0), (self.band_pass_filter_0, 0)) self.connect((self.band_pass_filter_0, 0), (self.gr_complex_to_mag_squared_0, 0)) self.connect((self.gr_agc2_xx_0, 0), (self.audio_sink_0, 0)) self.connect((self.gr_complex_to_mag_squared_0, 0), (self.band_pass_filter_1, 0)) self.connect((self.band_pass_filter_1, 0), (self.gr_agc2_xx_0, 0)) self.connect((self.uhd_usrp_source_0, 0), (self.wxgui_fftsink2_0, 0)) self.connect((self.band_pass_filter_0, 0), (self.wxgui_fftsink2_0_0, 0)) self.connect((self.band_pass_filter_1, 0), (self.wxgui_scopesink2_0, 0)) def get_samp_rate(self): return self.samp_rate def set_samp_rate(self, samp_rate): self.samp_rate = samp_rate self.uhd_usrp_source_0.set_samp_rate(self.samp_rate) self.wxgui_fftsink2_0.set_sample_rate(self.samp_rate) self.band_pass_filter_0.set_taps(firdes.band_pass(1, self.samp_rate, -3.0e3, 3.0e3, 300, firdes.WIN_HAMMING, 6.76)) self.wxgui_fftsink2_0_0.set_sample_rate(self.samp_rate/10) self.band_pass_filter_1.set_taps(firdes.band_pass(1, self.samp_rate/10, 50, 5000, 250, firdes.WIN_HAMMING, 6.76)) self.wxgui_scopesink2_0.set_sample_rate(int(self.samp_rate/10)) def get_frequency(self): return self.frequency def set_frequency(self, frequency): self.frequency = frequency self._frequency_slider.set_value(self.frequency) self._frequency_text_box.set_value(self.frequency) self.uhd_usrp_source_0.set_center_freq(self.frequency*1.0e3, 0) self.wxgui_fftsink2_0.set_baseband_freq(self.frequency*1.0e3) if __name__ == '__main__': parser = OptionParser(option_class=eng_option, usage="%prog: [options]") (options, args) = parser.parse_args() tb = bcband_am_receiver() tb.Run(True)
_______________________________________________ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org https://lists.gnu.org/mailman/listinfo/discuss-gnuradio