> does the error occur exactly in the "make" call, or in the get_device3
It occurs in the make.
> call, or somewhere else?
> What is your UHD version? Are you running the right FPGA image for that
> version?
My uhd version is UHD_4.0.0.rfnoc-devel-409-gec9138eb. Yes it’s a custom fpga
image.
>
> Best regards,
> Marcus
>
>
>> On Sat, 2018-03-17 at 20:13 +0000, Snehasish Kar wrote:
>> Hello Marcus
>>
>> Sorry, but I didn't receive a copy of my previous mail or your
>> response, so I posted again.
>>
>> For your reference below is my code:
>>
>> #include <uhd/types/tune_request.hpp>
>> #include <uhd/types/sensors.hpp>
>> #include <uhd/utils/thread_priority.hpp>
>> #include <uhd/utils/safe_main.hpp>
>> #include <uhd/device3.hpp>
>> #include <uhd/rfnoc/radio_ctrl.hpp>
>> #include <uhd/rfnoc/source_block_ctrl_base.hpp>
>> #include <ppchan/chan128_block_ctrl.hpp>
>> #include <uhd/exception.hpp>
>> #include <boost/program_options.hpp>
>> #include <boost/format.hpp>
>> #include <boost/thread.hpp>
>> #include <iostream>
>> #include <fstream>
>> #include <csignal>
>> #include <complex>
>> #include <stdio.h>
>> #include <uhd/stream.hpp>
>> #include <SynchronousLabs/downSampler_block_ctrl.hpp>
>> #include <uhd/usrp/multi_usrp.hpp>
>>
>> #define USRP_2954_R 0
>> #define USRP_2955_R 1
>> #define db_0 0
>> #define db_1 1
>>
>> namespace po = boost::program_options;
>> double centre_freq_2954_db0 = 947.8e6;
>> double centre_freq_2954_db1 = 947.8e6-45e6;
>> static bool stop_signal_called = false;
>>
>> void sig_int_handler(int){stop_signal_called = true;}
>>
>> void recv_to_file(
>> uhd::rx_streamer::sptr rx_stream,
>> size_t samps_per_buff,
>> unsigned long long num_requested_samples,
>> bool continue_on_bad_packet = false
>> ) {
>> unsigned long long num_total_samps = 0;
>>
>> uhd::rx_metadata_t md;
>> std::vector<std::complex<float> > buff(samps_per_buff);
>> std::ofstream outfile;
>> #if 1
>> //outfile.open("/media/ramdd/rxfile.bin", std::ofstream::binary);
>> FILE *fp = fopen("/media/ramdd/rxfile.bin","w");
>> #endif
>> bool overflow_message = true;
>>
>> //setup streaming
>> uhd::stream_cmd_t stream_cmd((num_requested_samples == 0)?
>> uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS:
>> uhd::stream_cmd_t::STREAM_MODE_NUM_SAMPS_AND_DONE
>> );
>> stream_cmd.num_samps = num_requested_samples;
>> stream_cmd.stream_now = true;
>> stream_cmd.time_spec = uhd::time_spec_t();
>> std::cout << "Issuing start stream cmd" << std::endl;
>> // This actually goes to the null source; the processing block
>> // should propagate it.
>> rx_stream->issue_stream_cmd(stream_cmd);
>> unsigned long long last_update_samps = 0;
>>
>> while(
>> not stop_signal_called
>> and (num_requested_samples != num_total_samps or
>> num_requested_samples == 0)
>> ) {
>> size_t num_rx_samps = rx_stream->recv(&buff.front(), buff.size(),
>> md, 3.0);
>> std::cout<<"number of samples "<<num_rx_samps<<std::endl;
>> if (md.error_code == uhd::rx_metadata_t::ERROR_CODE_TIMEOUT)
>> {
>> std::cout << boost::format("Timeout while streaming") <<
>> std::endl;
>> break;
>> }
>> if (md.error_code ==
>> uhd::rx_metadata_t::ERROR_CODE_OVERFLOW){
>> if (overflow_message){
>> overflow_message = false;
>> std::cerr << "Got an overflow indication. If writing
>> to disk, your\n"
>> "write medium may not be able to keep
>> up.\n";
>> }
>> continue;
>> }
>> if (md.error_code != uhd::rx_metadata_t::ERROR_CODE_NONE){
>> std::string error = str(boost::format("Receiver error:
>> %s") % md.strerror());
>> if (continue_on_bad_packet){
>> std::cerr << error << std::endl;
>> continue;
>> }
>> else {
>> throw std::runtime_error(error);
>> }
>> }
>> num_total_samps += num_rx_samps;
>> #if 1
>>
>> fwrite(&buff.front(),sizeof(std::complex<float>),num_rx_samps,fp);
>> #endif
>> #if 0
>> if (bw_summary) {
>> last_update_samps += num_rx_samps;
>> boost::posix_time::time_duration update_diff = now -
>> last_update;
>> if (update_diff.ticks() >
>> boost::posix_time::time_duration::ticks_per_second()) {
>> double t = (double)update_diff.ticks() /
>> (double)boost::posix_time::time_duration::ticks_per_second();
>> double r = (double)last_update_samps / t;
>> std::cout << boost::format("\t%f Msps") % (r/1e6) <<
>> std::endl;
>> last_update_samps = 0;
>> last_update = now;
>> }
>> }
>>
>> ticks_diff = now - start;
>> if (ticks_requested > 0){
>> if ((unsigned long long)ticks_diff.ticks() >
>> ticks_requested)
>> break;
>> }
>> #endif
>> }
>>
>> stream_cmd.stream_mode =
>> uhd::stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS;
>> rx_stream->issue_stream_cmd(stream_cmd);
>>
>> #if 1
>> fclose(fp);
>> #endif
>> }
>> void pretty_print_flow_graph(std::vector<std::string> blocks)
>> {
>> std::string sep_str = "==>";
>> std::cout << std::endl;
>> // Line 1
>> for (size_t n = 0; n < blocks.size(); n++) {
>> const std::string name = blocks[n];
>> std::cout << "+";
>> for (size_t i = 0; i < name.size() + 2; i++) {
>> std::cout << "-";
>> }
>> std::cout << "+";
>> if (n == blocks.size() - 1) {
>> break;
>> }
>> for (size_t i = 0; i < sep_str.size(); i++) {
>> std::cout << " ";
>> }
>> }
>> std::cout << std::endl;
>> // Line 2
>> for (size_t n = 0; n < blocks.size(); n++) {
>> const std::string name = blocks[n];
>> std::cout << "| " << name << " |";
>> if (n == blocks.size() - 1) {
>> break;
>> }
>> std::cout << sep_str;
>> }
>> std::cout << std::endl;
>> // Line 3
>> for (size_t n = 0; n < blocks.size(); n++) {
>> const std::string name = blocks[n];
>> std::cout << "+";
>> for (size_t i = 0; i < name.size() + 2; i++) {
>> std::cout << "-";
>> }
>> std::cout << "+";
>> if (n == blocks.size() - 1) {
>> break;
>> }
>> for (size_t i = 0; i < sep_str.size(); i++) {
>> std::cout << " ";
>> }
>> }
>> std::cout << std::endl << std::endl;
>> }
>>
>> #if 1
>> int c onfigure(int mboard_no, int dboard_no, uhd::device3::sptr
>> usrp){
>> uhd::rfnoc::radio_ctrl::sptr radio_ctrl;
>> uhd::rfnoc::block_ctrl_base::sptr chan128_ctrl;
>> std::string downsample_make;
>> //uhd::rfnoc::block_ctrl_base::sptr downSampler;
>> uhd::rfnoc::block_ctrl_base::sptr fifo;
>> //uhd::rfnoc::
>> uhd::rfnoc::downSampler_block_ctrl::sptr downSampler;
>> usrp->clear();
>> uhd::rfnoc::block_ctrl_base::sptr packetresizer_ctrl;
>> std::string file, format, ant, subdev, ref, wirefmt, streamargs,
>> block_id, block_args;
>> size_t total_num_samps, spp = 128, spb=10e3;
>> double sampleRate = 0x00;
>> std::string radio_args("Radio channel");
>> std::vector<std::string> blocks;
>>
>> uhd::device_addr_t stream_args_args;
>> usrp->clear();
>> uhd::rfnoc::graph::sptr rx_graph = usrp-
>>> create_graph("GSM_RF_DUPLEX_CHAIN");
>> uhd::rfnoc::block_id_t radio_ctrl_id(mboard_no, "Radio", dboard_no);
>> if(not(usrp->has_block(radio_ctrl_id))){
>> std::cout<<"error: radio block not found..please check whether the
>> block exists in the image! quiting"<<std::endl;
>> return (EXIT_FAILURE);
>> }else{
>> std::cout<<"radio_"<<dboard_no <<" block found.."<<std::endl;
>> radio_ctrl = usrp->get_block_ctrl< uhd::rfnoc::radio_ctrl
>>> (radio_ctrl_id);
>> blocks.push_back(radio_ctrl->get_block_id());
>> if(mboard_no == 0x00){
>> sampleRate = 200e6;
>> }else{
>> sampleRate = 100e6;
>> }
>> radio_ctrl->set_args(radio_args);
>> radio_ctrl->set_rate(sampleRate);
>> if(dboard_no==0){
>> uhd::tune_request_t tune_request(centre_freq_2954_db0);
>> radio_ctrl->set_rx_frequency(centre_freq_2954_db0,0);
>> }else{
>> uhd::tune_request_t tune_request(centre_freq_2954_db1);
>> radio_ctrl->set_rx_frequency(centre_freq_2954_db1,0);
>> }
>> std::cout<<"freq "<<radio_ctrl->get_rx_frequency(0)<<std::endl;
>> radio_ctrl->set_rx_antenna("RX2",0);
>> radio_ctrl->set_rx_gain(25,0);
>> std::cout<<"gain "<<radio_ctrl->get_rx_gain(0)<<std::endl;
>> radio_ctrl->set_rx_bandwidth(56e6,0);
>> uhd::device_addr_t stream_args_args1;
>> stream_args_args1["block_id"] = radio_ctrl_id;
>> #if 1
>> uhd::stream_args_t stream_args1("fc32", "sc16");
>> stream_args1.args = stream_args_args1;
>> uhd::tx_streamer::sptr tx_stream = usrp->get_tx_stream(stream_args1);
>> stream_args1.args["gr_vlen"] = boost::lexical_cast<std::string>(1);
>> uhd::rx_streamer::sptr rx_stream = usrp->get_rx_stream(stream_args1);
>> #endif
>> //radio_ctrl->set_arg<int>("gr_vlen",(int)1);
>> }
>>
>> #if 1
>> uhd::rfnoc::block_id_t downsampler_ctrl_id(mboard_no, "downSampler",
>> dboard_no);
>> if(not(usrp->has_block(downsampler_ctrl_id))){
>> std::cout<<"error: downsampler block not found..please check
>> whether the block exists in the image"<<std::endl;
>> return (EXIT_FAILURE);
>> }else{
>> std::cout<<"downSampler_"<<dboard_no<<" block found.."<<std::endl;
>> downSampler = usrp-
>>> get_block_ctrl<uhd::rfnoc::downSampler_block_ctrl>(downsampler_ctrl_
>> id);
>> blocks.push_back(downSampler->get_block_id());
>> #if 1
>> downSampler->set_arg<int>("sr_n",(int)1000);
>> downSampler->set_arg<int>("sr_m",(int)128);
>> #endif
>> #if 0
>> uhd::device_addr_t stream_args_args1;
>> stream_args_args1["block_id"] = downsampler_ctrl_id;
>> uhd::stream_args_t stream_args1("fc32", "sc16");
>> stream_args1.args = stream_args_args1;
>> stream_args1.args["sr_n"] =
>> boost::lexical_cast<std::string>(1000);
>> stream_args1.args["sr_m"] = boost::lexical_cast<std::string>(128);
>> uhd::rx_streamer::sptr rx_stream = usrp-
>>> get_rx_stream(stream_args1);
>> uhd::tx_streamer::sptr tx_stream = usrp-
>>> get_tx_stream(stream_args1);
>> #endif
>> }
>> #endif
>> #if 0
>> /*********************************************/
>> //downsampler = new downSampler_block_ctrl;
>>
>> /*********************************************/
>> #endif
>>
>> uhd::rfnoc::block_id_t packetresizer_ctrl_id(mboard_no,
>> "PacketResizer", dboard_no);
>> if(not(usrp->has_block(packetresizer_ctrl_id))){
>> std::cout<<"error: packetResizer block not found..please check
>> whether the block exists in the image"<<std::endl;
>> return (EXIT_FAILURE);
>> }else{
>> std::cout<<"packetResizer_"<<dboard_no<<" block
>> found.."<<std::endl;
>> packetresizer_ctrl = usrp->get_block_ctrl(packetresizer_ctrl_id);
>> blocks.push_back(packetresizer_ctrl->get_block_id());
>> packetresizer_ctrl->set_arg<int>("pkt_size",(int)512);
>> //packetresizer_ctrl->set
>> #if 0
>> uhd::device_addr_t stream_args_args1;
>> stream_args_args1["block_id"] = packetresizer_ctrl_id;
>> uhd::stream_args_t stream_args1("fc32", "sc16");
>> stream_args1.args = stream_args_args1;
>> uhd::rx_streamer::sptr rx_stream = usrp-
>>> get_rx_stream(stream_args1);
>> stream_args1.args["pkt_size"] =
>> boost::lexical_cast<std::string>(512);
>> uhd::tx_streamer::sptr tx_stream = usrp-
>>> get_tx_stream(stream_args1);
>> #endif
>> }
>> uhd::rfnoc::block_id_t chan128_ctrl_id(mboard_no, "chan128",
>> dboard_no);
>> if(not(usrp->has_block(chan128_ctrl_id))){
>> std::cout<<"error: chan128 block not found..please check whether
>> the block exists in the image"<<std::endl;
>> return (EXIT_FAILURE);
>> }else{
>> std::cout<<"chan128_"<< dboard_no<<" block found.."<<std::endl;
>> chan128_ctrl = usrp->get_block_ctrl(chan128_ctrl_id);
>> blocks.push_back(chan128_ctrl->get_block_id());
>> //stream_args_args["block_id"] = chan128_ctrl_id;
>> spp = chan128_ctrl->get_args().cast<size_t>("spp",spp);
>> std::cout<<"spp "<<(int)spp<<std::endl;
>> uhd::device_addr_t stream_args_args1;
>> stream_args_args1["block_id"] = chan128_ctrl_id;
>> #if 0
>> uhd::stream_args_t stream_args1("fc32", "sc16");
>> stream_args1.args = stream_args_args1;
>> stream_args1.args["gr_vlen"] = boost::lexical_cast<std::string>(128);
>> stream_args1.args["spp"] = boost::lexical_cast<std::string>(128);
>> uhd::rx_streamer::sptr rx_stream = usrp->get_rx_stream(stream_args1);
>> uhd::tx_streamer::sptr tx_stream = usrp->get_tx_stream(stream_args1);
>> #endif
>> }
>> blocks.push_back("HOST");
>> pretty_print_flow_graph(blocks);
>> uhd::rfnoc::block_id_t fifo_ctrl_id(mboard_no, "FIFO", dboard_no);
>> if(not usrp->has_block(fifo_ctrl_id)){
>> std::cout<<"error:FIFO block not found"<<std::endl;
>> }else{
>> fifo = usrp->get_block_ctrl(fifo_ctrl_id);
>> }
>> // Connect blocks and create flow graph
>> uhd::device_addr_t stream_args_args1;
>> stream_args_args["block_id"] = fifo_ctrl_id;
>> rx_graph->connect(radio_ctrl->get_block_id(),downSampler-
>>> get_block_id());
>> //rx_graph->connect(downSampler->get_block_id(),packetresizer_ctrl-
>>> get_block_id());
>> //rx_graph->connect(packetresizer_ctrl->get_block_id(),chan128_ctrl-
>>> get_block_id());
>> rx_graph->connect(downSampler->get_block_id(),fifo->get_block_id());
>> uhd::stream_args_t stream_args("fc32", "sc16");
>> stream_args.args = stream_args_args;
>> //stream_args.args["spp"] = boost::lexical_cast<std::string>(spp);
>> //stream_args.args["gr_vlen"] =
>> boost::lexical_cast<std::string>(spp);
>>
>> uhd::rx_streamer::sptr rx_stream = usrp->get_rx_stream(stream_args);
>> //uhd::tx_streamer::sptr tx_stream = usrp-
>>> get_tx_stream(stream_args);
>> recv_to_file(rx_stream, spb, 0, true);
>> return (EXIT_SUCCESS);
>> }
>> #endif
>>
>> int UHD_SAFE_MAIN(int argc, char *argv[]){
>> uhd::set_thread_priority_safe();
>> std::string args2954R("addr=192.168.40.2");
>> std::string args2955R("addr=192.168.110.2");
>> double rate, freq, gain, bw, total_time, setup_time;
>>
>> //Initializing the USRP Components
>>
>> std::cout <<"Initializing USRP 2954R"<<std::endl;
>> uhd::usrp::multi_usrp::sptr usrp_temp =
>> uhd::usrp::multi_usrp::make(args2954R);
>> uhd::device3::sptr usrp = usrp_temp->get_device3();
>> if(configure(USRP_2954_R,db_0,usrp)==1){
>> std::cout<<"error: Configuring USRP 2954R not
>> successful"<<std::endl;
>> }
>> //boost::thread usrp2954_db0(configure,USRP_2954_R,db_0,usrp);
>> /*if(configure(USRP_2954_R,db_1,usrp)==1){
>> std::cout<<"error: Configuring USRP 2954R not
>> successful"<<std::endl;
>> }*/
>> usleep(100);
>> //boost::thread usrp2954_db1(configure,USRP_2954_R,db_1,usrp);
>> std::signal(SIGINT, &sig_int_handler);
>> }
>>
>>
>> From: Marcus Müller <[email protected]>
>> Sent: Saturday, March 17, 2018 8:36:10 PM
>> To: Snehasish Kar; [email protected]
>> Subject: Re: [USRP-users] Help with uhd
>>
>> Dear Shehasish,
>>
>> Marcus Leech already responded to your last mail.
>>
>> We can't help you without all your code, especially whatever sets up
>> "args2954R".
>>
>> Best regards,
>> Marcus M
>>
>> On Sat, 2018-03-17 at 06:22 +0000, Snehasish Kar via USRP-users
>> wrote:
>>> hello
>>>
>>> On trying to use an multi usrp shared pointer, I get the following
>>> error in rfnoc enviroment:
>>>
>>> Error: TypeError: [0/FIFO_1] Invalid output port number (ANY).
>>>
>>> I declared the shared pointer as below
>>>
>>> uhd::usrp::multi_usrp::sptr usrp_temp =
>>> uhd::usrp::multi_usrp::make(args2954R);
>>> uhd::device3::sptr usrp = usrp_temp->get_device3();
>>>
>>> Any idea where I am going wrong.
>>>
>>> BR
>>> Snehasish
>>>
>>>
>>> _______________________________________________
>>> USRP-users mailing list
>>> [email protected]
>>> http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
_______________________________________________
USRP-users mailing list
[email protected]
http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com