# Running clockdemo

clockdemo is an application that configures H.100 and H.110 clocks for all boards using switching commands. Then it monitors for clocking changes, and reconfigures clocking if clock fallback occurs or if the status of a timing reference changes.

clockdemo provides a robust fallback scheme that suits most system configurations. Source code is included, allowing you to modify the program if your clocking configuration is complex. For a complete overview of H.100 and H.110 bus clocking, refer to CT bus clocking overview.

#### Name

clockdemo

#### Purpose

- Configures H.100 and H.110 clocks for all boards using switching commands.

- Monitors for clocking changes and reconfigures clocking if clock fallback occurs or the status of a timing reference changes.

#### Usage

clockdemo [options]

where options are:

Option | Description
--- | ---
-b n | Specifies a list of boards to be managed by clockdemo. Multiple boards can be specified by repeating the -b option on the command line: -b 1 -b 2 -b 3 The minimum number of boards allowed is 2. In addition to the listed boards, clocking for all boards listed in the file specified with the -f option are managed. If no boards are specified using either method, clockdemo attempts to manage clocking for boards numbered 0, 1, and 2.
-f file_name | Specifies the name of a text file containing a list of available timing references, prioritized by their reliability. For more information about this file, refer to Creating a timing reference priorities file. In addition to the boards listed in the file, clocking for all boards listed using the -b option are managed.
-d | Turns on debug messages, showing clocking status.
-t m_sec | Specifies the rate (in ms) at which clockdemo polls the boards for clocking status changes. Default is 2000.
-h | Displays a Help screen and terminates.

#### Description

clockdemo configures H.110/H.100 clocking for all specified boards. It then monitors the boards (and board trunks), and reconfigures clocking if events occur that jeopardize or interrupt the clock pulse.

clockdemo is given a text file listing boards to manage. Also listed are digital trunks on these boards from which a clock master can derive a timing reference. In the file, the trunks are rated in order of reliability. Based on this file, clockdemo assigns the board with the most reliable available trunks as primary master, and configures the most reliable trunks on this board as the primary and fallback timing references for the system. clockdemo also attempts to configure a different board as secondary master. All other boards become clock slaves.

clockdemo then polls all boards at regular intervals, and monitors all trunks currently serving as timing references. If clockdemo detects that a system clock has failed, or that fallback has occurred, or that a critical trunk is having problems, it reassigns timing references or configures new primary and secondary masters to maintain or restore the integrity of the system clock. In each case, clockdemo picks the most reliable available boards and trunks.

clockdemo also monitors NMS OAM events to detect Hot Swap insertion or removal of boards. If the primary or secondary master is removed, clockdemo assigns a new primary or secondary master as necessary.

clockdemo logs clocking configurations and changes to the screen. The following is sample clockdemo output:

CLOCKDEMO Version 2.0 Mar 15 2001 15:00:36
Boards Clock Mode Current Mastering Fallback
Clock Source A Clock B Clock Occurred
----------------------------------------------------------------
0: SLAVE H100_A NO
3: PRIMARY NETWORK 1 YES NO
1: SECONDARY H100_A YES NO
2: SLAVE H100_A NO
----------------------------------------------------------------
(Press 'q' then ENTER to Exit.)

clockdemo uses Switching (SWI) service commands to configure clocking on each board. It can configure and manage clocking on any board that complies with the MVIP-95 standard.

clockdemo can also operate without a clocking priorities file, and instead configure and manage clocking on boards specified on the command line with the -b option. In this case, clockdemo attempts to determine the current configuration and to maintain clock synchronization as best as it can. However, this mode does not provide as robust a clocking scheme as when the clocking priorities file is used. In some cases, clockdemo can assign OSC as a fallback source. Use this clockdemo mode only if board clocking has previously been configured using a swish script or other method.

If the clocking priorities file is used, set all boards to standalone mode before running clockdemo. To do so, use the NMS OAM utilities or the NMS OAM service to set the Clocking.HBus.ClockMode keyword to STANDALONE for each board.

Note: When using clockdemo, do not use any other Clocking.HBus.XXX keywords to specify clocking configurations for the boards. Board-level clocking configuration interferes with clockdemo's operation and can cause glitches in the system clock signal.

clockdemo does not provide support for NETREF(1) or NETREF2.