discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] DBSRx set gain code


From: Lee Patton
Subject: Re: [Discuss-gnuradio] DBSRx set gain code
Date: Thu, 22 Dec 2005 10:48:43 -0500

On Wed, 2005-12-21 at 23:02 -0800, Matt Ettus wrote:
> Lee Patton wrote:
> > I don't understand why the gain range returned by the DBSRx ranges from
> > 0 to 104 when the PGA gives only 0 to 20 dB.  Obviously, the answer lies
> > in db_dbs_rx.py, but I haven't a clue as to what the code is really
> > doing.  Can anyone (Eric) explain?  I read about Registers 2/3 in the
> > AD9862 data sheet, but I couldn't correlate that information with the
> > code.
> > 
> 
> There are 2 components to gain control in the RX daughterboards:
> 

Thanks. Matt. I didn't realize there were variable gain amps on the
daughterboards. 

> 1>  The PGA gain, which ranges from 0-20 dB in 1 dB steps
> 
> 2>  The gain control amplifiers on the daughterboard itself.
> 
> On the BasicRX there is no amplification, so you just get the PGA
> 
> On the dbsrx there are 2 variable gain amps.  One is controlled by an
> analog signal from the low-speed DAC output.  The other is controlled
> digitally over the I2C port.
> 

After looking at the data sheets for all components on the DBSRX, I
gather that the RF LNA and IF low-pass filter gain control, both of
which are in the MAX2118, are the two variable gain amps to which you
are referring. Is that correct?

I quote from the data sheet:

"Each IC includes an LNA with gain control, I and Q
downconverting mixers, and baseband lowpass filters
gain and cutoff frequency control. Together, the RF and
baseband variable gain amplifiers provide more than
79dB of gain control range."

daughterboard gain (79dB) + PGA gain (20dB) = 99dB. The DBSRX returns
104dB. Where does the extra 5dB of programmable gain come from? (It
looks like it is the "dl" variable in your code, but I don't know what
that corresponds to. Please see below)


> On the TVRX there are separate IF and RF AGC amps, both are controlled
> by the low-speed DACs
> 
> The FlexRF has a single AGC amp, again controlled by the low-speed DAC.
> 
> Matt
> 


To minimize noise, I would assume that when setting the gain it is
preferable to fist max out the RF LNA, then the IF gain control, and
finally the PGA.  Is that correct?

Would you please add some comments to the following code snippet from
db_dbs_rx.py?  After looking at the MAX2118 data sheet, I am starting to
recognize your variables like gc1 and gc2, but I would appreciate your
insight.



    181     # Gain setting
    182     def _set_dl(self,dl):
    183         assert dl == 0 or dl == 1
    184         self.dl = dl
    185         self._send_reg(4)
    186
    187     def _set_gc2(self,gc2):
    188         assert gc2<32 and gc2>=0
    189         self.gc2 = gc2
    190         self._send_reg(5)
    191
    192     def _set_gc1(self,gc1):
    193         assert gc1>=0 and gc1<4096
    194         self.gc1 = gc1
    195         self._u.write_aux_dac(self._which,0,int(gc1))
    196
    197     def _set_pga(self, pga_gain):
    198         assert pga_gain >=0 and pga_gain <=20
    199         if(self._which == 0):
    200             self._u.set_pga (0, pga_gain)
    201             self._u.set_pga (1, pga_gain)
    202         else:
    203             self._u.set_pga (2, pga_gain)
    204             self._u.set_pga (3, pga_gain)
    205
    206     def gain_range(self):
    207         return (0, 104, 1)
    208
    209     def set_gain(self,gain):
    210         if not (gain>=0 and gain<105):
    211             raise ValueError, "gain out of range"
    212         gc1 = 0
    213         gc2 = 0
    214         dl = 0
    215         pga = 0
    216         if gain <56:
    217             gc1 = int((-gain*1.85/56 + 2.6)*4096/3.3)
    218             gain = 0
    219         else:
    220             gc1 = 0
    221             gain = gain - 56
    222         if gain < 24:
    223             gc2 = int(round(31 * (1-gain/24)))
    224             gain = 0
    225         else:
    226             gc2 = 0
    227             gain = gain - 24
    228         if gain >= 4.58:
    229             dl = 1
    230             gain = gain - 4.58
    231         pga = gain
    232         print "Gain %f" % pga
    233         self._set_gc1(gc1)
    234         self._set_gc2(gc2)
    235         self._set_dl(dl)
    236         self._set_pga(pga)
    237

Thanks,
 - Lee





reply via email to

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