mcECUCreate

ECU Measurement and Calibration Toolkit Help

Edition Date: October 2018

Part Number: 371602T-01

»View Product Info
Download Help (Windows Only)

Purpose

Creates an ECU object in memory.

Format

mcTypeStatus mcECUCreate(
mcTypeTaskRef DBRefNum,
cstr ECUName,
char *Interface,
i32 ByteOrder,
u32 CRO_ID,
u32 DTO_ID,
u16 StationAddress,
u32 BaudRate,
mcTypeTaskRef *ECURefNum);

Input

DBRefNum

DBRefNum is the task reference from the initial database task function. The database task reference is originally returned from mcDatabaseOpen.

ECUname

Identifies the ECU object. Use this name as reference in mcMeasurementCreate to create a DAQ list on the ECU.

Interface

Specifies the protocol and optional interface to use for this task.

ByteOrder

Sets the byte order of the CCP slave device:

0—MSB_LAST

The CCP Slave device uses the MSB_LAST (Intel) byte ordering.

1—MSB_FIRST

The CCP Slave device uses the MSB_FIRST (Motorola) byte ordering.

CRO_ID

Sets the Command Receive Object (CRO) CAN Identifier for CCP, or XCP on CAN, which is used to send commands and data from the host to the slave device.

DTO_ID

Sets the Data Transfer Object (DTO) CAN Identifier for CCP, or XCP on CAN, which is used to send commands and data from the slave device to the host.

StationAddress

Sets the slave device station address. CCP is based on the idea that several ECUs can share the same CAN Arbitration IDs for CCP communication. To avoid communication conflicts, CCP defines a station address that must be unique for all ECUs sharing the same CAN Arbitration IDs. Unless an ECU has been addressed by its station address, the ECU must not react to CCP commands sent by the CCP master.

BaudRate

Sets the CAN baud rate in use by the selected interface. This property applies to all tasks initialized with the NI-CAN or NI-XNET interface. You can specify the following basic baud rates as the numeric rate: 33333, 83333, 100000, 125000, 200000, 250000, 400000, 500000, 800000, and 1000000. You can specify advanced baud rates as 8000XXYY hex, where YY is the value of Bit Timing Register 0 (BTR0), and XX is the value of Bit Timing Register 1 (BTR1). For more information, refer to the Interface Properties dialog in MAX.

Output

ECURefNum

ECURefNum is the task reference that links to the selected ECU.

Return Value

The return value indicates the status of the function call as a signed 32-bit integer. Zero means the function executed successfully. A negative value specifies an error, which means the function did not perform the expected behavior. A positive value specifies a warning, which means the function performed as expected, but a condition arose that may require attention.

Use the mcStatusToString function of the ECU M&C API to obtain a descriptive string for the return value.

Description

The function mcECUCreate is used to create an ECU object in memory instead of referring to a predefined ECU of an A2L database.

Interface selects the communication protocol and the desired interface to use for this task. The protocol and interface input are required, as these parameters are not defined in the A2L database. The default baud rate for CCP or XCP on CAN, or the IP address for XCP on UDP/TCP, may be defined in the A2L database, but you can change it by setting the Interface Baud Rate or IP Address property with MC Set Property.vi.

This parameter is expected to be a string with the format Protocol:CommInterface.

Protocol supports:

  • CCP to use the CAN Calibration Protocol
  • XCP to use the XCP Universal Measurement and Calibration Protocol

CommInterface selects the transport layer and hardware interface to employ:

Ethernet

Use UDP or TCP as CommInterface. Supported with XCP protocol only.

NI-CAN

Use CANx as CommInterface to select the corresponding NI-CAN interface. The special CAN interface values 256 and 257 refer to virtual interfaces. For more information about using virtual interfaces, refer to the Frame to Channel Conversion section of Chapter 6, Using The Channel API, in the NI-CAN Hardware and Software User Manual.

NI-XNET

Use CANx@nixnet as CommInterface to select the corresponding NI-XNET interface as configured under Devices and Interfaces in MAX.

For using NI-XNET hardware on CompactRIO or R Series hardware, you may need to create an FPGA bit file to enable access to the modules. Refer to NI-XNET documentation for information about creating and loading a bit file; use the regular NI-XNET string format.

Note Note  When you append @nixnet to the Protocol and Interface string, the ECU Measurement and Calibration Toolkit uses NI-XNET Queued sessions. To force the ECU Measurement and Calibration Toolkit to use Stream sessions instead, append @ni_genie_nixnet to the Protocol and Interface string (for example, CCP:CAN1@ni_genie_nixnet).

NI 985x CAN modules

Use CANx@BridgeBitFile.lvbitx as CommInterface. A bridge FPGA VI (found in the LabVIEW examples of ECU MC) must be compiled for the RIO target; BridgeBitFile.lvbitx represents the absolute file path of the resulting bit file. It will be downloaded to the FPGA automatically when opening the CAN interface. For Real-Time targets, the bit file must be transferred to the internal disk, and this local file path must be used.

CANx refers to the name of the front panel controls used in the bridge FPGA VI (not to the module name in the LabVIEW project). Only a single 985x CAN interface is supported per FPGA target.

Use CANx@RIOx,BridgeBitFile.lvbitx as CommInterface to also specify the RIO target. RIOx equals the RIO target name as defined in your LabVIEW Project definition.

WAS THIS ARTICLE HELPFUL?

Not Helpful