MagiSync post banner

What is Kvaser MagiSync

Kvaser MagiSync is a feature of Kvaser’s SemiPro, Pro, Professional and Precision CAN to USB interfaces that enables automatic and accurate clock synchronization across several Kvaser interfaces connected by a common USB hub.

  • Automatic and accurate clock tick synchronization.
  • Synchronises any number of Kvaser devices that support it, connected by a common hub.
  • No extra wiring required (unlike solutions from other CAN to USB interface vendors.)
  • Works with any standard PC with a USB host or USB hub.
  • A patented technology that is unique to Kvaser.

Each Kvaser USB to CAN interface has a relative time stamp, as opposed to a real time clock. MagiSync ensures that this relative time is the same across multiple interfaces with high accuracy – better than 500 ns. Clock ticks are synchronized automatically and then Kvaser’s free CANlib SDK can be used to place the interfaces in the same time domain.

How does MagiSync™ work?

MagiSync synchronisation happens automatically. An offset is continuously applied to the clocks within connected Kvaser’s SemiPro, Professional, and Precision CAN to USB devices to compensate for any drifting that may occur.

To check whether an interface supports MagiSync and view the group of MagiSync synchronised interfaces, open the Kvaser Device Guide and check the menu item ‘View -> Synchronized Hardware’. For applications requiring clock tick synchronisation across several hubs, MagiSync synchronises them all if they are connected to the same root hub. A hub can be inside a PC or a standalone device.

“We use Kvaser U100P units to record data on all our vehicles. Kvaser MagiSyncTM simplifies timestamp synchronisation and gives us peace-of-mind.”

Director of Diagnostics & Calibration at a well-known European automotive Tier 1

In Depth

Details for developers

The foundation of Kvaser MagiSync™ is the accurate time stamping of what we call reference events, events that are guaranteed to occur within a limited time period on all synchronised devices. The event used in the Kvaser Leaf’s is the USB SOF packet, a packet delivered to and identified by all device controllers in a USB tree within at most 500 ns. The worst case scenario of 500 ns can easily be made a lot less by simply connecting all devices at the same hub level and using cabling of equal length for all hubs. When the USB device controller identifies the SOF’s it asserts an interrupt to the microcomputer. The interrupt is connected to trig a capture register that reads and saves the present time of the microcomputer without its direct intervention. The interrupt handler then simply reads the captured time, assigns it the SOF sequence number for easy identification of the exact event and sends it to the drivers in the host computer.

The driver collects all time stamped reference events from the synchronised hardware and matches those events that refers to the same event with the time masters ditto. The set of matched pairs are then used to translate all further time stamped events (such as can messages etc) through simple linear regression. Recall from early school days the function

y – y0 = k * (x – x0), where k = (y1 – y0) / (x1 – x0)

x refers to the local time base of the devices and y is the common global time base.

The (xi, yi) are the matched reference event pairs mentioned above.

The pros of this approach are among others the simplicity by which devices can be built. With off-the-shelf hardware, that had to be there anyway, it can still outperform much heavier constructions that include dedicated hardware using FPGA’s. Already proven off-the-shelf hardware combined with the simplicity as such vouches for a clean stable highly reliable yet powerful product.