Dbsrx question

Hi All.

I’ve been trying to use the DBSRX daughterboard in slot A but am
running into some trouble while reading the status bytes of the Maxim
chip via i2c. The code I’m using to control the USRP is written in
Visual C++ 2005, and I’ve been able to talk to the TVRX daughterboard
with no problems. I added the c++ code to mimic the set_freq, set_gain,
etc… commands in db_dbs_rx.py, and seem to be able to adjust the gain
and bandwidth for the Maxim chip ok. The problem comes when I try to
use the set_freq command, which does a read_i2c which returns the two
status bytes as ints. I’ve done a side-by-side comparison with the
python script running on the same machine under Windows XP where I
monitor the register number and the value as commands are sent, and I
see my code executing exactly the same as the python script usrp_fft.py,
except that the status bytes returned by my code are 0, 127 as opposed
to the returned bytes in the python code of 8, 127. I don’t think I’m
doing
anything dumb with char to int conversions either in my code. Because
I get 0 for the first byte all the time, my while loop to set the
adc_val continues until it returns false, and the frequency never gets
set. The python script usrp_fft.py runs with no problems and I can
set_freq just fine. I have searched this forum for i2c errors and dbs
problems, but have not found anything like my problem. I’m sure I have
the correct i2c address set as well. Any suggestions? Please don’t
suggest that I just use the python script… :slight_smile:

Thanks a lot!

On Sun, Oct 22, 2006 at 10:31:31PM -0700, David Caruth wrote:

Hi All.

I have searched this forum for i2c errors and dbs problems, but have
not found anything like my problem. I’m sure I have the correct i2c
address set as well. Any suggestions? Please don’t suggest that I
just use the python script… :slight_smile:

My guess is that you are using the wrong i2c addresses. Many data
sheets conflate the 7-bit i2c address with the 8-bit byte that
contains the 7-bit i2c address in the top 7-bits and r/w bit in the
low bit of that byte. When our code is talking about an i2c address,
we really mean i2c address, not the i2c address shifted one way or
the other.

Eric

Well, I had the right i2c address, but was calling the wrong function
when initializing the dbs_rx board. I called the c++ equivalent of the
following Python code:

self._u._write_io(self._which,0x0001,0x0001)

instead of

self._u._write_oe(self._which,0x0001,0x0001)

So I typoed and put “io” instead of “oe” which resulted in the bad bad
behavior. Duh. Sorry for the false alarm, and thanks Eric and Matt for
your help!

Eric B. [email protected] wrote:
On Sun, Oct 22, 2006 at 10:31:31PM -0700, David Caruth wrote:

Hi All.

I have searched this forum for i2c errors and dbs problems, but have
not found anything like my problem. I’m sure I have the correct i2c
address set as well. Any suggestions? Please don’t suggest that I
just use the python script… :slight_smile:

My guess is that you are using the wrong i2c addresses. Many data
sheets conflate the 7-bit i2c address with the 8-bit byte that
contains the 7-bit i2c address in the top 7-bits and r/w bit in the
low bit of that byte. When our code is talking about an i2c address,
we really mean i2c address, not the i2c address shifted one way or
the other.

Eric

David Caruth wrote:

Hi All.

I’ve been trying to use the DBSRX daughterboard in slot A but am
running into some trouble while reading the status bytes of the Maxim
chip via i2c. The code I’m using to control the USRP is written in
Visual C++ 2005, and I’ve been able to talk to the TVRX daughterboard
with no problems. I added the c++ code to mimic the set_freq, set_gain,
etc… commands in db_dbs_rx.py, and seem to be able to adjust the gain
and bandwidth for the Maxim chip ok. The problem comes when I try to
use the set_freq command, which does a read_i2c which returns the two
status bytes as ints. I’ve done a side-by-side comparison with the
python script running on the same machine under Windows XP where I
monitor the register number and the value as commands are sent, and I
see my code executing exactly the same as the python script usrp_fft.py,
except that the status bytes returned by my code are 0, 127 as opposed
to the returned bytes in the python code of 8, 127. I don’t think I’m
doing
anything dumb with char to int conversions either in my code. Because
I get 0 for the first byte all the time, my while loop to set the
adc_val continues until it returns false, and the frequency never gets
set. The python script usrp_fft.py runs with no problems and I can
set_freq just fine. I have searched this forum for i2c errors and dbs
problems, but have not found anything like my problem. I’m sure I have
the correct i2c address set as well. Any suggestions? Please don’t
suggest that I just use the python script… :slight_smile:

Thanks a lot!

David,

I am trying to setup USRP w/RFX2400 db to work in visual C++.

Would I be able to get a copy of your Visual C++ code to use as a
guidline on what to do?

Thanks