Cannot use my gain block from the example. How to?

404 views Asked by At

I am trying to make a custom block for my x310 and use it. So far, I'm stuck at the example FPGA image compilation because I can't use the custom block gain.

I've followed step by step the "Building an FPGA Image with OOT Blocks" tutorial and successfully compiled and uploaded the image to my x310. A uhd_usrp_probe returned the expected "0/Block#0" linked back and forth to the SEP4 Block. But a warning from RFNOC:BLOCK_FACTORY states "could not find block with Noc-ID 0xb16, 0xffff"

I proceeded anyway after compiling a custom C++ program based on the rfnoc_radio_loopback example in order to make use of the gain block,

I added this line in the includes:

 #include <rfnoc::gain::gain_block_control.hpp>

And these two lines after the radio_block_control instancing:

uhd::rfnoc::block_id_t gain_id(0, "Block", 0);
rfnoc::example::gain_block_control::sptr gain_ctrl = graph->get_block<rfnoc::example::gain_block_control>(gain_id);

The program compiles fine but running it returns a LookupError stating "This device doesn't have a block of type rfnoc::example::gain_block_control with ID: 0/Block#0" I tend to believe the lookup error is clear but I don't know what to do instead.

I first tried to use the block with gnuradio-companion but was not able to generate the block at all. I am sure I am missing something but I have no idea what (apart from actual brain cells).

  • What is wrong with my C++?
  • Is it possible to generate a gain block in gnuradio-companion and if yes how?
  • Do you know of some tutorial that explains the different procedures on how to use a custom block?
1

There are 1 answers

2
mbr0wn On

There is an example application (rfnoc-example/apps/init_gain_block.cpp) that will test the functionality of the block for you. You can compile/run that to see if your block is working.

If you are seeing uhd_usrp_probe return 0/Block#0 instead of 0/Gain#0, then the .so file is not being picked up properly. The easiest way to test this is to LD_PRELOAD the DLL like this:

LD_PRELOAD=/path/to/librfnoc-example.so uhd_usrp_probe

What this will do is force a preload of the DLL containing the block controller (which will make sure it is registered). You should be seing 0/Gain#0 as the block ID now.