Hyper Open Edge Cloud

How to Synchronise ORS

How to synchronise ORS using GPS or PTP
  • Last Update:2021-12-14
  • Version:
  • Language:en

Contents

Some processes, such as handover, require several ORSs to be synchronised in order for them to communicate with each other without overlapping. 

In theory, the time synchronisation requirements for LTE TDD is about ±1.5 µs for a < 3km cell radius and ±5 µs for a > 3km cell radius.

This page describes how to synchronise two ORS using Amarisoft network. Two methods are shown here : GPS synchronisation and Precision Time Protocol (PTP). GPS requires a GPS antenna to be connected and the ORS to be close to the outdoor, such that the antenna can receive GPS signals. Precision Time Protocol, or PTP, is a standardised protocol used to synchronise clocks over a computer network, suitable for applications for which the radio device must be placed indoors and thus the GPS signals are unreachable.

Synchronisation using GPS

A convenient way to synchronise two devices is to use GPS antennas on both ORS.

Plug a GPS antenna on the GPS connector on the ORS. Preferably, the antenna should be placed close to the outdoors.

GPS : Check connection

Once the antenna is connected, you can check if the GPS is detected.  First, stop the LTE service on the ORS.

service lte stop

Go to /root/trx_sdr folder.

cd root/trx_sdr

Check if GPS clock is locked by entering the following command : 

./sdr_util -c 0 gps_state

If GPS is detected, TAI and UTC time will be displayed. 

If you are using a GPS clock antenna for LTE, then in the driver configuration file used in enb.cfg (usually /root/enb/config/rf_driver/config.cfg), the sync parameter should be gps

/* synchronisation source: internal, gps, external (default = internal) */
sync: "gps",

Synchronisation using PTP : Linux PTP

3 Programs in Linux PTP :

  • PTP4l
  • PMC
  • PHC2sys

Time Stamping methods :

  • Hardware stamping
  • Software stamping

Precision Time Protocol (PTP) is a protocol used to synchronise clocks over a computer network. A master communicates its clock to slave nodes that synchronises their clock to its master's. It can be used for applications for which GPS signals are unreachable.

On Linux, PTP is implemented in the Linux PTP package.

There are three programs available in linuxptp :

  • PTP4L : Implementation of PTP
  • PMC : PTP management client. It can be used to communicate between the PTP nodes. 
  • PHC2SYS : It is used to synchronise the system clock to the PTP Hardware Clock (PHC), when hardware time stamping is employed. 

There are two time stamping methods available in linuxptp. When synchronising two ORS, use the software time stamping.

  • Hardware stamping :  synchronise the PTP hardware clock to the master clock. 
  • Software stamping : synchronise the system clock to the master clock. 

Linux PTP : Check hardware compatibility

You need to verify the time stamping capabilities of the driver/NIC. To do this, first use ifconfig command to check the name of the network you want to synchronise over. Make sure that master and slave are both using the same network. 
Then take a look at the ethtool utility, with the name of the chosen network. 

For each time stamping method, the following parameters should be included : 

  • Software time stamping :   SOF_TIMESTAMPING_SOFTWARESOF_TIMESTAMPING_TX_SOFTWARESOF_TIMESTAMPING_RX_SOFTWARE
  • Hardware time stamping :   SOF_TIMESTAMPING_RAW_HARDWARE, SOF_TIMESTAMPING_TX_HARDWARESOF_TIMESTAMPING_RX_HARDWARE

Finally, install the linuxptp package on your computer : 

apt-get install linuxptp

Linux PTP : PTP4L Configuration

Edit the Execution Start command for PTP4L service.

The PTP4L configuration can be started as a service. However, the initial execution commands may not correspond to your setup. The execution command can be verified in the ExecStart field in the following command : 

$ systemctl cat ptp4l
ExecStart=/usr/sbin/ptp4l -f /etc/linuxptp/ptp4l.conf -i eth0

To override this, do :

sudo systemctl edit ptp4l

and add                                                                             

[Service]
ExecStart=
ExecStart=/usr/sbin/ptp4l -f /etc/linuxptp/ptp4l.conf

The systemctl cat ptp4l command should now also show the overridden command. 

You can now edit  /etc/linuxptp/ptp4l.conf, which is the configuration file for PTP4L. For documentation on the file settings, please refer to PTP4L Manual Page.

In this file, change the slaveOnly parameter to 1 for the slave ORS and keep it at 0 for the master ORS. 

At the end of the file add your network interface name in bracket, e.g. 

[enp2s0]

Linux PTP : PHC2SYS Configuration

Edit the Execution Start command for PHC2SYS service.

Similarly to PTP4L, you may have to change PHC2SYS execution commands. As explained above, do : 

sudo systemctl edit ptp4l

and add                                                 

  • Master                           
[Service]
ExecStart=
ExecStart=/usr/sbin/phc2sys -a -rr
  • Slave
[Service]
ExecStart=
ExecStart=/usr/sbin/phc2sys -a -r

TO DO : FOR SLAVE MAYBE ExecStart=/usr/sbin/phc2sys -s enp2s0 -O 0 

Linux PTP : Start PTP

Start both PTP4L and PHC2SYS services. 

To start PTP4L and PHC2SYS programs, run : 

service ptp4l start
service phc2sys start

You can view their status state with 

service ptp4l status
service phc2sys status

Linux PTP : Verify the synchronisation with PMC

Use PMC commands to view the synchronisation's state. 

You can use the PTP management client. pmc, to obtain information from PTP4L. For documentation on the PMC options, please refer to the PMC Manual Page.

Some useful commands, with their retrievable information, are : 

  • offsetFromMaster : last measured offset from the master clock (ns) 
  • meanPathDelay : estimated delay of the synchronization messages sent from the master (ns)
  • gmPresent : true for slave connected to a master clock. It would be false for a master clock.

Linux PTP : Verify the synchronisation with logs

View PTP4L and PHC2SYS logs.

When activated, PTP4L and PHC2SYS both print messages in /var/log/syslog. You can view the content with

cat /var/log/syslog | grep ptp4l
tail /var/log/syslog | grep phc2sys

 To reduce the amount of output in PTP4L. increase the summary_interval in /etc/linuxptp/ptp4l.conf (it will then update every 2^summary_interval value).

To reduce the amount of output in PHC2SYS, change the execution command the add -u summary-updates option, where summary-updates is the number of clock updates to include in summary statistics. 

Linux PTP : Verify synchronisation with clocks

There are two clocks in a PC : the hardware clock, or Real Time Clock (RTC) and the software clock. 

In a hardware stamping PTP process, PTP4L synchronises the slave's PTP Hardware Clock (PHC). Then the PHC2SYS synchronises the system clock to the PHC. 

To control the PHC time, you can use the phc_ctl commands. For more details please refer to the PHC CTL Manual. For example, the following command gives the current clock time : 

phc_ctl /dev/ptp0 get

To view the system clock, you can use the command :

timedatectl

PHC uses TAI time and system clock uses UTC. It is thus normal if there is a certain lag between the PHC and the system clock. Linux PTP automatically inserts the time lag between TAI and UTC (currently 37 seconds). 

TO DO : HANDOVER WITH PTP DOES NOT WORK