diff options
-rw-r--r-- | grc/blocks/usrp2_sink_xxxx.xml | 13 | ||||
-rw-r--r-- | grc/blocks/usrp2_source_xxxx.xml | 13 | ||||
-rw-r--r-- | grc/blocks/usrp_dual_sink_x.xml | 26 | ||||
-rw-r--r-- | grc/blocks/usrp_dual_source_x.xml | 28 | ||||
-rw-r--r-- | grc/blocks/usrp_simple_sink_x.xml | 16 | ||||
-rw-r--r-- | grc/blocks/usrp_simple_source_x.xml | 16 | ||||
-rw-r--r-- | grc/grc_gnuradio/usrp/dual_usrp.py | 16 | ||||
-rw-r--r-- | grc/grc_gnuradio/usrp/simple_usrp.py | 8 |
8 files changed, 85 insertions, 51 deletions
diff --git a/grc/blocks/usrp2_sink_xxxx.xml b/grc/blocks/usrp2_sink_xxxx.xml index 639f96cf4..f2ee4d151 100644 --- a/grc/blocks/usrp2_sink_xxxx.xml +++ b/grc/blocks/usrp2_sink_xxxx.xml @@ -2,6 +2,7 @@ <!-- ################################################### ##USRP2 Sink +## Note: the center freq must be set after the lo offset ################################################### --> <block> @@ -16,14 +17,16 @@ usrp2.sink_$(type.fcn)($interface) usrp2.sink_$(type.fcn)($interface, $mac_addr) #end if self.$(id).set_interp($interpolation) -self.$(id).set_center_freq($frequency) -self.$(id).set_gain($gain) #if $lo_offset() != float('inf') self.$(id).set_lo_offset($lo_offset) -#end if</make> - <callback>set_lo_offset($lo_offset)</callback> +#end if +self.$(id).set_center_freq($frequency) +self.$(id).set_gain($gain)</make> <callback>set_interp($interpolation)</callback> - <callback>set_center_freq($frequency)</callback> + <callback>#if $lo_offset() != float('inf') +self.$(id).set_lo_offset($lo_offset) +#end if +self.$(id).set_center_freq($frequency)</callback> <callback>set_gain($gain)</callback> <param> <name>Output Type</name> diff --git a/grc/blocks/usrp2_source_xxxx.xml b/grc/blocks/usrp2_source_xxxx.xml index 6c776d0ad..02046e609 100644 --- a/grc/blocks/usrp2_source_xxxx.xml +++ b/grc/blocks/usrp2_source_xxxx.xml @@ -2,6 +2,7 @@ <!-- ################################################### ##USRP2 Source +## Note: the center freq must be set after the lo offset ################################################### --> <block> @@ -16,14 +17,16 @@ usrp2.source_$(type.fcn)($interface) usrp2.source_$(type.fcn)($interface, $mac_addr) #end if self.$(id).set_decim($decimation) -self.$(id).set_center_freq($frequency) -self.$(id).set_gain($gain) #if $lo_offset() != float('inf') self.$(id).set_lo_offset($lo_offset) -#end if</make> - <callback>set_lo_offset($lo_offset)</callback> +#end if +self.$(id).set_center_freq($frequency) +self.$(id).set_gain($gain)</make> <callback>set_decim($decimation)</callback> - <callback>set_center_freq($frequency)</callback> + <callback>#if $lo_offset() != float('inf') +self.$(id).set_lo_offset($lo_offset) +#end if +self.$(id).set_center_freq($frequency)</callback> <callback>set_gain($gain)</callback> <param> <name>Output Type</name> diff --git a/grc/blocks/usrp_dual_sink_x.xml b/grc/blocks/usrp_dual_sink_x.xml index 8f418becd..4539b62f9 100644 --- a/grc/blocks/usrp_dual_sink_x.xml +++ b/grc/blocks/usrp_dual_sink_x.xml @@ -10,16 +10,18 @@ <import>from grc_gnuradio import usrp as grc_usrp</import> <make>grc_usrp.dual_sink_$(type.fcn)(which=$which) self.$(id).set_interp_rate($interpolation) -self.$(id).set_frequency_a($frequency_a, verbose=True) -self.$(id).set_frequency_b($frequency_b, verbose=True) -self.$(id).set_gain_a($gain_a) -self.$(id).set_gain_b($gain_b) +self.$(id).set_frequency_a($frequency_a, verbose=True#slurp #if $lo_offset_a() != float('inf') -self.$(id).set_lo_offset_a($lo_offset_a) +, lo_offset=$lo_offset_a#slurp #end if +) +self.$(id).set_frequency_b($frequency_b, verbose=True#slurp #if $lo_offset_b() != float('inf') -self.$(id).set_lo_offset_b($lo_offset_b) +, lo_offset=$lo_offset_b#slurp #end if +) +self.$(id).set_gain_a($gain_a) +self.$(id).set_gain_b($gain_b) ################################################## ## Flex RF A ################################################## @@ -39,8 +41,16 @@ self.$(id).set_enable_b(True) self.$(id).set_auto_tr_b(True) #end if</make> <callback>set_interp_rate($interpolation)</callback> - <callback>set_frequency_a($frequency_a)</callback> - <callback>set_frequency_b($frequency_b)</callback> + <callback>set_frequency_a($frequency_a#slurp +#if $lo_offset_a() != float('inf') +, lo_offset=$lo_offset_a#slurp +#end if +)</callback> + <callback>set_frequency_b($frequency_b#slurp +#if $lo_offset_b() != float('inf') +, lo_offset=$lo_offset_b#slurp +#end if +)</callback> <callback>set_gain_a($gain_a)</callback> <callback>set_gain_b($gain_b)</callback> <param> diff --git a/grc/blocks/usrp_dual_source_x.xml b/grc/blocks/usrp_dual_source_x.xml index 740895d42..ad9a860ac 100644 --- a/grc/blocks/usrp_dual_source_x.xml +++ b/grc/blocks/usrp_dual_source_x.xml @@ -13,19 +13,29 @@ self.$(id).set_format(width=$format.width, shift=$format.shift) #end if self.$(id).set_decim_rate($decimation) -self.$(id).set_frequency_a($frequency_a, verbose=True) -self.$(id).set_frequency_b($frequency_b, verbose=True) -self.$(id).set_gain_a($gain_a) -self.$(id).set_gain_b($gain_b) +self.$(id).set_frequency_a($frequency_a, verbose=True#slurp #if $lo_offset_a() != float('inf') -self.$(id).set_lo_offset_a($lo_offset_a) +, lo_offset=$lo_offset_a#slurp #end if +) +self.$(id).set_frequency_b($frequency_b, verbose=True#slurp #if $lo_offset_b() != float('inf') -self.$(id).set_lo_offset_b($lo_offset_b) -#end if</make> +, lo_offset=$lo_offset_b#slurp +#end if +) +self.$(id).set_gain_a($gain_a) +self.$(id).set_gain_b($gain_b)</make> <callback>set_decim_rate($decimation)</callback> - <callback>set_frequency_a($frequency_a)</callback> - <callback>set_frequency_b($frequency_b)</callback> + <callback>set_frequency_a($frequency_a#slurp +#if $lo_offset_a() != float('inf') +, lo_offset=$lo_offset_a#slurp +#end if +)</callback> + <callback>set_frequency_b($frequency_b#slurp +#if $lo_offset_b() != float('inf') +, lo_offset=$lo_offset_b#slurp +#end if +)</callback> <callback>set_gain_a($gain_a)</callback> <callback>set_gain_b($gain_b)</callback> <param> diff --git a/grc/blocks/usrp_simple_sink_x.xml b/grc/blocks/usrp_simple_sink_x.xml index f3ccf1263..b52cd4880 100644 --- a/grc/blocks/usrp_simple_sink_x.xml +++ b/grc/blocks/usrp_simple_sink_x.xml @@ -10,20 +10,24 @@ <import>from grc_gnuradio import usrp as grc_usrp</import> <make>grc_usrp.simple_sink_$(type.fcn)(which=$which, side=$side) self.$(id).set_interp_rate($interpolation) -self.$(id).set_frequency($frequency, verbose=True) +self.$(id).set_frequency($frequency, verbose=True#slurp +#if $lo_offset() != float('inf') +, lo_offset=$lo_offset#slurp +#end if +) self.$(id).set_gain($gain) #if $transmit.tx_enb self.$(id).set_enable(True) #end if #if $transmit.auto_tr self.$(id).set_auto_tr(True) -#end if -#if $lo_offset() != float('inf') -self.$(id).set_lo_offset($lo_offset) #end if</make> - <callback>set_lo_offset($lo_offset)</callback> <callback>set_interp_rate($interpolation)</callback> - <callback>set_frequency($frequency)</callback> + <callback>set_frequency($frequency#slurp +#if $lo_offset() != float('inf') +, lo_offset=$lo_offset#slurp +#end if +)</callback> <callback>set_gain($gain)</callback> <param> <name>Input Type</name> diff --git a/grc/blocks/usrp_simple_source_x.xml b/grc/blocks/usrp_simple_source_x.xml index 1a777bd63..7fcc7a22c 100644 --- a/grc/blocks/usrp_simple_source_x.xml +++ b/grc/blocks/usrp_simple_source_x.xml @@ -13,14 +13,18 @@ self.$(id).set_format(width=$format.width, shift=$format.shift) #end if self.$(id).set_decim_rate($decimation) -self.$(id).set_frequency($frequency, verbose=True) -self.$(id).set_gain($gain) +self.$(id).set_frequency($frequency, verbose=True#slurp #if $lo_offset() != float('inf') -self.$(id).set_lo_offset($lo_offset) -#end if</make> - <callback>set_lo_offset($lo_offset)</callback> +, lo_offset=$lo_offset#slurp +#end if +) +self.$(id).set_gain($gain)</make> <callback>set_decim_rate($decimation)</callback> - <callback>set_frequency($frequency)</callback> + <callback>set_frequency($frequency#slurp +#if $lo_offset() != float('inf') +, lo_offset=$lo_offset#slurp +#end if +)</callback> <callback>set_gain($gain)</callback> <param> <name>Output Type</name> diff --git a/grc/grc_gnuradio/usrp/dual_usrp.py b/grc/grc_gnuradio/usrp/dual_usrp.py index 1ecf7c47f..3692e1760 100644 --- a/grc/grc_gnuradio/usrp/dual_usrp.py +++ b/grc/grc_gnuradio/usrp/dual_usrp.py @@ -53,22 +53,22 @@ class _dual_source(gr.hier_block2): for i in range(2): self.connect((deinter, i), (self, i)) def set_decim_rate(self, decim): self._get_u().set_decim_rate(int(decim)) - def set_frequency_a(self, frequency, verbose=False): + def set_frequency_a(self, frequency, verbose=False, lo_offset=None): + if lo_offset is not None: self._subdev_a.set_lo_offset(lo_offset) self._set_frequency( chan=0, #ddc0 subdev=self._subdev_a, frequency=frequency, verbose=verbose, ) - def set_frequency_b(self, frequency, verbose=False): + def set_frequency_b(self, frequency, verbose=False, lo_offset=None): + if lo_offset is not None: self._subdev_b.set_lo_offset(lo_offset) self._set_frequency( chan=1, #ddc1 subdev=self._subdev_b, frequency=frequency, verbose=verbose, ) - def set_lo_offset_a(self, lo_offset): self._subdev_a.set_lo_offset(lo_offset) - def set_lo_offset_b(self, lo_offset): self._subdev_b.set_lo_offset(lo_offset) def set_gain_a(self, gain): self._subdev_a.set_gain(gain) def set_gain_b(self, gain): self._subdev_b.set_gain(gain) @@ -105,22 +105,22 @@ class _dual_sink(gr.hier_block2): for i in range(2): self.connect((self, i), (inter, i)) def set_interp_rate(self, interp): self._get_u().set_interp_rate(int(interp)) - def set_frequency_a(self, frequency, verbose=False): + def set_frequency_a(self, frequency, verbose=False, lo_offset=None): + if lo_offset is not None: self._subdev_a.set_lo_offset(lo_offset) self._set_frequency( chan=self._subdev_a.which(), subdev=self._subdev_a, frequency=frequency, verbose=verbose, ) - def set_frequency_b(self, frequency, verbose=False): + def set_frequency_b(self, frequency, verbose=False, lo_offset=None): + if lo_offset is not None: self._subdev_b.set_lo_offset(lo_offset) self._set_frequency( chan=self._subdev_b.which(), subdev=self._subdev_b, frequency=frequency, verbose=verbose, ) - def set_lo_offset_a(self, lo_offset): self._subdev_a.set_lo_offset(lo_offset) - def set_lo_offset_b(self, lo_offset): self._subdev_b.set_lo_offset(lo_offset) def set_gain_a(self, gain): self._subdev_a.set_gain(gain) def set_gain_b(self, gain): self._subdev_b.set_gain(gain) def set_enable_a(self, enable): self._subdev_a.set_enable(enable) diff --git a/grc/grc_gnuradio/usrp/simple_usrp.py b/grc/grc_gnuradio/usrp/simple_usrp.py index 9065c7fe9..fc4c75bf0 100644 --- a/grc/grc_gnuradio/usrp/simple_usrp.py +++ b/grc/grc_gnuradio/usrp/simple_usrp.py @@ -56,8 +56,8 @@ class _simple_source(gr.hier_block2): self._get_u().set_decim_rate(int(decim)) if self._no_hb: #set the BW to half the sample rate self._subdev.set_bw(self._get_u().converter_rate()/decim/2) - def set_lo_offset(self, lo_offset): self._subdev.set_lo_offset(lo_offset) - def set_frequency(self, frequency, verbose=False): + def set_frequency(self, frequency, verbose=False, lo_offset=None): + if lo_offset is not None: self._subdev.set_lo_offset(lo_offset) self._set_frequency( chan=0, #ddc0 subdev=self._subdev, @@ -96,14 +96,14 @@ class _simple_sink(gr.hier_block2): self.connect(self, self._get_u()) def set_interp_rate(self, interp): self._get_u().set_interp_rate(int(interp)) - def set_frequency(self, frequency, verbose=False): + def set_frequency(self, frequency, verbose=False, lo_offset=None): + if lo_offset is not None: self._subdev.set_lo_offset(lo_offset) self._set_frequency( chan=self._subdev.which(), subdev=self._subdev, frequency=frequency, verbose=verbose, ) - def set_lo_offset(self, lo_offset): self._subdev.set_lo_offset(lo_offset) def set_gain(self, gain): self._subdev.set_gain(gain) def set_enable(self, enable): self._subdev.set_enable(enable) def set_auto_tr(self, auto_tr): self._subdev.set_auto_tr(auto_tr) |