On Tue, Jun 15, 2010 at 06:48:39PM +0100, Charles Brain wrote:
> >
> >Does your code set the transmit gain on the WBX?
> >
> >Eric
> 
> Yes to 25. I checked the range and set it to maximum.
> 
> - Charles

Charles,

In my test with USRP2 and UHD here in the lab, I am able to get similar
power output numbers to when I used usrp_siggen_gui.py.

Here are my best guesses:

Try my attached grc/python code for transmitting with gr-uhd, assuming
you have built a gnuradio from branch next, which includes gr-uhd.

Probe the voltage at R532, it should vary from 1.4V to 0.5V with
different transmit gain settings.  Ok, R532 is on the bottom, so instead
try probing at the via between the "2" and "1" in the C521 label (which
is near the C523 label).

> I am using my own code that writes directly to the UHD and I forced it to
> set the I channel to 0x7FFF
> and the Q channel to 0 and the gain to 25.

Its also possible your app is not sending the correct type data for that
DC tone. (ie, sending int on an interface expecting float)

see host/include/uhd/types/io_type.hpp

Jason
<?xml version='1.0' encoding='ASCII'?>
<flow_graph>
  <timestamp>Tue Jun 15 14:26:14 2010</timestamp>
  <block>
    <key>options</key>
    <param>
      <key>id</key>
      <value>uhd_test_tx</value>
    </param>
    <param>
      <key>_enabled</key>
      <value>True</value>
    </param>
    <param>
      <key>title</key>
      <value></value>
    </param>
    <param>
      <key>author</key>
      <value></value>
    </param>
    <param>
      <key>description</key>
      <value></value>
    </param>
    <param>
      <key>window_size</key>
      <value>1280, 1024</value>
    </param>
    <param>
      <key>generate_options</key>
      <value>wx_gui</value>
    </param>
    <param>
      <key>category</key>
      <value>Custom</value>
    </param>
    <param>
      <key>run_options</key>
      <value>prompt</value>
    </param>
    <param>
      <key>run</key>
      <value>True</value>
    </param>
    <param>
      <key>realtime_scheduling</key>
      <value>1</value>
    </param>
    <param>
      <key>_coordinate</key>
      <value>(10, 10)</value>
    </param>
    <param>
      <key>_rotation</key>
      <value>0</value>
    </param>
  </block>
  <block>
    <key>variable</key>
    <param>
      <key>id</key>
      <value>tx_samp_rate</value>
    </param>
    <param>
      <key>_enabled</key>
      <value>True</value>
    </param>
    <param>
      <key>value</key>
      <value>1e8/interpolation</value>
    </param>
    <param>
      <key>_coordinate</key>
      <value>(10, 170)</value>
    </param>
    <param>
      <key>_rotation</key>
      <value>0</value>
    </param>
  </block>
  <block>
    <key>uhd_simple_sink</key>
    <param>
      <key>id</key>
      <value>uhd_simple_sink_0</value>
    </param>
    <param>
      <key>_enabled</key>
      <value>True</value>
    </param>
    <param>
      <key>type</key>
      <value>complex</value>
    </param>
    <param>
      <key>args</key>
      <value></value>
    </param>
    <param>
      <key>samp_rate</key>
      <value>tx_samp_rate</value>
    </param>
    <param>
      <key>center_freq</key>
      <value>tx_freq</value>
    </param>
    <param>
      <key>gain</key>
      <value>tx_gain</value>
    </param>
    <param>
      <key>ant</key>
      <value>tx_ant</value>
    </param>
    <param>
      <key>_coordinate</key>
      <value>(773, 298)</value>
    </param>
    <param>
      <key>_rotation</key>
      <value>0</value>
    </param>
  </block>
  <block>
    <key>variable_text_box</key>
    <param>
      <key>id</key>
      <value>tx_bb_freq</value>
    </param>
    <param>
      <key>_enabled</key>
      <value>True</value>
    </param>
    <param>
      <key>label</key>
      <value></value>
    </param>
    <param>
      <key>value</key>
      <value>1e6</value>
    </param>
    <param>
      <key>converver</key>
      <value>float_converter</value>
    </param>
    <param>
      <key>formatter</key>
      <value>None</value>
    </param>
    <param>
      <key>grid_pos</key>
      <value></value>
    </param>
    <param>
      <key>notebook</key>
      <value></value>
    </param>
    <param>
      <key>_coordinate</key>
      <value>(436, 405)</value>
    </param>
    <param>
      <key>_rotation</key>
      <value>0</value>
    </param>
  </block>
  <block>
    <key>variable_chooser</key>
    <param>
      <key>id</key>
      <value>tx_ant</value>
    </param>
    <param>
      <key>_enabled</key>
      <value>True</value>
    </param>
    <param>
      <key>label</key>
      <value></value>
    </param>
    <param>
      <key>value</key>
      <value>"TX/RX"</value>
    </param>
    <param>
      <key>choices</key>
      <value>["TX/RX"]</value>
    </param>
    <param>
      <key>labels</key>
      <value>[]</value>
    </param>
    <param>
      <key>type</key>
      <value>drop_down</value>
    </param>
    <param>
      <key>style</key>
      <value>wx.RA_HORIZONTAL</value>
    </param>
    <param>
      <key>grid_pos</key>
      <value></value>
    </param>
    <param>
      <key>notebook</key>
      <value></value>
    </param>
    <param>
      <key>_coordinate</key>
      <value>(292, 378)</value>
    </param>
    <param>
      <key>_rotation</key>
      <value>0</value>
    </param>
  </block>
  <block>
    <key>variable_text_box</key>
    <param>
      <key>id</key>
      <value>tx_freq</value>
    </param>
    <param>
      <key>_enabled</key>
      <value>True</value>
    </param>
    <param>
      <key>label</key>
      <value></value>
    </param>
    <param>
      <key>value</key>
      <value>1.3e9</value>
    </param>
    <param>
      <key>converver</key>
      <value>float_converter</value>
    </param>
    <param>
      <key>formatter</key>
      <value>None</value>
    </param>
    <param>
      <key>grid_pos</key>
      <value></value>
    </param>
    <param>
      <key>notebook</key>
      <value></value>
    </param>
    <param>
      <key>_coordinate</key>
      <value>(6, 405)</value>
    </param>
    <param>
      <key>_rotation</key>
      <value>0</value>
    </param>
  </block>
  <block>
    <key>variable_text_box</key>
    <param>
      <key>id</key>
      <value>interpolation</value>
    </param>
    <param>
      <key>_enabled</key>
      <value>True</value>
    </param>
    <param>
      <key>label</key>
      <value></value>
    </param>
    <param>
      <key>value</key>
      <value>16</value>
    </param>
    <param>
      <key>converver</key>
      <value>int_converter</value>
    </param>
    <param>
      <key>formatter</key>
      <value>None</value>
    </param>
    <param>
      <key>grid_pos</key>
      <value></value>
    </param>
    <param>
      <key>notebook</key>
      <value></value>
    </param>
    <param>
      <key>_coordinate</key>
      <value>(6, 325)</value>
    </param>
    <param>
      <key>_rotation</key>
      <value>0</value>
    </param>
  </block>
  <block>
    <key>wxgui_fftsink2</key>
    <param>
      <key>id</key>
      <value>wxgui_fftsink2_0</value>
    </param>
    <param>
      <key>_enabled</key>
      <value>False</value>
    </param>
    <param>
      <key>type</key>
      <value>complex</value>
    </param>
    <param>
      <key>title</key>
      <value>FFT Plot</value>
    </param>
    <param>
      <key>samp_rate</key>
      <value>tx_samp_rate</value>
    </param>
    <param>
      <key>baseband_freq</key>
      <value>tx_freq</value>
    </param>
    <param>
      <key>y_per_div</key>
      <value>10</value>
    </param>
    <param>
      <key>y_divs</key>
      <value>10</value>
    </param>
    <param>
      <key>ref_level</key>
      <value>50</value>
    </param>
    <param>
      <key>ref_scale</key>
      <value>2.0</value>
    </param>
    <param>
      <key>fft_size</key>
      <value>256</value>
    </param>
    <param>
      <key>fft_rate</key>
      <value>5</value>
    </param>
    <param>
      <key>peak_hold</key>
      <value>False</value>
    </param>
    <param>
      <key>average</key>
      <value>False</value>
    </param>
    <param>
      <key>avg_alpha</key>
      <value>0</value>
    </param>
    <param>
      <key>win</key>
      <value>None</value>
    </param>
    <param>
      <key>win_size</key>
      <value></value>
    </param>
    <param>
      <key>grid_pos</key>
      <value></value>
    </param>
    <param>
      <key>notebook</key>
      <value></value>
    </param>
    <param>
      <key>_coordinate</key>
      <value>(776, 72)</value>
    </param>
    <param>
      <key>_rotation</key>
      <value>0</value>
    </param>
  </block>
  <block>
    <key>variable_slider</key>
    <param>
      <key>id</key>
      <value>tx_gain</value>
    </param>
    <param>
      <key>_enabled</key>
      <value>True</value>
    </param>
    <param>
      <key>label</key>
      <value></value>
    </param>
    <param>
      <key>value</key>
      <value>0</value>
    </param>
    <param>
      <key>min</key>
      <value>0</value>
    </param>
    <param>
      <key>max</key>
      <value>25</value>
    </param>
    <param>
      <key>num_steps</key>
      <value>50</value>
    </param>
    <param>
      <key>style</key>
      <value>wx.SL_HORIZONTAL</value>
    </param>
    <param>
      <key>converver</key>
      <value>float_converter</value>
    </param>
    <param>
      <key>grid_pos</key>
      <value></value>
    </param>
    <param>
      <key>notebook</key>
      <value></value>
    </param>
    <param>
      <key>_coordinate</key>
      <value>(164, 377)</value>
    </param>
    <param>
      <key>_rotation</key>
      <value>0</value>
    </param>
  </block>
  <block>
    <key>gr_sig_source_x</key>
    <param>
      <key>id</key>
      <value>gr_sig_source_x_0</value>
    </param>
    <param>
      <key>_enabled</key>
      <value>True</value>
    </param>
    <param>
      <key>type</key>
      <value>complex</value>
    </param>
    <param>
      <key>samp_rate</key>
      <value>tx_samp_rate</value>
    </param>
    <param>
      <key>waveform</key>
      <value>gr.GR_COS_WAVE</value>
    </param>
    <param>
      <key>freq</key>
      <value>tx_bb_freq</value>
    </param>
    <param>
      <key>amp</key>
      <value>1.0</value>
    </param>
    <param>
      <key>offset</key>
      <value>0</value>
    </param>
    <param>
      <key>_coordinate</key>
      <value>(207, 116)</value>
    </param>
    <param>
      <key>_rotation</key>
      <value>0</value>
    </param>
  </block>
  <connection>
    <source_block_id>gr_sig_source_x_0</source_block_id>
    <sink_block_id>wxgui_fftsink2_0</sink_block_id>
    <source_key>0</source_key>
    <sink_key>0</sink_key>
  </connection>
  <connection>
    <source_block_id>gr_sig_source_x_0</source_block_id>
    <sink_block_id>uhd_simple_sink_0</sink_block_id>
    <source_key>0</source_key>
    <sink_key>0</sink_key>
  </connection>
</flow_graph>
#!/usr/bin/env python
##################################################
# Gnuradio Python Flow Graph
# Title: Uhd Test Tx
# Generated: Tue Jun 15 14:26:18 2010
##################################################

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 forms
from grc_gnuradio import wxgui as grc_wxgui
from optparse import OptionParser
import wx

class uhd_test_tx(grc_wxgui.top_block_gui):

	def __init__(self):
		grc_wxgui.top_block_gui.__init__(self, title="Uhd Test Tx")
		_icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png"
		self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY))

		##################################################
		# Variables
		##################################################
		self.interpolation = interpolation = 16
		self.tx_samp_rate = tx_samp_rate = 1e8/interpolation
		self.tx_gain = tx_gain = 0
		self.tx_freq = tx_freq = 1.3e9
		self.tx_bb_freq = tx_bb_freq = 1e6
		self.tx_ant = tx_ant = "TX/RX"

		##################################################
		# Controls
		##################################################
		self._interpolation_text_box = forms.text_box(
			parent=self.GetWin(),
			value=self.interpolation,
			callback=self.set_interpolation,
			label='interpolation',
			converter=forms.int_converter(),
		)
		self.Add(self._interpolation_text_box)
		_tx_gain_sizer = wx.BoxSizer(wx.VERTICAL)
		self._tx_gain_text_box = forms.text_box(
			parent=self.GetWin(),
			sizer=_tx_gain_sizer,
			value=self.tx_gain,
			callback=self.set_tx_gain,
			label='tx_gain',
			converter=forms.float_converter(),
			proportion=0,
		)
		self._tx_gain_slider = forms.slider(
			parent=self.GetWin(),
			sizer=_tx_gain_sizer,
			value=self.tx_gain,
			callback=self.set_tx_gain,
			minimum=0,
			maximum=25,
			num_steps=50,
			style=wx.SL_HORIZONTAL,
			cast=float,
			proportion=1,
		)
		self.Add(_tx_gain_sizer)
		self._tx_freq_text_box = forms.text_box(
			parent=self.GetWin(),
			value=self.tx_freq,
			callback=self.set_tx_freq,
			label='tx_freq',
			converter=forms.float_converter(),
		)
		self.Add(self._tx_freq_text_box)
		self._tx_bb_freq_text_box = forms.text_box(
			parent=self.GetWin(),
			value=self.tx_bb_freq,
			callback=self.set_tx_bb_freq,
			label='tx_bb_freq',
			converter=forms.float_converter(),
		)
		self.Add(self._tx_bb_freq_text_box)
		self._tx_ant_chooser = forms.drop_down(
			parent=self.GetWin(),
			value=self.tx_ant,
			callback=self.set_tx_ant,
			label='tx_ant',
			choices=["TX/RX"],
			labels=[],
		)
		self.Add(self._tx_ant_chooser)

		##################################################
		# Blocks
		##################################################
		self.gr_sig_source_x_0 = gr.sig_source_c(tx_samp_rate, gr.GR_COS_WAVE, tx_bb_freq, 1.0, 0)
		self.uhd_simple_sink_0 = uhd.simple_sink("", uhd.io_type_t.COMPLEX_FLOAT32)
		self.uhd_simple_sink_0.set_samp_rate(tx_samp_rate)
		self.uhd_simple_sink_0.set_center_freq(tx_freq)
		self.uhd_simple_sink_0.set_gain(tx_gain)
		self.uhd_simple_sink_0.set_antenna(tx_ant)

		##################################################
		# Connections
		##################################################
		self.connect((self.gr_sig_source_x_0, 0), (self.uhd_simple_sink_0, 0))

	def set_interpolation(self, interpolation):
		self.interpolation = interpolation
		self.set_tx_samp_rate(1e8/self.interpolation)
		self._interpolation_text_box.set_value(self.interpolation)

	def set_tx_samp_rate(self, tx_samp_rate):
		self.tx_samp_rate = tx_samp_rate
		self.uhd_simple_sink_0.set_samp_rate(self.tx_samp_rate)
		self.gr_sig_source_x_0.set_sampling_freq(self.tx_samp_rate)

	def set_tx_gain(self, tx_gain):
		self.tx_gain = tx_gain
		self.uhd_simple_sink_0.set_gain(self.tx_gain)
		self._tx_gain_slider.set_value(self.tx_gain)
		self._tx_gain_text_box.set_value(self.tx_gain)

	def set_tx_freq(self, tx_freq):
		self.tx_freq = tx_freq
		self.uhd_simple_sink_0.set_center_freq(self.tx_freq)
		self._tx_freq_text_box.set_value(self.tx_freq)

	def set_tx_bb_freq(self, tx_bb_freq):
		self.tx_bb_freq = tx_bb_freq
		self._tx_bb_freq_text_box.set_value(self.tx_bb_freq)
		self.gr_sig_source_x_0.set_frequency(self.tx_bb_freq)

	def set_tx_ant(self, tx_ant):
		self.tx_ant = tx_ant
		self.uhd_simple_sink_0.set_antenna(self.tx_ant)
		self._tx_ant_chooser.set_value(self.tx_ant)

if __name__ == '__main__':
	parser = OptionParser(option_class=eng_option, usage="%prog: [options]")
	(options, args) = parser.parse_args()
	if gr.enable_realtime_scheduling() != gr.RT_OK:
		print "Error: failed to enable realtime scheduling."
	tb = uhd_test_tx()
	tb.Run(True)

_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to