discuss-gnuradio
[Top][All Lists]
Advanced

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

RE: [Discuss-gnuradio] why does this code don't work!! help


From: Tom Rondeau
Subject: RE: [Discuss-gnuradio] why does this code don't work!! help
Date: Wed, 28 Feb 2007 08:19:22 -0500

> -----Original Message-----
> From: address@hidden [mailto:discuss-
> 
> hi,
> i have made this simple program, it spouse to send tx signals one to
> each tx board.
> #!/usr/bin/env python
> from gnuradio import gr
> from gnuradio.eng_notation import num_to_str, str_to_num
> from gnuradio import usrp
> from gnuradio import audio
> from gnuradio import blks
> from gnuradio.eng_option import eng_option
> from optparse import OptionParser
> import usrp_dbid
> import math
> import sys
> 
> def build_graph ():
> 
>     fg = gr.flow_graph ()
>     u = usrp.sink_c(nchan=2, interp_rate=128)
>     sampling_freq = 128e6

That high of a sampling rate? I hope you're running this on a super
computer, because a normal system won't be able to handle this. Also, you
need to make sure the signal's sampling rate matches the DAC's sampling rate
of 128 Msps _after_ interpolation (so if inter=128, sampling_freq=1e6).

>     src0 = gr.sig_source_f ( sampling_freq, gr.GR_SIN_WAVE, 30e4, 1.0, 1
> )
>     src1 = gr.sig_source_f ( sampling_freq, gr.GR_SIN_WAVE, 10e4, 0.5, 1
> )

You are using floating point signal sources here

> 
>     #this was an am_tx script
>     #mixer = gr.multiply_ff ()
>     #dst = usrp.sink_c(0, 128)
>     #f2c = gr.float_to_complex()
> 
>     interleaver = gr.interleave(gr.sizeof_gr_complex)

And here you're using complex values.

>     fg.connect(src0, (interleaver, 0))
>     fg.connect(src1, (interleaver, 1))
>     fg.connect(interleaver, u)
>     r0 = u.tune(0, u.db[0][0], 10e6)   # set center freq on side A
> d'board
>     r1 = u.tune(1, u.db[1][0], 5e6)
>     return fg
> 
> if __name__ == '__main__':
>     fg = build_graph ()
>     fg.start ()
>     raw_input ('Press Enter to quit: ')
>     fg.stop ()
> 
> when i run that code i get this error:
> 
> # python am_tx_two_sig.py
> Traceback (most recent call last):
>   File "am_tx_two_sig.py", line 41, in ?
>     fg = build_graph ()
>   File "am_tx_two_sig.py", line 32, in build_graph
>     fg.connect(src0, (interleaver, 0))
>   File
> "/usr/local/lib/python2.4/site-packages/gnuradio/gr/basic_flow_graph.py",
> line 115, in connect
>     self._connect (points[i-1], points[i])
>   File
> "/usr/local/lib/python2.4/site-packages/gnuradio/gr/basic_flow_graph.py",
> line 120, in _connect
>     self._connect_prim (s, d)
>   File
> "/usr/local/lib/python2.4/site-packages/gnuradio/gr/basic_flow_graph.py",
> line 128, in _connect_prim
>     self._check_type_match (src_endpoint, dst_endpoint)
>   File
> "/usr/local/lib/python2.4/site-packages/gnuradio/gr/basic_flow_graph.py",
> line 242, in _check_type_match
>     raise ValueError, (
> ValueError: source and destination data sizes are different:
> sig_source_f interleave

Look at your error message, it's telling you where the problem is. The
signal source outputs are different data types (float, 4 bytes) than the
interleaver (gr_complex, 8 bytes).

> 
> what is going wrong this is not much different of the
> fm_tx_2_daughterboard.py.
> Thanks
> anmar

Tom







reply via email to

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