Hello all,

I am currently attempting to use RFNoC blocks through UHD's C++ API, without 
using GNU Radio. Right now I am simply trying to create a working example, and 
later I will add in or substitute my own custom RFNoC blocks. What I am trying 
to do is to replicate the standard transmit chain of DMA FIFO --> DUC --> 
Radio, with an input sample rate of 1 Msps and a digital IF of 65 MHz. However, 
when I run the C++ code below, I get underflows. Can anyone please help me 
understand what change(s) I must make to my program to fix this issue?


Thank you in advance for your assistance.


Adam Parower

The Aerospace Corporation


#include <uhd/utils/safe_main.hpp>
#include <uhd/device3.hpp>
#include <uhd/rfnoc/graph.hpp>
#include <uhd/rfnoc/source_block_ctrl_base.hpp>

using namespace uhd;
int UHD_SAFE_MAIN(int argc, char *argv[]) {
    const char* FIFO = "DmaFIFO";
    const int NUM_SAMPS = 65536;
    uint32_t buffer[NUM_SAMPS];

    device3::sptr usrp = device3::make(std::string("type=x300"));
    rfnoc::graph::sptr graph = usrp->create_graph("test");
    usrp->clear();

    rfnoc::block_id_t radio_ctrl_id(0, "Radio", 0),
        fifo_ctrl_id(0, FIFO, 0), duc_ctrl_id(0, "DUC", 0);
    usrp->get_block_ctrl<rfnoc::source_block_ctrl_base>(duc_ctrl_id)->set_args(
        
device_addr_t("input_rate=1e6,output_rate=70e6,fullscale=1.0,freq=65e6"));
    graph->connect(fifo_ctrl_id, duc_ctrl_id);
    graph->connect(duc_ctrl_id, radio_ctrl_id);

    device_addr_t stream_args_args("");
    stream_args_args["block_id"] = std::string(FIFO);
    stream_args_args["block_port"] = std::string("0");

    stream_args_t stream_args("sc16", "sc16");
    stream_args.args = stream_args_args;
    tx_streamer::sptr tx_stream = usrp->get_tx_stream(stream_args);
    tx_metadata_t metadata = tx_metadata_t();

    for (int i = 0; i < 1000; i++)
        tx_stream->send(buffer, NUM_SAMPS, metadata);
    return 0;
}
_______________________________________________
USRP-users mailing list
USRP-users@lists.ettus.com
http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com

Reply via email to