Hi, I am really new to Gnuradio, and I want to play with using the USRP
N210 (or two USRP N210s) for transmission and reception. Basically, I
want
to transmit a sinusoidal signal (say at 1 GHz) for a few seconds, have
the
signal interact with an external coil, and then put the system in a
receiver mode to listen to what is sent back. I have a USRP N210, and
can
probably get one more.
What I would really like is some kind of example that does this in GRC,
but
as far as I could tell when I make a USRP in GRC, there is no way to
turn
off the transmission after a given amount of time or samples (like it
seems
you can do in C++ or Python). Does someone have some kind of example in
GRC
I can look at of sending a finite pulse from the USRP in transmission
mode
and then stopping to wait for any reception?
Here are some of the things I have done to try to figure out how to do
that. They don’t look very promising:
-
I changed tx_waveforms.cpp so that it only sends a few samples like
this:size_t num_acc_samps = 0 ; // number of accumulated samples
size_t total_num_samps = 10 ;
//send data for a given number of samples
while(num_acc_samps < total_num_samps){size_t samps_to_send = std::min(total_num_samps - num_acc_samps,
buff.size());
//fill the buffer with the waveform
for (size_t n = 0; n < buff.size(); n++){
buff[n] = wave_table(index += step);
}
//send the entire contents of the buffer
//tx_stream->send(buffs, buff.size(), md);
//send the "samps_to_send" number of samples in the buffer
size_t num_tx_samps = tx_stream->send(buffs, samps_to_send, md);
md.start_of_burst = false;
md.has_time_spec = false;
if (num_tx_samps < samps_to_send) std::cerr << "Send timeout..."
<<
std::endl;
//if(verbose) std::cout << boost::format(“Sent packet: %u
samples”)
% num_tx_samps << std::endl;
num_acc_samps += num_tx_samps;
}
//send a mini EOB packet
md.end_of_burst = true;
tx_stream->send("", 0, md);
I think this worked (I just bought a cheap scope but haven’t used it yet
to
really check), but the problem with this is that now I have to figure
out
how to stop, and do a receive. I really don’t understand all the C++
code
in the repository, and I am afraid it might take me too long.
- As another test, I changed the dial_tone.py example as a very simple
way
to start and stop transmission but it didn’t seem to work. The usual
case
using the method tb.run() worked fine and I heard the dial tone. I
thought
I could just change the Python so that it stops, and if it does, I will
replace the audio sink with a USRP. Here is how the audio sink code
looks
like:
class my_top_block(gr.top_block):
def init(self):
gr.top_block.init(self)
sample_rate = 44100
ampl = 0.1
src0 = gr.sig_source_f (sample_rate, gr.GR_SIN_WAVE, 350, ampl)
src1 = gr.sig_source_f (sample_rate, gr.GR_SIN_WAVE, 440, ampl)
dst = audio.sink (sample_rate, “”)
now connect the output of src0 to the first input of dst (audio sink)
self.connect (src0, (dst, 0))
now connect the output of src1 to the first input of dst (audio sink)
self.connect (src1, (dst, 1))
if name == ‘main’:
time.sleep(10)
correct?
Thanks for any help! I am having difficulties in understanding all this
and being able to transmit a sinusoidal wave for a few seconds, and then
wait to receive any response on the RX side.
–Bill Peter