Hardware Time Based Control of CAN Frame Transmit Time with NI-XNET

Updated Apr 26, 2023

Reported In

Driver

  • NI-XNET

Programming Language

  • LabVIEW G

Issue Details

What options do I have for hardware timed transmit time control in NI-XNET? Can I transmit non-cyclic CAN frames with hardware timing? 

Solution

  • Use cyclic frames.The most basic hardware timed control transmission is to use cyclic frames, which transmits CAN frames at a hardware-timed period regardless of the payload updated by XNET Write. Cyclic frames are defined in the XNET database file and begin transmitting frames as soon as the XNET Session starts. 

If you want to offset the start time between multiple cyclic frames, you can use the Active Frame and Frame:CAN:Start Time Offset property nodes. However, the accuracy available is 500µs (as of NI-XNET 18.0), and therefore any time offset set lower than 500µs will be rounded to the nearest multiple of 500µs.
  • Use Frame Output Stream Session with Replay Mode With Replay mode, NI-XNET attempts to maintain the transmit timing of CAN frames based on the timestamp associated with the CAN frame. 
    • Replay Exclusive: Hardware transmits frames specified by XNET Write.vi (No list is needed)
    • Replay Inclusive: Hardware transmits frames supplied by Interface:Output Stream List
Replay mode allows full control of transmit times independent of cyclic periods. This is especially useful if you want to replay logged CAN data to emulate or test an ECU.
However since you cannot take advantage of cyclical frames, you must continue writing frames while you want to transmit.

Below is an example of using Replay Mode:
Note: This image is a LabVIEW snippet, which includes LabVIEW code that you can reuse in your project. To use a snippet, right-click the image, save it to your computer, and drag the file onto your LabVIEW diagram.

Below are the resulting CAN frames captured in Bus Monitor:

Additional Information

Please refer to the Interface:Output Stream Timing for more details about replay mode.