# Configuring board clocking

When multiple boards are connected to the CT bus, you must set up a bus clock source to synchronize timing between them. In addition, you can configure alternative (or fallback) clock sources to provide the clock signal if the primary source fails.

This topic describes:

- CG 6565E clocking capabilities

- Clocking configurations

- Configuring CG 6565E board clocking using keywords

To create a robust clocking configuration, you must understand basic clocking concepts such as clock mastering and fallback. This topic assumes that you have a basic understanding of clocking. For a complete overview of board clocking, refer to the Dialogic® NaturalAccess™ OAM System Developer’s Manual.

Note: If you are not using PSTN trunks and if you are not using the CT bus, set Clocking.HBus.ClockMode = STANDALONE, Clocking.HBus.ClockSource = OSC, and skip this topic.

## CG 6565E clocking capabilities

This topic describes the rules and limitations that apply to setting up CT bus clocking on CG 6565E boards.

When a CG 6565E board is configured as the system primary clock master:

- The board's first timing reference must be set to a network trunk, a NETREF clock, or OSC.

- The board's fallback timing reference must be set to a network trunk, a NETREF reference, or OSC. Fallback to OSC is not recommended, because the transition can cause slave boards to fall back to the secondary clock and create an out-of-sync condition.

When a CG 6565E board is configured as the system secondary clock master:

- The board's first timing reference must be the system's primary clock.

- The board's fallback timing reference must be set to a network trunk, a NETREF source, or OSC.

When a CG 6565E board is configured as a clock slave:

- The board's first timing reference must be the system's primary clock.

- The board's fallback timing reference must be the system's secondary clock.

Refer to Other clocking capabilities for more options.

The following tables summarize the CT bus clocking capabilities of the CG 6565E board:

### Clocking capabilities as primary master

Capability | Yes/No | Comments
--- | --- | ---
Serve as primary master | Yes |
Drive A_CLOCK | Yes |
Drive B_CLOCK | Yes |
Available primary timing references:
Local trunk | Yes | The secondary timing reference must also be a local trunk.
NETREF1 | Yes | The application must reconfigure the board as soon as possible if NETREF1 fails.
NETREF2 | No | This board does not support NETREF2.
OSC | Yes |
Fallback to secondary timing reference | Yes |
Available secondary timing references:
Local trunk | Yes | This is the only valid reference if the primary timing reference is a local trunk.
NETREF1 | Yes |
NETREF2 | No | This board does not support NETREF2.
OSC | No |
Slave to secondary master if both references fail | Yes |

### Clocking capabilities as secondary master

Capability | Yes/No | Comments
--- | --- | ---
Serve as secondary master | Yes |
Drive A_CLOCK | Yes | If the primary master drives B_CLOCK, the secondary master drives A_CLOCK.
Drive B_CLOCK | Yes | If the primary master drives A_CLOCK, the secondary master drives B_CLOCK.
Available secondary timing references:
Local trunk | Yes |
NETREF1 | Yes |
NETREF2 | No | This board does not support NETREF2.
OSC | Yes |

### Clocking capabilities as slave

Capability | Yes/No | Comments
--- | --- | ---
Serve as slave | Yes |
Slave to A_CLOCK | Yes |
Slave to B_CLOCK | Yes |
Available fallback timing references:
A_CLOCK | Yes |
B_CLOCK | Yes |
OSC | Yes | The board is synchronized when the application reconfigures the clock.

### Other clocking capabilities

Capability | Yes/No | Comments
--- | --- | ---
Drive NETREF1 | Yes |
Drive NETREF2 | No | This board does not support NETREF2.
Operate in standalone mode | Yes |

## Configuring clocking

You can configure board clocking in your system in one of two ways:

Method | Description
--- | ---
Using clockdemo application model | Create an application that assigns each board its clocking mode, monitors clocking changes, and reconfigures clocking if clock fallback occurs. A sample clocking application, clockdemo, is provided with Natural Access. clockdemo provides a robust fallback scheme that suits most system configurations. clockdemo source code is included, allowing you to modify the program if your clocking configuration is complex. For more information about clockdemo, refer to the Dialogic® NaturalAccess™ OAM System Developer’s Manual. Note: Most clocking applications (including clockdemo) require all boards on the CT bus to be started in standalone mode.
Using board keywords (with or without application intervention) | For each board on the CT bus, set the board keywords to determine the board's clocking mode and to determine how each board behaves if clock fallback occurs. This method is documented in this topic. Unlike the clockdemo application, which allows you to specify several boards to take over mastery of the clock from one another in a fallback situation, the board keyword method allows you to specify only a single secondary master. For this reason, the board keyword method is best used to implement clock fallback in your system or in test configurations where clock reliability is not a factor. The board keyword method does not create an autonomous clock timing environment. If you implement clock fallback using this method, an application must still intervene when clock fallback occurs to reset system clocking before other clocking changes occur. If both the primary and secondary clock masters stop driving the clocks, and an application does not intervene, the boards default to standalone mode.

Choose only one of these configuration methods across all boards on the CT bus. Otherwise, the two methods interfere with one another, and board clocking may not operate properly.

## Configuring CG 6565E board clocking using keywords

CG 6565E board keywords enable you to configure the board in the following ways:

- System primary clock master

- System secondary clock master

- Clock slave

- Standalone board

You can also use board keywords to establish clock fallback sources. Refer to the multiple board system example for a sample configuration.

The following tables describe how to use board keywords to specify the clocking role of each CG 6565E board in a system.

### Configuring the CG 6565E as primary clock master

Use the following board keywords to configure the CG 6565E as a primary clock master:

Keyword | Description
--- | ---
Clocking.HBus.ClockSource | Specifies the source from which this board derives its timing. Set this keyword to a network source (NETREF or NETWORK).
Clocking.HBus.ClockSourceNetwork | (Optional) Specifies the trunk number that the board uses as an external network clocking source for its internal clock. Note: Trunk numbering, in this case, is one-based.
Clocking.HBus.ClockMode | Specifies the CT bus clock that the board drives. Set this keyword to either A_CLOCK (MASTER_A) or B_CLOCK (MASTER_B).
Clocking.HBus.AutoFallBack | Enables or disables clock fallback on the board.
Clocking.HBus.FallBackClockSource | Specifies an alternate timing reference to use when the master clock source fails. Set this keyword to a network timing source (NETREF or NETWORK).
Clocking.HBus.FallBackNetwork | (Optional) Specifies the trunk from which a fallback network timing source (for the clock fallback reference) can be derived when Clocking.HBus.FallBackClockSource = NETWORK. Note: Trunk numbering, in this case, is one-based.

If the primary master's first source fails and then returns, the board's timing reference (and consequently, the reference for any slaves) switches back to the first timing source. This is not true for the secondary clock master.

### Configuring the CG 6565E as secondary clock master

Use the following board keywords to configure the CG 6565E as a secondary clock master:

Keyword | Description
--- | ---
Clocking.HBus.ClockSource | Specifies the source from which this board derives its timing. Set this keyword to the clock driven by the primary clock master. For example, if the primary master drives A_CLOCK, set this keyword to A_CLOCK.
Clocking.HBus.ClockMode | Specifies the CT bus clock that the secondary master drives. Set this keyword to the clock not driven by the primary clock master (MASTER_A or MASTER_B).
Clocking.HBus.AutoFallBack | Enables or disables clock fallback on the board. Set this keyword to YES.
Clocking.HBus.FallBackClockSource | Specifies an alternate timing reference to use when the master clock does not function properly. Set this keyword to a network source (NETREF or NETWORK).
Clocking.HBus.FallBackNetwork | (Optional) Specifies the trunk from which a fallback network timing source (for the clock fallback reference) can be derived. Note: Trunk numbering in this case, is one-based.

If the primary master's timing reference recovers, the secondary master continues to drive the clock referenced by all clock slaves in the system until the application intervenes.

### Configuring the CG 6565E as a clock slave

Use the following board keywords to configure the CG 6565E as a clock slave:

Keyword | Description
--- | ---
Clocking.HBus.ClockMode | Specifies the CT bus clock from which the board derives its timing. Set this keyword to SLAVE to indicate that the board does not drive any CT bus clock (although the board can still drive NETREF).
Clocking.HBus.ClockSource | Specifies the source from which this clock derives its timing. Set this keyword to the clock driven by the primary clock master (A_CLOCK or B_CLOCK).
Clocking.HBus.AutoFallBack | Enables or disables clock fallback on the board.
Clocking.HBus.FallBackClockSource | Specifies the alternate clock reference to use when the master clock does not function properly. Set this keyword to the clock driven by the secondary clock master (B_CLOCK or A_CLOCK).

### Configuring the CG 6565E as a standalone board

To configure a CG 6565E board in standalone mode so the board references its own clocking information, set Clocking.HBus.ClockMode to STANDALONE. The board can use either its own oscillator or a signal received from a digital trunk as a timing signal reference. However, the board cannot make switch connections to the CT bus.

## Multiple board system example

The following example assumes a system configuration in which four CG 6565E boards reside in a single chassis. The boards are configured in the following way using keywords:

Board | Configuration
--- | ---
0 | System primary bus master (driving A_CLOCK)
1 | System secondary bus master (driving B_CLOCK)
2 | Clock slave (clock fallback enabled)
3 | Clock slave (clock fallback enabled - drives the NETREF clock)

This configuration assigns the following clocking priorities:

Priority | Timing reference
--- | ---
First | Board 0, digital trunk 1. A network signal from a digital trunk provides the primary master clock source.
Second | Board 3, digital trunk 3. The NETREF signal driven by a digital trunk on board 3 acts as the primary master clock fallback source.
Third | Board 1, digital trunk 2. A network signal from a digital trunk provides the secondary master clock fallback source.

The following illustration shows an example of a multiple-board system with a primary and secondary clock master:

The following table shows keywords used to configure the multiple boards according to the configuration shown in the preceding illustration:

Board | Role | Clocking keyword settings
--- | --- | ---
0 | Primary clock master | Clocking.HBus.ClockMode = MASTER_A Clocking.HBus.ClockSource = NETWORK Clocking.HBus.ClockSourceNetwork = 1 Clocking.HBus.AutoFallBack = YES Clocking.HBus.FallBackClockSource = NETREF Clocking.HBus.NetRefSpeed = 8K
1 | Secondary clock master | Clocking.HBus.ClockMode = MASTER_B Clocking.HBus.ClockSource = A_CLOCK Clocking.HBus.AutoFallBack = YES Clocking.HBus.FallBackClockSource = NETWORK Clocking.HBus.FallBackNetwork = 2
2 | Clock slave | Clocking.HBus.ClockMode = SLAVE Clocking.HBus.ClockSource = A_CLOCK Clocking.HBus.AutoFallBack = YES Clocking.HBus.FallBackClockSource = B_CLOCK
3 | Slave driving NETREF | Clocking.HBus.ClockMode = SLAVE Clocking.HBus.ClockSource = A_CLOCK Clocking.HBus.AutoFallBack = YES Clocking.HBus.FallBackClockSource = B_CLOCK Clocking.HBus.NetRefSource = NETWORK Clocking.HBus.NetRefSourceNetwork = 3 Clocking.HBus.NetRefSpeed = 8K

In this configuration, Board 0 is the primary clock master, and it drives A_CLOCK. All slave boards on the system use A_CLOCK as their first timing reference. Board 0 references its timing from a network timing signal received on its own trunk 1. Board 0 also uses the NETREF signal (driven based on the digital signal received on trunk 3 of Board 3) as its clock fallback source. If the network timing signal derived from its own digital trunks fails, Board 0 continues to drive A_CLOCK based on NETREF timing reference.

If, however, both of the clocking signals used by Board 0 (the network timing signal and the NETREF signal) fail, Board 0 stops driving A_CLOCK. The secondary clock master (Board 1) then falls back to a timing reference received on its own trunk 3, and uses this signal to drive B_CLOCK. B_CLOCK then becomes the timing source for all boards that use B_CLOCK as their backup timing reference.

For this clock fallback scheme to work, all clock slaves must specify A_CLOCK as the clock source and B_CLOCK as the clock fallback source.