From Saturday, Nov 23rd 7:00 PM CST - Sunday, Nov 24th 7:45 AM CST, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

CAN, LIN, and FlexRay Interfaces for NI VeriStand

Overview

NI VeriStand is a software environment for configuring real-time testing applications, including hardware-in-the-loop (HIL) test systems. Out of the box, NI VeriStand helps you configure a multicore-ready real-time engine to execute tasks that include:

 

  • Real-time I/O interfaces
  • Deterministic model and control algorithm execution
  • Triggerable, multifile data logging
  • Real-time stimulus profile generation
  • Calculated channels

 

Event alarming and alarm response routines CAN, LIN, and FlexRay bus interfaces are commonly required to communicate with embedded electronics that are either part of the device being tested or of the test system itself. NI offers a number of interfaces for these buses as part of the NI-XNET family. NI VeriStand includes a rich feature set for using NI-XNET-based hardware interfaces to these buses. This document provides a brief overview of the NI-XNET product family with specifics for the different types of bus interfaces, and then covers the NI-XNET interface capabilities with NI VeriStand.

 

Contents

NI-XNET CAN, LIN, and FlexRay Interfaces

The NI-XNET platform includes a series of high-performance CAN, LIN, and FlexRay interfaces. NI-XNET CAN, LIN, and FlexRay interfaces are optimized for applications that require real-time, high-speed manipulation of hundreds of CAN, LIN, and FlexRay frames and signals, such as HIL simulation, rapid control prototyping, bus monitoring, automation control, and more.

The patent-pending NI-XNET device-driven DMA engine reduces system latency from milliseconds to microseconds. This gives the onboard processor the ability to move CAN, LIN, and FlexRay frames and signals between the interface and the NI VeriStand Real-Time Engine without CPU interrupts, freeing processor time for the execution of other system tasks such as complex models.

The CAN, LIN, and FlexRay interfaces have features applicable to their specific bus:

Controller Area Network (CAN)

  • 1- or 2-port high-speed/FD, low-speed/fault-tolerant, or software-selectable CAN interfaces with onboard transceivers
  • Integrated CAN databases for importing, editing, and using signals from FIBEX, .DBC, and .NCD files

 

Local Interconnect Network (LIN)

  • 2-port LIN interface (up to 40 kbit/s) with onboard transceivers
  • Integrated support for importing and using signals from LDF databases
  • Master and slave support; hardware-timed scheduling for master tasks

 

FlexRay

  • Two complete FlexRay interfaces with onboard transceivers for cold-start and normal applications
  • Integrated FlexRay database for importing, editing, and using signals from FIBEX

NI-XNET Interface Capabilities with NI VeriStand

NI VeriStand has a number of native features for communicating with the CAN, LIN, and FlexRay buses using the NI-XNET products. These features play a role in frame acquisition, frame transmission, and more advanced bus capabilities.

One essential feature that allows for customized frame acquisition and transmission is a direct link from NI VeriStand to the NI-XNET Database Editor, which gives you the ability [j1] to configure and edit database files that will be used with CAN and FlexRay buses. Inside the editor, you can import and configure FIBEX, .DBC, and .NCD files. You can also import .LDF files for use with a LIN bus.

Figure 1. You can use the NI-XNET Database Editor in NI VeriStand.

 

Frame Acquisition

Acquire CAN, LIN, and FlexRay Signals and Frames – NI VeriStand can acquire both raw frame and scaled signal data from the CAN, LIN, and FlexRay buses. For further analysis, you can obtain the received time and time difference from the last received frame for each frame.

Figure 2. Log and display data from CAN, LIN, or FlexRay buses in addition to their received time and time difference between frames.

Frame Data Logging – For the frames that the NI-XNET interfaces receive from the bus, NI VeriStand can log the raw data frames to file. You can also place a filter on this data logging to make sure that only certain frames are logged to the file while others are not.

Figure 3. You can log bus traffic being monitored to a specific file and include or exclude certain data.

Launch NI-XNET Bus Monitor – You can launch the NI-XNET Bus Monitor directly from NI VeriStand. With this tool, you gain a real-time view of the data that is on a particular bus. For a more customized view, select the specific port to be monitored in the Bus Monitor.

Figure 4. Launch the NI-XNET Bus Monitor to monitor traffic on the CAN, LIN, or FlexRay bus in real time.

 

Frame Transmission

Conditional Frame Transmission – You can configure the CAN, LIN, and FlexRay NI-XNET interfaces for both event and cyclic frame transmission. In addition, you can set conditions for the frame transmissions. The conditions include transmitting in response to a trigger, a value change of the frame, or neither one of these two occurring, which results in transmission.

Figure 5. You can set a transmission trigger for different conditions from the System Explorer.

Data Replay – When communicating with the CAN bus, you can replay data it has acquired back onto the CAN bus exactly as it was received. Because of the capability to acquire frame received time and time difference between frames, the data frames can be transmitted on the bus in the same order and time difference as they were initially received. You can filter this data to configure the replay for specific frames. This mode can be applicable in any restbus simulations.

Figure 6. Replay data on the bus as it was received and filter it to include or exclude specific frames.

Transmission Disabling – To allow for a quick transition from transmitting to not transmitting data frames, NI VeriStand also has the capability to disable the transmission of frames on the CAN, LIN, and FlexRay buses without uninitializing the driver for the interfaces.

Figure 7. NI VeriStand includes native functionality to disable transmission of frames.

Drop Cyclic Frames – For use cases in creating error situations on a CAN bus and inserting erroneous data, you can configure the hardware interface to drop cyclic frames, or skip transmissions. Specify that you would like to skip a number of transmissions and the hardware stops transmitting until this limit is reached and begins transmitting again after.

Figure 8. You can skip a specific number of cycles from cyclic frames as needed.

Change CAN Period Instantly – For cyclic transmission of CAN frames, NI VeriStand has native functionality to change the period of those cyclic transmissions quickly and easily. While the NI-XNET interface is transmitting cyclic frames with a certain period, you can change the period on the fly without stopping transmission.

Figure 9. Change the period of cyclic frames by specifying the transmit time.

Advanced Capabilities

Automated Frame Processing – For CAN frames, NI VeriStand allows you to take advantage of a configurable counter and CRC setup for cyclic frames. In addition, you can specify if you are using an 8- or 16-bit CRC for your application. An advantage of doing this with the NI-XNET hardware interfaces is that the processing for the CRC and the counter is done onboard the hardware interfaces themselves, which reduces overall system latency.

Figure 10. You can configure additional frame processing for desired CAN ports.

64-Bit Data Frame – With NI VeriStand and NI-XNET interfaces, you can define and use up to 64-bit data frames on CAN, LIN, and FlexRay buses. Typical data frames are allowed up to only 52-bits, but you can specify if you want to have a 64-bit frame. If you use this option, you can typecast your data inside of your simulation model.

Figure 11. Configure data frames of lengths up to 64-bits in NI VeriStand.

Other Capabilities

XCP and CCP Master Add-On for NI VeriStand – This custom device for NI VeriStand enables connectivity to an eXtended Calibration Protocol (XCP) or CAN Calibration Protocol (CCP) slave. This custom device uses the NI ECU Measurement and Calibration Toolkit to test and tune XCP- and CCP-enabled electronic control units (ECUs). The add-on also supports all PXI and PCI CAN boards that are part of the NI-XNET family. For more information see Add-ons for NI VeriStand

 

Additional Resources