Why does this code don't work! help

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

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
)

#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)
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

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

from gnuradio import audio
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.start ()
fg.connect(src0, (interleaver, 0))

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

Quoting anmar [email protected]:

hi Tom,
thanks for your help,

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).

ok I didn’t understood the interpolation, in fact i the hole
interpolation is confusing me because we have :
usrp interp, dac rate and usrp rate, i get them all mixed up.

If you don’t understand interpolation and decimation, I suggest you read
up on
them and on sampling theory in general. These are very important
concepts in
SDR.

Tom

hi Tom,
thanks for your help,

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).

ok I didn’t understood the interpolation, in fact i the hole
interpolation is confusing me because we have :
usrp interp, dac rate and usrp rate, i get them all mixed up.

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

ohh that is very stupid of me, i didn’t noticed that, didn’t even looked
there ops

Anmar