# DBSRX coherent problem (Phase Noise)

Hi all

I am trying to create a simple direction finding device using the Ettus
USRP1 and 2 DBSRX receivers. However I am finding a large amount of
phase
noise between the two receivers. Even across a 128 sample collection I
find over 60 degrees of phase change. Because the two receivers are
driven
from the same 64M clock I had hoped and read that they would be coherent
over the short term. Is there something special I need to program to
get

while
there are reports I did not get the feel that the values were so high.
I
have found that using an FFT and calculating the phase at the peak
provides
processing improvements, however there is still a 2 - 6 degree standard
deviation in the phase. This calculated phase was for 200 FFTs of 128
points.

I am using the gnuradio-3.2 software to control the usrp and simply
collecting raw I & Q data to a file. I have a signal generator
outputting a
tone signal at 1.88 GHz, -50dBM. The signal goes in to a splitter and
then
directly into the receivers. I modified the software to be able to set
the
frequency & gain of both receivers. The data is then written to a file
and
I process the data using Matlab. I am using the std_2rxhb_2tx_dig.rbf
firmware file but have also used the std_2rxhb_2tx.rbf firmware and
collected complex data with the same results.

http://old.nabble.com/file/p30200932/Diagram.jpg

The frequency 1.88 GHz
Decimation 128
The sample rate is 500k/sec

The first image is the phase between RXA & RXB for each sample of a 128
sample collection.
Phase is calculate using time domain complex values.
phase = RXB / conjugate(RXA)

http://old.nabble.com/file/p30200932/Phase_accross_128_samples.jpg

The sample changes over 60 degrees across this very short sample period
The data sample can be anywhere in a 10 second collection and the
results
are similar.

The second image shows the plot of the two real components of the same
128
samples.
The phase shift is so large it is visible in the plot. I
I noticed that the tuned frequency is about 12 kHz off target, but this
is
within the expected spec. of the system.

http://old.nabble.com/file/p30200932/Real-RXa_Real_RXb.jpg

What phase noise improvements are seen in the new DBSRX2 daughter
boards?

## Thank you for your time and any help would be very much appreciated. Tom

View this message in context:
http://old.nabble.com/DBSRX-coherent-problem-(Phase-Noise)-tp30200932p30200932.html
Sent from the GnuRadio mailing list archive at Nabble.com.

Can you copy and paste the section of code where you issue tuning
commands
to your daughtercards? This looks similar to something I was seeing
earlier,
with 2 WBX cards, which was due to a mistype in my tuning commands.

-Steven

On 11/12/2010 08:32 AM, tom_wgs wrote:

directly into the receivers. I modified the software to be able to set the
frequency& gain of both receivers. The data is then written to a file and
I process the data using Matlab. I am using the std_2rxhb_2tx_dig.rbf
firmware file but have also used the std_2rxhb_2tx.rbf firmware and
collected complex data with the same results.

What phase noise improvements are seen in the new DBSRX2 daughter boards?

The DBSRX2 has much better close in phase noise, so it will improve on
this. However, I think what you are seeing with the original DBSRX
should look better than that. Can you do an FFT of each input signal
and send a link to them? I think you might see a lot more noise on one
than the other, indicating a problem with one board.

Matt

Matt E. wrote in post #961018:

On 11/12/2010 08:32 AM, tom_wgs wrote:

directly into the receivers. I modified the software to be able to set the
frequency& gain of both receivers. The data is then written to a file and
I process the data using Matlab. I am using the std_2rxhb_2tx_dig.rbf
firmware file but have also used the std_2rxhb_2tx.rbf firmware and
collected complex data with the same results.

What phase noise improvements are seen in the new DBSRX2 daughter boards?

The DBSRX2 has much better close in phase noise, so it will improve on
this. However, I think what you are seeing with the original DBSRX
should look better than that. Can you do an FFT of each input signal
and send a link to them? I think you might see a lot more noise on one
than the other, indicating a problem with one board.

Matt

Attached are 2 FFT plots one for each of the receivers. The plots are of
the same data used to create previous images.

I have attached a couple additional plots showing the results of taking
128 complex points at 500 kHz sampling rate from channel 2, and dividing
it (complex) by the same number of complex points from channel 1
(element-by-element division, or complex mixing).

If the boards were coherent, you would expect to see a constant value
for the real and imaginary results that represent the static, or short
term, phase offsets between the channels. Instead, we are seeing that
both real and imaginary output is showing a pseudo-periodic waveform,
suggesting phase imbalance between the real and imaginary, and also
non-coherent behavior.

In some test (3rd image) we see that the real channel is fairly
you would expect to see the real and imaginary parts have a sinusoidal
output.

Steven C. wrote in post #961016:

Can you copy and paste the section of code where you issue tuning
commands
to your daughtercards? This looks similar to something I was seeing
earlier,
with 2 WBX cards, which was due to a mistype in my tuning commands.

-Steven

below is a snippet of the code that sets up the usrp and the functions
that set freq and gain.

//snippet

mux = 0x00003210;
d_which = 0;
fpga_filename=“std_2rxhb_2tx_dig.rbf”;
d_usrp_s = usrp_make_source_s(d_which, d_decim, 2, mux, 0, 0, 0,
fpga_filename.c_str());
d_usrp_s->set_nchannels(2);
d_spec = str_to_subdev(“A:0”);
d_spec2 = str_to_subdev(“B:0”);
d_subdev = d_usrp_s->selected_subdev(d_spec);
d_subdev2 = d_usrp_s->selected_subdev(d_spec2);

// Set Gain
float gain_min = d_subdev->gain_min();
float gain_max = d_subdev->gain_max();
if(d_gain == -1) {
d_gain = (gain_min + gain_max)/2.0;
}

// Set the USRP/dboard Gain
usrp_phaser_gain(d_gain);
// Set the USRP/dboard frequency
usrp_phaser_tune(freq);

d_my_gpio = wgs_gpio_make_stream_ss();
connect(d_src, 0, d_my_gpio, 0);

int usrp_phaser::usrp_phaser_tune( double freq)
{
usrp_tune_result r;
bool ok;
char tmp_str[256];

ok = d_usrp_s->tune(0, d_subdev, freq, &r);
if(!ok)
{
sprintf (tmp_str, “Could not set frequency for
(%s).\n”,d_subdev->side_and_name().c_str());
printf("%s", tmp_str);
return(1);
}
else
{
printf(“Tune Results: DC-Freq=%g, DDC-Freq=%g,Residual=%g,
Inverted+=%d\n”,
r.baseband_freq,r.dxc_freq,r.residual_freq,r.inverted);
}

// Set the USRP/dboard 2 frequency
ok = d_usrp_s->tune(1, d_subdev2, freq, &r);
if(!ok)
{
sprintf (tmp_str, “Could not set frequency for
(%s).\n”,d_subdev2->side_and_name().c_str());
printf("%s", tmp_str);
return(1);
}
else
{
printf(“Tune Results: DC-Freq=%g, DDC-Freq=%g,Residual=%g,
Inverted+=%d\n”,
r.baseband_freq,r.dxc_freq,r.residual_freq,r.inverted);
}
return(0);
}

int usrp_phaser::usrp_phaser_gain( int gain )
{
usrp_tune_result r;
bool ok;

// Set the USRP/dboard 1 gain
ok = d_subdev->set_gain(gain);
if(!ok)
{
sprintf (tmp_str, “Could not set gain (%d) for (%s).\n”, gain,
d_subdev->side_and_name().c_str());
printf("%s", tmp_str);
return(1);
}
else
{
printf(“Gain A set to %d\n”, gain);
}

// Set the USRP/dboard 2 gain
ok = d_subdev2->set_gain(gain);
if(!ok)
{
sprintf (tmp_str, “Could not set gain (%d) for (%s).\n”, gain,
d_subdev2->side_and_name().c_str());
printf("%s", tmp_str);
return(1);
}
else
{
printf(“Gain B set to %d\n”, gain);
}
return(0);
}

Steven C.-2 wrote:

if(d_gain == -1) {

{
}
else
usrp_tune_result r;
}
gain, d_subdev2->side_and_name().c_str());

[email protected]

View this message in context:
http://old.nabble.com/DBSRX-coherent-problem-(Phase-Noise)-tp30200932p30202545.html
Sent from the GnuRadio mailing list archive at Nabble.com.

Matt E. wrote:

Attached are 2 FFT plots one for each of the receivers. The plots are of
the same data used to create previous images.

View this message in context:
http://old.nabble.com/DBSRX-coherent-problem-(Phase-Noise)-tp30200932p30202581.html
Sent from the GnuRadio mailing list archive at Nabble.com.

tom_wgs wrote:

http://old.nabble.com/file/p30202507/Time%2BDomain%2BFreq%2B%2526%2Bother%2Berrors.jpg

http://old.nabble.com/file/p30202507/RXA_norm_RXB_Time_Domain.jpg

I found a partial solution but am not sure why and if my problem is
completely fixed. I found that the Charge pump setting (_set_cp(int)
was
being set to 2 different values at 1880mHz for the 2 receivers. After
experimenting the best results come when forcing the values both to 1
for
all tested frequencies.

The results can be seen below. Compare this to the results previous
provided above. Can anyone provide some information on the charge pump
and
how the settings effect the receiver.

Thanks.

Results at 826 mHz
http://old.nabble.com/file/p30208676/826.1_cp-1_test-2.jpg

View this message in context:
http://old.nabble.com/DBSRX-coherent-problem-(Phase-Noise)-tp30200932p30208676.html
Sent from the GnuRadio mailing list archive at Nabble.com.

tom_wgs wrote:

Hi all

Thank you for your time and any help would be very much appreciated.
Tom

I have attached a couple additional plots showing the results of taking
128 complex points at 500 kHz sampling rate from channel 2, and dividing
it (complex) by the same number of complex points from channel 1
(element-by-element division, or complex mixing).

If the boards were coherent, you would expect to see a constant value
for the real and imaginary results that represent the static, or short
term, phase offsets between the channels. Instead, we are seeing that
both real and imaginary output is showing a pseudo-periodic waveform,
suggesting phase imbalance between the real and imaginary, and also
non-coherent behavior.

http://old.nabble.com/file/p30202507/Time%2BDomain%2BFreq%2B%2526%2Bother%2Berrors.jpg

http://old.nabble.com/file/p30202507/RXA_norm_RXB_Time_Domain.jpg

In some test (3rd image) we see that the real channel is fairly
you would expect to see the real and imaginary parts have a sinusoidal
output.

http://old.nabble.com/file/p30202507/RXA_norm_RXB_Time_Domain_2.jpg

View this message in context:
http://old.nabble.com/DBSRX-coherent-problem-(Phase-Noise)-tp30200932p30202507.html
Sent from the GnuRadio mailing list archive at Nabble.com.

On Sat, Nov 13, 2010 at 10:41 AM, tom_wgs [email protected]
wrote:

being set to 2 different values at 1880mHz for the 2 receivers. After
experimenting the best results come when forcing the values both to 1 for
all tested frequencies.

The results can be seen below. Compare this to the results previous
provided above. Can anyone provide some information on the charge pump and
how the settings effect the receiver.

Interesting results, there is an application note (max2116 AN02-R0)
that can be requested from Maxim regarding how to select VCOs when
tuning the max2118.

It indicates that the Vtune voltage for the selected VCO should be
charge pump current. That is what was implemented at:

http://ettus-apps.sourcerepo.com/redmine/ettus/projects/uhd/repository/revisions/master/entry/host/lib/usrp/dboard/db_dbsrx.cpp#L383

Could you set dbsrx_debug to true on line 46 of db_dbsrx.cpp and
rebuild and install UHD. Then look for output lines like:

DBSRX: final vco %d, vtune adc %d

and see what VCO and Vtune voltage is achieved on each DBSRX.

It is possible that your frequency of choice falls on the edge of a
VCO band for the DBSRX, and thus you get different settings. But if
the DBSRX is locked, I would not think the difference in charge pump
current would cause varying phase offsets.

Jason