[USRP-users] Two receive channels simultaneously for E312

Xingjian Chen xingjian at umass.edu
Tue Mar 26 14:30:58 EDT 2019


I made it worked by modifying the second code for stream_cmd by passing a time reference to stream_cmd.time_spec.

uhd::time_spec_t time_ref = rx_radio_ctrl->get_time_now();
stream_cmd.time_spec = time_ref + uhd::time_spec_t(seconds_in_future);


________________________________
From: USRP-users <usrp-users-bounces at lists.ettus.com> on behalf of Xingjian Chen via USRP-users <usrp-users at lists.ettus.com>
Sent: Tuesday, March 26, 2019 11:25:05 AM
To: USRP-users at lists.ettus.com
Cc: usrp-users-bounces at lists.ettus.com
Subject: [USRP-users] Two receive channels simultaneously for E312

Dear all,
Good morning. What is the right way to use two receive channels simultaneously for E312 with RFNOC radio and UHD cpp control? Thank you in advance.

There is only a receiver radio block and I have set up the rx streamer:

    rx_radio_ctrl->set_rx_streamer(true, rx_chan);
    rx_radio_ctrl->set_rx_streamer(true, rx_chan_1);
    std::cout << "Samples per packet: " << spp << std::endl;
    uhd::stream_args_t stream_args(format, "sc16");
    stream_args.args = streamer_args;
    stream_args.args["spp"] = boost::lexical_cast<std::string>(spp);
    stream_args.args["block_id0"] = "0/Radio_0";
    stream_args.args["block_id1"] = "0/Radio_0";
    stream_args.args["block_port0"] = "0";
    stream_args.args["block_port1"] = "1";
    stream_args.channels.push_back(0);
    stream_args.channels.push_back(1);
    std::cout << "Using streamer args: " << stream_args.args.to_string() << std::endl;
    uhd::rx_streamer::sptr rx_stream = dev->get_rx_stream(stream_args);

I have set up the buffer for two channels in "recv_to_file" template according to rx_multi_samples.cpp:

    std::vector<std::vector<samp_type>> buff(2,std::vector<samp_type>(samps_per_buff) );
    //create a vector of pointers to point to each of the channel buffers
    std::vector<samp_type *> buff_ptrs;
    for (size_t i = 0; i < buff.size(); i++) buff_ptrs.push_back(&buff[i].front());

I am not sure if I miss anything up to this point. Where I get stuck is I cannot receive any sample from the radio. I don't know if that is caused by the stream_cmd. If using the following code for stream_cmd, then timeout while streaming...

    // This code gives me "Timeout while streaming" error.
    uhd::stream_cmd_t stream_cmd(uhd::stream_cmd_t::STREAM_MODE_NUM_SAMPS_AND_DONE);
    stream_cmd.num_samps = size_t(num_requested_samples);
    stream_cmd.stream_now = true;
    stream_cmd.time_spec = uhd::time_spec_t();
    std::cout << "Issueing stream cmd" << std::endl;
    rx_stream->issue_stream_cmd(stream_cmd);
    size_t num_rx_samps = rx_stream->recv(buff_ptrs, samps_per_buff, md, 3.0, enable_size_map);

If using the following code for stream_cmd, then num_rx_samps = 0.

    // This code gives me num_rx_samps = 0
    uhd::stream_cmd_t stream_cmd(uhd::stream_cmd_t::STREAM_MODE_NUM_SAMPS_AND_DONE);
    stream_cmd.num_samps = total_num_samps;
    stream_cmd.stream_now = false;
    stream_cmd.time_spec = uhd::time_spec_t(seconds_in_future);
    std::cout << "Issueing stream cmd" << std::endl;
    rx_stream->issue_stream_cmd(stream_cmd);
    size_t num_rx_samps = rx_stream->recv(buff_ptrs, samps_per_buff, md, 3.0, enable_size_map);
    std::cout << "num_rx_samps = "<<num_rx_samps << std::endl;




Ref:
1. https://files.ettus.com/manual/structuhd_1_1stream__args__t.html
2. https://github.com/manuts/uhd-examples/blob/master/rx_multi_samples.cpp




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ettus.com/pipermail/usrp-users_lists.ettus.com/attachments/20190326/45b4e32b/attachment.html>


More information about the USRP-users mailing list