[USRP-users] Reading and Writing custom FPGA registers in a B210

Jon Anderson jon-paul.anderson at raytheon.com
Wed Jul 19 15:34:40 EDT 2017


In radio_legacy.v there is example code for adding user registers. Namely:


generate
   if (USER_SETTINGS == 1) begin
      wire           set_stb_user;
      wire [7:0]     set_addr_user;
      wire [31:0]    set_data_user;
      wire [7:0]     rb_addr_user;

      user_settings #(.BASE(SR_USER_SR_BASE)) user_settings
        (.clk(radio_clk), .rst(radio_rst),
         .set_stb(set_stb), .set_addr(set_addr), .set_data(set_data),
         .set_stb_user(set_stb_user), .set_addr_user(set_addr_user), .set_data_user(set_data_user));

      setting_reg #(.my_addr(SR_USER_RB_ADDR), .awidth(8), .width(8)) user_rb_addr
        (.clk(radio_clk), .rst(radio_rst), .strobe(set_stb), .addr(set_addr), .in1(set_data),
         .out1(rb_addr_user), .changed());

      // ----------------------------------
      // Enter user settings registers here
      // ----------------------------------

      /*
      //Example code for 32-bit settings registers and 64-bit readback registers

      wire [31:0] user_reg_0_value, user_reg_1_value;

      setting_reg #(.my_addr(8'd0), .awidth(8), .width(32)) user_reg_0
        (.clk(radio_clk), .rst(radio_rst), .strobe(set_stb_user), .addr(set_addr_user), .in1(set_data_user),
         .out1(user_reg_0_value), .changed());

      setting_reg #(.my_addr(8'd1), .awidth(8), .width(32)) user_reg_1
        (.clk(radio_clk), .rst(radio_rst), .strobe(set_stb_user), .addr(set_addr_user), .in1(set_data_user),
         .out1(user_reg_1_value), .changed());

      always @* begin
         case(rb_addr_user)
            8'd0 : rb_data_user <= {user_reg_1_value, user_reg_0_value};
            default : rb_data_user <= 64'd0;
         endcase
      end
      */

   end else begin    //for USER_SETTINGS == 1
      always @* rb_data_user <= 64'd0;
   end
endgenerate


However, I can find no code, example or otherwise, in UHD to read and write to these registers. There is a set_user_register function, but no corresponding read function. Then there are enumerate_registers, read_register, and write_register in multi_usrp.cpp, but when I enumerate the registers I get nothing. More to the point, these user registers sit within the radio and the functions have no way of selecting which radio. How do I use the UHD software to talk to these registers? If I want more than 2 user registers do I need to change the value of SR_USER_SR_BASE? Currently it is set at 253.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ettus.com/pipermail/usrp-users_lists.ettus.com/attachments/20170719/b884e7b6/attachment-0002.html>


More information about the USRP-users mailing list