I am trying to achieve a hardware synchronization between an analog input and a CAN signal. To achieve this, I am using the DAQ device USB-6343 and the CAN Bus device USB-8502. Both devices have the functionality to export/import triggers and clock sources.
Attached you can find my attempt at synchronizing both devices. I am exporting the sample clock trough PFI14 and the start trigger signal trough PFI15 (on the USB-6343). These ports are connected to the USB-8502 T0 and T1 terminals respectively. Both GND are also connected. I am using the 20MHz Time base of the USB-6343, since only that one can be used by both devices (as far as I could tell from the data sheets).
My problem is that when I subtract the time stamps from one another, the difference is equivalent to the difference without any synchronization (around 1ms). Code without synchronization also attached. Am I doing something wrong with the synchronization? Perhaps with the XNET connect terminals VI? Any information would be helpful
Solved! Go to Solution.
The working principle of Accuracy of the Waveform Timestamp Returned by NI-DAQmx is applicable for XNET.
The start time, t0 is provided by the host PC when Start VI is called and the values of t0 provided to each device are different during the polling. Thus, the devices are physically synchronized but cosmetically have different timestamps. To correct the time, you can get the actual start time for both DAQmx and XNET, and adjust the start time of XNET as shown below.
Disclaimer: I don't have actual hardware to validate the code. It was modified based on my memory and experience.
Ohhh I see. Thanks for the explanation and code ZYOng! I now better understand the problem.
However, after trying your code I get this error, saying that the property is not supported. I cannot find any information regarding device compatibility and that property. Furthermore, I cannot even select the property. I can find it when I search the class DAQmx timing class, but I am unable to select any of the "Advanced:[...]" properties regardless of the hardware selected. The "Advanced" properties should be shown under "More.." when clicking on the property node, but they are not. Any idea why I cannot select or even see that property?
Information about the property:
In that case, you can use the t0 of the first sample. The start trigger is generated on the first sample clock.
That's a nice idea! I did that and it seems to fix the problem on the DAQ side. However, now a new problem is appearing. This time is the Property Intf:AdjustLocalTime.
I feel so bad for all of this smaller problems just popping up. Normally I have no problem with property issues and such, but unfortunately i cannot find any information regarding compatibility. I just downloaded the newest NI XNET driver (2023 Q1) and the problem persist. I am using LabVIEW 2022 Q3. Maybe the hardware I am using (USB-8502) is just not compatible, but I cannot find any information.
Once again thanks for the help and any further advice, would be appreciate it 🙂
I guess the XNET USB device does not support this feature. I am confident that it works on PXI-851x. We used this method to synchronize with PXIe-852x automotive ethernet module.
Perhaps you need to do manual post-processing on the waveform then.