MX Foundation 4
IRIG-B Timebase

IRIG-B timebase is normally used when time correlation with other equipment is necessary.

In order to use IRIG-B synchronization as timebase, the application must enable the IRIG-B input by setting the KMXF_DEVICE_IRIGB_INPUT_SIGNAL attribute for the device. The IRIG-B signal must be locked before setting the timebase to IRIG-B. The IRIG-B status can be monitored using the mxfDeviceIrigbStatusGet() function.

The precision of the system timing is related by two factors; the IRIG-B equipment and carrier VCXO.

With the device IRIG-B decoder and firmware, the system can auto-calibrate itself to the IRIG-B signal and thus provide a precision of 5 µs precision/stability at all time.

In all IRIG-B modes, the IRIG-B state-machine tracks the phase of the signal and cumulates it.

If, at a certain point, the cumulating phase value is out of the attribute KMXF_DEVICE_IRIGB_DRIFT_MAX range, the IRIG-B state-machine unlocks from the IRIG-B signal (the mxfDeviceIrigbStatusGet() function will return a status different from MXF_IRIGB_LOCKED and MXF_ASYNCEVENT_IRIGB_EVENT_UNLOCKED asynchronous event will be set).

Between the unlock event and until the next lock event, the RTC will be in free running mode. During this time, the RTC might drift from the IRIG-B time. At the lock event, the user can call the mxfSystemTimeBaseSet() function again to compute a new offset with the new lock time. This might cause a non-linearity between the data time tags.

When the mxfSystemTimeBaseSet() function is called to set the timebase to IRIG-B, a correlation between the RTC on the device and the last IRIG-B lock time is done and an offset is computed from that.

This computed offset includes the number of seconds elapsed since January 1st, 1970 (86400 seconds per day from the device time), counting leap years and excluding the current year. The IRIG-B time however is a very precise time based on atomic clock but the precision is only at the second.

The enhanced format of the internal IRIG-B time in binary of the time value is then computed as follow;

IRIG-B time = [Years Days Minutes Seconds] from the IRIG-B time + [leap seconds] + [offset] from the device clock.

Note
The leap second is an adjustment factor defined by International Earth Rotation and Reference Systems Service (IERS) each year.

This works because there is a process to control the RTC on the device to keep it locked to the IRIG-B time by using a VCXO.

Therefore, you don't have to adjust the time tag with leap seconds, because the offset was computed only once at the beginning. If a leap second happens during the acquisition of data, the time tags will now have one second offset with the IRIG-B time. Asynchronous events for MXF_ASYNCEVENT_IRIGB_EVENT_LEAP_SECOND_INS and MXF_ASYNCEVENT_IRIGB_EVENT_LEAP_SECOND_DEL are generated and can be used to save the time at which the event occurred and adjust the time tags in post-processing.

Supported format

Input supported format: B00X and B12X.

Format Modulation Frequency Frequency/Resolution Coded Expressions
B 0 (Pulse width code) [TTL] 0 (No carrier) 0 (BCDTOY, CF, SBS) *
B 0 (Pulse width code) [TTL] 0 (No carrier) 1 (BCDTOY, CF) *
B 0 (Pulse width code) [TTL] 0 (No carrier) 2 (BCDTOY)
B 0 (Pulse width code) [TTL] 0 (No carrier) 3 (BCDTOY, SBS) *
B 0 (Pulse width code) [TTL] 0 (No carrier) 4 (BCDTOY, BCDYEAR, CF, SBS) *
B 0 (Pulse width code) [TTL] 0 (No carrier) 5 (BCDTOY, BCDYEAR, CF) *
B 0 (Pulse width code) [TTL] 0 (No carrier) 6 (BCDTOY, BCDYEAR)
B 0 (Pulse width code) [TTL] 0 (No carrier) 7 (BCDTOY, BCDYEAR, SBS) *
B 1 (Sine wave, amplitude modulated) [AM] 2 (1 kHz/1 ms) 0 (BCDTOY, CF, SBS) *
B 1 (Sine wave, amplitude modulated) [AM] 2 (1 kHz/1 ms) 1 (BCDTOY, CF) *
B 1 (Sine wave, amplitude modulated) [AM] 2 (1 kHz/1 ms) 2 (BCDTOY)
B 1 (Sine wave, amplitude modulated) [AM] 2 (1 kHz/1 ms) 3 (BCDTOY, SBS) *
B 1 (Sine wave, amplitude modulated) [AM] 2 (1 kHz/1 ms) 4 (BCDTOY, BCDYEAR, CF, SBS) *
B 1 (Sine wave, amplitude modulated) [AM] 2 (1 kHz/1 ms) 5 (BCDTOY, BCDYEAR, CF) *
B 1 (Sine wave, amplitude modulated) [AM] 2 (1 kHz/1 ms) 6 (BCDTOY, BCDYEAR)
B 1 (Sine wave, amplitude modulated) [AM] 2 (1 kHz/1 ms) 7 (BCDTOY, BCDYEAR, SBS) *

*: only the BCDTOY and BCDYEAR (if available) parts will be decoded.

Example

The example uses the Flex IRIG-B generator and loopback capability to demonstrate how to use IRIG-B timebase.

mil1553_bc_rt_data_assignment.c

Asynchronous Events

IRIG-B can post asynchronous events when a condition is registered using the mxfAsyncEventConditionsSet() function for trapping events.

The following events for IRIG-B can be reported;

Async Event Description
MXF_ASYNCEVENT_IRIGB_EVENT_LOCKED When the IRIG signal was detected and is now locked.
MXF_ASYNCEVENT_IRIGB_EVENT_UNLOCKED When the IRIG signal is unlocked; this can be a permanent condition (cable unplugged) or a transient condition (cloud). In both cases the IRIG-B logic changes its state to free running until a signal lock occurs.
MXF_ASYNCEVENT_IRIGB_EVENT_LEAP_SECOND_INS Positive leap second reported.*
MXF_ASYNCEVENT_IRIGB_EVENT_LEAP_SECOND_DEL Negative leap second reported.*

*The leap second is verified at the end of each day, regardless of the month. It is up to the user to confirm that the leap second detected is in fact a real leap second and not an erroneous value of the IRIG-B frame by checking with International Earth Rotation and Reference Systems Service (IERS). The IRIG-B time includes all preceding leap seconds. So, at this point, you do not have to adjust the time tag with leap seconds, but since the offset is computed only once at the beginning, if a leap second happens during the acquisition of data, the time tags will now have one second offset with the IRIG-B time. The MXF_ASYNCEVENT_IRIGB_EVENT_LEAP_SECOND_INS and MXF_ASYNCEVENT_IRIGB_EVENT_LEAP_SECOND_DEL asynchronous events can be used to save the time at which the event occurred and adjust the time tags in post-processing.

Example

The example below shows how an IRIG-B asynchronous handler can be implemented.

This first example is the handler itself and the following example shows how an application can register the conditions for calling this handler.

// IRIG-B Event Handler
uint32 IRIGBEventHandler(HMXF_ASYNCEVENT asyncEvent, void* param)
{
MXF_ASYNCEVENT_PENDING_INFO aPendingList[16];
uint64 timetag;
uint64 i, count;
uint32 rc;
// Read the pending list
rc = mxfAsyncEventPendingGet(asyncEvent, 16, &count, aPendingList);
for (i = 0; i < count && !rc; i++)
{
switch(aPendingList[i].condID)
{
// Check for IRIG-B conditions
case MXF_ASYNCEVENT_COND_IRIGB_EVENTS:
timetag = pendingList[i].condition.irigbEvents.timeTag;
switch(pendingList[i].condition.irigbEvents.status)
{
case MXF_ASYNCEVENT_IRIGB_EVENT_LOCKED:
printf("IRIG-B Lock\n");
break;
case MXF_ASYNCEVENT_IRIGB_EVENT_UNLOCKED:
printf("IRIG-B Unlock\n");
break;
case MXF_ASYNCEVENT_IRIGB_EVENT_LEAP_SECOND_INS:
printf("IRIG-B Positive leap second\n");
break;
case MXF_ASYNCEVENT_IRIGB_EVENT_LEAP_SECOND_DEL:
printf("IRIG-B Negative leap second\n");
break;
}
break;
default:
break;
}
}
return rc;
}
void main()
{
HMXF_SERVER server;
MXF_ASYNCEVENT_CONDITION eventCondition;
HMXF_ASYNCEVENT asyncEvent;
uint32 rc;
...
// Register the callback handler service function
rc = mxfAsyncEventHandlerInit(server, IRIGBEventHandler, NULL, &asyncEvent);
memset(&eventCondition, 0, sizeof(eventCondition));
// IRIG-B unlock event
eventCondition.condID = MXF_ASYNCEVENT_COND_IRIGB_EVENTS;
eventCondition.condition.irigbEvents.device = device;
eventCondition.condition.irigbEvents.status = MXF_ASYNCEVENT_IRIGB_EVENT_UNLOCKED;
if (!rc)
rc = mxfAsyncEventConditionsSet(asyncEvent, TRUE, 1, &eventCondition);
...
// Check for any errors
if (rc)
printf("Error code=0x%lX\n", rc);
}

IRIG-B Device Attributes

The following IRIG-B attributes are available.



IRIG-B Input

The KMXF_DEVICE_IRIGB_INPUT attribute selects which IRIG-B input is used to synchronize the device timer with the IRIG-B signal.

The supported values are:

Constant Definition
VMXF_DEVICE_IRIGB_INPUT_NONE IRIG-B not used (default)
VMXF_DEVICE_IRIGB_INPUT_DEVICE Use Device input
Note
Once the IRIG-B input is set, the IRIG-B input circuit requires two consecutive Pr points in order to lock onto the IRIG-B signal.

The application should wait that the status returned by the mxfDeviceIrigbStatusGet() function is MXF_IRIGB_STATUS_LOCKING or MXF_IRIGB_STATUS_LOCKED before calling any other functions.

IRIG-B Input Signal

The KMXF_DEVICE_IRIGB_INPUT_SIGNAL attribute designates the IRIG-B signal type to be used by the selected IRIG-B input.

The IRIG-B input must be selected before the selection of the signal type.

The supported values are:

Constant Description
VMXF_DEVICE_IRIGB_INPUT_SIGNAL_AM AM signal (default)
VMXF_DEVICE_IRIGB_INPUT_SIGNAL_AM_1PPS AM and 1 PPS signals
VMXF_DEVICE_IRIGB_INPUT_SIGNAL_DIGITAL Digital signal
Note
Any changes to IRIG-B input attribute resets the IRIG-B signal to AM.


IRIG-B Phase Compensation

The KMXF_DEVICE_IRIGB_PHASE_COMPENSATION defines the IRIG-B input phase compensation. The value is expressed according to the timebase resolution. The effective value is truncated according to the timebase resolution.

It is a positive adjustments to move the device timer, module timer and module time tag earlier.

The supported range is:

Range Value (ns)
Minimum -1000000000.0
Maximum 1000000000.0

Default value: 0.0 ns

IRIG-B Generator BCD Time

The KMXF_DEVICE_IRIGB_GEN_BCD_TIME attribute controls the IRIG-B TTL generator BCD Time. This attribute should be used to set the starting IRIG-B time to generate when IRIG-B generator is enabled.

The format is as follow:

Digit Position
Seconds 0-3
Tens of Seconds 4-6
Minutes 7-10
Tens of Minutes 11-13
Hours 14-17
Tens of Hours 18-19
Days 20-23
Tens of Days 24-27
Hundreds of Days 28-29
Years 32-35
Tens of Years 36-39
Hundreds of Years 40-43
Thousands of Years 44-47

Default value: 0

IRIG-B Generator Enable

The KMXF_DEVICE_IRIGB_GEN_ENABLE attribute controls the IRIG-B TTL generator enable state. When enabled, the IRIG-B generator generates IRIG-B frame by starting with the value set in KMXF_DEVICE_IRIGB_GEN_BCD_TIME.

The supported values are:

Constant Value
VMXF_ENABLE Enable IRIG-B Generator
VMXF_DISABLE Disable IRIG-B Generator (default)


IRIG-B Generator Loopback

The KMXF_DEVICE_IRIGB_GEN_LOOPBACK_ENABLE attribute controls the IRIG-B TTL internal loopback.

When enabled, IRIG-B generator must also be enabled to receive IRIG-B TTL signal without the need to be externally connected to an IRIG-B source.

The supported values are:

Constant Value
VMXF_ENABLE Enable IRIG-B Generator loopback
VMXF_DISABLE Disable IRIG-B Generator loopback (default)


IRIG-B Year Decoding

The KMXF_DEVICE_IRIGB_YEAR_DECODING_ENABLE attribute controls the decoding of the year from the IRIG-B frame.

The supported values are:

Constant Value
VMXF_ENABLE Enable Year decoding from IRIG-B frame. The IRIG-B frame must be compliant to IRIG 2004 specification.
VMXF_DISABLE Disable Year decoding from IRIG-B frame (default)


IRIG-B Year Range

The KMXF_DEVICE_IRIGB_YEAR_RANGE_MIN attribute specifies the base year value from which the two year digits from the IRIG-B frame will be added.

Note
This attribute is available only when IRIG-B Year decoding is enabled.

The supported range is:

Range Value
(year)
Minimum 1970
Maximum 2999

Default value: 2000

IRIG-B Timeout

The KMXF_DEVICE_IRIGB_TIMEOUT attribute specifies the time in seconds, based on the timebase resolution, after which a stalled signal will be reported as a lost of signal.

The supported range is:

Range Value
(secs)
Minimum 1
Maximum 60

Default value: 5 seconds

IRIG-B Maximum Drift

The KMXF_DEVICE_IRIGB_DRIFT_MAX attribute specifies the maximum drift allowed from the IRIG-B source after which the IRIG-B decoder will fall to unlock state. The value is expressed according to the timebase resolution.

The supported range is:

Range Value
(ns)
Minimum 1000
Maximum 999000

Default value: 25000 ns

Updated 10/23/2023