Sample rate for source_noise and source_vector

Hello,

When you specify a signal_source, you have to set up the sample rate.
But with the noise and vector sources you do not have to specify this
parameter.

What is the sample rate in the computer -> USB when we generate a noise
or generate data from a list/file?

Thanks

On Thu, Oct 26, 2006 at 05:33:26PM +0200, De Lima Julian wrote:

Hello,

When you specify a signal_source, you have to set up the sample rate.

This is just for convenience and allows you to specify the output
frequency in absolute instead of normalized terms. If you prefer, you
can of course set the sample_rate to 1.

But with the noise and vector sources you do not have to specify this
parameter.

What is the sample rate in the computer -> USB when we generate a noise
or generate data from a list/file?

The sample rate across the USB is determined by the interpolation or
decimation rate programmed into the usrp.

On receive, USB sample rate = 64e6 / decimation_rate
On transmit, USB sample rate = 128e6 / interpolation_rate

Eric

I’m having some python coding issues with a slider I’m trying to
implement. The code is based on usrp_wfm_rcv_pll.py, which uses the
powermate to adjust either frequency or volume. I would like to replace
the volume slider with a gain slider, which exists in the original but
which is not controlled by the powermate.

My code is below, and the symptoms are that while the new gain slider
moves, the value shown does not update until I click the powermate
button
to switch to frequency control. Any suggestions?

Thanks!

eric

     # control area form at bottom
     self.myform = myform = form.form()

     hbox = wx.BoxSizer(wx.HORIZONTAL)
     hbox.Add((5,0), 0)
     myform['freq'] = form.float_field(
         parent=self.panel, sizer=hbox, label="Carrier Freq", 

weight=1,
callback=myform.check_input_and_call(_form_set_freq,
self._set_status_msg))

     hbox.Add((5,0), 0)
     myform['freq_slider'] = \
         form.quantized_slider_field(parent=self.panel, sizer=hbox,

weight=3,
range=(.5e6, 3.5e6, 0.001e6),
callback=self.set_freq)
hbox.Add((5,0), 0)
vbox.Add(hbox, 0, wx.EXPAND)

     hbox = wx.BoxSizer(wx.HORIZONTAL)
     hbox.Add((5,0), 0)

     myform['gain'] = \
         form.quantized_slider_field(parent=self.panel, sizer=hbox,

label=“Gain”,
weight=3,
range=self.subdev.gain_range(),
callback=self.subdev.set_gain)
hbox.Add((5,0), 0)
vbox.Add(hbox, 0, wx.EXPAND)

     try:
         self.knob = powermate.powermate(self.frame)
         self.rot = 0
         powermate.EVT_POWERMATE_ROTATE (self.frame, self.on_rotate)
         powermate.EVT_POWERMATE_BUTTON (self.frame, self.on_button)
     except:
         print "FYI: No Powermate or Contour Knob found"


 def on_rotate (self, event):
     self.rot += event.delta
     if (self.state == "FREQ"):
         if self.rot >= 3:
             self.set_freq(self.freq + .001e6)
             self.rot -= 3
         elif self.rot <=-3:
             self.set_freq(self.freq - .001e6)
             self.rot += 3
     else:
         step = self.subdev.gain_range()[2]
         if self.rot >= 3:
             self.set_gain(self.gain + step)
             self.rot -= 3
         elif self.rot <=-3:
             self.set_gain(self.gain - step)
             self.rot += 3

 def on_button (self, event):
     if event.value == 0:        # button up
         return
     self.rot = 0
     if self.state == "FREQ":
         self.state = "GAIN"
     else:
         self.state = "FREQ"
     self.update_status_bar ()


 def set_gain (self, gain):
     g = self.subdev.gain_range()
     self.gain = max(g[0], min(g[1], gain))
     #self.gain_control.set_k(10**(self.gain/10))
     self.myform['gain'].set_value(self.gain)
     self.update_status_bar ()

 def set_freq(self, target_freq):
     """
     Set the center frequency we're interested in.

     @param target_freq: frequency in Hz
     @rypte: bool

     Tuning is a two step process.  First we ask the front-end to
     tune as close to the desired frequency as it can.  Then we use
     the result of that operation and our target_frequency to
     determine the value for the digital down converter.
     """
     r = usrp.tune(self.u, 0, self.subdev, target_freq)

     if r:
         self.freq = target_freq
         self.myform['freq'].set_value(target_freq)         # update

displayed value
self.myform[‘freq_slider’].set_value(target_freq) # update
displayed value
self.update_status_bar()
self._set_status_msg(“OK”, 0)
return True

     self._set_status_msg("Failed", 0)
     return False

 def set_gain(self, gain):
 	self.gain=gain
     self.myform['gain'].set_value(gain)     # update displayed 

value
self.subdev.set_gain(gain)

 def update_status_bar (self):
     msg = "Gain:%r  Setting:%s" % (self.gain, self.state)
     self._set_status_msg(msg, 1)
     self.src_fft.set_baseband_freq(self.freq)

 def gain_range(self):
     return (0, 20, 1)

Eric H. Matlis, Ph.D.
Aerospace & Mechanical Engineering Dept.
120 Hessert Center for Aerospace Research
University of Notre Dame
Notre Dame, IN 46556-5684
Phone: (574) 631-6054
Fax: (574) 631-8355

So I tested but I have another question.
I read that the data through the USB cable (from computer to USRP) are
in the format I/Q complex. (Dawei Shen tutorial)

My interpolation factor is 512, so the sample rate is 128M/512 =
250kSample/s

I have a data list with 500e3 data. 250e3 are of 1000uV and 250e3 are of
0uV. I see with my spectrum analyzer during 1 second some power and
during another second nothing.

With a vector_source in complex, no problem. But if I specify a
vector_source in short, during 0.5 second I see power and during another
0.5 second nothing. So there is a factor of 2 between the complex and
short format.

Therefore with a vector_list in short the sampling rate is doubled?
Because in I/Q format there are 16bits * 2 (I & Q) and in short only
16bits?

Is it true that when we have a source in short the sampling rate is
double because we do not use the I/Q format?

Thanks

Julian De Lima

-----Message d’origine-----
De : Eric B. [mailto:[email protected]]
Envoyé : jeudi, 26. octobre 2006 15:36
À : De Lima Julian
Cc : [email protected]
Objet : Re: [Discuss-gnuradio] Sample rate for source_noise and
source_vector

On Thu, Oct 26, 2006 at 05:33:26PM +0200, De Lima Julian wrote:

Hello,

When you specify a signal_source, you have to set up the sample rate.

This is just for convenience and allows you to specify the output
frequency in absolute instead of normalized terms. If you prefer, you
can of course set the sample_rate to 1.

But with the noise and vector sources you do not have to specify this
parameter.

What is the sample rate in the computer → USB when we generate a noise
or generate data from a list/file?

The sample rate across the USB is determined by the interpolation or
decimation rate programmed into the usrp.

On receive, USB sample rate = 64e6 / decimation_rate
On transmit, USB sample rate = 128e6 / interpolation_rate

Eric

Thanks

Therefore the USB rate is automatically adapted by the
interpolation/decimation factor! I thinked that it was us that have to
adapted the different parameters (interpolation/decimation and sample
rate over USB).

Thank you

Julian

-----Message d’origine-----
De : Eric B. [mailto:[email protected]]
Envoyé : jeudi, 26. octobre 2006 15:36
À : De Lima Julian
Cc : [email protected]
Objet : Re: [Discuss-gnuradio] Sample rate for source_noise and
source_vector

On Thu, Oct 26, 2006 at 05:33:26PM +0200, De Lima Julian wrote:

Hello,

When you specify a signal_source, you have to set up the sample rate.

This is just for convenience and allows you to specify the output
frequency in absolute instead of normalized terms. If you prefer, you
can of course set the sample_rate to 1.

But with the noise and vector sources you do not have to specify this
parameter.

What is the sample rate in the computer → USB when we generate a noise
or generate data from a list/file?

The sample rate across the USB is determined by the interpolation or
decimation rate programmed into the usrp.

On receive, USB sample rate = 64e6 / decimation_rate
On transmit, USB sample rate = 128e6 / interpolation_rate

Eric

On Fri, Oct 27, 2006 at 09:23:19PM +0200, De Lima Julian wrote:

Is it true that when we have a source in short the sampling rate is double because we do not use the I/Q format?

Thanks

Julian De Lima

I recommend that you don’t use the short interface to the usrp.

Eric