Re: USRP+Digital Radio Mundial


#1

The DRM is still sitting on sourceforge @ http://drm.sourceforge.net/

It builds nicely on FC4, provided that the instructions on
http://drm.sourceforge.net/installation.html are followed.

In order to make it work with usrp it is sufficient to write some python
code with a gr_file_sink of shorts @ 48000 samples per second, feed it
to a linux pipe on a tempfs and start the drm code with the -fileio
option to the same pipe.

regards
MC

#!/usr/bin/env python

from gnuradio import gr
from gnuradio import usrp
from math import pi
from gnuradio import eng_notation
from gnuradio.eng_option import eng_option
from gnuradio.wxgui import stdgui, scopesink, fftsink
from optparse import OptionParser
import wx

class app_flow_graph (stdgui.gui_flow_graph):
def init(self, frame, panel, vbox, argv):
stdgui.gui_flow_graph.init (self, frame, panel, vbox, argv)

    parser = OptionParser(option_class=eng_option)
    parser.add_option("-f", "--freq", type="eng_float",

default=5990e3,
help=“set frequency to FREQ”, metavar=“FREQ”)
parser.add_option("-g", “–gain”, type=“int”, default=10,
help=“set gain in dB (default is midpoint)”)
(options, args) = parser.parse_args()
if len(args) != 0:
parser.print_help()
sys.exit(1)

    adc_rate = 64e6
    usrp_decim = 148
    if_rate = adc_rate / usrp_decim
    if_decim = 9
    demod_rate = if_rate / if_decim        #48048.048
    src = usrp.source_c (0, usrp_decim)
    src.set_rx_freq (0, -options.freq+7e3)
    actual_freq = src.rx_freq(0)
    src.set_pga(0,options.gain)

    print "FREQ: ",actual_freq
    print "Gain: ",options.gain

    channel_coeffs = \
                 gr.firdes.low_pass (if_decim,   # gain
                                     if_rate,    # sampling rate
                                     14e3,       # low pass cutoff

freq
3e3, # width of trans.
band
gr.firdes.WIN_HANN)

    dec =  gr.fir_filter_ccf(if_decim,channel_coeffs)
    vc = gr.multiply_const_cc(10)
    print "len(channel_coeffs) =", len(channel_coeffs)

    fft, win = fftsink.make_fft_sink_c (self, panel, "Spectrum",

512, demod_rate)
vbox.Add (win, 1, wx.EXPAND)

    c2r = gr.complex_to_real()
    r2s = gr.float_to_short()

    out = gr.file_sink(gr.sizeof_short,"/mnt/ramfs/drm.raw")

    # now wire it all together
    self.connect (src, dec)
    self.connect (dec, vc)
    self.connect (dec,fft)
    self.connect (vc,c2r,r2s,out)

def main():
app = stdgui.stdapp (app_flow_graph, “Spectrum Analyzer”)
app.MainLoop ()

if name == ‘main’:
main()