[USRP-users] Accessing a customized register of FPGA code from UHD

Marcus Müller marcus.mueller at ettus.com
Tue Apr 14 06:05:14 EDT 2015


Hi Isen,
> Thanks. I was aware of the file, setting_reg.hpp, and I just did not
> know what address number I should set up.
The address you used for your user settings register.

> setting_reg #(.my_addr(BASE+2), .width(WIDTH)) reg_tx
> (.clk(clk),.rst(reset), .strobe(set_stb),.addr(set_addr),
> .in(set_data), .out(in_tx),.changed());
since you set my_addr to BASE+2, you should use the same value when
poking. (BASE==0 is reserved for user extensions, by the way)

> However, I still have no idea how to access this variable from
> Applications like UHD program.
You would use the poke32/peek method from
uhd/host/lib/usrp/cores/radio_ctrl_core_3000.cpp. You can access the
right instance in x300_impl, so inside x300_impl.cpp, the right thing to
do is

mb.radio_perifs[0].ctrl->poke32(SR_REG(my_addr), value);

with 0 being the radio control chain A, 1 being B.

Now, if you want to export that functionality, the UHD way of doing that
is adding an entry to the property tree, and binding a method to that;
something like:

    _tree->create<boost::uint32_t>(mb_path / "custom" / "my_register")
        .publish(boost::bind(&radio_ctrl_core_3000::peek32,
mb.radio_perifs[mb_i].ctrl, SR_REG(BASE,2) ))
        .subscribe(boost::bind(&radio_ctrl_core_3000::poke32,
mb.radio_perifs[mb_i].ctrl, SR_REG(BASE,2), _1 ));

inside x300_impl::setup_mb.

Other than that, Ian answered a question on a very related topic
yesterday, see
http://lists.ettus.com/pipermail/usrp-users_lists.ettus.com/2015-April/013525.html

@Ian: SR_REG is the right thing to use here, isn't it?

Greetings,
Marcus

On 04/14/2015 11:03 AM, Isen I-Chun Chao wrote:
> Hi Marcus, 
>
>
> Also, following your instruction, I got a piece of code segment below,
> which is from control/gpio_atr:
>
> setting_reg #(.my_addr(BASE+2), .width(WIDTH)) reg_tx
> (.clk(clk),.rst(reset), .strobe(set_stb),.addr(set_addr),
> .in(set_data), .out(in_tx),.changed());
>
> However, I still have no idea how to access this variable from
> Applications like UHD program. Is there any example code available for
> us? I know Marcus has been dedicated to GNURadio S/W part. But I am
> sure there are someone who is completely familiar with FPGA related
> problems. Could somebody helps? I would very appreciate it.
>
>
>
>
>
>
> /Best Regards,
> Isen I-Chun Chao/
>
> On Wed, Apr 8, 2015 at 4:32 AM, Marcus Müller
> <usrp-users at lists.ettus.com <mailto:usrp-users at lists.ettus.com>> wrote:
>
>     Commenting on code that I don't know is a bit hard, but:
>
>     you will need to have a working instance of setting_reg; after
>     that, you'll be able to use the register just like the other
>     registers you'd find in your uhd/host/lib/usrp/x300/x300_regs.hpp.
>
>     Git grep is really helpful finding examples for the usage of
>     setting_reg:
>     cd fpga/usrp3/lib
>     git grep --context 3 setting_reg
>
>     Greetings,
>     Marcus
>
>     On 04/05/2015 04:38 AM, Isen I-Chun Chao via USRP-users wrote:
>>     Hi,
>>     I have a customized register in x300_core.v, say named *my_var.* I would
>>     like to get the register value from the application layer through UHD or
>>     whatever.
>>
>>     I wonder if there any example in UHD can be used for my reference or anyone
>>     could provide some advice.
>>     j
>>     Thank you very much.
>>
>>
>>
>>     *Best Regards,Isen I-Chun Chao*
>>
>>
>>
>>     _______________________________________________
>>     USRP-users mailing list
>>     USRP-users at lists.ettus.com <mailto:USRP-users at lists.ettus.com>
>>     http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
>
>
>     _______________________________________________
>     USRP-users mailing list
>     USRP-users at lists.ettus.com <mailto:USRP-users at lists.ettus.com>
>     http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ettus.com/pipermail/usrp-users_lists.ettus.com/attachments/20150414/5cf031bf/attachment-0002.html>


More information about the USRP-users mailing list