usrp-users@lists.ettus.com

Discussion and technical support related to USRP, UHD, RFNoC

View all threads

Read user registers with RFNoC

RK
Rob Kossler
Wed, Dec 13, 2023 4:30 PM

Take a look at the block controller for the UHD example "gain" block found
here
https://github.com/EttusResearch/uhd/blob/master/host/examples/rfnoc-example/lib/gain_block_control.cpp.
Note how this block doesn't even bother with creating a property. Instead
there is simply a set and get function which pokes or peeks an FPGA
register.  But, I don't know how to configure gnuradio so that it can call
this custom function.

On Wed, Dec 13, 2023 at 11:12 AM mamuki92@gmail.com wrote:

Hi Rob,

Do you mean instead of doing it across the register_property as the
set_int_property does, directly call the peek function?

Now I have this in the controller:

register_property(&_test_reg, this {

int test_reg = this->regs().peek32(REG_TEST_ADDR);

this->_test_reg.set(test_reg);

});

Do you suggest changing it to something like this? (taken from
uhd/host/lib/rfnoc/ddc_block_control.cpp)

double get_freq(const size_t chan) const

{

return _freq.at(chan).get();

}

“_freq” seems to be also a property_t class as “_test_reg” is. What’s the
difference of doing it that way?


USRP-users mailing list -- usrp-users@lists.ettus.com
To unsubscribe send an email to usrp-users-leave@lists.ettus.com

Take a look at the block controller for the UHD example "gain" block found here <https://github.com/EttusResearch/uhd/blob/master/host/examples/rfnoc-example/lib/gain_block_control.cpp>. Note how this block doesn't even bother with creating a property. Instead there is simply a set and get function which pokes or peeks an FPGA register. But, I don't know how to configure gnuradio so that it can call this custom function. On Wed, Dec 13, 2023 at 11:12 AM <mamuki92@gmail.com> wrote: > Hi Rob, > > Do you mean instead of doing it across the register_property as the > set_int_property does, directly call the peek function? > > Now I have this in the controller: > > register_property(&_test_reg, [this]() { > > int test_reg = this->regs().peek32(REG_TEST_ADDR); > > this->_test_reg.set(test_reg); > > }); > > Do you suggest changing it to something like this? (taken from > uhd/host/lib/rfnoc/ddc_block_control.cpp) > > > double get_freq(const size_t chan) const > > { > > return _freq.at(chan).get(); > > } > > > “_freq” seems to be also a property_t class as “_test_reg” is. What’s the > difference of doing it that way? > _______________________________________________ > USRP-users mailing list -- usrp-users@lists.ettus.com > To unsubscribe send an email to usrp-users-leave@lists.ettus.com >
M
mamuki92@gmail.com
Wed, Dec 13, 2023 5:01 PM

I suspect the register property part is for Gnuradio to call that function since it sets the result of the peek to the _test_reg property, and that property is declared as:
property_t<int> _test_reg{"test_reg", REG_TEST_DEFAULT, {res_source_info::USER}};

Then on the gnuradio code part, I use “test_reg” with the get_int_property:

callbacks:

set_int_property('user_reg', ${user_reg})

get_int_property('test_reg')

I get the correct value that way, but just one time.

As you said, I think it is better to get it to work first in UHD (as the example, but getting the value updated continuously) and then go back to gnuradio.

I will go back again if I discover something new. Thanks again!

I suspect the register property part is for Gnuradio to call that function since it sets the result of the peek to the _test_reg property, and that property is declared as:\ *`property_t<int> _test_reg{"test_reg", REG_TEST_DEFAULT, {res_source_info::USER}};`* Then on the gnuradio code part, I use “test_reg” with the get_int_property:\ \ `callbacks:` ` set_int_property('user_reg', ${user_reg})` ` get_int_property('test_reg')` I get the correct value that way, but just one time. As you said, I think it is better to get it to work first in UHD (as the example, but getting the value updated continuously) and then go back to gnuradio. I will go back again if I discover something new. Thanks again!