Fixing initialization of timing gains. Alpha should be < 1, and beta should be << 1.
[debian/gnuradio] / gnuradio-core / src / python / gnuradio / blks2impl / dbpsk2.py
index e9e3e965fed303dd0664d62dbd7f71eef1df8bba..4541b453b38d6f46efbe229d5152973ac3e44259 100644 (file)
@@ -39,8 +39,8 @@ _def_verbose = False
 _def_log = False
 
 _def_costas_alpha = 0.1
-_def_timing_alpha = None
-_def_timing_beta = None
+_def_timing_alpha = 0.100
+_def_timing_beta = 0.010
 _def_timing_max_dev = 1.5
 
 
@@ -220,7 +220,7 @@ class dbpsk2_demod(gr.hier_block2):
         self._excess_bw = excess_bw
         self._costas_alpha = costas_alpha
         self._timing_alpha = timing_alpha
-        self._timing_beta = _def_timing_alpha
+        self._timing_beta = _def_timing_beta
         self._timing_max_dev=timing_max_dev
         self._gray_code = gray_code
         
@@ -230,26 +230,22 @@ class dbpsk2_demod(gr.hier_block2):
         arity = pow(2,self.bits_per_symbol())
 
         # Automatic gain control
-        #self.agc = gr.agc2_cc(0.6e-1, 1e-3, 1, 1, 100)
-        self.agc = gr.feedforward_agc_cc(16, 1.0)
+        self.agc = gr.agc2_cc(0.6e-1, 1e-3, 1, 1, 100)
+        #self.agc = gr.feedforward_agc_cc(16, 1.0)
 
         self._costas_beta  = 0.25 * self._costas_alpha * self._costas_alpha
-        fmin = -0.25
-        fmax = 0.25
+        # Allow a frequency swing of +/- half of the sample rate
+        fmin = -0.5
+        fmax = 0.5
         
         self.clock_recov = gr.costas_loop_cc(self._costas_alpha,
                                              self._costas_beta,
                                              fmax, fmin, arity)
 
-        # symbol clock recovery
-        if not self._timing_alpha:
-            self._timing_alpha = 2
-            self._timing_beta = 0.020
-            
-        # RRC data filter
-        nfilts = 8
+        # symbol timing recovery with RRC data filter
+        nfilts = 32
         ntaps = 11 * samples_per_symbol*nfilts
-        taps = gr.firdes.root_raised_cosine(nfilts, nfilts, 0.25, self._excess_bw, ntaps)
+        taps = gr.firdes.root_raised_cosine(nfilts, nfilts, 1.0/float(self._samples_per_symbol), self._excess_bw, ntaps)
         self.time_recov = gr.pfb_clock_sync_ccf(self._samples_per_symbol,
                                                 self._timing_alpha,
                                                 taps, nfilts, nfilts/2, self._timing_max_dev)
@@ -277,9 +273,9 @@ class dbpsk2_demod(gr.hier_block2):
         if log:
             self._setup_logging()
 
-        # Connect and Initialize base class
+        # Connect
         self.connect(self, self.agc,
-                     #self.clock_recov,
+                     self.clock_recov,
                      self.time_recov,
                      self.diffdec, self.slicer, self.symbol_mapper, self.unpack, self)
 
@@ -309,8 +305,10 @@ class dbpsk2_demod(gr.hier_block2):
                      gr.file_sink(gr.sizeof_gr_complex, "rx_agc.dat"))
         self.connect(self.rrc_filter,
                      gr.file_sink(gr.sizeof_gr_complex, "rx_rrc_filter.dat"))
-        self.connect(self.receiver,
-                     gr.file_sink(gr.sizeof_gr_complex, "rx_receiver.dat"))
+        self.connect(self.clock_recov,
+                     gr.file_sink(gr.sizeof_gr_complex, "rx_clock_recov.dat"))
+        self.connect(self.time_recov,
+                     gr.file_sink(gr.sizeof_gr_complex, "rx_time_recov.dat"))
         self.connect(self.diffdec,
                      gr.file_sink(gr.sizeof_gr_complex, "rx_diffdec.dat"))        
         self.connect(self.slicer,