kb:driver_software:command_line_tools_mbgtools

Command Line Tools 'mbgtools'

mbgtools is a collection of command line programs that can be used to monitor and configure Meinberg bus level devices, i.e. PCI and PCI Express cards as well as USB devices.

These tools are already included in the

and are also available as


This is a general description of the individual tools. Please note that not each tool is necessarily included in each of the packages mentioned above, and the detailed behavior may depend on the package version and target operating system.

Anyway, each tool can be called with command line option -? or -h to display a summary of usage information and available options.


A kernel module which implements the device driver.
Only included in mbgtools-lx, mbgtools-fbsd, and mbgtools-nbsd.


The Meinberg Service Daemon (mbgsvcd) runs in the background and periodically calls the kernel driver to reads both the PCI card's on-board time and the associated system time with highest resolution, and as close as possible after each other.

The usual execution time required to read those time stamp pairs depends mainly on the operating system type and version, the CPU power, etc. However, if the call into the kernel driver takes longer to execute than usually, execution may have been interrupted, and thus the time stamps might not have been taken as close as possible after each other, which might lead to a small time offset error. In this case the time stamps are discarded and a new call is made to grab another pair.

If the execution time doesn't exceed the usual time the time stamp pairs are fed into a shared memory segment that is compatible with ntpd, chronyd etc.

The operating system time is synchronized by one of these daemons which need to be running and configured to receive their reference time from the shared memory segment.

This approach avoids time offset errors due to interrupt latencies and processing times.

mbgsvcd is only included in and used with:
mbgtools-lx, mbgtools-fbsd, and mbgtools-nbsd.


This program prints some status information for a device. The kind of information to be printed depends on the specific type of the card. One or more parameters '-v' increase verbosity.


This program can be used to do some basic configuration of a device, depending on the type of device. The usage information provides a list of valid options.


This program can be used to check and configure IRIG settings of devices which provide an IRIG input or output.


This program reads the time from a device and sets the system time once. If NTP is used on a system which has an unreliable clock, this program can be used to set the system time initially (before the NTP daemon is started). The program should not be run if NTP is active and controls the system time since NTP achieves a higher accuracy.


This program displays the modulation (i.e. the second marks) of a received longwave signal, e.g. from DCF77, if supported by the device.


This program can be used with Time Code Reader (TCR) devices to configure a compensation value for the propagation delay of the incoming time code signal.


This program compares the times provided by different devices, and shows the computed difference. The PC's cycles counter is used to compensate the latency that is introduced since the two devices can only be accessed one after the other.


This example program reads time capture events from a device's time capture buffer. This works only with devices that provide time capture inputs, and the DIP switches on those cards must have been set up properly to enable time capturing. See the manual for the particular device.


This example program checks whether a card supports high-resolution time and reads those time stamps from the device, if supported.


This example program demonstrates how to read high resolution time stamps from a card very much faster than mbghrtime. However, this works only with cards that support memory mapped I/O. Current PCI Express cards support this feature, but older PCI cards may not, and USB devices don't, either.


This example program also shows how to get time stamps faster than shown in mbghrtime. This is not as easy as mbgfasttstamp but can be used with every card which can be used with mbghrtime, even if the card does not support memory mapped I/O.

The program starts a polling thread which reads a high resolution time stamp from the card once per second, and then uses the CPU's time stamp counter to extrapolate the time.

A limitation of this approach is that the CPU's time stamp counters may return different values on different CPUs. So the program takes care to have the code executed always on the same CPU. Also, power saving mechanisms (Intel's Speedstep, or AMD's Cool'n'Quiet) should be disabled to prevent the extrapolated times from being messed up.


Martin Burnicki martin.burnicki@meinberg.de 2019-03-21

  • kb/driver_software/command_line_tools_mbgtools.txt
  • Last modified: 2020-09-21 12:44
  • by 127.0.0.1