Reading and writing registers

Hi

I am having some trouble trying to get register writing and reading from
the C++ level to work. I’ve created two methods:

for writing

static bool
write_a_reg (usrp_basic *u, int address, int amount)
{
bool isit = u->_write_fpga_reg (address, amount);

return isit;
}

for reading

int
read_a_reg (usrp_basic *u, int address)
{
int val = u->_read_fpga_reg (address);

return val;
}

When I use the write method:

bool fine2 = write_a_reg (urx, 78, 60);

The returned boolean indicates that the write was successful. If I try
to read the same register though:

int value = read_a_reg (urx, 78);

it always returns zero no matter what I put in. The urx is the handle of
a usrp_standard_rx object, and if I’m not mistaken, register number 78
(`FR_USER_14) shoul be free to use. What am I doing wrong?

Regards

Lance

On Fri, Nov 03, 2006 at 02:43:46AM -0800, seph 004 wrote:

Hi

return isit;
}
register number 78 (`FR_USER_14) shoul be free to use. What am I
doing wrong?

Regards
Lance

Assuming that all registers are readable, or that they
are in the same address space as the writable registers would be a
mistake.

Try reading from registers 1, 2 or 3. See
usrp/firmware/include/fpga_regs_standard.h, down toward the bottom.

Please also note that writing random values into random registers can
lead to permanent damage. FR_USER_0 through FR_USER_15 are safe to
write with the .rbf’s that we distribute. We don’t pay any attention
to them.

Eric

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs