Gnuradio,OOT:更正标记流块的 send()?

Gnuradio,OOT: correcting send() for tagged stream block?

我在制作 gnuradio OOT 模块时需要帮助。我实际上正在尝试扩展一个代码。

我正在尝试制作 2 TX 1Rx 标记流块 (OOT)。对于 1Tx 1Rx,它 工作正常。我正在尝试扩展它。现在的问题是,我不是 能够配置 send() 函数。使用此代码,一个发射器可以发射,但其他发射器不工作。 subdev 规范和频率以及其他参数已正确分配。我检查了。

如果我尝试 make test,它没有显示任何问题。我检查了每一个 我的 USRP X310 的端口,它工作正常。

这是代码。我放了一小部分来处理发送和接收缓冲区。

void
usrp_echotimer_cc_impl::send()
{
// Data to USRP
num_tx_samps = d_tx_stream->send(d_in_send1, total_num_samps,
d_metadata_tx, total_num_samps/(float)d_samp_rate+d_timeout_tx);
num_tx_samps = d_tx_stream->send(d_in_send0, total_num_samps,
d_metadata_tx, total_num_samps/(float)d_samp_rate+d_timeout_tx);
}

int
usrp_echotimer_cc_impl::work (int noutput_items,
gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
gr_complex *in0 = (gr_complex *) input_items[0];
gr_complex *in1 = (gr_complex *) input_items[1];
gr_complex *out = (gr_complex *) output_items[0];
// Set output items on packet length
noutput_items = ninput_items[0]=ninput_items[1];

// Resize output buffer
if(d_out_buffer.size()!=noutput_items)
d_out_buffer.resize(noutput_items);

// Send thread
d_in_send0 = in0;
d_in_send1 = in1;
d_noutput_items_send = noutput_items;
d_thread_send =
gr::thread::thread(boost::bind(&usrp_echotimer_cc_impl::send, this));

// Receive thread
d_out_recv = &d_out_buffer[0];
d_noutput_items_recv = noutput_items;
d_thread_recv =
gr::thread::thread(boost::bind(&usrp_echotimer_cc_impl::receive, this));

我的系统配置是 X310,子板 SBX-120,我使用的是 UHD-3.9。我检查了 subdev 规范、增益和频率分配。那些 很好

完整性: 昨天在 GNU Radio 邮件列表中有人问过这个问题; Sanjoy 已经收到两条回复:

马丁布劳恩写道:

Sorry, Sanjoy,

we'll need some more information before we can give you better feedback. It's not clear exactly what you're trying to achieve, and what exactly is failing.

Perhaps this helps getting started: http://gnuradio.org/redmine/projects/gnuradio/wiki/ReportingErrors

Cheers, Martin

我的回答有点长,但是可以 here。摘录中:

Hi Sanjoy,

I am trying to make 2 TX 1Rx tagged stream block(OOT). For 1Tx 1Rx, it was working fine. I am trying to extend it. Now the problem is, I am not being able to configure the send() function.

有没有 您创建自己的区块的特殊原因?有没有特色 缺少 gr-uhd 随附的 USRP 接收器和源?

...

your send() function looks a bit strange; what you're doing is transmitting two things on a single channel after each other. Also, what you should be doing (from a programming style point of view) is pass the buffers you want to send as references or something, but not save them to class properties and then call send(). To send two buffers to two different channels, you will need to use a vector containing the two buffers -- have a look at rx_multi_samples; that of course recv()s rather than sends(), but the semantics are the same.

...

noutput_items is given to you to let your work now how much it may produce, that's why it's a parameter.

...

There's no reason GNU Radio couldn't already call your work function again while usrp_echotimer_cc_impl::send() hasn't even started to transmit samples. Then, your d_send variables will be overwritten.

...

Since a single X310 is inherently coherent and has the same time, you can simply use a USRP sink and a source, use set_start_time(...) on both with the same time spec, and have your flow graph consume and produce samples in different threads, coherently.