Martin- Thanks for the quick reply. I posted the console output below. I also attached the top level for my component which shows the input buffer set to 11 I believe. I just used the rfnocmodtool thing and it autogenerated this top so I did not touch that. I also attached the UHD host code which is just a customization of the tx_waveforms example but for RFNOC. Seems to work but I was just shooting in the dark here since there is not really a good example of this anywhere.
Thanks for your help. Jeff jplong@hermes:~/proj/rfnoc-usr_module/examples$ ./main_exe Creating the USRP device with: ... [INFO] [UHDlinux; GNU C++ version 4.8.4; Boost_105400; UHD_4.0.0.rfnoc-devel-409-gec9138eb] [WARNING] [UHD] Unable to set the thread priority. Performance may be negatively affected. Please see the general application notes in the manual for instructions. EnvironmentError: OSError: error in pthread_setschedparam [INFO] [X300] X300 initialization sequence... [INFO] [X300] Determining maximum frame size... [INFO] [X300] Maximum frame size: 1472 bytes. [INFO] [X300] Setup basic communication... [INFO] [X300] Loading values from EEPROM... [INFO] [X300] Setup RF frontend clocking... [INFO] [X300] Radio 1x clock:200 [INFO] [RFNOC] [DMA FIFO] Running BIST for FIFO 0... [INFO] [RFNOC] pass (Throughput: 1300.5MB/s) [INFO] [RFNOC] [DMA FIFO] Running BIST for FIFO 1... [INFO] [RFNOC] pass (Throughput: 1303.9MB/s) [INFO] [RFNOC RADIO] Register loopback test passed [INFO] [RFNOC RADIO] Register loopback test passed [INFO] [RFNOC RADIO] Register loopback test passed [INFO] [RFNOC RADIO] Register loopback test passed [INFO] [CORES] Performing timer loopback test... [INFO] [CORES] Timer loopback test passed [INFO] [CORES] Performing timer loopback test... [INFO] [CORES] Timer loopback test passed Using radio 0, channel 0 Setting RX Rate: 200.000000 Msps... Actual RX Rate: 200.000000 Msps... Setting RX Freq: 100.000000 MHz... Actual RX Freq: 100.000000 MHz... Connecting 0/Radio_0 ==> 0/txchain_0 [INFO] [RFNOC] Assuming max packet size for 0/txchain_0 Samples per packet: 364 Using streamer args: block_id=0/txchain_0,spp=364 6250000.000000 2000000.000000 3.125000 UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU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UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU^C jplong@hermes:~/proj/rfnoc-usr_module/examples$ -----Original Message----- From: USRP-users [mailto:[email protected]] On Behalf Of Martin Braun via USRP-users Sent: Tuesday, January 09, 2018 12:52 PM To: [email protected] Subject: Re: [USRP-users] RFNOC design question Hey Jeff, at first glance, it looks like you're doing it all right. What's the size of your input buffer on your custom DUC? Also, can you post a full log of the streamer setup? -- M On 01/09/2018 08:41 AM, Long, Jeffrey P. via USRP-users wrote: > Looking for some advice and help on RFNOC.. > > > > I am creating a custom RFNOC block that will roughly do what the > noc_block_duc does but instead uses a fractional polyphase interpolator. > I believe I have everything working correctly in terms of the tlast and > EOB and for single timed bursts it seems to work fine which I can verify > on the scope and in chipscope. However when I switch to a streaming data > I start getting UUs. If I look at it in chipscope it appears that the > incoming data is just not being supplied fast enough. My block is not > pushing back. In terms of rates I am using a 1 gig Ethernet connection > and am running 32 times interpolation in my block with the radio block > being set to 200 MHz. This would imply that I have a 6.25Msps required > feed rate to my block. I think this should be well within the 1 gig > capability. Again I verified that my block is not pushing back so it > really appears the data is not coming down fast enough. My rfnoc graph > consists of the radio core connected to my block and then to the host. > Nothing else. > > > > I am wondering are there flow control things that I am not doing > properly in my block. Perhaps the host UHD code is not getting the right > feedback for the flow control? Perhaps sample line rate settings that I > should be doing? In my UHD code I am only setting the sample rate in the > radio core and it only accepts 200 MHz but does that somehow screw up > the flow control? Is there special sauce in the duc that makes it > necessary to use that with the radio core to get the rates correct? > > > > Thanks for any help. > > > > Jeff > > > > _______________________________________________ > 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
// // Copyright 2014-2016 Ettus Research LLC // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. // #include "wavetable.hpp" #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 <uhd/exception.hpp> #include <boost/program_options.hpp> #include <boost/math/special_functions/round.hpp> #include <boost/format.hpp> #include <boost/thread.hpp> #include <iostream> #include <fstream> #include <csignal> #include <complex> namespace po = boost::program_options; static bool stop_signal_called = false; void sig_int_handler(int) { stop_signal_called = true; } int UHD_SAFE_MAIN(int argc, char *argv[]){ uhd::set_thread_priority_safe(); double rate = 200e6; double freq = 100e6; //size_t total_num_samps; size_t radio_id = 0; size_t radio_chan = 0; std::string args = ""; //std::string format = "sc16"; std::string format = "fc32"; std::string streamargs = ""; std::string radio_args = ""; std::string block_id = "txchain_0"; std::string block_args = ""; /************************************************************************ * Create device and block controls ***********************************************************************/ std::cout << std::endl; std::cout << boost::format("Creating the USRP device with: %s...") % args << std::endl; uhd::device3::sptr usrp = uhd::device3::make(args); // Create handle for radio object uhd::rfnoc::block_id_t radio_ctrl_id(0, "Radio", radio_id); // This next line will fail if the radio is not actually available uhd::rfnoc::radio_ctrl::sptr radio_ctrl = usrp->get_block_ctrl<uhd::rfnoc::radio_ctrl>(radio_ctrl_id); std::cout << "Using radio " << radio_id << ", channel " << radio_chan << std::endl; /************************************************************************ * Set up radio ***********************************************************************/ radio_ctrl->set_args(radio_args); //set the sample rate if (rate <= 0.0) { std::cerr << "Please specify a valid sample rate" << std::endl; return EXIT_FAILURE; } std::cout << boost::format("Setting RX Rate: %f Msps...") % (rate / 1e6) << std::endl; radio_ctrl->set_rate(rate); std::cout << boost::format("Actual RX Rate: %f Msps...") % (radio_ctrl->get_rate() / 1e6) << std::endl << std::endl; //set the center frequency std::cout << boost::format("Setting RX Freq: %f MHz...") % (freq / 1e6) << std::endl; uhd::tune_request_t tune_request(freq); radio_ctrl->set_rx_frequency(freq, radio_chan); std::cout << boost::format("Actual RX Freq: %f MHz...") % (radio_ctrl->get_rx_frequency(radio_chan) / 1e6) << std::endl << std::endl; //boost::this_thread::sleep( // boost::posix_time::milliseconds(long(setup_time * 1000))); //allow for some setup time size_t spp = radio_ctrl->get_arg<int>("spp"); uhd::device_addr_t streamer_args(streamargs); uhd::rfnoc::graph::sptr tx_graph = usrp->create_graph("rfnoc_tx"); usrp->clear(); if (not usrp->has_block(block_id)) { std::cout << "Block does not exist on current device: " << block_id << std::endl; return EXIT_FAILURE; } uhd::rfnoc::sink_block_ctrl_base::sptr blk_ctrl = usrp->get_block_ctrl<uhd::rfnoc::sink_block_ctrl_base>(block_id); if (not block_args.empty()) { // Set the block args on the other block: blk_ctrl->set_args(uhd::device_addr_t(block_args)); } // Connect: std::cout << "Connecting " << radio_ctrl_id << " ==> " << blk_ctrl->get_block_id() << std::endl; tx_graph->connect(blk_ctrl->get_block_id(), uhd::rfnoc::ANY_PORT, radio_ctrl_id, radio_chan); streamer_args["block_id"] = blk_ctrl->get_block_id().to_string(); spp = blk_ctrl->get_args().cast<size_t>("spp", spp); uhd::tx_metadata_t md_tx; std::cout << "Samples per packet: " << spp << std::endl; uhd::stream_args_t stream_args(format, "sc16");// We should read the wire format from the blocks stream_args.args = streamer_args; stream_args.args["spp"] = boost::lexical_cast<std::string>(spp); std::cout << "Using streamer args: " << stream_args.args.to_string() << std::endl; uhd::tx_streamer::sptr tx_stream = usrp->get_tx_stream(stream_args); std::string wave_type = "SINE"; double wave_freq = 2e6; float ampl = .7; double true_sample_rate = (200e6 / 32); printf("%f %f %f\n",true_sample_rate, wave_freq, true_sample_rate/std::abs(wave_freq) ); //error when the waveform is not possible to generate if (std::abs(wave_freq) > true_sample_rate/2){ throw std::runtime_error("wave freq out of Nyquist zone"); } if (true_sample_rate/std::abs(wave_freq) > wave_table_len/2){ throw std::runtime_error("wave freq too small for table"); } //pre-compute the waveform values const wave_table_class wave_table(wave_type, ampl); const size_t step = boost::math::iround(wave_freq/true_sample_rate * wave_table_len); size_t index = 0; //allocate a buffer which we re-use for each channel int spb = spp*200; std::vector<std::complex<float> > buff(spb); std::vector<std::complex<float> *> buffs(1, &buff.front()); //std::signal(SIGINT, &sig_int_handler); //std::cout << "Press Ctrl + C to stop streaming..." << std::endl; // Set up metadata. We start streaming a bit in the future // to allow MIMO operation: uhd::tx_metadata_t md; md.start_of_burst = true; md.end_of_burst = false; md.has_time_spec = false; md.time_spec = radio_ctrl->get_time_now() + uhd::time_spec_t(0.1); //send data until the signal handler gets called //or if we accumulate the number of samples specified (unless it's 0) uint64_t num_acc_samps = 0; //fill the buffer with the waveform for (size_t n = 0; n < buff.size(); n++){ buff[n] = wave_table(index += step); } while(true){ //send the entire contents of the buffer num_acc_samps += tx_stream->send( buffs, buff.size(), md ); md.start_of_burst = false; md.has_time_spec = false; } //send a mini EOB packet md.end_of_burst = true; tx_stream->send("", 0, md); //finished std::cout << std::endl << "Done!" << std::endl << std::endl; return EXIT_SUCCESS; }
noc_block_txchain.v
Description: noc_block_txchain.v
rfnoc_ce_auto_inst_x310.v
Description: rfnoc_ce_auto_inst_x310.v
_______________________________________________ USRP-users mailing list [email protected] http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
