# Phase coherence for N210 and SBX

**URL:** <https://www.ruby-forum.com/t/phase-coherence-for-n210-and-sbx/241688>\
**Category:** GNU Radio\
**Created:** [April 23, 2015, 8:51pm UTC](https://www.ruby-forum.com/t/phase-coherence-for-n210-and-sbx/241688 "2015-04-23T20:51:54Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![musicdenotation](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ea666f/32.png) [@musicdenotation](https://www.ruby-forum.com/u/musicdenotation)\
**Post date:** [April 23, 2015, 8:51pm UTC](https://www.ruby-forum.com/t/phase-coherence-for-n210-and-sbx/241688/1 "2015-04-23T20:51:54Z")

</div>

Hi,

I am working on phase coherent reception using 2 USRP N210s where each  
is  
mounted with a SBX. The 2 N210s are connected via a MIMO cable. 10MHz  
reference clock and PPS are generated by an OctoClock-G and are fed into  
each N210. In this experiment, a TX antenna transmits a constant signal  
to  
2 RX antennas. I want to obtain coherent phases at the 2 RX antennas.  
Attached is the flow graph I am executing. It seems that I cannot  
achieve  
coherent phase at the 2 Rx antennas. Any suggestions? Thanks.

Pengyu

---

<div class="post-metadata">

**Author:** ![Pengyu\_Z](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e79b87/32.png) [@Pengyu\_Z](https://www.ruby-forum.com/u/Pengyu_Z)\
**Post date:** [April 24, 2015, 12:07am UTC](https://www.ruby-forum.com/t/phase-coherence-for-n210-and-sbx/241688/2 "2015-04-24T00:07:57Z")

</div>

I followed the suggestions and plotted the received baseband signal in  
the  
IQ constellation. The phase offset of the baseband received by the two  
RX  
antennas are still not constant… Attached are the update flow graph  
and  
python program. Would be great if you can take a look again. Thanks.

---

<div class="post-metadata">

**Author:** ![Pengyu\_Z](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e79b87/32.png) [@Pengyu\_Z](https://www.ruby-forum.com/u/Pengyu_Z)\
**Post date:** [April 23, 2015, 9:08pm UTC](https://www.ruby-forum.com/t/phase-coherence-for-n210-and-sbx/241688/3 "2015-04-23T21:08:15Z")

</div>

If you have the Octoclock-G connected to both units, then you don’t need  
to use the MIMO cable.

Make sure that both mboards have “external” for both the reference clock  
and pps selections, and that “device time” is set to “unknown PPS” for  
both of them.

On 2015-04-23 14:49, Pengyu Z. wrote:

> Hi,
> 
> I am working on phase coherent reception using 2 USRP N210s where each is  
> mounted with a SBX. The 2 N210s are connected via a MIMO cable. 10MHz reference  
> clock and PPS are generated by an OctoClock-G and are fed into each N210. In this  
> experiment, a TX antenna transmits a constant signal to 2 RX antennas. I want to  
> obtain coherent phases at the 2 RX antennas. Attached is the flow graph I am  
> executing. It seems that I cannot achieve coherent phase at the 2 Rx antennas. Any  
> suggestions? Thanks.
> 
> Pengyu
> 
> * * *
> 
> Discuss-gnuradio mailing list  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> [Discuss-gnuradio Info Page](https://lists.gnu.org/mailman/listinfo/discuss-gnuradio) [1]

Links:

---

<div class="post-metadata">

**Author:** ![Pengyu\_Z](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e79b87/32.png) [@Pengyu\_Z](https://www.ruby-forum.com/u/Pengyu_Z)\
**Post date:** [April 24, 2015, 12:19am UTC](https://www.ruby-forum.com/t/phase-coherence-for-n210-and-sbx/241688/4 "2015-04-24T00:19:44Z")

</div>

On 04/23/2015 06:06 PM, Pengyu Z. wrote:

> I followed the suggestions and plotted the received baseband signal in  
> the IQ constellation. The phase offset of the baseband received by the  
> two RX antennas are still not constant… Attached are the update flow  
> graph and python program. Would be great if you can take a look again.  
> Thanks.

ALSO, the WX GUI scope sink doesn’t maintain predictable phase-alignment  
between multiple signal sources…

---

<div class="post-metadata">

**Author:** ![Pengyu\_Z](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e79b87/32.png) [@Pengyu\_Z](https://www.ruby-forum.com/u/Pengyu_Z)\
**Post date:** [April 24, 2015, 12:14am UTC](https://www.ruby-forum.com/t/phase-coherence-for-n210-and-sbx/241688/5 "2015-04-24T00:14:20Z")

</div>

On 04/23/2015 06:06 PM, Pengyu Z. wrote:

> ```
> don't need to use the MIMO cable.
> 
> ```
> 
> > ```
> > cable. 10MHz reference clock and PPS are generated by an
> > https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
> > 
> > ```

If you want phase-coherency, the two USRP sources _must_ be part of the  
same multi\_usrp object–you have them as separate sources. One  
can think of a multi\_usrp object as also providing a common  
“coherency domain”.

Also, even when you do that, the “timed commands” feature in UHD,  
specifically designed to zero-out phase _offset_ for the SBX and WBX and  
UBX boards, isn’t, as far as I recall, something that gr-uhd does  
automatically, so it isn’t available in a GR flow-graph. Martin B.  
can correct  
me if I’m wrong.

---

<div class="post-metadata">

**Author:** ![Pengyu\_Z](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e79b87/32.png) [@Pengyu\_Z](https://www.ruby-forum.com/u/Pengyu_Z)\
**Post date:** [April 24, 2015, 12:25am UTC](https://www.ruby-forum.com/t/phase-coherence-for-n210-and-sbx/241688/6 "2015-04-24T00:25:09Z")

</div>

Thanks for the inspiring tips. I did not use the WX GUI scope for  
checking  
the phase offset. Instead, I log the baseband signal received by each RX  
antenna. Then, I plot the IQ constellation of the received baseband for  
checking their phase offset.

Can you be a bit more specific when you say the “multi\_usrp object” and  
the  
“timed commands”? Are there tutorials that I can follow step by step for  
using the two functions you mentioned? Your comments are very helpful 🙂

---

<div class="post-metadata">

**Author:** ![Pengyu\_Z](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e79b87/32.png) [@Pengyu\_Z](https://www.ruby-forum.com/u/Pengyu_Z)\
**Post date:** [April 24, 2015, 12:30am UTC](https://www.ruby-forum.com/t/phase-coherence-for-n210-and-sbx/241688/7 "2015-04-24T00:30:35Z")

</div>

On 04/23/2015 06:23 PM, Pengyu Z. wrote:

> Thanks for the inspiring tips. I did not use the WX GUI scope for  
> checking the phase offset. Instead, I log the baseband signal received  
> by each RX antenna. Then, I plot the IQ constellation of the received  
> baseband for checking their phase offset.
> 
> Can you be a bit more specific when you say the “multi\_usrp object”  
> and the “timed commands”? Are there tutorials that I can follow step  
> by step for using the two functions you mentioned? Your comments are  
> very helpful 🙂

A source/sink block in Gnu Radio uses an underlying multi\_usrp object,  
so all you have to do is configure your source block for two channels,  
with  
two devices, and use

addr0=\<first-device-ip-addr,addr1=

In the device arguments.

Also, recent gr-uhd (3.7.6.1 and newer at least) use timed commands, so  
phase-zeroing will happen after a tune automatically, without you having  
to do anything.

The top of the UHD manual is here:

[http://files.ettus.com/manual/page\_devices.htmlhttp://files.ettus.com/manual/page\_devices.html](http://files.ettus.com/manual/page_devices.htmlhttp://files.ettus.com/manual/page_devices.html)

The Doxygen docs are here:

> **[USRP Hardware Driver and Device Manual: Coding to the API](https://files.ettus.com/manual/page_coding.html)**

The documents for gr-uhd are part of the Gnu Radio documentation:

> **[GNU Radio Manual and C++ API Reference: gr::uhd::usrp\_source Class Reference](https://www.gnuradio.org/doc/doxygen/classgr_1_1uhd_1_1usrp__source.html)**

---

<div class="post-metadata">

**Author:** ![Pengyu\_Z](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e79b87/32.png) [@Pengyu\_Z](https://www.ruby-forum.com/u/Pengyu_Z)\
**Post date:** [April 24, 2015, 9:09am UTC](https://www.ruby-forum.com/t/phase-coherence-for-n210-and-sbx/241688/8 "2015-04-24T09:09:02Z")

</div>

Hi Marcus, hi Pengyu,

I’d like to make an addition to that:  
modern gr-uhd uses a timed command to start streaming samples, so the  
CORDICs in both USRPs should be aligned. But:  
It doesn’t inherently use timed commands for tuning; you should do  
something like:

usrp\_source0.set\_command\_time(uhd\_source0.get\_time\_now()+0.1)  
usrp\_source0.set\_center\_freq(frequency)  
usrp\_source0.clear\_command\_time()  
time.sleep(0.15)

after you configured your usrp\_source and before your top\_block is  
.start()ed.

Generally, I like  
[http://files.ettus.com/manual/page\_sync.html](http://files.ettus.com/manual/page_sync.html)  
because it explains a bit why and how things work.

Greetings,  
Marcus

---

<div class="post-metadata">

**Author:** ![Pengyu\_Z](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e79b87/32.png) [@Pengyu\_Z](https://www.ruby-forum.com/u/Pengyu_Z)\
**Post date:** [April 24, 2015, 10:29pm UTC](https://www.ruby-forum.com/t/phase-coherence-for-n210-and-sbx/241688/9 "2015-04-24T22:29:11Z")

</div>

Hi Marcus,

I updated the flow graph (attached) as you suggested. It would be great  
if  
you can help check and let me know if I am wrong…

For upgrading the UHD, I followed this link. UHD is installed  
successfully.  
However, it seems that gnuradio does not call the latest UHD. Instead,  
it  
still calls uhd-host which is combined in the gnuradio package. Do you  
have  
suggestions about how to solve this problem? Thanks.

Pengyu

---

<div class="post-metadata">

**Author:** ![Pengyu\_Z](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e79b87/32.png) [@Pengyu\_Z](https://www.ruby-forum.com/u/Pengyu_Z)\
**Post date:** [April 24, 2015, 11:25pm UTC](https://www.ruby-forum.com/t/phase-coherence-for-n210-and-sbx/241688/10 "2015-04-24T23:25:27Z")

</div>

I got the same UHD version (shown below) when I use apt-get for  
installation. I will try the PyBOMBS now…

$ python top\_block.py  
linux; GNU C++ version 4.8.2; Boost\_105400; UHD\_003.005.005-0-unknown

$ apt-get install gnuradio

---

<div class="post-metadata">

**Author:** ![Pengyu\_Z](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e79b87/32.png) [@Pengyu\_Z](https://www.ruby-forum.com/u/Pengyu_Z)\
**Post date:** [April 24, 2015, 10:50pm UTC](https://www.ruby-forum.com/t/phase-coherence-for-n210-and-sbx/241688/11 "2015-04-24T22:50:04Z")

</div>

On 04/24/2015 04:27 PM, Pengyu Z. wrote:

> ```
> constellation of the received baseband for checking their
> two devices, and use
> 
> http://gnuradio.org/doc/doxygen/classgr_1_1uhd_1_1usrp__source.html
> 
> ```

Uninstall all your uhd and gnuradio packages, and re-install, following  
the guide here:

[http://ettus-apps.sourcerepo.com/redmine/ettus/projects/uhd/wiki/GNU\_Radio\_UHD](http://ettus-apps.sourcerepo.com/redmine/ettus/projects/uhd/wiki/GNU_Radio_UHD)

---

<div class="post-metadata">

**Author:** ![Pengyu\_Z](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e79b87/32.png) [@Pengyu\_Z](https://www.ruby-forum.com/u/Pengyu_Z)\
**Post date:** [April 25, 2015, 10:51am UTC](https://www.ruby-forum.com/t/phase-coherence-for-n210-and-sbx/241688/12 "2015-04-25T10:51:41Z")

</div>

You _must not_ do apt-get install gnuradio, because Ubuntu’s GNU Radio  
depends on Ubuntu’s UHD which will automatically and inevitably be  
installed; so you must uninstall gnuradio, uhd-host, and your manually  
installed UHD now, before doing things with pybombs.

Greetings,  
Marcus

---

<div class="post-metadata">

**Author:** ![Pengyu\_Z](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e79b87/32.png) [@Pengyu\_Z](https://www.ruby-forum.com/u/Pengyu_Z)\
**Post date:** [April 24, 2015, 11:43pm UTC](https://www.ruby-forum.com/t/phase-coherence-for-n210-and-sbx/241688/13 "2015-04-24T23:43:43Z")

</div>

Hello Pengyu:

I’ll send you my build instructions document. I think that will help  
guide  
you.

–Neel
