Hi,
I want to read RSSI value using analog AUX ADC, I think we can read
RSSI
through AUX_ADC_A1 pin of AD9862, I looked through the code
of usrp_read_aux_adc in file
/root/gnuradio/gnuradio-3.1.3/usrp/host/lib/legacy/usrp_primes.cc,
bool
usrp_read_aux_adc (struct usb_dev_handle *udh, int slot,
int which_adc, int *value)
{
*value = 0;
int which_codec;
if (!slot_to_codec (slot, &which_codec))
return false;
if (!(0 <= which_codec && which_codec < 2)){
fprintf (stderr, “usrp_read_aux_adc: invalid adc = %d\n”,
which_adc);
return false;
}
unsigned char aux_adc_control =
AUX_ADC_CTRL_REFSEL_A // on chip reference
| AUX_ADC_CTRL_REFSEL_B; // on chip reference
int rd_reg = 26; // base address of two regs to read for result
// program the ADC mux bits
if (tx_slot_p (slot))
aux_adc_control |= AUX_ADC_CTRL_SELECT_A2 | AUX_ADC_CTRL_SELECT_B2;
else {
rd_reg += 2;
aux_adc_control |= AUX_ADC_CTRL_SELECT_A1 | AUX_ADC_CTRL_SELECT_B1;
}
// I’m not sure if we can set the mux and issue a start conversion
// in the same cycle, so let’s do them one at a time.
usrp_9862_write (udh, which_codec, 34, aux_adc_control);
if (which_adc == 0)
aux_adc_control |= AUX_ADC_CTRL_START_A;
else {
rd_reg += 4;
aux_adc_control |= AUX_ADC_CTRL_START_B;
}
// start the conversion
usrp_9862_write (udh, which_codec, 34, aux_adc_control);
// read the 10-bit result back
unsigned char v_lo = 0;
unsigned char v_hi = 0;
bool r = usrp_9862_read (udh, which_codec, rd_reg, &v_lo);
r &= usrp_9862_read (udh, which_codec, rd_reg + 1, &v_hi);
if ®
*value = ((v_hi << 2) | ((v_lo >> 6) & 0x3)) << 2; // format
as
12-bit
return r;
}
my question is:
1.The AD 9862 specification says: “The AUX SPI can be enabled and
configured
by setting register AUX ADC CTRL. Setting register use pins high enables
the
AUX SPI port.”, but in the above code AUX_ADC_CTRL_AUX_SPI was not set
high(
In my opinion, aux_adc_control should be added with | =
AUX_ADC_CTRL_AUX_SPI
because usrp_9862_write and usrp_9862_read all need SPI operation, so we
should enable AUX API), Is this a mistype or another method ?
2.stefan.bruens in the list had said that the low 16 bits is the RSSI
value,
I want to know why did the above code combine the high and low 16-bit
and
format the data into 12-bit ?
3. Even with the RSSI value (int type), what should I do to convert that
value into dBm unit ?
Thanks.
–
Su Jinzhao
On Tue, Jun 16, 2009 at 09:15:34PM +0800, Su Jinzhao wrote:
Hi,
I want to read RSSI value using analog AUX ADC, I think we can read RSSI
through AUX_ADC_A1 pin of AD9862, I looked through the code
of usrp_read_aux_adc in file
/root/gnuradio/gnuradio-3.1.3/usrp/host/lib/legacy/usrp_primes.cc,
If you are using usrp_standard_rx, or gr.usrp_source_*, you can do
this much more simply by using:
adc_val = u->read_aux_adc(which_side, which_adc)
http://gnuradio.org/doc/doxygen/classusrp__basic__rx.html
http://gnuradio.org/doc/doxygen/classusrp__standard__rx.html
You didn’t mention which daughterboard you are using. Not all
daughterboards have an analog RSSI output.
my question is:
1.The AD 9862 specification says: “The AUX SPI can be enabled and configured
by setting register AUX ADC CTRL. Setting register use pins high enables the
AUX SPI port.”, but in the above code AUX_ADC_CTRL_AUX_SPI was not set high(
In my opinion, aux_adc_control should be added with | = AUX_ADC_CTRL_AUX_SPI
because usrp_9862_write and usrp_9862_read all need SPI operation, so we
should enable AUX API), Is this a mistype or another method ?
The code is correct. There are a couple of ways to use the AUX ADCs.
We use them by polling, not over the AUX SPI bus.
2.stefan.bruens in the list had said that the low 16 bits is the RSSI value,
I want to know why did the above code combine the high and low 16-bit and
format the data into 12-bit ?
This is a digital RSSI, determined post high-speed ADC. You can look
at the computation here:
http://gnuradio.org/trac/browser/gnuradio/trunk/usrp/fpga/sdr_lib/rssi.v
- Even with the RSSI value (int type), what should I do to convert that
value into dBm unit ?
You would need to calibrate the entire signal path. Left as an
exercise…
Eric
Hi,
Eric
On Wed, Jun 17, 2009 at 1:52 AM, Eric B. [email protected] wrote:
adc_val = u->read_aux_adc(which_side, which_adc)
http://gnuradio.org/doc/doxygen/classusrp__basic__rx.html
http://gnuradio.org/doc/doxygen/classusrp__standard__rx.html
You didn’t mention which daughterboard you are using. Not all
daughterboards have an analog RSSI output.
my question is:
1.The AD 9862 specification says: “The AUX SPI can be enabled and
configured
by setting register AUX ADC CTRL. Setting register use pins high enables
the
AUX SPI port.”, but in the above code AUX_ADC_CTRL_AUX_SPI was not set
high(
In my opinion, aux_adc_control should be added with | =
AUX_ADC_CTRL_AUX_SPI
because usrp_9862_write and usrp_9862_read all need SPI operation, so we
should enable AUX API), Is this a mistype or another method ?
The code is correct. There are a couple of ways to use the AUX ADCs.
http://gnuradio.org/trac/browser/gnuradio/trunk/usrp/fpga/sdr_lib/rssi.v
- Even with the RSSI value (int type), what should I do to convert that
value into dBm unit ?
You would need to calibrate the entire signal path. Left as an exercise…
Eric
my new questions are (Sorry for my talkactive ^_^ ) :
1. Autually, I was indeed use u->read_aux_adc(which_side, which_adc)
in
my python code, However, I can’t step into the C++ code while using pdb
to
debug my python code, so I am not sure whether read_aux_adc() really
call
the function usrp_read_aux_adc in file
gnuradio-3.1.3/usrp/host/lib/legacy/usrp_prims.cc ?
2. In the function usrp_read_aux_adc, we can read values of
registers
26-33 directly, so I am confused with the relation between
usrp_read_aux_adc
and the rssi.v code, do they have no relation ?
3. If I want to convert the RSSI value into dBm units, means that I
have
to find the reference voltage and resistance,( however, on page 16 and
30 of AD9860_9862 specification, settings of bits Refsel B/A are
illustated
self-contradictory), and then calculate the power with voltage and
resistance ? Please confirm me whether my idea is correct.
4. By the way, I am using daughterboard RFX2400 and RFX900, so I
think
this two daughterboards have no problem with RSSI output.
On Thu, Jun 18, 2009 at 11:34:37AM +0800, Su Jinzhao wrote:
my new questions are (Sorry for my talkactive ^_^ ) :
1. Autually, I was indeed use u->read_aux_adc(which_side, which_adc) in
my python code, However, I can’t step into the C++ code while using pdb to
debug my python code, so I am not sure whether read_aux_adc() really call
the function usrp_read_aux_adc in file
gnuradio-3.1.3/usrp/host/lib/legacy/usrp_prims.cc ?
Yes it does.
2. In the function usrp_read_aux_adc, we can read values of registers
26-33 directly, so I am confused with the relation between usrp_read_aux_adc
and the rssi.v code, do they have no relation ?
There is no relation.
Eric