discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] USRP2 + WBX: Unable to receive FM signals


From: Elvis Dowson
Subject: Re: [Discuss-gnuradio] USRP2 + WBX: Unable to receive FM signals
Date: Fri, 16 Jul 2010 12:10:33 +0400

Hi Alex,
               
On Jul 16, 2010, at 9:05 AM, Elvis Dowson wrote:

> When I hard-code the value to 32050Hz, the system plays back, but at a slower 
> speed. 

In the previous patch, I missed setting the frequency of the audio sink to the 
rational resampler's output rate as shown in the patch snippet. Once I replaced 
it, it playback worked at the correct frequency.

         # sound card as final sink
-        audio_sink = audio.sink (int (audio_rate),
+        audio_sink = audio.sink (int (output_rate),


Now, there are 2 outstanding issues:

a. If I stop and restart the application, the system becomes unstable, and I 
get a bunch of audio under-runs.

b. If I use the computed audio rate, which according to the code below, results 
in it being 32051 Hz, the system doesn't launch 

         audio_rate = demod_rate / audio_decimation  # ~32 kHz
+        print "audio rate =", audio_rate

I get the following output, and the GUI doesn't launch.

audio rate = 32051
Using RX d'board 0x0053
>>> gr_fir_ccf: using SSE
>>> gr_fir_fff: using SSE
interp = 48000
decim  = 32051

If I hard code the values, and use the default options setting that I just 
added, and use 32050 Hz, the application works. Why is that?

Best regards,

Elvis


PS: Here is the working patch, with the rational resampler after the WFM 
demodulator. In this patch, the rational resampler's audio input_rate is set to 
32050 Hz. Settting to to audio_rate computed from the WFM demodulation block, 
results in 32051 Hz, which doesn't work.


diff --git a/gnuradio-examples/python/usrp2/usrp2_wfm_rcv.py 
b/gnuradio-examples/python/usrp2/usrp2_wfm_rcv.py
index 1783660..8adb845 100755
--- a/gnuradio-examples/python/usrp2/usrp2_wfm_rcv.py
+++ b/gnuradio-examples/python/usrp2/usrp2_wfm_rcv.py
@@ -51,7 +51,10 @@ class wfm_rx_block (stdgui2.std_top_block):
                           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")
-
+        parser.add_option("-i", "--input-rate", type="eng_float", 
default=32050,
+                          help="set input sample rate to RATE (%default)")
+        parser.add_option("-o", "--output-rate", type="eng_float", 
default=48000,
+                          help="set output sample rate to RATE (%default)")
         (options, args) = parser.parse_args()
         if len(args) != 0:
             parser.print_help()
@@ -66,6 +69,7 @@ class wfm_rx_block (stdgui2.std_top_block):
 
         # build graph
         
+        # USRP2 source
         self.u = usrp2.source_32fc(options.interface, options.mac_addr)
 
         adc_rate = self.u.adc_rate()                # 100 MS/s
@@ -76,6 +80,7 @@ class wfm_rx_block (stdgui2.std_top_block):
         demod_rate = usrp_rate / chanfilt_decim
         audio_decimation = 10
         audio_rate = demod_rate / audio_decimation  # ~32 kHz
+        print "audio rate =", audio_rate
 
         #FIXME: need named constants and text descriptions available to 
(gr-)usrp2 even
         #when usrp(1) module is not built.  A usrp_common module, perhaps?
@@ -87,11 +92,13 @@ class wfm_rx_block (stdgui2.std_top_block):
                 dbid == 0x0040 or #usrp_dbid.TV_RX_REV_3
                 dbid == 0x0043 or #usrp_dbid.TV_RX_MIMO
                 dbid == 0x0044 or #usrp_dbid.TV_RX_REV_2_MIMO
-                dbid == 0x0045 ): #usrp_dbid.TV_RX_REV_3_MIMO
+                dbid == 0x0045 or #usrp_dbid.TV_RX_REV_3_MIMO
+                dbid == 0x0053 ): #usrp_dbid.WBX
             print "This daughterboard does not cover the required frequency 
range"
             print "for this application.  Please use a BasicRX or TVRX 
daughterboard."
             raw_input("Press ENTER to continue anyway, or Ctrl-C to exit.")
 
+        # channel filter co-efficients
         chan_filt_coeffs = optfir.low_pass (1,           # gain
                                             usrp_rate,   # sampling rate
                                             80e3,        # passband cutoff
@@ -101,17 +108,32 @@ class wfm_rx_block (stdgui2.std_top_block):
         #print len(chan_filt_coeffs)
         chan_filt = gr.fir_filter_ccf (chanfilt_decim, chan_filt_coeffs)
 
+        # wide-band FM demodulator
         self.guts = blks2.wfm_rcv (demod_rate, audio_decimation)
 
+        # rational resampler
+        input_rate  = int(options.input_rate)       # 32050 Hz default
+        #input_rate  = audio_rate                   # 32051 Hz as computed 
earlier (line 82), but hangs the application
+        output_rate = int(options.output_rate)      # 48 kHz default
+
+        interp = gru.lcm(input_rate, output_rate) / input_rate
+        decim  = gru.lcm(input_rate, output_rate) / output_rate
+
+        print "interp =", interp
+        print "decim  =", decim
+        rr = blks2.rational_resampler_fff(interp, decim)
+
+        # volume control
         self.volume_control = gr.multiply_const_ff(self.vol)
 
         # sound card as final sink
-        audio_sink = audio.sink (int (audio_rate),
+        audio_sink = audio.sink (int (output_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.connect (self.u, chan_filt, self.guts, rr, self.volume_control, 
audio_sink)
+        #self.connect (self.u, chan_filt, self.guts, self.volume_control, 
audio_sink)
 
         self._build_gui(vbox, usrp_rate, demod_rate, audio_rate)
 




reply via email to

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