With the increasing number of channels for automotive network testing, it is often necessary to connect multiple TOSUN devices to the same TSMaster application on the same computer at the same time, and perform functions such as CAN message sending and receiving and logging by multiple devices at the same time, which inevitably has the requirement of timestamp synchronization between multiple devices as well as time synchronization between devices and the operating system on the computer.
In order to meet TOSUN between multiple devices and devices and computers between the time synchronization requirements, in this regard, TOSUN TSMaster introduced the TSync synchronization mechanism function, this article introduces the TSync synchronization mechanism function and the corresponding method of use.
Keywords in this article: tsync synchronization mechanism, multiple devices, devices and computers, timestamp synchronization
Table of Contents for this article
01、Why there is synchronization error between equipment
In a multi-device operating environment, each device has an internal clock source. Usually generated by a crystal, the number of pulses are counted by the controller, which in turn timestamps specific events (e.g., message reception, send completion, etc.). This is shown in Figure 1. When multiple devices receive the same event, we would like to get the same timestamp, but this is usually not done and the sources of error include:
Phase Error:For example, different device power-up timings, startup sequences, etc. lead to fixed deviations in their timestamps;
Frequency deviation:Even though the phase deviation is corrected during startup, there is still a slight difference in the frequency of the crystal.
For example, a crystal with a temperature difference of ±30 ppm at room temperature, assuming that the actual deviation is 10 ppm, i.e., 10 parts per million, will produce 60*60*1000*10/10^6 = 36 milliseconds of deviation in one hour, which is brought about by the lowest level device, and the device can not be corrected by itself alone.
02. Awakening
2.1 Verification methods for the TSync time synchronization mechanism
TSync time synchronization verification is achieved by sending and receiving CAN messages through two TOSUN devices, the main verification method is to use the CAN message send callback event and CAN message receive callback event of C applet to get the message timestamp, and further calculate the time difference between the message sending time of device A and the message receiving time of device B, which is "comp_time", as shown in Fig. 3. time", as shown in Figure 3. At the same time, the graphical module can be used to accurately observe the floating change of the time difference between devices and derive the synchronization effect between devices.
The following compares the differences in time synchronization between the devices of the two test groups by means of a reference test group with and without the TSync synchronization mechanism activated.
2.2 Reference test set for activating the TSync time synchronization mechanism
Reference test group 1: Using activated TSync mechanism and running for more than 48 hours
[Project] | descriptive |
[TOSUN devices] | Two TC1013s, designated by "Equipment A" and "Equipment B" |
[Device firmware compilation time] | V2024-09-21 |
[Software environment] | TSMaster x64 v2024.9.23.1185 |
[TSync mechanism activated] | be |
[Test Procedure] | ► Physically connect CAN channel 1 of "Device A" to CAN channel 1 of "Device B". ► CAN message 0x123 sent by "Device A" channel 1, received by "Device B" channel 1 ► Run the C applet script to calculate the send/receive time difference between the two devices ► Observation of the time difference by means of a graphical module ► Continuous operation and observation |
[Test run length] | 178200 seconds, i.e. over 48 hours |
Refer to the results of the test group 1 run:
After 2 days of continuous operation and observation, it can be found that the time difference "comp_time" between the two devices has been maintained at about 220 microseconds. In fact, this 200us difference is mainly due to the startup phase error, because the error caused by different crystal sources has been controlled to a very small range, so it can meet most of the synchronization requirements of CAN bus communication. As shown in Figure 4.
2.3 Reference test set without TSync time synchronization mechanism activated
Reference test group 2: TSync mechanism not activated
[Project] | descriptive |
[TOSUN devices] | Two TC1013s, designated by "Equipment A" and "Equipment B" |
[Device firmware compilation time] | V2024-09-21 |
[Software environment] | TSMaster x64 v2024.9.23.1185 |
[TSync mechanism activated] | clogged |
[Test Procedure] | ► Physically connect CAN channel 1 of "Device A" to CAN channel 1 of "Device B". ► CAN message 0x123 sent by "Device A" channel 1, received by "Device B" channel 1 ► Run the C applet script to calculate the send/receive time difference between the two devices ► Observation of the time difference by means of a graphical module ► Continuous operation and observation |
[Test run length] | About 30 minutes. |
Refer to the results of the test group 2 run:
Without activating the TSync time synchronization function in advance, you can find that the time difference between the two devices for sending and receiving messages "comp_time" is getting bigger and bigger with the running time, which is not quite in line with the application of time synchronization requirements. As shown in Figure 6.
03、How to activate the TSync function of TOSUN device
To activate the TSync function of TOSUN device, mainly through upgrading the device firmware and the control settings of TSync on the TSMaster software side.
3.1 Upgrading the firmware of the updated device
The procedure for upgrading the firmware of TOSUN device is as follows:
1. Prepare a computer and install the latest version of TSMaster software, the recommended version is V2024.09.23.1185 and above. Software update path: [Help] - [Check Upgrade] - [Download Public Test Version]. As shown in Figure 7.
2. Connect the device that needs to be upgraded to the computer via USB.
3. Through [Hardware] - [Channel Mapping] - [Hardware], after selecting the device, right-click at [Device Firmware Compilation Time] on the right and select [Read Latest Firmware Compilation Time], as shown in Figure 8.
3.2 TSync Control Settings for TSMaster Software
After connecting the device to the TSMaster, activate [Enable TSync Time Synchronization Mechanism] through [Hardware] - [Channel Selection] - [Settings] - [TSync Control], and you can refresh the list by right clicking on "List of Online Devices Supporting TSync Technology" at the bottom. After enabling the TSync mechanism, devices that support this mechanism can realize hardware timestamp synchronization. As shown in Figure 10.
- Software Download:
Click on the software download link below to download and install directly, beta version is recommended: - Software upgrades:
You can check for upgrades to the latest version within the software, provided that your computer has an Internet connection.
Note: TOSUN Technical Support Email:support@tosunai.cnWe welcome inquiries! (Company and contact information must be indicated)