Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Document Type: Tutorial
NI Supported: Yes
Publish Date: May 16, 2008


Feedback


Yes No

Related Categories

Related Links - Developer Zone

Related Links - Products and Services

Controller Area Network (CAN) FAQs

10 ratings | 3.20 out of 5
Read in | Print

Overview

This FAQ covers some of the most frequently asked questions regarding NI CAN interfaces.

Are National Instruments CAN Interfaces Compatible with J1939 Networks?

J1939 networks utilize the extended frame format specified in the CAN 2.0B standard. All National Instruments CAN interfaces comply with the CAN 2.0B standard which supports this optional, extended frame format. This extended frame format uses 29 bits for the arbitration ID, rather than the standard 11 bits. NI-CAN 2.0 and later allows for database files (.dbc or .ncd) to be imported into NI Measurement and Automation Explorer (MAX). These database files can contain both standard and extended arbitration IDs.

Multi-frame messages, which are also utilized in J1939 networks, can also be used with NI CAN tools. While they are not currently directly supported with the NI-CAN Channel API, you can read the individual messages (also known as frames) and append them together in software. Since a typical J1939 network only contains a few multi-frame messages, it is generally pretty easy to implement this aspect of your program.

In conclusion, all of the tools that are needed for J1939 communication, are provided with the NI CAN tools. The vast majority of J1939 communication is supported natively with the NI-CAN driver, but there are a few aspects, such as appending two individual frames together to create a multi-frame message, that require additional programming.

What Do the NI-CAN Error Codes Stand For?


If you are using LabVIEW to develop your CAN applications, you can use the Simple Error Handler.vi (located in the All Functions >> Time & Dialog sub-pallette) for specific information on error codes.

If you are using other programming environments (VB or C), there is a utility, explain.exe, which is typically installed in the following location with version 2.0 or later of the NI-CAN driver:

C:\Program Files\National Instruments\NI-CAN\Utilities\

If you run the utility from the command line and pass the error code, the error description is returned. Figure 1 shows how this executable can be called.


[+] Enlarge Image
Figure 1. Calling explain.exe

For a detailed list of all of the NI-CAN error codes and their meanings, please refer to the following link.

See Also:
KB: How Do I Know What the NI-CAN Error Codes Stand For?

What Level of Isolation at the Physical Layer is Provided on NI-CAN Interfaces?


The CAN physical layer (V+ and V-) contains isolation from the PC as well as between ports (2 Port CAN Interfaces) for both externally and internally powered CAN interfaces. The internal power isolation is handled by a 5V DC-to-DC converter. This DC-to-DC converter has 500 V isolation, which means the power supplied to the CAN physical layer is provided by the computer using a DC-to-DC converter that isolates the PC power and ground from the CAN physical layer.

When you are using an external power source, you still have 500 V optical isolation between the PC and the CAN physical layer power and ground. The CAN physical layer has a 5VDC regulator to obtain power and ground from the external source, and protective circuitry to prevent damage to the CAN physical layer and the external source in the event of incorrect wiring.

Note: The optional shield signal is not isolated from the computer power and ground.

What is the Latest Version of NI-CAN That Supports My Version of LabVIEW or LabWindows/CVI?


Please consult the following knowledge base for the most up-to-date information on NI-CAN driver software versions for specific LabVIEW and LabWindows/CVI releases.

See Also:
Download NI-CAN Driver Software
What is the Latest Version of NI-CAN That Supports My Version of LabVIEW or LabWindows/CVI?

NI-CAN Channel and Frame API


The NI-CAN driver installs 2 APIs to program National Instruments CAN interfaces. The choice to use either the Channel API or the Frame API is dependent upon both the needs of your application and your personal preference. The Channel API is favored by many because it provides access to the CAN network in simple physical units that are easy to use. Using this API, the NI-CAN software converts the raw data of the CAN messages to or from the physical units of each channel in the channel configuration. However, because the Frame API provides low-level access to the CAN network, there are certain scenarios where it is recommended over the Channel API. Here are some examples of times when it would be better to use the Frame API:

  • You are using an application developed with NI-CAN version 1.6 or earlier.
  • You want to implement a command/response protocol with your device, where you write a command to a device and the device then sends a response.
  • You want to use remote frames with your device. The Channel API does not support this feature.
  • You are synchronizing the CAN communication with data acquisition from a DAQ card. The Frame API provides lower-level RTSI features than those provided with the Channel API, and therefore is better for advanced synchronization.


NOTE: You cannot use both the Channel API and the Frame API on the same CAN interface at the same time. If one application is running using the Frame API on CAN0, then you cannot run another application using the Channel API also on CAN0. If you have a 2-port CAN card, you can use separate applications on different interfaces, or you can run the applications at different times.

See Also:
The NI-CAN Channel API

Proper Termination for NI-CAN Hardware


In order to ensure that reflection does not cause communication failure, the transmission line must be terminated. The method of terminating your CAN hardware varies depending on the physical layer of your hardware: High-Speed, Low-Speed, Single-Wire, or Software-Selectable.

High-Speed CAN: For High-Speed CAN, both ends of the pair of signal wires (CAN_H and CAN_L) must be terminated. This is because communication flows both ways on the CAN bus. CAN_L is pin 2, and CAN_H is pin 7 on the standard 9-Pin D-Sub connector. The termination resistors on a cable should match the nominal impedance of the cable. ISO 11898 requires a cable with a nominal impedance of 120 ohms, and therefore 120 ohm resistors should be used for termination. If multiple devices are placed along the cable, only the devices on the ends of the cable need termination resistors. Figure 2 gives an example of how to terminate a high-speed network.


Figure 2. Example: Terminating a High-Speed Network.

Low-Speed CAN: For Low-Speed CAN, each device on the network needs a termination resistor for each data line: R(RTH) for CAN_H and R(RTL) for CAN_L. Unlike the High-Speed CAN, Low-Speed CAN requires termination on the transceiver rather than on the cable. The resistance of each resistor is calculated through several formulas. This process is detailed on pages 4-10 through 4-12 of the NI-CAN Hardware and Software Manual linked below. Figure 3 details indicates where the termination resistors should be placed on a low-speed network.


[+] Enlarge Image
Figure 3. Placement of Termination Resistors on a Low-Speed Network.

Single-Wire CAN: The NI Single-Wire CAN hardware includes a built-in 9.09 kohm load resistor. This is all the required load resistance for the network, and no additional resistors are needed.

Software-Selectable CAN: The Software-Selectable CAN hardware can be configured to operate either as a High-Speed, Low-Speed, or Single-Wire interface. The required termination is dependent upon which of the physical layers it is configured to use.

Does National Instruments Offer CAN I/O?


Yes. National Instruments offers CAN I/O with the FP-1300. With the National Instruments FP-1300, you can easily add I/O onto a CAN network. The NI FP-1300 is a CAN interface module for FieldPoint that provides full user control of the CAN messages. The FP-1300 works with all the FieldPoint I/O modules, so you can add analog I/O, digital I/O, temperature measurements, and strain measurements to a CAN network. The module is designed for device prototyping and for adding I/O to CAN networks in automotive, aerospace, and machine building applications.



Figure 4. National Instruments FP-1300 CAN Interface module.

See Also:
National Insturments CAN I/O


Related Links:
Controller Area Network (CAN) Homepage

10 ratings | 3.20 out of 5
Read in | Print

Reader Comments | Submit a comment »

single wire CAN wiring
there's no information about single wire cabling. This could be very useful
- Paolo Squillari, Politecnico di torino. anon3689068 - Aug 2, 2008

 

Legal
This tutorial (this "tutorial") was developed by National Instruments ("NI"). Although technical support of this tutorial may be made available by National Instruments, the content in this tutorial may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this content with each new revision of related products and drivers. THIS TUTORIAL IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).