commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] gr-usrp/src db_tv_rx.py


From: Matt Ettus
Subject: [Commit-gnuradio] gr-usrp/src db_tv_rx.py
Date: Sun, 18 Jun 2006 05:11:13 +0000

CVSROOT:        /sources/gnuradio
Module name:    gr-usrp
Changes by:     Matt Ettus <mettus>     06/06/18 05:11:13

Modified files:
        src            : db_tv_rx.py 

Log message:
        fixed a VERY longstanding bug having to do with setting freq on TVRX2
        and 3

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gr-usrp/src/db_tv_rx.py?cvsroot=gnuradio&r1=1.7&r2=1.8

Patches:
Index: db_tv_rx.py
===================================================================
RCS file: /sources/gnuradio/gr-usrp/src/db_tv_rx.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- db_tv_rx.py 7 Jun 2006 05:03:28 -0000       1.7
+++ db_tv_rx.py 18 Jun 2006 05:11:13 -0000      1.8
@@ -60,7 +60,7 @@
     return c
 
 class db_tv_rx(db_base.db_base):
-    def __init__(self, usrp, which, second_if, inverted):
+    def __init__(self, usrp, which, first_IF, second_IF):
         """
         Control Microtune 4937 based USRP daughterboard.
         
@@ -73,11 +73,11 @@
 
         self._i2c_addr = (0x60, 0x61)[which]
 
-        self._first_IF = 43.75e6
-        self._second_IF = second_if
+        self._first_IF = first_IF
+        self._second_IF = second_IF
         self._reference_divisor = 640
         self._fast_tuning = False
-        self._inverted = inverted
+        self._inverted = False      # FIXME get rid of this
         
         g = self.gain_range()                  # initialize gain
         self.set_gain(float(g[0]+g[1]) / 2)
@@ -136,7 +136,7 @@
         self._set_pga(pgagain)
         
     def freq_range(self):
-        return (50e6, 900e6, 10e3)
+        return (50e6, 860e6, 10e3)
 
     def set_freq(self, target_freq):
         """
@@ -148,11 +148,12 @@
         if target_freq < r[0] or target_freq > r[1]:
             return (False, 0)
         
-        target_f_osc = target_freq + self._first_IF;
-        f_ref = 4e6 / self._reference_divisor
+        target_lo_freq = target_freq + self._first_IF;  # High side mixing
+        f_ref = 4e6 / self._reference_divisor   # frequency steps
 
-        divisor = int((target_f_osc + (f_ref * 4)) / (f_ref * 8))
-        actual_freq = (f_ref * 8 * divisor) - self._first_IF
+        divisor = int((target_lo_freq + (f_ref * 4)) / (f_ref * 8))  
+        actual_lo_freq = (f_ref * 8 * divisor)
+        actual_freq = actual_lo_freq - self._first_IF;
 
         if (divisor & ~0x7fff) != 0:           # must be 15-bits or less
             return (False, 0)
@@ -186,12 +187,12 @@
 
 # With MT4937DI5-3x7702 with second downconversion
 db_instantiator.add(usrp_dbid.TV_RX,
-                    lambda usrp, which : (db_tv_rx(usrp, which, 5.75e6, 
False),))
+                    lambda usrp, which : (db_tv_rx(usrp, which, 43.75e6, 
5.75e6),))
 
 # With MT4937DI5-3x8680, and 3x8769 without second downconversion
 db_instantiator.add(usrp_dbid.TV_RX_REV_2,
-                    lambda usrp, which : (db_tv_rx(usrp, which, 43.75e6, 
True),))
+                    lambda usrp, which : (db_tv_rx(usrp, which, 44e6, 20e6),))
 
 # With MT4937DI5-3x7901 without second downconversion, basically the same as 
tvrx2
 db_instantiator.add(usrp_dbid.TV_RX_REV_3,
-                    lambda usrp, which : (db_tv_rx(usrp, which, 43.75e6, 
True),))
+                    lambda usrp, which : (db_tv_rx(usrp, which, 44e6, 20e6),))




reply via email to

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