[USRP-users] How good can USRPs with internal GPSDOs being synchronized?

Josh Blum josh at ettus.com
Wed Sep 4 18:40:26 EDT 2013

On 09/04/2013 04:50 AM, Chi wrote:
> Hi all,
> I am trying to synchronise two USRP N210 with the goal of receiving
> time-aligned samples.
> I've modified the rx_samples_to_file.cpp code according to this page:
> http://files.ettus.com/uhd_docs/manual/html/sync.html
> It seems that the signals at the USRPs have between +0.2 and -0.2 us time
> difference.
> This time difference seems to be random, as it changes every time I run a
> new experiment.
> Does anyone know why the samples receive at these two USRPs are still not
> aligned?
> I thought the time difference should be less than 100ns. What's the right
> way to minimize the
> time difference??

Well, synchronization involves a few steps. Since you are using internal
GPSDOs, here is sort of a checklist of things to do:

1) The USRP will automatically set its time and clock source to GPSDO
and set the time registers to be UTC time from the GPSDO. I think
explicitly setting usrp->set_time/clock_source("gpsdo", unit) is still a
good idea.

1.1) Add a sleep(1) after multi_usrp::make(args). This will allow extra
time for the time registers to trigger and sync from the PPS.

2) Is the reference clock locked? bool locked =

3) Is the GPSDO locked? bool locked =

4) Print the device time when you run the app. Its good to confirm that
the time from the time registers is UTC from the GPSDO.

5) You must ask each device to begin streaming at the same exact
timestamp to ensure that the samples are time-aligned. Use the
stream_command's time_spec and stream_now=false.

6) Phase offsets. Is it possible that you are just measuring phase
offsets between channels. These can be random after each retune
operation, with the exception of the SBX which can be sync'd with timed
commands, see:

> Best regards,
> Cheng Chi
> ------------------------------------------------------------------------------------------------
> Here is the setup and the code snippet that I've add to the example
> rx_samples_to_file.cpp.
> - USRP N210 with internal GPSDO module, daughtherboard is DBSRX2
> - Signal generator outputs a common signal and connects to the two USRPs
> through equal length cables
> Transmitter part: Common signal is FM signal with 1MHz bandwidth, carrier
> frequency is 1.6GHz.
> Receiver part: Sampling rate is 5Msps
> 1. For Common Reference Signals
> {{{
> usrp->set_clock_source("gpsdo");
> usrp->set_time_source("gpsdo");
> }}}
> 2. For synchronising the Device Time
> Because each N210 has an internal GPDSO module, the device times are
> automatically synchronised
> 3. For Synchronising Channel Phase
> To align CORDIC:
> {{{
>     uhd::stream_cmd_t stream_cmd((num_requested_samples == 0)?
>         uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS:
>         uhd::stream_cmd_t::STREAM_MODE_NUM_SAMPS_AND_DONE
>     );
>     stream_cmd.num_samps = num_requested_samples;
>     stream_cmd.stream_now = false;
>     stream_cmd.time_spec = uhd::time_spec_t(time_to_receive);
>     usrp->issue_stream_cmd(stream_cmd);
> }}}
> To align LOs in the frontend:
> {{{
>     uhd::time_spec_t cmd_time = usrp->get_time_now() +
> uhd::time_spec_t(0.1);
>     usrp->set_command_time(cmd_time);
>     usrp->set_rx_freq(1.6e9);
>     usrp->clear_command_time();
> }}}
> For DBSRX2, does this method for aligning LO work?

Just SBX, so you might just be measuring phase offset. However, make
sure to go through the checklist above. Its good to check some of the
sensors. However, your code above looks like the right idea.


> _______________________________________________
> USRP-users mailing list
> USRP-users at lists.ettus.com
> http://lists.ettus.com/mailman/listinfo/usrp-users_lists.ettus.com

More information about the USRP-users mailing list