TLDR- Setting the time ( set_time_next_pps() ) on (multiple) X310 doesn't 
result in USRP time being aligned with PPS edge. Works on N320.


I have two X310's and an N320 as well as an Octoclock. The Octoclock does have 
GPS lock. All four devices are on different computers, each of which has its 
system time set via NTP. We are using UHD version UHD_4.1.0.4-0-g25d617ca. I'll 
include the find_devices and probe output at the end for reference. We're 
running Ubuntu Bionic 18.04.6 LTS on all machines.


The Octoclock is accessed via a custom network shim that runs on the machine to 
which the Octoclock is attached. Machines with radios ( X's or N's ) can make a 
request of the custom Octoclock network service to get Octoclock time. 
Octoclock time agrees very well with the NTP top of the second ( typically 
withing 25ms ) given the inherent uncertainty running python code on different 
machines. By "agrees very well" I mean the delta between Octoclock time and NTP 
time has a low variance. All that to say, I do not suspect the Octoclock or 
software used to access the Octoclock.


The crux of the issue is that when using external clock (10MHz) and timing 
reference (1PPS) ( provided by Octoclock ) and setting an X310 time ( 
set_time_next_pps ), I am seeing about a 200ms (or 800ms depending on how you 
are measuring ) difference in when the X310 reports it is at the top of a 
second versus either time.time() or the octoclock time. I do not see this 
discrepancy with the N320 radio.


The net effect of this is that if an X and N are set to transmit at the very 
same time, we can see that the X transmits 800ish ms early relative to the N 
using a spectrum analyzer ( real hardware ). The N transmits at the correct 
time eyeballing wall clock/computer time.


Here is some of our test code that we've been using to investigate this:

    usrp = uhd.usrp_sink( ",".join((options.address, "")), uhd.stream_args( 
cpu_format="fc32", args='', channels=list(range(0,1)), ),'', )
    usrp.set_time_source('external', 0)
    usrp.set_clock_source('external', 0)
    usrp.set_time_unknown_pps(uhd.time_spec())

    reflock = str(usrp.get_mboard_sensor("ref_locked", 0)).split(": ")[1]
    if  reflock != 'locked':
        print('reference not locked')
        print('exiting')
        exit()
    else:
        print('referenced locked')

     # the get_octo_time () call is a call to our networked octoclock. Just 
imagine this line as querying the octoclock for time
    next_pps = get_octo_time() + 1

     usrp.set_time_next_pps(uhd.time_spec_t(next_pps))

    # sleep for a few seconds
    time.sleep(2.0)

    oc_time=get_octo_time()
    usrp_time = usrp.get_time_now()
    usrp_time_last_pps = usrp.get_time_last_pps()
    system_time = time.time()

    usrp_time_source = usrp.get_time_source(0)
    usrp_time_sources = usrp.get_time_sources(0)
    print(f"TRANSMIT:: OC time is {oc_time} \n" \
          f"TRANSMIT:: usrp_time_last_pps is 
{usrp_time_last_pps.get_full_secs()} \n" \
          f"TRANSMIT:: usrp_time_last_pps_frac is 
{usrp_time_last_pps.get_frac_secs()} \n" \
          f"TRANSMIT:: usrp_time is {usrp_time.get_full_secs()} \n" \
          f"TRANSMIT:: usrp_time_frac is {usrp_time.get_frac_secs()} \n" \
          f"TRANSMIT:: system time is {system_time} \n" \
          f"TRANSMIT:: usrp_time_source is {usrp_time_source} \n" \
          f"TRANSMIT:: usrp_time_sources are {usrp_time_sources}")

And here is some output from an X310:

TRANSMIT:: OC time is 1636568870
TRANSMIT:: usrp_time_last_pps is 1636568869
TRANSMIT:: usrp_time_last_pps_frac is 0.0
TRANSMIT:: usrp_time is 1636568869
TRANSMIT:: usrp_time_frac is 0.82498684
TRANSMIT:: system time is 1636568870.0275745
TRANSMIT:: usrp_time_source is external
TRANSMIT:: usrp_time_sources are ('internal', 'external', 'gpsdo')

So the problem here is that the fractional time (usrp_time_frac) is 800ish ms 
when it should be more like 25ish ms (  like time.time() i.e. system time ).

Here is the result of running the same code on a host with an N320:

TRANSMIT:: OC time is 1636570841
TRANSMIT:: usrp_time_last_pps is 1636570841
TRANSMIT:: usrp_time_last_pps_frac is 0.0
TRANSMIT:: usrp_time is 1636570841
TRANSMIT:: usrp_time_frac is 0.025938016764322915
TRANSMIT:: system time is 1636570841.0290515
TRANSMIT:: usrp_time_source is external
TRANSMIT:: usrp_time_sources are ('internal', 'external', 'gpsdo', 'sfp0')



As I mentioned, the octoclock time comes back right at the top of the second 
reletive to NTP time ( as I would expect )- this can be seen by the green 
hightlighted fraction. However on the X310, some 800ms have already passed. Not 
so on the N320 (as expected) . Why?


Below is the output of uhd_find_devices and uhd_usrp_probe for the two radios:

[INFO] [UHD] linux; GNU C++ version 7.5.0; Boost_106501; UHD_4.1.0.4-0-g25d617ca
--------------------------------------------------
-- UHD Device 0
--------------------------------------------------
Device Address:
    serial: 31EDED4
    addr: 192.168.40.2
    claimed: False
    fpga: XG
    mgmt_addr: 192.168.30.2
    mgmt_addr: 192.168.40.2
    product: n320
    type: n3xx




[INFO] [UHD] linux; GNU C++ version 7.5.0; Boost_106501; UHD_4.1.0.4-0-g25d617ca
[INFO] [MPMD] Initializing 1 device(s) in parallel with args: 
mgmt_addr=192.168.40.2,type=n3xx,product=n320,serial=31EDED4,fpga=XG,claimed=False,addr=192.168.40.2
[INFO] [MPM.PeriphManager] init() called with device args 
`fpga=XG,mgmt_addr=192.168.40.2,product=n320,clock_source=external,time_source=external'.
[INFO] [MPM.Rhodium-0] init() called with args 
`fpga=XG,mgmt_addr=192.168.40.2,product=n320,clock_source=external,time_source=external'
[INFO] [MPM.Rhodium-1] init() called with args 
`fpga=XG,mgmt_addr=192.168.40.2,product=n320,clock_source=external,time_source=external'
  _____________________________________________________
 /
|       Device: N300-Series Device
|     _____________________________________________________
|    /
|   |       Mboard: ni-n3xx-31EDED4
|   |   dboard_0_pid: 338
|   |   dboard_0_serial: 31EBB6F
|   |   dboard_1_pid: 338
|   |   dboard_1_serial: 31EBB94
|   |   eeprom_version: 3
|   |   fs_version: 20210910210929
|   |   mender_artifact: v4.1.0.2_n3xx
|   |   mpm_sw_version: 4.1.0.2-g8ce6e64f
|   |   pid: 16962
|   |   product: n320
|   |   rev: 10
|   |   rpc_connection: remote
|   |   serial: 31EDED4
|   |   type: n3xx
|   |   MPM Version: 4.0
|   |   FPGA Version: 8.0
|   |   FPGA git hash: d5c2750.clean
|   |
|   |   Time sources:  internal, external, gpsdo, sfp0
|   |   Clock sources: external, internal, gpsdo
|   |   Sensors: ref_locked, gps_locked, temp, fan, gps_gpgga, gps_sky, 
gps_time, gps_tpv
|     _____________________________________________________
|    /
|   |       RFNoC blocks on this device:
|   |
|   |   * 0/DDC#0
|   |   * 0/DDC#1
|   |   * 0/DUC#0
|   |   * 0/DUC#1
|   |   * 0/Radio#0
|   |   * 0/Radio#1
|   |   * 0/Replay#0
|     _____________________________________________________
|    /
|   |       Static connections on this device:
|   |
|   |   * 0/SEP#0:0==>0/DUC#0:0
|   |   * 0/DUC#0:0==>0/Radio#0:0
|   |   * 0/Radio#0:0==>0/DDC#0:0
|   |   * 0/DDC#0:0==>0/SEP#0:0
|   |   * 0/SEP#1:0==>0/DUC#1:0
|   |   * 0/DUC#1:0==>0/Radio#1:0
|   |   * 0/Radio#1:0==>0/DDC#1:0
|   |   * 0/DDC#1:0==>0/SEP#1:0
|   |   * 0/SEP#2:0==>0/Replay#0:0
|   |   * 0/Replay#0:0==>0/SEP#2:0
|   |   * 0/SEP#3:0==>0/Replay#0:1
|   |   * 0/Replay#0:1==>0/SEP#3:0
|     _____________________________________________________
|    /
|   |       TX Dboard: 0/Radio#0
|   |     _____________________________________________________
|   |    /
|   |   |       TX Frontend: 0
|   |   |   Name: Rhodium
|   |   |   Antennas: TX/RX, CAL, TERM
|   |   |   Freq range: 1.000 to 6000.000 MHz
|   |   |   Gain range all: 0.0 to 60.0 step 1.0 dB
|   |   |   Bandwidth range: 250000000.0 to 250000000.0 step 0.0 Hz
|   |   |   Connection Type:
|   |   |   Uses LO offset: No
|     _____________________________________________________
|    /
|   |       RX Dboard: 0/Radio#0
|   |     _____________________________________________________
|   |    /
|   |   |       RX Frontend: 0
|   |   |   Name: Rhodium
|   |   |   Antennas: TX/RX, RX2, CAL, TERM
|   |   |   Freq range: 1.000 to 6000.000 MHz
|   |   |   Gain range all: 0.0 to 60.0 step 1.0 dB
|   |   |   Bandwidth range: 250000000.0 to 250000000.0 step 0.0 Hz
|   |   |   Connection Type:
|   |   |   Uses LO offset: No
|     _____________________________________________________
|    /
|   |       TX Dboard: 0/Radio#1
|   |     _____________________________________________________
|   |    /
|   |   |       TX Frontend: 0
|   |   |   Name: Rhodium
|   |   |   Antennas: TX/RX, CAL, TERM
|   |   |   Freq range: 1.000 to 6000.000 MHz
|   |   |   Gain range all: 0.0 to 60.0 step 1.0 dB
|   |   |   Bandwidth range: 250000000.0 to 250000000.0 step 0.0 Hz
|   |   |   Connection Type:
|   |   |   Uses LO offset: No
|     _____________________________________________________
|    /
|   |       RX Dboard: 0/Radio#1
|   |     _____________________________________________________
|   |    /
|   |   |       RX Frontend: 0
|   |   |   Name: Rhodium
|   |   |   Antennas: TX/RX, RX2, CAL, TERM
|   |   |   Freq range: 1.000 to 6000.000 MHz
|   |   |   Gain range all: 0.0 to 60.0 step 1.0 dB
|   |   |   Bandwidth range: 250000000.0 to 250000000.0 step 0.0 Hz
|   |   |   Connection Type:
|   |   |   Uses LO offset: No



And then for the X310:

[INFO] [UHD] linux; GNU C++ version 7.5.0; Boost_106501; UHD_4.1.0.4-0-g25d617ca
--------------------------------------------------
-- UHD Device 0
--------------------------------------------------
Device Address:
    serial: 30E153C
    addr: 192.168.30.2
    addr: 192.168.40.2
    fpga: XG
    name:
    product: X310
    type: x300




[INFO] [UHD] linux; GNU C++ version 7.5.0; Boost_106501; UHD_4.1.0.4-0-g25d617ca
[INFO] [X300] X300 initialization sequence...
[INFO] [X300] Maximum frame size: 8000 bytes.
[INFO] [X300] Radio 1x clock: 200 MHz
  _____________________________________________________
 /
|       Device: X-Series Device
|     _____________________________________________________
|    /
|   |       Mboard: X310
|   |   revision: 8
|   |   revision_compat: 7
|   |   product: 30818
|   |   mac-addr0: 00:80:2f:25:90:e6
|   |   mac-addr1: 00:80:2f:25:90:e7
|   |   gateway: 192.168.10.1
|   |   ip-addr0: 192.168.10.2
|   |   subnet0: 255.255.255.0
|   |   ip-addr1: 192.168.20.2
|   |   subnet1: 255.255.255.0
|   |   ip-addr2: 192.168.30.2
|   |   subnet2: 255.255.255.0
|   |   ip-addr3: 192.168.40.2
|   |   subnet3: 255.255.255.0
|   |   serial: 30E153C
|   |   FW Version: 6.0
|   |   FPGA Version: 38.0
|   |   FPGA git hash: b1ca7f3
|   |
|   |   Time sources:  internal, external, gpsdo
|   |   Clock sources: internal, external, gpsdo
|   |   Sensors: ref_locked
|     _____________________________________________________
|    /
|   |       RFNoC blocks on this device:
|   |
|   |   * 0/DDC#0
|   |   * 0/DDC#1
|   |   * 0/DUC#0
|   |   * 0/DUC#1
|   |   * 0/Radio#0
|   |   * 0/Radio#1
|   |   * 0/Replay#0
|     _____________________________________________________
|    /
|   |       Static connections on this device:
|   |
|   |   * 0/SEP#0:0==>0/DUC#0:0
|   |   * 0/DUC#0:0==>0/Radio#0:0
|   |   * 0/Radio#0:0==>0/DDC#0:0
|   |   * 0/DDC#0:0==>0/SEP#0:0
|   |   * 0/Radio#0:1==>0/DDC#0:1
|   |   * 0/DDC#0:1==>0/SEP#1:0
|   |   * 0/SEP#2:0==>0/DUC#1:0
|   |   * 0/DUC#1:0==>0/Radio#1:0
|   |   * 0/Radio#1:0==>0/DDC#1:0
|   |   * 0/DDC#1:0==>0/SEP#2:0
|   |   * 0/Radio#1:1==>0/DDC#1:1
|   |   * 0/DDC#1:1==>0/SEP#3:0
|   |   * 0/SEP#4:0==>0/Replay#0:0
|   |   * 0/Replay#0:0==>0/SEP#4:0
|   |   * 0/SEP#5:0==>0/Replay#0:1
|   |   * 0/Replay#0:1==>0/SEP#5:0
|     _____________________________________________________
|    /
|   |       TX Dboard: 0/Radio#0
|   |   ID: UBX-160 v1 (0x0079)
|   |   Serial: 30DC6D8
|   |     _____________________________________________________
|   |    /
|   |   |       TX Frontend: 0
|   |   |   Name: UBX TX
|   |   |   Antennas: TX/RX, CAL
|   |   |   Sensors: lo_locked
|   |   |   Freq range: 10.000 to 6000.000 MHz
|   |   |   Gain range PGA0: 0.0 to 31.5 step 0.5 dB
|   |   |   Bandwidth range: 160000000.0 to 160000000.0 step 0.0 Hz
|   |   |   Connection Type: QI
|   |   |   Uses LO offset: No
|     _____________________________________________________
|    /
|   |       RX Dboard: 0/Radio#0
|   |   ID: UBX-160 v1 (0x007a)
|   |   Serial: 30DC6D8
|   |     _____________________________________________________
|   |    /
|   |   |       RX Frontend: 0
|   |   |   Name: UBX RX
|   |   |   Antennas: TX/RX, RX2, CAL
|   |   |   Sensors: lo_locked
|   |   |   Freq range: 10.000 to 6000.000 MHz
|   |   |   Gain range PGA0: 0.0 to 31.5 step 0.5 dB
|   |   |   Bandwidth range: 160000000.0 to 160000000.0 step 0.0 Hz
|   |   |   Connection Type: IQ
|   |   |   Uses LO offset: No
|     _____________________________________________________
|    /
|   |       TX Dboard: 0/Radio#1
|   |   ID: UBX-160 v1 (0x0079)
|   |   Serial: 30DCD7E
|   |     _____________________________________________________
|   |    /
|   |   |       TX Frontend: 0
|   |   |   Name: UBX TX
|   |   |   Antennas: TX/RX, CAL
|   |   |   Sensors: lo_locked
|   |   |   Freq range: 10.000 to 6000.000 MHz
|   |   |   Gain range PGA0: 0.0 to 31.5 step 0.5 dB
|   |   |   Bandwidth range: 160000000.0 to 160000000.0 step 0.0 Hz
|   |   |   Connection Type: QI
|   |   |   Uses LO offset: No
|     _____________________________________________________
|    /
|   |       RX Dboard: 0/Radio#1
|   |   ID: UBX-160 v1 (0x007a)
|   |   Serial: 30DCD7E
|   |     _____________________________________________________
|   |    /
|   |   |       RX Frontend: 0
|   |   |   Name: UBX RX
|   |   |   Antennas: TX/RX, RX2, CAL
|   |   |   Sensors: lo_locked
|   |   |   Freq range: 10.000 to 6000.000 MHz
|   |   |   Gain range PGA0: 0.0 to 31.5 step 0.5 dB
|   |   |   Bandwidth range: 160000000.0 to 160000000.0 step 0.0 Hz
|   |   |   Connection Type: IQ
|   |   |   Uses LO offset: No


Robert









_______________________________________________
USRP-users mailing list -- usrp-users@lists.ettus.com
To unsubscribe send an email to usrp-users-le...@lists.ettus.com

Reply via email to