Forum: GNU Radio bug with gain setting in usrp1?

7582f404751c7d2b331b707bc01c564a?d=identicon&s=25 Wolfgang Buesser (Guest)
on 2013-05-29 18:31
(Received via mailing list)
Hi,
I am having problems with the gain-settings on the RX-channels of usrp1
My USRP1 is populated with 2 LFRX and 2 LFTX.

I want to use 2 DDC-channels each connect to one 2 ADC of LF-RX-Board A.
I have generated the following code with grc.

When  apply a signal of roughly 11MHz I see the mixed signals on each
scope.
The relation to the inputs is o.k.

The gain-settings are however not as I expect:
self.uhd_usrp_source_0.set_gain(6, 1) affects both channels while
self.uhd_usrp_source_0.set_gain(6, 0 has no effect.

From what I rememeber that was different in the pre-uhd-times.

Any hint, on how I can set the gains for both channels independently?

Thanks

Wolfgang

#!/usr/bin/env python
##################################################
# Gnuradio Python Flow Graph
# Title: Top Block
# Generated: Wed May 29 18:17:11 2013
##################################################

from gnuradio import eng_notation
from gnuradio import gr
from gnuradio import uhd
from gnuradio.eng_option import eng_option
from gnuradio.gr import firdes
from gnuradio.wxgui import scopesink2
from grc_gnuradio import wxgui as grc_wxgui
from optparse import OptionParser
import wx

class top_block(grc_wxgui.top_block_gui):

        def __init__(self):
                grc_wxgui.top_block_gui.__init__(self, title="Top
Block")
                _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 = 500000

                ##################################################
                # Blocks
                ##################################################
                self.wxgui_scopesink2_0_0 = scopesink2.scope_sink_c(
                        self.GetWin(),
                        title="Scope Plot1",
                        sample_rate=samp_rate,
                        v_scale=0,
                        v_offset=0,
                        t_scale=4e-6,
                        ac_couple=True,
                        xy_mode=False,
                        num_inputs=1,
                        trig_mode=gr.gr_TRIG_MODE_NORM,
                        y_axis_label="Counts",
                )
                self.Add(self.wxgui_scopesink2_0_0.win)
                self.wxgui_scopesink2_0 = scopesink2.scope_sink_c(
                        self.GetWin(),
                        title="Scope Plot0",
                        sample_rate=samp_rate,
                        v_scale=0,
                        v_offset=0,
                        t_scale=4e-6,
                        ac_couple=True,
                        xy_mode=False,
                        num_inputs=1,
                        trig_mode=gr.gr_TRIG_MODE_NORM,
                        y_axis_label="Counts",
                )
                self.Add(self.wxgui_scopesink2_0.win)
                self.uhd_usrp_source_0 = uhd.usrp_source(
                        device_addr="serial=47432785",
                        stream_args=uhd.stream_args(
                                cpu_format="fc32",
                                channels=range(2),
                        ),
                )
                self.uhd_usrp_source_0.set_clock_source("gpsdo", 0)
                self.uhd_usrp_source_0.set_time_source("gpsdo", 0)
                self.uhd_usrp_source_0.set_subdev_spec("A:A A:B", 0)
                self.uhd_usrp_source_0.set_samp_rate(samp_rate)
                self.uhd_usrp_source_0.set_center_freq(11e6, 0)
                self.uhd_usrp_source_0.set_gain(0, 0)
                self.uhd_usrp_source_0.set_center_freq(11e6, 1)
                self.uhd_usrp_source_0.set_gain(6, 1)

                ##################################################
                # Connections
                ##################################################
                self.connect((self.uhd_usrp_source_0, 0),
(self.wxgui_scopesink2_0, 0))
                self.connect((self.uhd_usrp_source_0, 1),
(self.wxgui_scopesink2_0_0, 0))

        def get_samp_rate(self):
                return self.samp_rate

        def set_samp_rate(self, samp_rate):
                self.samp_rate = samp_rate
                self.wxgui_scopesink2_0_0.set_sample_rate(self.samp_rate)
                self.wxgui_scopesink2_0.set_sample_rate(self.samp_rate)
                self.uhd_usrp_source_0.set_samp_rate(self.samp_rate)

if __name__ == '__main__':
        parser = OptionParser(option_class=eng_option, usage="%prog:
[options]")
        (options, args) = parser.parse_args()
        tb = top_block()
        tb.Run(True)
This topic is locked and can not be replied to.