Awareness | How PTPv1 and PTPv2 grandmaster election works

Find out how grandmaster clock election works in PTPv1/PTPv2 and how they are different.

Updated at April 9th, 2024

Information


PTPv2

Let's start with PTPv2 first as Q-SYS follows the AES67 standard which utilizes PTPv2 for time synchronization. 

PTPv2 (IEEE 1588-2008) utilizes a hierarchical selection algorithm known as the Best Master Clock Algorithm (BMCA) to determine the best PTPv2 clock within a network. Devices capable of acting as a PTPv2 grandmaster, such as Q-SYS cores, external grandmaster clocks, certain Cisco switches, and AES67-enabled Dante devices, employ BMCA based on the following properties, in the specified order:

  1. Priority 1 – the user can assign a specific static-designed priority to each clock, preemptively defining a priority among them. Smaller numeric values indicate higher priority.
  2. Class – each clock is a member of a given class, and each class gets its own priority.
  3. Accuracy – precision between clock and UTC, in nanoseconds (ns)
  4. Variance – variability of the clock
  5. Priority 2 – final-defined priority, defining backup order in case the other criteria were not sufficient. Smaller numeric values indicate higher priority.
  6. Unique identifier – MAC address-based selection is used as a tiebreaker when all other properties are equal.

Q-SYS Designer Software allows modification of Priority 1 and Priority 2 values to adjust the grandmaster of the PTP clock domain, so we primarily focus on these two values when it comes to the PTP grandmaster clock election.

Here is a scenario: There is a Core-110f (core1) on the network performing PTPv2, and this is the only device on the network utilizing PTPv2. Since it is the only device on the network, it will be elected as a PTPv2 leader, and there is no doubt about it.

The PTPv2 grandmaster will periodically send out a PTPv2 Announce Message (Q-SYS core sends this out every 2 seconds), and the grandmaster will also send out Sync Messages (Q-SYS core sends this out every 0.125 seconds) to the network.

Let's introduce another Core-110f (core2) to this network participating in the PTPv2 domain with a lower Priority 1 value (higher priority). In theory, the newly added Core-110f (core2) will be elected as the grandmaster.

This is correct. Core2 will eventually get elected as the grandmaster clock. In this article, we will focus on this grandmaster election process.

When core2 is added to the network, both cores will advertise themselves as the leaders of the PTPv2 domain, potentially causing clock drift events if there are clock followers on the network. However, there is no need to worry about it. Both cores will evaluate the other core's PTP properties to decide whether they should continue to be the grandmaster or stop sending out PTP Announce Messages and Sync Messages.

So, how do cores evaluate the other core's PTP properties?

The answer lies in the PTP Announce Message. The PTP Announce Message includes the PTP properties, and here is a sample PTP Announce Message.

In the scenario above, after core1 finishes comparing the PTP properties, it will become a clock follower and no longer send out Announce Messages and Sync Messages.

 
 

PTPv1

PTPv1 is an older PTP protocol released in 2002. Although Q-SYS utilizes PTPv2, understanding how PTPv1 works is important, as Audinate/Dante uses PTPv1.

It's also crucial to note that if there's a Software Dante Receiver/Transmitter in the design, the Q-SYS core will participate in the PTPv1 domain as well.

While we've learned that in PTPv2, PTP clocks compare properties by checking the PTP Announce Message, in PTPv1, there's no such thing as a PTP Announce Message, as it was introduced in PTPv2.

So, how do cores evaluate each other's PTP properties in PTPv1?

The answer lies in the PTPv1 Sync Message, and here's a sample:

This packet includes a field named grandmasterPreferred and localClockStratum

The grandmasterPreferred value indicates whether the device generating the PTPv1 Sync Message is one of the preferred PTPv1 grandmasters on the network. A value of 1 signifies that it is one of the preferred PTPv1 clocks on the network, whereas a value of 0 indicates that it is not one of the preferred PTPv1 clocks on the network.

The localClockStratum value in the PTPv1 Sync Message denotes the PTPv1 priority within the network. A lower value suggests a higher likelihood of the device being elected as a PTPv1 grandmaster.

In PTPv1, devices always first consider the grandmasterPreferred value.  If one or more preferred PTPv1 clocks exist on the network, non-preferred PTPv1 clocks will not participate in the clock election, regardless of their lower localClockStratum values. Only among preferred PTPv1 clocks will the election proceed by comparing the localClockStratum values.

How to configure a Dante device as a preferred clock?

Open Dante Controller > Clock Status and check the Preferred Leader option.

 

Q-SYS Core as a preferred clock

Q-SYS cores cannot be selected as a Preferred Leader in Dante Controller. If the PTP Priority 1 value of a Q-SYS core is less than or equal to 127, it will automatically designate itself as a Preferred Leader.

 

In conclusion, unlike PTPv2, PTPv1 doesn't have an Announce Message and uses the grandmasterPreferred and localClockStratum values in the Sync Message to announce its eligibility to become a PTP grandmaster and its clock priority.

PTPv1 (IEEE 1588-2002) uses similar properties as PTPv2 listed at the beginning of this article, so lowering the Priority 1 and Priority 2 values in Q-SYS Designer Software will lower the localClockStratum value.

The lower the localClockStratum value, the higher the chance the device will get elected as a PTPv1 grandmaster.

 
 

Please Create a Case with Q-SYS Support if you encounter any clocking issues with our products.