ncConfigCANNet.vi

NI-CAN

ncConfigCANNet.vi

Purpose

Configure a CAN Network Interface Object before opening it.

Format

Input

ObjName is the name of the CAN Network Interface Object to configure. This name uses the syntax "CANx", where x is a decimal number starting at zero that indicates the CAN network interface (CAN0, CAN1, up to CAN63). CAN network interface names are associated with physical CAN ports using the Measurement & Automation Explorer (MAX).

The Frame API and Channel API cannot use the same CAN network interface simultaneously. If the CAN network interface is already initialized in the Channel API, this function returns an error.

The special interface values 256 and 257 refer to virtual interfaces. For virtual interfaces, the only valid attribute is Start On Open. All other attributes in the config cluster are ignored. The mask and comparator attributes are always zero for virtual interfaces (receive all frames).

For more information on usage of virtual interfaces, refer to Frame to Channel Conversion.

The 847x and 847x with Sync Series LIN interfaces do not support ncConfigCANNet.vi.

CAN Network Interface Config provides the core configuration attributes of the CAN Network Interface Object. This cluster uses the typedef ncNetAttr.ctl. You can wire in the cluster by first placing it on the front panel from the NI-CAN Controls palette, or you can right-click the VI input and select Create Constant or Create Control.

For the 847x and 847x with Sync series CAN interfaces, only Start on Open and Baud Rate are valid configuration attributes. All other configuration attributes are ignored.

Start On Open indicates whether communication starts for the CAN Network Interface Object (and all applicable CAN Objects) immediately upon opening the object with ncOpen. The default is True, which starts communication when ncOpen is called. If you set Start On Open to False, you can call ncSetAttribute after opening the interface, then ncAction to start communication. The ncSetAttribute VI can be used to set attributes that are not contained within the ncConfigCANNet VI.
Baud Rate is the baud rate to use for communication. Basic baud rates are supported, including 33333, 83333, 100000, 125000, 250000, 500000, and 1000000. If you are familiar with the Bit Timing registers used in CAN controllers, you can use a special hexadecimal baud rate of 0x8000zzyy, where yy is the desired value for register 0 (BTR0), and zz is the desired value for register 1 (BTR1) of the CAN controller.

For the Frame API, the Baud Rate has no relationship with the baud rate property in MAX. You must always configure the Baud Rate with the ncConfigCANNet VI.
Read Queue Length is the maximum number of unread frames for the read queue of the CAN Network Interface Object. A typical value is 100. For more information, refer to ncReadNetMult.vi.

The internal read queue exists between the CAN hardware and the NI-CAN device driver. This internal read queue holds frames temporarily prior to transfer a larger queue in the NI-CAN device driver. The larger NI-CAN device driver queue grows as needed in order to accommodate high bus loads.

For more information on reading from the CAN Network Interface Object, refer to ncReadNetMult.vi.

Write Queue Length is the maximum number of frames for the internal write queue of the CAN Network Interface Object awaiting transmission. A typical value is 10.

The internal write queue exists between the CAN hardware and the NI-CAN driver. This internal write queue holds frames temporarily prior to transfer to CAN hardware from a larger queue in the NI-CAN device driver.

For more information on writing to the CAN Network Interface object, refer to ncWriteNetMult.vi.

Standard Comparator is the CAN arbitration ID for the standard (11-bit) frame comparator. For information on how this attribute is used to filter received frames for the Network Interface, refer to the following Standard Comparator attribute.

If you intend to open the Network Interface, most applications can set this attribute and the Standard Comparator to 0 in order to receive all standard frames.

If you intend to use CAN Objects as the sole means of receiving standard frames from the network, you should disable all standard frame reception in the Network Interface by setting this attribute to the special value CFFFFFFF hex. With this setting, the Network Interface is best able to filter out incoming standard frames except those handled by CAN Objects.

Standard Mask is the bit mask used in conjunction with the Standard Comparator attribute for filtration of incoming standard (11-bit) CAN frames. For each bit set in the mask, NI-CAN compares the corresponding bit in the Standard Comparator to the arbitration ID of the received frame. If the mask/comparator matches, the frame is stored in the Network Interface queue, otherwise it is discarded. Bits in the mask that are clear are treated as don't-cares. For example, hex 00000700 means to compare only the three upper bits of the 11-bit standard ID.

If you set the Standard Comparator to CFFFFFFF hex, this attribute is ignored, because all standard frame reception is disabled for the Network Interface.

Most applications can set this attribute and the Standard Comparator to 0 to receive all standard frames. This is particularly advisable for Series 2 hardware, because the Philips SJA1000 CAN controller does not support distinct filters for standard and extended IDs. For Series 2, nonzero values for this attribute are implemented in software, as an additional filter applied after the Series 2 Filter Mode. When you set this attribute to zero for Series 2, filtering is optimized to use only the Series 2 Filter Mode attribute for the SJA1000.
Extended Comparator is the CAN arbitration ID for the extended (29-bit) frame comparator. For information on how this attribute is used to filter extended frames for the Network Interface, refer to the following Extended Mask attribute.

If you intend to open the Network Interface, most applications can set this attribute and the Extended Mask to 0 in order to receive all extended frames.

If you intend to use CAN Objects as the sole means of receiving extended frames from the network, you should disable all extended frame reception in the Network Interface by setting this attribute to the special value CFFFFFFF hex. With this setting, the Network Interface is best able to filter out incoming extended frames except those handled by CAN Objects.
Extended Mask is the bit mask used in conjunction with the Extended Comparator attribute for filtration of incoming extended (29-bit) CAN frames. For each bit set in the mask, NI-CAN compares the corresponding bit in the Extended Comparator to the arbitration ID of the received frame. If the mask/comparator matches, the frame is stored in the Network Interface queue, otherwise it is discarded. Bits in the mask that are clear are treated as don't-cares. For example, hex 1F000000 means to compare only the five upper bits of the 29-bit extended ID.

If you set the Extended Comparator to CFFFFFFF hex, this attribute is ignored, because all extended frame reception is disabled for the Network Interface.

Most applications can set this attribute and the Extended Comparator to 0 to receive all extended frames. This is particularly advisable for Series 2 hardware, because the Philips SJA1000 CAN controller does not support distinct filters for standard and extended IDs. For Series 2, nonzero values for this attribute are implemented in software, as an additional filter applied after the Series 2 Filter Mode. When you set this attribute to zero for Series 2, filtering is optimized to use only the Series 2 Filter Mode attribute for the SJA1000.
Error in describes error conditions occurring before the VI executes. If an error has already occurred, the VI returns the value of the Error in cluster in Error out.
status is True if an error occurred. If status is True, the VI does not perform any operations.
code is the error code number identifying an error. A value of 0 means success. A negative value means error: VI did not execute the intended operation. A positive value means warning: VI executed intended operation, but an informational warning is returned. For a description of the code, wire the error cluster to a LabVIEW error-handling VI, such as the Simple Error Handler.
source identifies the VI where the error occurred.

Output

Error out describes error conditions. If the Error in cluster indicated an error, the Error out cluster contains the same information. Otherwise, Error out describes the error status of this VI.
status is True if an error occurred.
code is the error code number identifying an error. A value of 0 means success. A negative value means error: VI did not execute the intended operation. A positive value means warning: VI executed intended operation, but an informational warning is returned. For a description of the code, wire the error cluster to a LabVIEW error-handling VI, such as the Simple Error Handler.
source identifies the VI where the error occurred.

Description

The Network Interface provides read/write access to all IDs on the network.

If you intend to use RTSI features to synchronize the Network Interface with other National Instruments cards, refer to the ncConfigCANNetRTSI VI.

If you need to log transceiver fault indications to the Network Interface read queue, refer to the Log Comm Warnings attribute of ncSetAttr.vi

The first NI-CAN VI in the application will normally be ncConfigCANNet.

For the 847x and 847x with Sync series CAN interfaces, only Start On Open and Baud Rate are valid configuration attributes.

The 847x and 847x with Sync series LIN interfaces do not support ncConfigCANNet.vi.