discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] building local programs


From: Eric Blossom
Subject: Re: [Discuss-gnuradio] building local programs
Date: Wed, 2 Jul 2003 13:47:13 -0700
User-agent: Mutt/1.4i

On Wed, Jul 02, 2003 at 02:10:34PM -0600, Joseph DiVerdi wrote:
> 
> That said I'm now just:
> 
> (1) getting my complex down convertor really shaken down (documentation in 
> progress for those following this piece), 
> (2) getting my arms wrapped around my sound card (Creative Sound Blaster 16 
> PCI), its controls, levels, nuances, stupid AGC, etc., 
> (3) gaining sufficient C++ familiarity to be effective in stringing all those 
> most exciting classes and structures, 
> (4) working out the physics of my first measurements, 
>     and so on and so forth. Loads of fun. :) 
> 
> All of this is made more pressing as I am scheduled to make a
> presentation on this work later in July. Looks like it will be one
> of those "works in progress" talks. ;)
> 
> That said I've got a few specific questions that I would like to throw out:
> 
>  - I can't seem to locate any reference info or docs on the "NWO_CONNECT" 
> function 
> 
>   <snip>
>     NWO_CONNECT (audio_source, fft_sink);
>     NWO_CONNECT (audio_source,audio_sink);
>   </snip>
> 
>   nor can I find it in headers. Where can I find some information on it?

It's an inline function in VrSigProc.h
It's used to wire the output of one module into the input of another.

   NWO_CONNECTN (src, src_port, dst) connects the src_port'th output
     of VrSigProc src to the next input of VrSigProc dst.

   NWO_CONNECT (src, dst) is short hand for  NWO_CONNECTN (src, 0, dst).
     That is, it connects the first (typically only) output of src to
     the next (typically only) input of dst.

Now that that's explained, let me suggest that you may want to
consider using the gr_FlowGraph abstraction instead.  You can find an
example in gnuradio/src/gnu/atsc/atsc_tx.cc (in the CVS repository).
The Flow Graph stuff doesn't play nicely with the Qt stuff, but the
plan is to deprecate the Qt stuff soon anyway.  The ultimate plan is
to move all the GUI stuff into Python using wxPython.  The Python code
uses the gr_FlowGraph abstraction too.

>  - The sound card is not behaving as I expect it to do so. I've
>  resorted to injecting a sine wave into the auxiliary input with a
>  signal generator. Using the example/audio_fft program I find that I
>  can only get the single tone signal to be around 20-30dB above the
>  noise floor before I start observing distortion as evidenced by
>  harmonic (both even and odd!) content. Perhaps the noise floor is
>  high because of cage EMI and/or the resolution is set at 8 bits
>  rather than 16 and/or the acquisition parameters are not set
>  optimally, and/or a bunch of other things. I'm working through my
>  trouble shooting tree but would (once again) welcome any advice
>  from those whom have experienced this particular problem.

Good luck.

> 
> Best regards,
> Joseph

FYI, here's some working python code from the CVS repository,
gnuradio/src/gnu/python/fm_demod1.py It's a much easier way to sling
the underlying modules together.  We've got most of them added to
python, but not all of the yet.  This is a single channel broadcast FM
receiver.  It assumes that somebody else has tuned the front end to
the appropriate place and expects the IF center to be 5.75 MHz.

Eric

#!/usr/bin/env python
#
# Copyright 2003 Free Software Foundation, Inc.
# 
# This file is part of GNU Radio
# 
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# 
# GNU Radio is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with GNU Radio; see the file COPYING.  If not, write to
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
# 

from GnuRadio import *

#
# return a gr_FlowGraph
#
def build_graph ():
    input_rate = 20e6
    IF_freq = 5.75e6

    chan_taps = 75
    CFIR_decimate = 125
    fm_demod_gain = 2200

    RFIR_decimate = 5

    quad_rate = input_rate / CFIR_decimate
    audio_rate = quad_rate / RFIR_decimate

    volume = 1.0
    
    src = make_GrMC4020SourceS (input_rate,
                                MCC_CH3_EN | MCC_ALL_5V)

    offset_fixer = VrFixOffsetSS ()

    channel_coeffs = gr_firdes.low_pass (1.0,          # gain
                                         input_rate,   # sampling rate
                                         250e3,        # low pass cutoff freq
                                         8*100e3,      # width of trans. band
                                         gr_firdes.WIN_HAMMING)


    chan_filter = GrFreqXlatingFIRfilterSCF (CFIR_decimate,
                                             channel_coeffs, IF_freq)

    fm_demod = VrQuadratureDemodCF (volume * fm_demod_gain)

    width_of_transition_band = audio_rate / 32
    audio_coeffs = gr_firdes.low_pass (1.0,            # gain
                                       quad_rate,      # sampling rate
                                       audio_rate/2 - width_of_transition_band,
                                       width_of_transition_band,
                                       gr_firdes.WIN_HAMMING)

    audio_filter = GrFIRfilterFSF (RFIR_decimate, audio_coeffs)

    final_sink = GrAudioSinkS (32767, "/dev/dsp")
    

    fg = gr_FlowGraph ()

    fg.connect (src, offset_fixer)
    fg.connect (offset_fixer, chan_filter)
    fg.connect (chan_filter, fm_demod)
    fg.connect (fm_demod, audio_filter)
    fg.connect (audio_filter, final_sink)

    return fg


if __name__ == '__main__':
    fg = build_graph ()
    fg.start ()                         # fork thread(s) and return immediately
    # your GUI mail loop goes here...
    fg.wait ();                         # wait (forever)







reply via email to

[Prev in Thread] Current Thread [Next in Thread]