Setting registers

Hi guys:

My name is Zhuocheng Y., you can call me Leo. I am pretty new to
gnuradio, started working on it a month ago. Since Thibaud has gone back
to Switzerland, I will be taking over his work. I am currently trying to
process the control packets, but I am not sure how I can read/write to
registers. Can anyone tell me where the registers are and how I can
read/write to them?

Leo

On 7/16/07, Zhuocheng Y. [email protected] wrote:

Hi guys:

My name is Zhuocheng Y., you can call me Leo. I am pretty new to gnuradio, started working on it a month ago. Since Thibaud has gone back to Switzerland, I will be taking over his work. I am currently trying to process the control packets, but I am not sure how I can read/write to registers. Can anyone tell me where the registers are and how I can read/write to them?

I believe setting_reg.v is instantiated wherever there is a register
which can be written to. Being able to have access to every register
makes for a very hairy problem. They are written to the FX2 over I2C
I am pretty sure.

Are there specific registers you want access to? What is your final
goal? Is there another way to perform what you want to do?

Brian

Zhuocheng Y. wrote:

Can anyone tell me where the registers are and how I can read/write
to them?

Once you create a usrp.source_c() or usrp.sink_c() object, you can call:

u = usrp.source_c()

u._write_fpga_reg(regno, val)

The registers are write-only. You may call:

u._read_fpga_reg(regno)

…but the return value will either be zero or a semi-documented set of
debugging values unrelated to the register number you put.

The register definitions are in:

usrp/firmware/include/fpga_regs_common.h
usrp/firmware/include/fpga_regs_standard.h

*** NOTE: it is possible to damage your hardware by incorrectly setting
these registers ***


Johnathan C.
Corgan Enterprises LLC
http://corganenterprises.com

On 7/16/07, George N. [email protected] wrote:

instance, how he can actually perform the read or write.
Major surgery. Disconnect the I2C pins between the FX2 and the FPGA
logic (float the pins coming in, and ground the pin going out?). Then
every register has to be put into a register file which the C/S state
machine has the ability to read/write, and create input ports for each
of the modules which have registers associated with them.

You may be able to use a spare pin connected to the FX2 to perform
some weird loopback thing where the host sends to FX2 which then sends
to the FPGA. The FPGA notices it must write a register, so it sends a
special packet back to the FX2 which the FX2 parses after it reads (no
DMA here) and then performs the I2C write, but that is a big old mess
too.

Both are pretty involved modifications - at least that’s my take on
the whole affair, which I could be completely wrong about.

Brian

So I think what Leo is getting at is how to actually perform the read or
the write to a register for the C/S packets. For instance we have the
read/write register commands where the application says read from
register X or write this data to it.

This would pertain to OP_WRITE_REG, OP_WRITE_REG_MASKED, OP_READ_REG,
and OP_READ_REG_REPLY:
http://gnuradio.org/trac/browser/gnuradio/trunk/usrp/doc/inband-signaling-usb

I’m assuming what Leo is wondering, is when I pass him register 3 for
instance, how he can actually perform the read or write.

  • George

Brian P. wrote:

I’m assuming what Leo is wondering, is when I pass him register 3 for
instance, how he can actually perform the read or write.

Major surgery. Disconnect the I2C pins between the FX2 and the FPGA
logic (float the pins coming in, and ground the pin going out?). Then
every register has to be put into a register file which the C/S state
machine has the ability to read/write, and create input ports for each
of the modules which have registers associated with them.

FPGA registers are not set using I2C, they are set with SPI. There is
already a mechanism for reading back values over SPI, but it is only set
up to read back 8 values now, mostly for reading io pins and rssi
levels, but not every register. See serial_io.v and setting_reg.v

You may be able to use a spare pin connected to the FX2 to perform
some weird loopback thing where the host sends to FX2 which then sends
to the FPGA. The FPGA notices it must write a register, so it sends a
special packet back to the FX2 which the FX2 parses after it reads (no
DMA here) and then performs the I2C write, but that is a big old mess
too.

No hardware modifications necessary
.

Matt