Re: [Discuss-gnuradio] Getting the API version at compile time

2011-10-13 Thread Peter Massam

The approach that I used is similar, but I thought I'd mention it because it
only relies on the installation and not on having the source code (I'm using
a Ubuntu package).  The newer version supports the UHD drivers and there is
an install directory for the headers, so I added the following to my
makefile:

USRP_API_VERSION=$(shell if test -d /usr/local/include/uhd ; then echo
NEW_USRP_API ; else echo OLD_USRP_API ; fi ;)

I used the USRP_API_VERSION variable in a "-D" compiler option.

Thanks for the suggestions, which led to the solution I adopted.



Johnathan Corgan-2 wrote:
> 
> On Oct 12, 2011, at 20:13, Tom Rondeau  wrote:
> 
> On Wed, Oct 12, 2011 at 5:26 AM, Peter D. Massam
> wrote:
> 
>>  I need to be able to maintain my program for both old and new systems
>> and
>> I've been looking for a version constant that I can use for conditional
>> compilation.
>>
>> **
>>
> You can find the version information in
> $(top_builddir)/gnuradio-core/gnuradio-core.pc. This is...
> 
> ___
> Discuss-gnuradio mailing list
> Discuss-gnuradio@gnu.org
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Getting-the-API-version-at-compile-time-tp32637243p32644037.html
Sent from the GnuRadio mailing list archive at Nabble.com.


___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] DAC I/Q swap and bit inversion

2011-10-13 Thread Matt Ettus
On Wed, Oct 12, 2011 at 4:12 PM, Ian Buckley  wrote:

> (Matt, this just occurred to me, you should be 2's comping the bus here,
> not simply inverting it, you've introduced an LSB DC offset).


An optimization -- the 1 LSB offset is swamped by real offset in the
hardware, so we just take it out as part of normal DC offset calibration.

Matt
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


[Discuss-gnuradio] Signal Seperation

2011-10-13 Thread Raullen Chai
Hi,

Could somebody give me some tips and help on the following problem? Really
appreciated!

The input signal is b1(t)*sin(f1*t) + b2(t)*sin(f2*t), where f1 and f2 are
close but different,  and b1(t) and b2(t) are two different square waves
with different period.
After the USRP down coverts this wave to the baseband, the two modulated
sine waves are mixed. How could I extract b2(t) or b1(t) respectively?
I tried to used a baseband filter, but it seems not work well.

Thanks!
-- 
--
Best Regards
(Raullen) Qi Chai
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


[Discuss-gnuradio] GRC Polyphase Channelizer examples?

2011-10-13 Thread John Ackermann N8UR
Is there a (hopefully simple) example of using the polyphase channelizer 
block in grc?


I'm trying to do a simple case of dividing a 250 kHz wide stream from 
USRP into a small number (initially 4) of contiguous channels.  Given my 
generally ignorant status, I'm stumped on setting the parameters.


e.g. --

(a) is the "taps" param an integer or is it a firdes function as in the 
xlating FIR filter?


(b) what is the oversample param used for?

(c) what is the sample rate of each of the output channels -- it doesn't 
appear to be the same at the sample rate at the input, or alternatively 
my parameters are so far off that what's coming out of the thing is 
absolute junk (when I feed it into a USRP sink set to 250ksamples, I get 
screens of underruns).


Thanks,

John

___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] GRC Polyphase Channelizer examples?

2011-10-13 Thread Marcus D. Leech

On 10/13/2011 09:11 PM, John Ackermann N8UR wrote:
Is there a (hopefully simple) example of using the polyphase 
channelizer block in grc?


I'm trying to do a simple case of dividing a 250 kHz wide stream from 
USRP into a small number (initially 4) of contiguous channels.  Given 
my generally ignorant status, I'm stumped on setting the parameters.


e.g. --

(a) is the "taps" param an integer or is it a firdes function as in 
the xlating FIR filter?


(b) what is the oversample param used for?

(c) what is the sample rate of each of the output channels -- it 
doesn't appear to be the same at the sample rate at the input, or 
alternatively my parameters are so far off that what's coming out of 
the thing is absolute junk (when I feed it into a USRP sink set to 
250ksamples, I get screens of underruns).


Thanks,

John


If it's only 250Khz wide, and you only need four, have you tried 4 
discrete freq-xlating FIR filters?  They're fairly easy to use, and can

  produce a baseband output at a decimated rate.

I haven't yet figured out how to use the polyphase channelizer because I 
almost never have the N equi-spaced channels problem in
  my fields of interest.  So, discrete filters it is (sometimes a 
hierarchy of discrete filters).









--
Marcus Leech
Principal Investigator
Shirleys Bay Radio Astronomy Consortium
http://www.sbrac.org


___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] New webpage look

2011-10-13 Thread adeel anwar
i think josh is right about the color. Instead of red, some shade of blue or
green might give a better look.

http://gnuradio.org/redmine/projects/gnuradio/wiki

instead of putting "Start page", "Index by Title", "Index by Date" buttons
on right-side,
they may be placed on the top of start page (maybe beside "History").
This may be useful for people new to gnuradio website (initially for 2
weeks, i thought that "start page" is the only wiki)
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


[Discuss-gnuradio] gr_file_sink error handling and incorrect behavior on broken pipes

2011-10-13 Thread Achilleas Anastasopoulos
This relates to a previous post regarding the behavior of gr_file_sink
when it writes to a named pipe and the other side of the pipe stops reading.

Currently the bahavior of the block is that it does not catch the
"errno=32=EPIPE"
(or any errno!=0 for that matter)
and thus the work function returns a false number of consumed items
(for some reason even with a broken pipe it always returns 512 items
consumed...)

As a result the remaing graph keeps producing samples that are somehow falsely
consumed into the file sink.

I added a couple of lines to check for the errno!=0

Please check and comment.
I attach 2 python files to check the bahavior of the file sink.
Firtst do " mkfifo fifo_rx" and then run tx.py and rx.py in different shells.
You can stop start rx.py any number of times and tx.py pauses and
restarts as well.

Observe though that tx.py consumes cpu even when the pipe is broken
because it continuosly calls
the gr_file_sink work function...

Achilleas

==

diff --git a/gnuradio-core/src/lib/io/gr_file_sink.cc
b/gnuradio-core/src/lib/io/gr_file_sink.cc
index aab0158..52d4c84 100644
--- a/gnuradio-core/src/lib/io/gr_file_sink.cc
+++ b/gnuradio-core/src/lib/io/gr_file_sink.cc
@@ -27,6 +27,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 


 gr_file_sink_sptr
@@ -64,9 +66,16 @@ gr_file_sink::work (int noutput_items,
 return noutput_items;  // drop output on the floor

   while (nwritten < noutput_items){
+errno=0;
 int count = fwrite (inbuf, d_itemsize, noutput_items - nwritten, d_fp);
-if (count == 0)// FIXME add error handling
+if (count == EOF){ // FIXME add error handling
+  //printf("fwrite() returned EOF. Requested %d and wrote
%d\n",noutput_items - nwritten,count);
   break;
+}
+if (errno!=0){ // FIXME add error handling
+  //printf("fwrite() raised error no = %d. Requested %d and wrote
%d\n",errno,noutput_items - nwritten,count);
+  break;
+}
 nwritten += count;
 inbuf += count * d_itemsize;
   }
diff --git a/gnuradio-core/src/lib/io/gr_file_sink.cc 
b/gnuradio-core/src/lib/io/gr_file_sink.cc
index aab0158..52d4c84 100644
--- a/gnuradio-core/src/lib/io/gr_file_sink.cc
+++ b/gnuradio-core/src/lib/io/gr_file_sink.cc
@@ -27,6 +27,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 
 gr_file_sink_sptr
@@ -64,9 +66,16 @@ gr_file_sink::work (int noutput_items,
 return noutput_items;  // drop output on the floor
 
   while (nwritten < noutput_items){
+errno=0;
 int count = fwrite (inbuf, d_itemsize, noutput_items - nwritten, d_fp);
-if (count == 0)// FIXME add error handling
+if (count == EOF){ // FIXME add error handling
+  //printf("fwrite() returned EOF. Requested %d and wrote 
%d\n",noutput_items - nwritten,count);
   break;
+}
+if (errno!=0){ // FIXME add error handling
+  //printf("fwrite() raised error no = %d. Requested %d and wrote 
%d\n",errno,noutput_items - nwritten,count);
+  break;
+}
 nwritten += count;
 inbuf += count * d_itemsize;
   }
#!/usr/bin/env python
##
# Gnuradio Python Flow Graph
# Title: Tx
# Generated: Thu Oct 13 23:55:47 2011
##

from gnuradio import eng_notation
from gnuradio import gr
from gnuradio import window
from gnuradio.eng_option import eng_option
from gnuradio.gr import firdes
from gnuradio.wxgui import fftsink2
from grc_gnuradio import wxgui as grc_wxgui
from optparse import OptionParser
import wx

class tx(grc_wxgui.top_block_gui):

	def __init__(self):
		grc_wxgui.top_block_gui.__init__(self, title="Tx")

		##
		# Variables
		##
		self.samp_rate = samp_rate = 100e3

		##
		# Blocks
		##
		self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
			self.GetWin(),
			baseband_freq=0,
			y_per_div=10,
			y_divs=5,
			ref_level=20,
			ref_scale=2.0,
			sample_rate=samp_rate,
			fft_size=1024,
			fft_rate=30,
			average=True,
			avg_alpha=0.1,
			title="FFT Plot",
			peak_hold=False,
		)
		self.Add(self.wxgui_fftsink2_0.win)
		self.gr_sig_source_x_0 = gr.sig_source_c(samp_rate, gr.GR_COS_WAVE, 5000, 1, 0)
		self.gr_noise_source_x_0 = gr.noise_source_c(gr.GR_GAUSSIAN, 0.1, 42)
		self.gr_file_sink_0 = gr.file_sink(gr.sizeof_gr_complex*1, "fifo_rx")
		self.gr_file_sink_0.set_unbuffered(True)
		self.gr_add_xx_0 = gr.add_vcc(1)

		##
		# Connections
		##
		self.connect((self.gr_noise_source_x_0, 0), (self.gr_add_xx_0, 1))
		self.connect((self.gr_sig_source_x_0, 0), (self.gr_add_xx_0, 0))
		self.connect((self.gr_add_xx_0, 0), (self.wxgui_fftsink2_0, 0))
		self.connect((self.gr_add_xx_0, 0), (self.gr_file_sink_0, 0))

	def get_sa