Kvaser Linux CANLIB

Time Stamping Accuracy and Resolution

Accuracy

The accuracy of the time stamps depends on the hardware.

The members of the Kvaser Leaf family have an onboard CPU. The time stamp accuracy varies (check the hardware manual) but the high-end members have very precise time stamping. The accuracy can be as good as one microsecond depending on the hardware. If more than one Leaf is used, their clocks are automatically kept in sync by the Kvaser MagiSync™ technology.

Other CAN interfaces, like the Kvaser Leaf, LAPcan and USBcan II, have an on-board CPU and clock and provide very accurate time stamps for incoming CAN messages. The accuracy is typically 10-20 microseconds.

Certain interfaces, like the PCIcan (PCI) series of boards, don't have an on-board CPU so the driver relies on the clock in the PC to timestamp the incoming messages. As Windows is not a real-time operating system, this gives an accuracy which is in the order of one millisecond.

Resolution

The resolution of the time stamps is, by default, 1 ms. It can be changed by calling canIoCtl() with the canIOCTL_SET_TIMER_SCALE function code.

LAPcan / LAPcan II note

LAPcan uses an on-board clock for creating the message time stamps. The resolution of this clock is 8 microseconds. The accuracy of the time stamps can vary from around 8 microseconds up to 100 microseconds, depending on the bus load and if you have one or two CAN busses connected. If two messages arrive at the same time, but on different busses, to LAPcan, the message on channel 1 will be handled first and will have the most accurate time stamp. The time stamp on the second message will be up to 100 microseconds "too late".

PCIcan II / USBcan Rugged / USBcan II / Kvaser Memorator note

  • Use firmware 2.0 or later, and driver 3.5 or later, to get accurate timestamps. Previous firmware/driver made the timestamps in the driver.
  • The on-board clock has a resolution of 10 microseconds, and the same note as for LAPcan/LAPcan II (above) applies.

PCcan / PCIcan note

PCcan and PCIcan do not have an on-board clock but uses the PC clock instead. On certain types of PCs, the on-board clock can jump forward with random intervals. The amount of time added to the clock is one to a few seconds. This is due to a bug in the PC hardware. For more information, check out Microsoft Knowledgebase Q274323. (The URL was, as of this writing, http://support.microsoft.com/kb/q274323/)

Kvaser Leaf notes

  • The accuracy of the time stamps depend on the type of Leaf.
  • Kvaser MagiSync™ is not available in all types of Leafs.
  • A prerequisite for Kvaser MagiSync™ to work efficiently is that all Leafs are connected (possibly via other hubs) to the same root hub, that is, the same USB controller. Use the Kvaser Hardware applet in the Control Panel to find out if this is the case.