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




_______________________________________________
USRP-users mailing list
USRP-users@lists.ettus.com
http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com

Reply via email to