Home
ECU Measurement and Calibration Toolkit User Manual
Contents
1. Purpose Creates an Event object in memory Format ECU ref in ECU ref out Event Name Event Number error out error in Input ECU ref in is the task reference that links to the selected ECU This Eo E a ECU M amp C Toolkit User Manual reference is originally Create vi returned from MC ECU Open vi or MC ECU Event Name identifies the event channel object Use this name as a reference in MC Measurement Create vi to identify the event channel Event Number specifies the generic signal source that effectively determines the data transmission timing To allow a reduction of the desired transmission rate a prescaler may be applied to the event channel The prescaler value factor must be greater than or equal to 1 and can be set using MC Set Property vi using the DAQ Prescaler property Error in is a cluster w hich describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out status is TRUI E if an error occurred This VI will not execute when status is TRUE 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 suc
2. Format characteristic name ECU ref in ECU ref out x characteristic value Y error out error in Input HBA EE Characteristic name is the name of the Characteristic defined in the A2L database ECU ref in is the task reference which links to the selected ECU This reference is originally returned from MC ECU Open vi or MC ECU Select vi and then wired through subsequent VIs x is the horizontal index if the Characteristic consists of 1 or 2 dimensions y is the vertical index if the Characteristic consists of 2 dimensions Error in is a cluster which describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out status is TRUE if an error occurred This VI is not executed when CTE status is TRUE 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 ECU M amp C Toolkit User Manual 5 32 ni com Chapter5 ECU M amp C API for LabVIEW ECU ref out is the same as ECU ref in Wire the task reference to subsequent VIs for this task Characteristic
3. Data Type Purpose u8 8 bit unsigned integer ul6 16 bit unsigned integer u32 32 bit unsigned integer 32 32 bit floating point number f64 64 bit floating point number str ASCII string represented as an array of characters terminated by null character 0 This type is used with output strings str is typically used in the ECU M amp C API as a pointer to a string as char cstr ASCII string represented as an array of characters terminated by null character 0 This type is used with input strings estr is typically used in the ECU M amp C API as a pointer to a string as const char mcTypeTaskRef Reference to an initialized database task ECU task or Measurement task mcAddress C struct which represents the target address for a specific CCP operation in the ECU List of Functions The following table contains an alphabetical list of the ECU M amp C Toolkit API functions Table 6 2 Functions for the ECU M amp C API for C Function Purpose mcBuildChecksum Calculates a checksum over a defined memory range within the ECU mcCalculateChecksum Calculates the checksum of a data block in memory mcCCPActionService Calls an implementation specific action service on the ECU mcCCPDiagService Calls an implementation specific diagnostic service on the ECU mcCCPGetActiveCalPage Retrieves the ECU Memory Transfer Address pointer to the calibration data page m
4. Measurement Specific Properties Table 6 8 Measurement Specific Value Types for the PropertylD Input Value Data Type Name Description u32 mcPropMeas_ByteOrder Sets the specified byte order of the selected Measurement 0 Intel format Bytes are in little endian order with least significant bit first 1 Motorola format Bytes are in big endian order with most significant bit first National Instruments 6 123 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C mceStatusToString Purpose Converts a status code into a descriptive string Format mcTypeStatus mcStatusToString mcTypeTaskRef Status u32 SizeofString str ErrorString Input Status Nonzero status code returned from an ECU M amp C function SizeofString SizeofString buffer in bytes Output Errorstring ASCII string that describes Status Description When the status code returned from an ECU M amp C function is nonzero an error or warning is indicated This function is used to obtain a description of the error warning for debugging purposes The return code is passed into the Status parameter The SizeofString parameter indicates the number of bytes available in the string for the description The description is truncated to size SizeofString if needed but a size of 300 characters is large enough to hold any description The text returned in ErrorString is null terminated so it can be used
5. dir View the files present get index htm c index htm Copy the file cd Change directory back to the root c cd d Change directories to the external compact flash ECU M amp C Toolkit User Manual 2 6 ni com Chapter 2 Installation and Configuration Table 2 1 Example of FTP Transfer Continued Command Result put c index htm index htm Copy the file from the FTP client machine to the target dir Verify the copied file on the target cd c Change directory back to the internal compact flash or hard drive quit Disconnect from the FTP server Web Browsers You can also use Internet Explorer or Netscape Navigator to ftp files to and from the controller This is an easier method of transfer since there is no need to learn ftp commands instead the files are simply copied and pasted as they would be in a Windows Explorer window The disadvantage of this method is that Internet Explorer sometimes caches old information so you will need to refresh occasionally If w x y z is the IP address of your RT target open Internet Explorer to access the hard drive or internal compact flash or type the following in the address field ftp w x y z If a username and password are required then use the following format ftp username password w x y Z To access the external compact flash open Internet Explorer and type the following in the address field ftp w x y z
6. MC Characteristic Read vi Reads data from a named Characteristic on the ECU which is identified by the ECU Reference handle The Poly VI returns a specific double 1D or 2D double array MC Characteristic Read Single Value vi Reads a value from a named Characteristic on the ECU which is identified by the ECU Reference handle MC Characteristic Write vi Writes the value s of a named Characteristic to an ECU identified by the ECU ref handle The Poly VI writes the selected type double 1D or 2D array MC Characteristic Write Single Value vi Writes a value to a named Characteristic on the ECU MC Clear Memory vi Clears the contents of a specified memory block MC Conversion Create vi Creates a signal conversion object in memory MC DAQ Clear vi Stops communication for the Measurement task and then clears the configuration MC DAQ Initialize vi Initializes a Measurement task for the specified Measurement channel list MC DAQ List Initialize vi Defines a DAQ list on a specific DAQ list number and initializes the Measurement task for the specified Measurement channel list ECU M amp C Toolkit User Manual 5 2 ni com Chapter5 ECU M amp C API for LabVIEW Table 5 1 ECU M amp C API VIs for LabVIEW Continued Function Purpose MC DAQ Read vi Reads samples from a Measurement task Samples are obtained from received CAN messages MC DAQ Start Stop vi
7. Type Hierarchy Subl Sub 2 Param Description ECU XCP SeedKey DLL Sets the file name of the XCP SeedKey DLL For Remote Seedkey access refer to the LabVIEW examples set the name to RSK lt server ip address gt lt port gt ECU XCP Access Sets the selected access Method mode 0x00 Absolute Access Mode default The MTA uses physical addresses 0x01 Functional Access Mode The MTA functions as a block sequence number of the new flash content file Ox80 0xFF User defined It is possible to use different access modes for clearing and programming ECU XCP Compression Sets the selected Method compression method used for MC Program vi 0 data is uncompressed 0x80 0xFF User defined ECU XCP Encryption Sets the selected encryption Method method used for MC Program vi 0x00 data is not encrypted 0x80 0xFF User defined National Instruments 5 167 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW Table 5 6 ECU Specific Property Value Types for the POLY Input Value Continued Sub Hierarchy Type Hierarchy Sub 1 Sub 2 Param Description ECU XCP Programming Sets the selected Method programming method used for MC Program vi 0x00 Sequential programming 0x80 0xFF User defined ECU XCP CAN Baudrate Sets the Baud Rate in use by the NI CAN Interface Basic baud rates such as 12
8. include niemc h HINSTANCE NiMcLib NULL NiMcLib LoadLibrary niemcc dl1l1 Next the application must call the Win32 Get ProcAddress function to obtain a pointer to each ECU M amp C Toolkit function that the application will use For each function you must declare a pointer variable using the prototype of the function For the prototypes of each ECU M amp C Toolkit function refer to Chapter 6 ECU M amp C API for C Before exiting the application you must unload the ECU M amp C Toolkit DLL as follows FreeLibrary NiMcLib 3 3 ECU M amp C Toolkit User Manual Chapter 3 Application Development Application Development on CompactRIO or R Series Using an NI 985x or NI 986x C Series Module ECU M amp C Toolkit User Manual To run a project on an FPGA target with an NI 985x C Series module you need an FPGA bitfile lvbitx The FPGA bitfile is downloaded to the FPGA target on the execution host A bitfile is a compiled version of an FPGA VI FPGA VIs and thus bitfiles define the CAN analog digital and pulse width modulation PWM inputs and outputs of an FPGA target The ECU M amp C Toolkit includes FPGA bitfiles for several FPGA targets If your target is not included in the examples you can use the examples as a template and adjust them based on your installed FPGA target The default bitfiles are sufficient for a basic ECU M amp C application However in some situations you may need to modify t
9. Description If you are using the XCP protocol mcSet Property implements the XCP command PROGRAM_RESET This optional command indicates the end of a non volatile memory programming sequence and may or may not have a response from the ECU In either case the slave device will go into a disconnected state mcSetProperty may be used to reset a slave device for other purposes For further information on how to use program ECU memory and to use the mcSet Property command refer to the ASAM XCP Part 2 Protocol Layer Specification ECU M amp C Toolkit User Manual 6 110 ni com Chapter 6 ECU M amp C API for C mcProgramStart Purpose Indicates the start of a programming sequence Format mcTypeStatus mcProgramStart mcTypeTaskRef ECURefNum Input ECURefNum ECURe Num is the task reference which links to the selected ECU This reference is originally returned from mcECUSelectEx Output 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 amp C API to obtain a descriptive string for the return value Description If you are using the XCP protocol mcProgra
10. 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 MC CCP Action Service vi implements the CCP command ACTION_SERVICE The ECU carries out the requested service and automatically uploads the requested action service return information National Instruments 5 13 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW MC CCP Diag Service vi Purpose Calls a diagnostic service on the ECU CCP only Format ECU ref in ECU ref out service no data type result error out params error in Input ECU ref in is the task reference which links to the selected ECU This reference is originally returned from MC ECU Open vi or MC ECU Select vi and then wired through subsequent VIs Service no determines the diagnostic service that is executed inside the ECU For more information about the services
11. In some situations you may want to check for specific errors in the code For example when mcCharacteristicRead times out you may want to continue communication rather than exit the application To check for specific errors use the constants defined in niemc h These constants have the same names as described in this manual For example to check for a function timeout use if status mcErrorTimeout National Instruments 6 125 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C meTextToDouble Purpose Converts a text string to a numerical value using an enumeration or range text scaling Format mcTypeStatus mcTextToDoubl1le mcTypeTaskRef ECURefNum u32 ObjectType cstr ObjectName cstr TextValue double Value Input ECURefNum The task reference that links to the selected ECU This reference is originally returned from mcECUSelectEx ObjectType Indicates the type of the object named in ObjectName Valid values are 1 Measurement Name 2 Characteristic Name ObjectName Indicates the object measurement or characteristic for which the enumeration or range text scaling is performed TextValue The text that you want to turn into the numeric representation Output Value Returns the converted value 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
12. Name specifies an individual channel within the task defined by reference in The default unwired value of name is empty which means the property applies to the entire task not a specific channel If a property relates to Measurement or Characteristic channels and does not apply to the entire task but an individual channel or message within the task you must wire the name of a Measurement or Characteristic channel from channel list into the name input For other properties you must leave name unwired empty Reference in is the reference to any opened A2L database a selected ECU or an ECU which is already connected with MC Database Open vi MC ECU Select vi MC ECU Open vi or MC ECU Connect vi The type of this reference depends on the property you want to get Error in is a cluster which describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out status is TRUE if an error occurred This VI will not execute when status is TRUE 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 5 102 ni com Output
13. Use the mcStatusToString function of the ECU M amp C API to obtain a descriptive string for the return value ECU M amp C Toolkit User Manual 6 32 ni com Chapter 6 ECU M amp C API for C Description Use mcConversionCreate to create a conversion object in memory instead of referring to measurement properties defined in the A2L database National Instruments 6 33 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C mecDAQClear Purpose Stops communication for the Measurement task and clears the task Format mcTypeStatus mcDAQClear mcTypeTaskRef DAQRefNum Input DAQRef Num DAQRefNum is the task reference which links to the selected Measurement task This reference is originally returned from mcDAQInitialize Output 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 amp C API to obtain a descriptive string for the return value Description mcDAQClear must always be the final function called for a Measurement task If you do not use mcDAQC lear the remaining Measurement task configuration can cause problems in the execution
14. mcCCPGetResult Purpose Uploads data from the ECU when the Memory Transfer Address pointer 0 MTAO has been set CCP only Format mcTypeStatus mcCCPGetResult mcTypeTaskRef ECURefNum u32 BlockSize u8 Data Input ECURefNum ECURe Num is the task reference which links to the selected ECU This reference is originally returned from mcECUSelectEx BlockSize BlockSize determines the size of the data block to be uploaded from the ECU Output Data Data contains the data uploaded from the ECU memory 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 amp C API to obtain a descriptive string for the return value Description This function uploads data from the ECU It is assumed that the Memory Transfer Address 0 MTAO has already been set to the start address of the data to be uploaded Functions like mcCCPActionService or mcCCPDiagService implicitly set the Memory Transfer Address 0 MTAO to the beginning of their result To upload data from a specified address use mcUp1load instead National Instruments 6 17 ECU M amp C Toolkit User Manual Chapt
15. 0 and bit_offset FF Session configuration ID is reset to 0 As soon as the request has been fulfilled the slave will reset the appropriate bit The slave device may indicate this by transmitting an EV_CLEAR_DAQ event packet If the slave device does not support the requested mode an ERR_OUT_OF_RANGE is returned The DAQ_ RUNNING flag indicates that at least one DAQ list has been started and is in RUNNING mode The RESUME flag indicates that the slave is in RESUME mode National Instruments 5 187 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW Resource mask contains the current resource protection status as a bit mask described below Bit Number Flag Description 0 CAL PAG REQuest to STORE CALibration data 0 STORE_CAL_REQ mode is reset 1 STORE_CAL_REQ mode is set 1 Unused 2 DAQ DAQ list commands DIRECTION DAQ 0 DAQ list commands are not protected with SEED amp Key mechanism 1 DAQ list commands are protected with SEED amp Key mechanism 3 STIM DAQ list commands DIRECTION STIM 0 DAQ list commands are not protected with SEED amp Key mechanism 1 DAQ list commands are protected with SEED amp Key mechanism 4 PGM ProGraMming commands 0 ProGraMming commands are not protected with SEED amp Key mechanism 1 ProGraMming commands are protected with SEED amp Key mechanism 5 Unused 6 Unused 7 Unused The
16. Chapter 6 ECU M amp C API for C mcDatabaseOpenEx Purpose Creates a specified A2L database by a name in memory Format mcTypeStatus mcDatabaseOpenEx cstr DatabaseName mcTypeTaskRef DBRefNum Input DatabaseName DatabaseName is a database name associated with the database created in memory Use the string syntax lt myname gt for the A2L database if using multiple databases in memory For example if using two databases in memory use MyDatabase1 as DatabaseName for the first database and MyDatabase2 for the second DatabaseName created in memory Output DBRefNum DBRefNum is the task reference from the initial database task function The database task reference is originally returned from mcDatabaseOpen 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 amp C API to obtain a descriptive string for the return value Description mcDatabaseOpenEx does not start communication Use it to create all needed objects in memory After creating an A2L database in memory you typically create an ECU object using mcECUCreate a scaling object using mcConvers
17. Data Type Name Description u32 mcPropChar_Dimension Returns the dimension of the Characteristic 0 0 dimensional The Characteristic can be accessed read write through a double value 1 1 dimensional The Characteristic can be accessed read write through a one dimensional array of double value 2 2 dimensional The Characteristic can be accessed read write through a two dimensional array of double value u8 mcPropChar_Extension Returns additional address information For instance it can be used to distinguish different address spaces of an ECU multi microcontroller devices 64 mcPropChar_Maximum Returns the Maximum value of the Characteristic f64 mcPropChar_Minimum Returns the Minimum value of the Characteristic u32 mcPropChar_ReadOnly Returns if a Characteristic is set to read only In this case it is not allowed to call mcCharacteristicWwrite for this Characteristic u32 mcPropChar_Sizes Returns the Array Sizes for the X and Y directions of the Characteristic str mcPropChar_Unit Returns the unit string defined for this Characteristic in the A2L database u32 mcPropChar_Unit_Size Returns the number of bytes to be allocated if you call mcGet Property with the parameter mcPropChar_Unit f64 mcPropChar_X_Axis Returns X axis values on which the Characteristic is defined Valid if the selected Characteristic is 1 or 2 dimensional 64 mcPropChar_Y_Axis Returns Y a
18. Input DBRefNum ECUname Interface ByteOrder CRO_ID DTO_ID StationAddress ECU M amp C Toolkit User Manual mcECUCreate mcTypeTaskRef DBRefNum cstr ECUName char Interface 132 ByteOrder u32 CRO_ID u32 DTO_ID u16 StationAddress u32 BaudRate mcTypeTaskRef ECURefNum DBRefNum is the task reference from the initial database task function The database task reference is originally returned from mcDatabaseOpen Identifies the ECU object Use this name as reference in mcMeasurementCreate to create a DAQ list on the ECU Specifies the protocol and optional interface to use for this task 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 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 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 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 6 58 ni com Chapter 6 ECU M amp C API for C same C
19. After calling this VI you can establish the communication to another ECU defined in the A2L database using MC ECU Select vi National Instruments 5 81 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW MC ECU Disconnect vi Purpose Disconnects the CCP or XCP communication to the selected ECU Format ECU ref in ECU ref out error in error out Input ECU M amp C Toolkit User Manual ECU ref in is the task reference which links to the selected ECU This reference is originally returned from MC ECU Open vi or MC ECU Select vi and then wired through subsequent VIs Error in is a cluster which describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out status is TRUE if an error occurred This VI will not execute when status is TRUE 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 ECU ref out is the same as ECU ref in Wire the task reference to subsequent VIs for this task Error out describes error conditions If th
20. If an ECU offers a reduced and specific range of DAQ list entry numbers use MC DAQ List Initialize vi to setup your Measurement list MC DAQ List Initialize vi does not start the transmission of the DAQ lists from the ECU to the application or vice versa through CCP or XCP This enables you to use MC Set Property vi to change the properties of a Measurement task After you change properties use MC DAQ Start Stop vi to start the communication for the Measurement task To query the available DAQ list entry numbers use MC Get Property vi with the Poly option selection DAQ List Numbers National Instruments 5 49 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW MC DAQ Read vi Purpose Reads samples from a Measurement task Format DAQ ref in DAQ ref out number of samples number of samples returned error in value error out Input ECU M amp C Toolkit User Manual DAQ ref in is the task reference from the previous Measurement task VI The task reference is originally returned from MC DAQ Initialize vi and then wired through subsequent Measurement task VIs Number of samples specifies the number of samples to read for the Measurement task For single sample Poly VI types MC DAQ Read vi always returns one sample so this input is ignored Error in is a cluster w hich describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the err
21. ME CCP Select Cal Page vies siic ccsci satescei seiuans iiianoe niai MC CCP Set Session Status Vi ccccccccccsssscccceessseeeccessssseecceessneeeeeeeesseeseeeees ME Characteristic Redd Viiner eel GA RL ss MC Characteristic Read Single Value vi oo ee cece eeseeseeeseeseceseeeeeeeeeeeees MC Characteristic Wit Visnet eravan ara E EEEE EES EASA MC Characteristic Write Single Value vi sessessesessesesesseseeresrsresresrsresrseesreee MG Clear Memory Viire inreseseniir aro na o ai a ai MC Conversion Create vi cccccccccsssscccccesssecceeessseeeeccsssseecceesssseeeeeeesseeeeeeees ME DAO Cleat Vi r r Be heen eee inn hie he ee ME DAQ Initialize Vinene nenen a nGana anes dietiaiet MC DAO List Initialize yii e a A a See EEEE MC DAQ Re A Vi E EE A REE E E TE MC DAQ Start StOpeviis ies Mies sess oee enen a EE EEA EA MEDAO Write Vi ee aN A a a a ME Database Close Fii e ee te a a AEA a N MC Database Create V a aa a a aa e ae a aiies ME Database OPen Vi eiennenn uonane dessedubeacsecudbeedy ses ubedanes MC Double to Text Vi crean a e N e ME Download Visura hA ech heh A es WG N E MC ECU BE O a EE E A S E MG ECU Connect Viher aee e E N E E E T ee MC ECU Greate Vienon e A N MCEECU Deselect Viei E hath ee a ented MC ECU Disconnect Vi susini a ia i aas ieaiai MC ECU OPen Vhen on Dana a ek EA E RATO MC ECU Set Calibration Page vi seesseesssessseersersresrsresrsresresrsresrsrrsresrsresrsee MC Event O KET 1E a TA PE A E EEEE ETA MO
22. Note You can download the ASAM MCD 2MC database configuration file to a LabVIEW RT target by the File Transfer Protocol FTP An FTP file transfer is possible within MAX Refer to the LabVIEW Real Time Graphical File Transfer Utility section of Chapter 2 Installation and Configuration for instructions on performing an FTP transfer through MAX National Instruments 5 87 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW MC ECU Select vi Purpose Selects an ECU based upon the names stored in an A2L database Format protocol and interface DB ref in ECU ref out ECU name error out error in interface Input ECU M amp C Toolkit User Manual protocol and interface selects target communication protocol CCP or XCP and the desired interface to use for this task The interface input uses a string xxx yyy where xxx defines one of the two available protocols CCP or XCP and yyy defines the desired interface to use like CANO for CCP or XCP or UDP or TCP for XCP The protocol and interface input is required as this parameter is 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 NI CAN The special CAN interface values 256 and 257 refer to virtual interfaces For mor
23. Optional Commands Sets whether the ECU supports the optional ASAM CCP Command BUILD_CHKSUM ECU TE CCP CLEAR MEMORY Optional Commands Sets whether the ECU supports the optional ASAM CCP Command CLEAR_MEMORY ECU M amp C Toolkit User Manual 5 164 ni com Chapter 5 Table 5 6 ECU Specific Property Value Types for the POLY Input Value Continued Sub Hierarchy Type Hierarchy Subl Sub 2 Param Description ECU CCP Optional CLEAR Sets whether the ECU Commands MEMORY supports the optional ASAM CCP Command CLEAR_MEMORY ECU CCP Optional DIAG Sets whether the ECU Commands SERVICE supports the optional ASAM CCP Command DIAG_SERVICE ECU CCP Optional DNLOAD 6 Sets whether the ECU Commands supports the optional ASAM CCP Command DNLOAD_6 ECU CCP Optional GET Sets whether the ECU Commands ACTIVE supports the optional CAL PAGE ASAM CCP Command GET_ACTIVE_CAL_ PAGE ECU CCP Optional GETS Sets whether the ECU Commands STATUS supports the optional ASAM CCP Command GET_S_STATUS ECU CCP Optional GET SEED Sets whether the ECU Commands supports the optional ASAM CCP Command GET_SEED ECU CCP Optional MOVE Sets whether the ECU Commands supports the optional ASAM CCP Command MOVE ECU CCP Optional PROGRAM Sets whether the ECU Commands supports the optional ASAM CCP Command PROGRAM National Instruments 5 165 ECU M amp C To
24. Output 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 amp C API to obtain a descriptive string for the return value Description mcMeasurementWrite performs a single point write download of a Measurement into the selected ECU without opening a Measurement task mcMeasurementWrite can only be performed if the Measurement channel is not set to read only To query if an ECU Measurement channel can be accessed by mcMeasurementWrite call mcGet Property with the parameter mcPropMeas_ReadOnly National Instruments 6 107 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C mcProgram Purpose Programs a memory block on the ECU Format mcTypeStatus mcProgram mcTypeTaskRef ECURefNum mcAddress Address u32 BlockSize u8 Data Input ECURefNum ECURefNum is the task reference which links to the selected ECU This reference is originally returned from mcECUSelectEx Address Configures the target address for the programming operation in the ECU mcAddress is a C struct consisting of Address Specifies the address part of the pro
25. Returns the minor version of the ECU M amp C software such as the 2 in version 1 2 5 Returns the update version of the ECU M amp C software such as the 5 in version 1 1 5 National Instruments 5 143 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW MC Measurement Create vi Purpose Creates a Measurement object in memory Format ConversionName Measurement Name ECU ref in Feu ee Address error in Data Type ECU ref out 1s error out Input Conversion Name identifies the referred conversion object defined by MC Conversion Create vi Measurement Name sets the measurement object name ECU ref in is the task reference that links to the selected ECU This reference is originally returned from MC ECU Open vi or MC ECU Create vi Address is a cluster that contains the following values H BE E Address specifies the address part of the source address Extension contains the extension part of the source address BE Error in is a cluster which describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out a status is TRUE if an error occurred This VI will not execute when status is TRUE m B E 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 int
26. Table 6 5 ECU Specific Value Types for the PropertylD Input Value Continued Data Type Name Description u32 mcPropECU_CCP_Timeout_ Sets the timeout value in milliseconds for the T_diag CCP DIAG_SERVICE command Default and Standard 500 Note that the mcPropECU_TimingFactor property might modify this value u32 mcPropECU_CCP_Timeout_ Sets the timeout value in milliseconds for the T_act CCP ACTION_SERVICE command Default 500 Standard 5000 Note that the mcPropECU_TimingFactor property might modify this value str mcPropIPAddress Sets the IP address for XCP on Ethernet TCP or UDP as a string ul6 mcPropIPPort Sets the IP port for XCP on Ethernet TCP or UDP u32 mcPropOptCmd_ACTION_ Sets whether the ECU supports the optional SERVICE CCP Command ACTION_SERVICE u32 mcPropOptCmd_BUILD_ Sets whether the ECU supports the optional CHKSUM CCP Command BUILD_CHKSUM u32 mcPropOptCmd_CLEAR_ Sets whether the ECU supports the optional MEMORY CCP Command CLEAR_MEMORY u32 mcPropOptCmd_DIAG_ Sets whether the ECU supports the optional SERVICE CCP Command DIAG_SERVICE u32 mcPropOptCmd_DNLOAD_6 Sets whether the ECU supports the optional CCP Command DNLOAD_6 u32 mcPropOptCmd_GET_ Sets whether the ECU supports the optional ACTIVE_CAL_PAGE CCP Command GET_ACTIVE_CAL_PAGE u32 mcPropOptCmd_GET_S_ Sets whether the ECU supports the optional STATUS CCP Comma
27. and the Frame Input and Output Stream Sessions may be used for example for a Frame logging replay use case HE E ECU M amp C Toolkit User Manual CompactRIO or R Series If using CompactRIO or R Series hardware you must provide a bitfile that handles the CAN communication between the host system and FPGA To access the CAN module on the FPGA you must specify the bitfile name after the for example CCP CAN1 MyBitfile lvbitx To specify a special RIO target you can specify that target by its name followed by the bitfile name for example XCP CAN1 RIO1 MyBitfile lvbitx Currently only a single CAN interface is supported RIO defines the RIO target name as defined in your LabVIEW Project definition The vbitx filename represents the filename and location of the bitfile on the host if using RIO or on a CompactRIO target This implies that you must download the bitfile to the CompactRIO target before you can run your application You may specify an absolute path or a path relative to the root of your target for the bitfile ECU Name sets the ECU object name For all related ECU functions such as MC ECU Select vi use this name as reference DB ref in is the task reference that links to the opened database file Communication Params is a cluster that contains the following values CRO ID sets the CAN identifier for the Command Receive Object CRO ID which sends commands and data from the host to the slave device DTO ID se
28. as a reference page ECU M amp C Toolkit User Manual 6 68 ni com Chapter 6 ECU M amp C API for C mcEventCreate Purpose Creates an Event object in memory Format mcTypeStatus mcEventCreate mcTypeTaskRef ECURefNum cstr EventChannelName u8 EventChannelNumber Input ECURefNum ECURefNum is the task reference that links to the selected ECU This reference is originally returned from mcECUCreate EventChannelName EventChannelName identifies the Event Channel object EventChannelNumber EventChannelNumber identifies the number of the Event Channel The event channel number specifies the generic signal source that effectively determines the data transmission timing To allow a reduction of the desired transmission rate a prescaler may be applied to the Event Channel The prescaler value factor must be greater than or equal to 1 to use mcSet Property using mcPropDAQ_ Prescaler Output 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 amp C API to obtain a descriptive string for the return value Description Use the function mcEventCreate to crea
29. 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 amp C API to obtain a descriptive string for the return value ECU M amp C Toolkit User Manual 6 126 ni com Chapter 6 ECU M amp C API for C Description mcText ToDoub1le performs text to double conversion for measurement or characteristic values Especially if the measurement or characteristic has an associated enumeration or range text type scaling the text input will be converted into the numeric representation using the related COMPU_VTAB or COMPU_VTAB_RANGE table National Instruments 6 127 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C mcUpload Purpose Uploads data from an ECU Format mcTypeStatus mcUpload mcTypeTaskRef ECURefNum mcAddress Address u32 BlockSize u8 Data Input ECURefNum ECURefNum is the task reference which links to the selected ECU This reference is originally returned from mcECUSelectEx Address Configures the source address for the upload operation in the ECU mcAddress is a C struct consisting of Address Specifies the address part of the source address Extension Extension contains the extension part of the address BlockSize BlockSize is the size of the data block in bytes to be uploaded Output Data Data is a byte array which
30. has specified the CAN Calibration Protocol CCP a protocol layer based on CAN to access the measurement and calibration data in an ECU To build on the functionality of the CAN Calibration Protocol CCP ASAM defined the new protocol specification XCP Universal Measurement and Calibration Protocol which can be considered an improved and generalized version of CCP The X represents the various transportation layers used by the members of the XCP protocol family for instance XCP on CAN XCP on TCP IP XCP on UDP IP XCP on USB etc The ECU M amp C Toolkit is particularly suited to the automotive industry and their component suppliers It provides a function set that can be used in the development or verification phase of an ECU Access to the data inside an ECU takes place based on information stored in an ASAM MCD 2MC A2L database file provided by the ECU supplier Selecting each signal by its name provides convenient access to the data inside an ECU The ECU M amp C Toolkit uses CCP and XCP as the fundamental communication protocols and to support ECU database A2L files You can easily switch between the CCP and XCP protocol layers through software National Instruments 1 1 ECU M amp C Toolkit User Manual Chapter 1 Introduction CAN Calibration Protocol CCP Overview The CAN Calibration Protocol is a CAN based master slave protocol for calibration and data acquisition A single master device host can be connecte
31. mcECUSetCalibrationPage 6 67 mcEventCreate 6 69 mcGeneric 6 70 mcGetNames 6 72 mcGetNamesLength 6 75 mcGetProperty 6 78 options table 6 79 mcMeasurementCreate 6 104 mcMeasurementRead 6 106 mcMeasurementWrite 6 107 mcProgram 6 108 mcProgramReset 6 110 mcProgramStart 6 111 mcSetProperty 6 112 Characteristic specific options table 6 123 DAQ specific options table 6 122 ECU specific options table 6 114 Measurement specific options table 6 123 mcStatusToString 6 124 return codes table 6 124 mcTextToDouble 6 126 mcUpload 6 128 mcXCPCopyCalPage 6 130 mcXCPGetCalPage 6 132 mcXCPGetld 6 134 mcXCPGetStatus 6 136 ECU M amp C Toolkit User Manual l 2 mcXCPProgramPrepare 6 140 mcXCPProgram Verify 6 142 mcXCPSetCalPage 6 144 mcXCPSetRequest 6 146 mcXCPSetSegmentMode 6 148 CAN calibration protocol CCP overview 1 2 A 1 version 1 2 CAN overview A 1 CCP functions 4 3 overview A 1 protocol definition A 3 scope A 2 Channel functions 4 2 Characteristic Read and Write 4 7 Characteristics accessing 4 7 reading 4 8 writing 4 8 checksum algorithm 4 21 definition 4 21 4 22 for VxWorks targets 4 23 example 4 23 choosing programming languages 3 1 CompactRIO application development on using NI 985x or NI 986x C Series module 3 4 computer ID xvi CRO ID property 4 5 D deactivating a product xvii debugging an application 3 6 definition of activation terms 2
32. reference is originally returned from MC ECU Open vi or MC ECU Select vi and then wired through subsequent VIs Value writes a single sample for the Measurement channel initialized in measurement name Error in is a cluster which describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out HE EG status is TRUE if an error occurred This VI will not execute when status is TRUE 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 ECU M amp C Toolkit User Manual 5 148 ni com Chapter5 ECU M amp C API for LabVIEW ECU ref out is the same as ECU ref in Wire the task reference to subsequent VIs for this task 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 e
33. return value SessionStatus is a bit mask that represents several session states inside the ECU StatusQualifier and AdditionalStatus contain additional status information The content of these parameters is ECU specific and not defined by CCP For more information about the parameter SessionStatus refer to the description of mcCCPSetSessionStatus ECU M amp C Toolkit User Manual 6 18 ni com Chapter 6 ECU M amp C API for C mcCCPGetVersion Purpose Retrieves CCP version implemented in the ECU CCP only Format mcTypeStatus mcCCPGet Version mcTypeTaskRef ECURefNum u8 MajorVersion u8 MinorVersion Input ECURefNum ECURefNum is the task reference which links to the selected ECU This reference is originally returned from mcECUSelectEx Output MajorVersion MajorVersion returns the major version number of the CCP implementation MinorVersion MinorVersion returns the minor version number of the CCP implementation 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 amp C API to obtain a descriptive string for the return value Description mcCCPGet
34. 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 There are four types of properties which can be modified in the poly input value ECU specific properties DAQ specific properties Characteristic specific properties and Measurement specific properties ECU Specific Properties ECU specific properties relate to the setting of the ECU If you need to change a property of the ECU you need a valid ECU reference but the ECU should not be connected First call MC ECU Open vi followed by MC Set Property vi and then MC ECU Connect vi If you have already connected to the ECU you can change an ECU property by calling MC ECU Disconnect vi followed by MC Set Property vi and then MC ECU Connect vi again Refer to Table 5 6 for a list of ECU specific properties that can be used to define the poly input value National Instruments 5 157 ECU M amp C Toolkit User Manual Chapter 5 ECU M amp C API for LabVIEW DAQ Specific Properties You cannot set a property while the task is running If you need to change a property prior to starting the task call MC DAQ Initialize vi followed by MC Set Property vi and then MC DAQ Start Stop vi After you start the task you also can change a property by calling MC DAQ Start Stop vi followed by MC Set Property vi and then restart the task with MC DAQ Start Stop v
35. 03 8 CCP 14 53 49 457 Master GET_SEED DAQ 04 9 CCP 14 53 49 457 ECU gt OK protected Seed 74 DO 00 00 04 10 CCP 14 53 49 457 Master UNLOCK Key 74 D1 E3 0B FF 00 05 11 CCP 14 53 49 457 ECU gt OK CAL DAQ PROGRAM 05 12 CCP 14 53 49 457 Master GET_SEED PROGRAM 06 I 13 CCP 14 53 49 473 ECU gt OK protected Seed A0 69 00 00 06 14 CCP 14 53 49 473 Master UNLOCK Key A0 6A E3 0B FF 00 07 15 CCP 14 53 49 473 ECU gt OK CAL DAQ PROGRAM 07 16 CCP 14 53 49 473 Master UPLOAD Size 5 08 Ready NUM CCP XCP Spy is an application that monitors records and displays CCP and XCP communication commands and parameters called by your ECU M amp C application using the CCP or XCP protocol Use CCP XCP Spy to analyze your application s communication and to verify that the communication with your ECU slave is correct You can use this application on Windows only when the ECU M amp C master also is running on Windows CCP XCP Spy may slow down the performance of your application communication to your ECU slave and the entire system You should use CCP XCP Spy only while you are debugging or when performance is not critical For further information about the displayed CCP or XCP commands and parameters refer to the ASAM XCP Part 2 Protocol Layer Specification or CAN Calibration Protocol Version 2 1 specification documents 3 7 ECU M amp C Toolkit User Manual Chapter 3 Application Development ECU M amp C Toolkit User Manual Savin
36. 2 Param Description ECU CCP Timeout T_mem Sets the timeout value in milliseconds for the CCP memory commands For details of which timeout applies to a specific command refer to the CCP standard Default and Standard 30000 Note that the Timing Factor property may modify this value ECU CCP Timeout T_diag Sets the timeout value in milliseconds for the CCP DIAG_SERVICE command Default and Standard 500 Note that the Timing Factor property may modify this value ECU CCP Timeout T_act Sets the timeout value in milliseconds for the CCP ACTION_SERVICE command Default 500 Standard 5000 Note that the Timing Factor property may modify this value National Instruments 5 171 ECU M amp C Toolkit User Manual Chapter 5 ECU M amp C API for LabVIEW Table 5 7 DAQ Specific Property Value Types for the POLY Input Value Type Hierarchy Sub Hierarchy Sub 1 Sub 2 Param Description DAQ Event Channel Name Sets the event channel name to which the Measurement task is assigned If there is no event channel name defined in the A2L file you can set the Event Channel Number manually by passing a decimal number as a string DAQ Mode Sets the selected I O mode for the M amp C Measurement task 0 DAQ List The data is transmitted from the ECU in equidistant time intervals as defined
37. 2 STIM List In this mode the data from the Measurement task are sent to the ECU whenever MC DAQ Write vi is called Mode 3 Timestamped read The data is transmitted from the ECU in equidistant time intervals as defined in the A2L database The data can be read back with MC DAQ Read vi as timestamped data array Input channel data are received from the DAQ messages Use MC DAQ Read vi to obtain input samples as an array of sample timestamp pairs Poly VI types ending in Timestamped Dbl Use this input mode to read samples with timestamps that indicate when each channel is received from the network Sample rate specifies the timing to use for samples of the task The sample rate is specified in Hertz samples per second A sample rate of zero means to sample immediately If the Mode is defined as DAQ List a sample rate of zero means that MC DAQ Read vi returns a single point from the most recent message received and greater than zero means that MC DAQ Read vi returns samples timed at the specified rate If the Mode is defined as Polling the sample rate is ignored Error in is a cluster which describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out status is TRUE if an error occurred This VI will not execute when status is TRUE code is the error code number identifying an error A value of 0 means success A negative value means
38. 3 developing an application 3 1 diagnostic tools NI resources B 1 ni com documentation NI resources B 1 related documentation xiii drivers NI resources B 1 DTO ID property 4 5 E ECU API C 6 1 LabVIEW 5 1 ECU Characteristics definition 4 2 overview 1 4 ECU Close 4 7 ECU Connect 4 6 ECU databases 1 4 ECU Disconnect 4 7 ECU M amp C API additional programming topics 4 16 architecture figure 4 1 CCP functions overview 4 3 Channel functions 4 2 structure 4 1 XCP functions overview 4 3 ECU Measurements DAQ Clear 4 13 DAQ Read 4 11 DAQ Start Stop 4 10 DAQ Write 4 12 definition 4 2 DTO ID 4 10 ECU DAQ Initialize 4 10 ECU reference handle 4 10 flowchart figure 4 9 list 4 10 mode 4 10 overview 4 9 sample rate 4 10 ECU Open 4 5 National Instruments l 3 Index ECU toolkit activation 2 2 API overview 4 1 basic programming model 4 3 Characteristics 1 4 databases ASAM MCD 2MC 1 4 ASAP 1 4 definition 1 1 hardware and software requirements 2 10 installation 2 1 introduction 1 1 LabVIEW RT 2 5 license management 2 1 Measurements 1 4 examples NI resources B 1 F FTP transfers table 2 6 FTP with LabVIEW 2 9 FTP with LabVIEW RT graphical file transfer utility 2 7 FTP with web browsers 2 7 G generic CCP functions 4 17 generic XCP functions 4 18 Get Names 4 16 H help technical support B 1 home software use 2 4 instrument d
39. 4 12 DTO ID 4 10 ECU DAQ Initialize 4 10 ECU reference handle 4 10 flowchart figure 4 9 list 4 10 mode 4 10 overview 4 9 sample rate 4 10 software activating xv evaluating xvi moving after activation xvii software NI resources B 1 Station Address property 4 5 structure of ECU M amp C API 4 1 support technical B 1 T task concept 1 4 technical support B 1 training and certification NI resources B 1 troubleshooting NI resources B 1 U using with FTP 2 6 V volume licensing program 2 4 ECU M amp C Toolkit User Manual Index W Web resources B 1 Windows Guest accounts xvii writing Characteristics 4 8 X XCP functions overview 4 3 ECU M amp C Toolkit User Manual l 8 ni com
40. CAL PAG flags indicates that all commands of the CALibration PAGing group are protected and will return an ERR_ACCESS_LOCKED upon an attempt to execute the command without a previous successful GET_SEED UNLOCK sequence The PGM flags indicates that all the commands of the ProGraMming group are protected and will return a ERR_ACCESS_LOCKED upon an attempt to execute the command without a previous successful GET_SEED UNLOCK sequence ECU M amp C Toolkit User Manual 5 188 ni com Chapter5 ECU M amp C API for LabVIEW The parameter Session Id contains the Session configuration ID The session configuration ID must be set by a prior MC XCP Set Request vi call with STORE_DAQ_ REQ set This allows the master device to verify that automatically started DAQ lists contain the expected data transfer configuration National Instruments 5 189 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW MC XCP Program Prepare vi Purpose Prepares the programming of non volatile memory Format ECU ref in ECU ref out address code size error out error in Input ECU ref in is the task reference which links to the selected ECU This reference is originally returned from MC ECU Open vi or MC ECU Select vi and then wired through subsequent VIs Address is a cluster which contains the following values Address specifies the address part of the source address Extension contains the extension part of the source
41. Chapter 6 ECU M amp C API for C Properties Table 6 4 Values for PropertylD Data Type Name Description u32 mcPropCANBaudRate Returns the CAN Baud rate for CCP or XCP on CAN which is used to send commands and data from the host to the slave device u8 mcPropCANTermination For all XNET devices the termination is software selectable XNET provides the option of 80 Q between Bus Plus and Bus Minus or no termination The Termination property configures the onboard termination of the NI XNET interface CAN connector port The Boolean property supports two values TRUE Termination ON and FALSE Termination Off However different CAN hardware has different termination requirements and the termination values have different meanings Refer to the Termination attribute in the XNET API for more details This property is supported for NI XNET devices only u32 mcPropChar_Address Returns the address of the selected Characteristic in the memory of the ECU u32 mcPropChar_ByteOrder Returns the specified byte order 0 Intel format Bytes are in little endian order with least significant bit first 1 Motorola format Bytes are in big endian order with most significant bit first u8 mcPropChar_Datatype Returns the data type of the Characteristic National Instruments 6 79 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C Table 6 4 Values for PropertyID Continued
42. EERE E 4 6 ECU Disconnect rinnen i A a a AR 4 7 ECU Close mooie aani Big hei RE a decades a e aA 4 7 Characteristic Read and Write ee eesceseesceeeeeseeceseeeeeceseeseeeceaeceseeesaeeeaees 4 7 ACCESS Characteristics i c ssoviescussevessnet ocvavivedsevece censdontevennvestoseceenseds 4 7 Characteristic Read noii man n a a 4 8 Characteristic Wite xi iscceiiileassedsiaied e aa E O ees 4 8 Measurement Taskir a a aa a raa hd aaa a o TS eiS 4 9 DAQ Initialize a E a EEE EE E 4 10 DAQ Start Stop sii ernir en iaa ais 4 10 DAQ R d a ea E a a o a anana 4 11 DAQ Waites seh cite tte aai i RO E R 4 12 DAQ Cleats iscote desetiniel Sete hte ie Hse EERE EEA 4 13 Memory Programming isinisisi ssri r aisina oa ET Va E ETA EE RES 4 13 Program Start i siiccs et a Nes a kE EE R ESNA 4 14 Clear MeEMOTY noenee erasian bests ced eabesdasescabeedicededsigtas 4 15 Programen naa adda ti sates teva bays oxi E EE ee peu EE 4 15 Program Reset a sisscsecsssss cescass stan gadg stench ates eases ade 4 15 Optional Steps for the XCP Protocol 0 0 eee eeeeee eects eeeeeeeeees 4 15 Additional Programming Topics 00 0 0 cceeceseeseesecseceseceeceeecseeeseeaecseesaecseensesaeenseeaeenaes 4 16 Get Names aiteis E E succtvednsevdia cases edgena cunts dons taaa dean oatna NE 4 16 Set Get Properties s sseossesscbscscsadessyaciseschat cass e E a E E Aa 4 16 Genee COP Functions een e E A EE AEAT i 4 17 Genetic XCP PUNCUOMNS 3 s 5 cess ssccccsscicivedsctesiteesecst
43. FREEZE mode through an XCP STORE_CAL_REQ operation Refer to the ASAM XCP Part 2 Protocol Layer Specification for more information on how to set up a request National Instruments 5 201 ECU M amp C Toolkit User Manual ECU M amp C API for C This chapter lists the ECU M amp C functions and describes the format purpose and parameters Unless otherwise stated each ECU M amp C function suspends execution of the calling thread until it completes The functions in this chapter are listed alphabetically Section Headings The following are section headings found in the ECU M amp C API for C functions Purpose Each function description includes a brief statement of the purpose of the function Format The format section describes the format of each function for the C programming language Input and Output The input and output parameters for each function are listed Description The description section gives details about the purpose and effect of each function List of Data Types The following data types are used with functions of the ECU M amp C API for C Table 6 1 Data Types for the ECU M amp C API for C Data Type Purpose i8 8 bit signed integer il6 16 bit signed integer 132 32 bit signed integer National Instruments 6 1 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C Table 6 1 Data Types for the ECU M amp C API for C Continued
44. Measurement or a Measurement task Format mcTypeStatus mcGetProperty mcTypeTaskRef RefNum cstr Name u32 PropertyID u32 SizeOfValue void Value Input RefNum RefNum is any ECU M amp C task reference which consists of a valid link to the opened A2L database DBRef Num a selected ECU ECURefNum or a Measurement task DAQRefNum RefNum must be valid for the related PropertyID type Name Specifies an individual name ECU name Measurement channel name or Characteristic name within the task PropertyID Selects the property to get For a description of each property including its data type and PropertyId refer to the Properties section SizeOfValue Number of bytes allocated for the Value output This size normally depends on the data type listed in the description of the property Output Value Returns the property value Property1d determines the data type of the returned value 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 amp C API to obtain a descriptive string for the return value ECU M amp C Toolkit User Manual 6 78 ni com
45. Microsoft Corporation Windows is a registered trademark of Microsoft Corporation in the United States and other countries Other product and company names mentioned herein are trademarks or trade names of their respective companies Members of the National Instruments Alliance Partner Program are business entities independent from National Instruments and have no agency partnership or joint venture relationship with National Instruments Patents For patents covering National Instruments products technology refer to the appropriate location Help Patents in your software the patents txt file on your media or the National Instruments Patent Notice at ni com patents Export Compliance Information Refer to the Export Compliance Information at ni com legal export compliance for the National Instruments global trade compliance policy and how to obtain relevant HTS codes ECCNs and other import export data WARNING REGARDING USE OF NATIONAL INSTRUMENTS PRODUCTS YOU ARE ULTIMATELY RESPONSIBLE FOR VERIFYING AND VALIDATING THE SUITABILITY AND RELIABILITY OF THE PRODUCTS WHENEVER THE PRODUCTS ARE INCORPORATED IN YOUR SYSTEM OR APPLICATION INCLUDING THE APPROPRIATE DESIGN PROCESS AND SAFETY LEVEL OF SUCH SYSTEM OR APPLICATION PRODUCTS ARE NOT DESIGNED MANUFACTURED OR TESTED FOR USE IN LIFE OR SAFETY CRITICAL SYSTEMS HAZARDOUS ENVIRONMENTS OR ANY OTHER ENVIRONMENTS REQUIRING FAIL SAFE PERFORMANCE INCLUDING IN THE OPERATION OF NUCLEAR FACILIT
46. Mode view ieee cece sseesceeseceeceseeseeeseceeesesaeesaeeseseeees 5 200 Chapter 6 ECU M amp C API for C Section Headings osasin aa dacenes eetecsed a a aad 6 1 PULPOSG ninan nana a a a Mate da ube etnies 6 1 oI aTe EEEE E A E A EET eet eth 6 1 Inputand Output a soiin a ced Rast E e EE E aS 6 1 DeOSCEIPUON si isuees szeesstodkesisdicasssestuccdhadaaciseaaeestheerelsaehects E laenanaaeae 6 1 List of Data Ty pes sin ssces eit ates dik ee ae ae ei ee Ie AS ieee 6 1 Listiot PUNCHONSs3 3 2 AnitaiainiAlaiinidnt ads niet Ainslie wakes 6 2 MCBittld Checksum eisien eE E EE E uch el eesnas EE R R 6 6 meCalc lateChecks m enee a hic a ete a Ae Ea 6 10 MCCGCPACHONSELVICE sai a a e sch ieh he tae ak 6 12 MCCCPDiagServiCe sees scseisscessacascesascaideateesddbvesqeetiti saves dies vbigneierceseesideevs aay 6 14 mCCCPGetActiveCal Page ioina 6 16 MmCCCPGetResultescsscucenteAecshendnien i tacreudtaies mena Wack eee 6 17 mcCCPGetSessionS tatus ick sisi atkect sec Aen AA nia Wie ek 6 18 MCCCPGELV CrSiON se25 6553s adhe eves desaresbinds Ais stersecA r E aie Gi 6 19 MCCECPMOVEMEMOLY siorr n i sabes EAA ine vacua dd EE E see 6 20 meCCPSelectCal Page ernai tiene etaesestoned vedo eteaed hoses ai 6 22 mcCCPSetSessions tatus 2 03 222k ecteete a stel eds cheek hcl edad 6 23 micCharacteristicReads 3 0 05 sceccsdeds sede a ea o E a aetna eetinns 6 25 mecCharacteristicReadSingle Value eee eeeeeeseeseceseeseeeseceeeeeeseeeaeeaeeeeees 6 26 mcCharacte
47. Mode Sets the mode of an M amp C Measurement task 0 DAQ List The data is transmitted from the ECU in equidistant time intervals as defined in the A2L database The data can be read back with mcDAQRead as Single point data using sample rate 0 or as waveform using a sample rate gt 0 Input channel data is received from the DAQ messages Use mcDAQRead to obtain input samples as single point array or waveform 1 Polling In this mode the data from the Measurement task is uploaded from the ECU whenever mcDAQRead is called ul6 mcPropDAQ_Prescaler Sets the Prescaler which reduces the desired transmission frequency of the associated DAQ list ECU M amp C Toolkit User Manual 6 122 ni com Chapter 6 ECU M amp C API for C Characteristic Specific Properties Table 6 7 Characteristic Specific Value Types for the PropertylD Input Value Data Type Name Description double mcPropChar_X_Axis Sets the X axis values on which the Characteristic is defined The Characteristic dimension must be at least 1 double mcPropChar_Y_Axis Sets the Y axis values on which the Characteristic is defined The Characteristic dimension must be 2 u32 mcPropChar_ByteOrder Sets the specified byte order of the selected Characteristic 0 Intel format Bytes are in little endian order with least significant bit first 1 Motorola format Bytes are in big endian order with most significant bit first
48. Por National Instruments Chapter5 ECU M amp C API for LabVIEW source identifies the VI where the error occurred Reference out contains an ECU M amp C task reference which can be wired through subsequent ECU M amp C VIs Value is a poly output value that returns the property value You select the property returned in value by selecting the poly VI type The data type of value is also determined by the poly VI selection For information about the different properties provided by MC Get Property vi refer to the Poly VI Types section To select the property right click the VI go to Select Type and select the property by name 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 5 103 ECU M amp C Toolkit User Manual Chapter 5 Description Poly VI Types ECU M amp C API for LabVIEW Table 5 5 Poly Values for Value Ou
49. 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 amp C API to obtain a descriptive string for the return value Description mc mc ECUSelectEx creates an ECU reference handle to the selected ECU name The ECUSelectEx function does not start communication This enables you to use mcSetProperty to change the properties of an ECU task After you change properties use mc ECUConnect to start communication for the task and logically connect to the selected ECU ECU M amp C Toolkit User Manual 6 64 ni com Chapter 6 ECU M amp C API for C Interface is the name of the protocol and interface the selected ECU task will use This string uses the syntax XXX YYY where X defines the selected protocol The following strings may be used String CCP refers using the CAN Calibration Protocol CCP e String XCP refers using the Universal Measurement and Calibration Protocol XCP If you are using the CCP protocol YYY can be associated with a defined NI CAN interface CANO CAN1 up to CAN63 CAN network interface names are associated with physical CAN ports using the Measur
50. Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW code is the error code number identifying an error A value of 0 pase 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 Opens a specified A2L Database MC Database Open vi enables you to query all defined ECU names in the A2L Database using the MC Get Names vi and selecting the property ECU Names MC Database Open vi does not start communication MC Database Open vi is an advanced function for database handling In most cases it is sufficient to use MC ECU Open vi instead ECU M amp C Toolkit User Manual 5 66 ni com Chapter5 ECU M amp C API for LabVIEW MC Double to Text vi Purpose Converts a numerical value to a text string using an enumeration or range text type scaling Format object name ECU ref in ECUMEC ECU ref out object type TextValue value error out error in Input object name indicates the object measurement or characteristic for which the COMPU_VTAB scaling is performed If no COMPU_VTAB scaling is available for the object TextValue is just a string representation of the value specified in value a ECU ref in is the t
51. Value stored in Verification value EG ECU ref in is the task reference which links to the selected ECU This reference is originally returned from MC ECU Open vi or MC ECU Select vi and then wired through subsequent VIs Verification type specifies the Verification Type of the requested program verification The Verification Type is a bit mask described below Verification Type Description 0x0001 Calibration area s of the flash 0x0002 Code area s of the flash 0x0004 Complete flash content 0x0008 0x0080 Reserved 0x0100 OxFFOO User defined ECU M amp C Toolkit User Manual 5 192 ni com Description Chapter5 ECU M amp C API for LabVIEW Verification value contains the selected verification value if Mode 1 Error in is a cluster which describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out status is TRUE if an error occurred This VI will not execute when status is TRUE 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 identifie
52. XCP on UDP the value passed to Interface is XCP UDP If you are using the XCP on TCP the value passed to Interface is XCP TCP The special string values CAN256 and CAN257 refer to virtual interfaces Refer to the NI CAN Hardware and Software User Manual for detailed information on how to use virtual NI CAN ports Using NI XNET If you are using NI XNET hardware and select the xxx yyy syntax the ECU M amp C Toolkit uses the XNET NI CAN compatibility library XCL internally if the XNET interface is defined in MAX under NI CAN Devices To force use of the native XNET API you must define a unique interface name that differs from the NI CAN compatible interface name under XNET Devices or use the xxx yyy nixnet syntax The interface name is related to the NI XNET hardware naming under Devices and Interfaces in MAX The extension nixnet directs the ECU M amp C Toolkit to use the native NI XNET API Note By selecting nixnet as Protocol and Interface string the ECU Measurement and Calibration Toolkit uses the Frame Input and Output Queued sessions To force the ECU Measurement and Calibration Toolkit to use Frame Input and Output Stream sessions instead select ni_genie_nixnet as Protocol and Interface string for example CCP CAN1 ni_genie_nixnet An application instance can use only one Frame Input Stream Session and one Frame Output Stream Session at a time so use the default name nixnet as Protocol and Interface string so that multipl
53. a set of CCP slaves sharing identical CRO and DTO identifiers MC ECU Connect vi is an optional function and is automatically performed before MC Characteristic Read vi MC Characteristic Write vi MC DAQ Initialize vi any MC CCP xxx command or any MC XCP xxx command is performed ECU M amp C Toolkit User Manual 5 74 ni com MC ECU Create vi Chapter5 ECU M amp C API for LabVIEW Purpose Creates an ECU object in memory Format Protocol and Interface ECU Name DB ref in ECU ref out Communication Params Byte Order error out error in Input National Instruments Protocol and Interface selects target communication protocol CCP or XCP and the desired interface to use for this task The interface input uses a string xxx yyy where xxx defines one of the two available protocols CCP or XCP and yyy defines the desired interface to use such as CANO for CCP or XCP UDP or TCP for XCP The protocol and interface input is required as this parameter is 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 NI CAN 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 A
54. a special RIO target you can specify that target by its name followed by the bitfile name for example XCP CAN RIO1 MyBitfile lvbitx Currently only a single CAN interface is supported RIO1 defines the RIO target name as defined in your LabVIEW Project definition The vbitx filename represents the filename and location of the bitfile on the host You may use just the filename without the folder if the bitfile is in the same folder as the LabVIEW Project vproj ECU M amp C Toolkit User Manual 6 66 ni com Chapter 6 ECU M amp C API for C mcECUSetCalibrationPage Purpose Sets the appropriate RAM or ROM calibration page on the ECU Format mcTypeStatus mcECUSetCalibrationPage mcTypeTaskRef ECURefNum u8 UseRAM u8 mapAddresses Input ECURefNum ECURefNum is the task reference that links to the selected ECU This reference is originally returned from mcECUSelectEx UseRAM 0 Select ROM calibration page 1 Select RAM calibration page mapAddresses 0 Do not map addresses 1 Map addresses from ROM to the page specified in UseRAM Output 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
55. address Code size determines the size of data code to be downloaded by the subsequent memory programming Error in is a cluster which describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out status is TRUE if an error occurred This VI is not executed when status is TRUE 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 ECU M amp C Toolkit User Manual 5 190 ni com Chapter5 ECU M amp C API for LabVIEW ECU ref out is the same as ECU ref in Wire the task reference to subsequent VIs for this task 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 info
56. and diagnostic equipment must be used At this time almost no standards exist in the area of software interfaces for such devices Each company has its proprietary systems and interfaces to support the development of these high end configurations National Instruments A 1 ECU M amp C Toolkit User Manual Appendix A Summary of the CCP Standard Scope of CCP ECU M amp C Toolkit User Manual The CAN Calibration Protocol was originally developed and introduced by Ingenieurb ro Helmut Kleinknecht a manufacturer of calibration systems and is used in various application areas in the automotive industry Afterwards CCP was taken over by the ASAP working group and enhanced with optional functions and is now maintained by the ASAM organization The CAN Calibration Protocol is a CAN based master slave protocol for calibration and data acquisition using the CAN 2 0B standard 11 bit and 29 bit identifiers which includes 2 0A 11 bit identifier A single master device host can be connected to one or more slave devices Before a slave device may accept commands from the host the host must establish a logical point to point connection to the slave device After this connection has been established the slave device must acknowledge each command received from the host within a specific time CCP offers continuous or event driven data acquisition from the controllers as well as memory transfers to and control functions in the controllers for
57. and is not part of the CCP protocol specification ECU ref out is the same as ECU ref in Wire the task reference to subsequent VIs for this task ECU M amp C Toolkit User Manual 5 20 ni com Chapter5 ECU M amp C API for LabVIEW session status is the actual session status which is returned from the ECU 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 additional status describes an additional status qualifier If the status qualifier does not contain additional status information the additional status parameter must be set to FALSE If the additional status parameter is not FALSE it may be used to determine the type of the additional status information Description MC CCP Get Session Status vi retrieves the session status of the ECU The return value session status is a bit mask that represents several session states in
58. behavior of the ECU Controller Area Network The Controller Area Network CAN is a joint development of Robert Bosch GmbH and Intel Corporation CAN is used in many high end automotive control systems like engine management as well as in industrial control systems Controller chips for CAN are available from various semiconductor manufacturers CAN Calibration Protocol The CCP master device host is a calibration monitoring tool for initiating data transfers on the CAN by sending commands to slave devices Typically an ECU which communicates through CCP with the CCP master A Characteristic is a memory area within the ECU which defines the behavior of a control subsystem Calibration is a process to optimize the Characteristic A Characteristic can be represented by a single value parameter a one dimensional array of values curve or a two dimensional array of values map A Dynamic Link Library which implements a function to calculate a checksum over a given data block A Command Receive Object CRO is sent from the CCP master device to one of the slave devices The slave device answers with a Data Transmission Object DTO containing a Command Return Message CRM G 2 ni com Glossary Controller Area Network See CAN CRM CRO CRO ID D DAQ DAQ channel DAQ list DAQ mode Data Transfer Object database task DLL DTO DTO ID National Instruments Command Return Message A CCP communicatio
59. calibration purposes With these functions CCP may be used in e The development of electronic control units ECU e Systems for functional and environmental tests of an ECU e Test systems and test stands for controlled devices combustion engines gearboxes suspension systems climate control systems body systems anti locking systems e On board test and measurement systems of pre series vehicles e Any non automotive application of CAN based distributed electronic control systems CCP defines two function sets one for control memory transfer and one for data acquisitions that are independent of each other and may run asynchronously The control commands are used to carry out functions in the slave device and may use the slave to perform tasks on other devices The data acquisition commands are used for continuous data acquisition from a slave device The devices continuously transmit internal data according to a list that has been configured by the host Data acquisition is initiated by the host then executed by the slave device and may be based on a fixed sampling rate or be event driven A 2 ni com Appendix A Summary of the CCP Standard CCP Protocol Definition Two communication objects are defined by CCP to handle the communication between host and slave devices The CommandReceiveObject CRO which is used to send commands and data from the host to the slave device and the DataTransmissionObject DTO which is used
60. 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 ECU ref out is the same as ECU ref in Wire the task reference to subsequent VIs for this task 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 MC CCP Move Memory vi is used to move the memory contents of an ECU from one memory location to another Before calling the CCP MOVE command this function sets the Memory Transfer Address pointers MTAO as defined in the source cluster and MTA1 as d
61. contains the number of bytes returned from ECU M amp C Toolkit User Manual the ECU passed to ReturnValue 6 70 ni com Chapter 6 ECU M amp C API for C 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 amp C API to obtain a descriptive string for the return value Description mcGeneric can be used to send commands to the ECU that are not defined by the CCP or XCP specification The command code in Command and the parameters of this command defined in Data are sent to the ECU and the data returned by the ECU is passed to the parameter ReturnValue Since the ECU M amp C driver has no knowledge of the parameters of the command and their data types all parameters and return values are passed as an array of bytes Therefore you are responsible for the correct type casting of all parameters and return values of this command Make sure that all parameters are passed in the correct byte ordering for this function For more information about the user defined commands and their parameters refer to the documentation for the ECU National Instruments 6 71 ECU M amp
62. contents fits to the rest of the flash Only the result is of interest If vVerMode 01 the master can tell the slave that he is sending a Verification Value to the slave The definition of the Verification Mode is project specific The master is getting the Verification Mode from the project specific programming flow control and passing it to the slave The tool needs no further information about the details of the project specific check routines The XCP parameters allow a wide range of project specific adaptations The Verification Type is specified in the project specific programming flow control The master is getting this parameter and passing it to the slave The definition of the Verification Value is project specific and the use is defined in the project specific programming flow control Refer to the ASAM XCP Part 2 Protocol Layer Specification for more information on how to set up a request mcXCPProgramVerify can be used to verify the success of non volatile memory reprogramming With Mode set to 00 the master can request the slave to start internal test routines to check whether the new flash contents fits to the rest of the flash Only the result is of interest With Mode set to 01 the master can tell the slave that he will be sending a Verification value to the slave The definition of the Verification mode is project specific The master receives the Verification mode from the project specific programming flow control and passes it
63. create a Measurement Task or read write a Characteristic mcECUCreate Creates an ECU object in memory mcECUDeselect Deselects an ECU and invalidates the ECU reference handle mcECUDisconnect Disconnects CCP communication to the selected ECU mcECUSelectEx Selects an ECU from the names stored in an A2L database mcECUSetCalibrationPage Sets the appropriate RAM or ROM calibration page on the ECU mcEventCreate Creates an Event object in memory mcGeneric Sends a generic CCP command mcGetNames Retrieves a comma separated list of ECU names Measurement names Characteristic names Event names Characteristic pages or Group names from a specified A2L database mcGetNamesLength Retrieves the amount of memory required to store the names returned by mcGetNames mcGet Property Retrieves a property of the driver the database the ECU a Characteristic a Measurement or a Measurement task mcMeasurementCreate Creates a Measurement object in memory mcMeasurementRead Reads a single Measurement value from the ECU mcMeasurementWrite Writes a single Measurement value to the ECU ECU M amp C Toolkit User Manual 6 4 ni com Chapter 6 ECU M amp C API for C Table 6 2 Functions for the ECU M amp C API for C Continued Function Purpose mcProgram Programs a memory block on the ECU mcProgramReset Indicates the end of a programmi
64. d To enter a directory double click on its icon Right click on a file or folder and choose cut copy paste or delete to perform those actions LabVIEW Real Time Graphical File Transfer Utility National Instruments LabVIEW Real Time Module versions 7 0 and later include a File Transfer Utility that can be used to access your RT target This method helps you avoid the caching problem encountered when using web browsers You can find this utility in the Measurement and Automation Explorer MAX To open the utility right click on the desired RT target under the Remote Systems list and choose File Transfer as shown in Figure 2 2 2 7 ECU M amp C Toolkit User Manual Chapter 2 Installation and Configuration ECU M amp C Toolkit User Manual Configuration 4 My System Data Neighborhood G Devices and Interfaces Scales Software amp Remote Systems fez JPXI 8175R Reboot re Data Ne 8 iak Devices View Error Lo Scales abled alae Softwar File Transfer p X Delete Figure 2 2 FTP Utility Access in MAX At this point you are prompted for a username and password If these security features have not been enabled check the Anonymous Login box as shown in Figure 2 3 Username Password x Username anonymous pete Login Password paatna Figure 2 3 FTP Login Dialog Box The upper section of the utility interface shows the current directory an
65. equidistant in time or sporadic The data can be read back with the MC DAQ Read vi as Single point data using sample rate 0 or as a waveform using a sample rate gt 0 Input channel data is received from the DAQ messages Use MC DAQ Read vi to obtain input samples as single point array or waveform 1 Polling In this mode the data from the Measurement task is uploaded from the ECU whenever MC DAQ Read vi is called DAQ Channels Returns the number of channels initialized in a DAQ channel list of a M amp C Measurement task This is the number of array entries required when using MC DAQ Read vi National Instruments 5 133 ECU M amp C Toolkit User Manual Chapter 5 ECU M amp C API for LabVIEW Table 5 5 Poly Values for Value Output Continued Type Hierarchy Sub Hierarchy Sub 1 Sub 2 Param Description DAQ Prescaler Returns the prescaling factor which is used to reduce the desired transmission frequency of the associated DAQ list DAQ Sample Rate Returns the selected Sample Rate in Hz for the M amp C Measurement task which may be obtained with MC DAQ Initialize vi DAQ Samples Pending Returns the number of samples available to be read using MC DAQ Read vi If you set the number of samples to read input of MC DAQ Read vi to this value DAQ Read returns immediately without waiting This prope
66. 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 5 48 ni com Chapter5 ECU M amp C API for LabVIEW DTO_ID is the CAN identifier for the Data Transmission Object DTO used by the ECU to transmit the DAQ list data to the host If the DTO_ID terminal is unwired the ECU will use the same identifier for sending the DAQ list data as for the normal CCP communication DAQ ref out is a task reference for the Measurement task created Wire this task reference to subsequent VIs for this Measurement task 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
67. 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 ECU ref out is the same as ECU ref in Wire the task reference to subsequent VIs for this task 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 5 154 ni com Chapter5 ECU M amp C API for LabVIEW code is the error code number identifying an error A value of 0 J 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 If you are using the XCP protocol MC Program Start vi implements the XCP command PROGRAM_ START This optional command indicates the beginning of a programming sequence into a non volatile memory area If the slave device is not in a state which permits programming an error is returned The memory programming commands Th
68. in the A2L database file as 2 dimensional If the Characteristic is defined as 0 or 1 dimensional you can set Y to 0 Output 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 amp C API to obtain a descriptive string for the return value National Instruments 6 29 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C Description mcCharacteristicWriteSingleValue writes a value to a named Characteristic on the ECU which is identified by the ECU Reference handle ECURef Num The location to which the value is written is identified by the x and y indices If the Characteristic array is 0 or 1 dimensional Y and or X can be set to 0 ECU M amp C Toolkit User Manual 6 30 ni com Chapter 6 ECU M amp C API for C mcClearMemory Purpose Clears the contents of the specified ECU memory Format mcTypeStatus mcClearMemory mcTypeTaskRef ECURefNum mcAddress Address u32 BlockSize Input ECURefNum ECURe Num is the task reference which links to the selected ECU This reference is originally returned from mcECUSelectEx Address Configures th
69. item within the application or by selecting your product within NI License Manager Start All Programs National Instruments NI License Manager You can also contact your local National Instruments branch What is a Computer ID The computer ID contains unique information about your computer National Instruments requires this information to enable your software You can find your computer ID through the NI Activation Wizard or by using NI License Manager as follows 1 Launch NI License Manager by selecting Start All Programs National Instruments NI License Manager 2 Click the Display Computer Information button in the toolbar For more information about product activation and licensing refer to ni com activate How Can I Evaluate NI Software ECU M amp C Toolkit User Manual You can install and run most NI application software in evaluation mode This mode lets you use a product with certain limitations such as reduced functionality or limited execution time Refer to your product documentation for specific information on the product s evaluation mode xvi ni com Activating Your Software Moving Software After Activation To transfer your software to another computer install and activate it on the second computer You are not prohibited from transferring your software from one computer to another and you do not need to contact or inform NI of the transfer Because activation codes are unique to each co
70. itself Nevertheless the ECU M amp C Toolkit offers direct access to the low level CCP commands if a non standard timing behavior or independent user defined command sequence is needed CCP Protocol Version The ECU M amp C Toolkit supports the CAN Calibration Protocol specification version 2 1 ECU M amp C Toolkit User Manual 1 2 ni com Chapter 1 Introduction Universal Measurement and Calibration Protocol XCP Overview The Universal Measurement and Calibration Protocol XCP is a single master single slave protocol for calibration and data acquisition based on various transport layers Communication is always initiated by the XCP master An XCP slave must respond to requests from the master within a specified time The XCP protocol uses a soft master slave principle once the master establishes a communication channel with the slave the slave can send certain messages Events Service Requests and Data Acquisition messages autonomously In addition the master sends Data Stimulation messages without expecting a direct response from the slave The XCP builds a continuous logical unambiguous point to point connection with 1 specific slave when establishing a communication channel The XCP slave cannot handle multiple connections The master is not allowed to broadcast XCP messages to multiple slaves at the same time The identification parameters of the Transport Layer for instance CAN identifiers on CAN must be chosen in su
71. mode of a specified segment Format mcTypeStatus mcXCPSetSegmentMode mcTypeTaskRef ECURefNum u8 Segment u8 Mode Input ECURefNum ECURe Num is the task reference which links to the selected ECU This reference is originally returned from mcECUSelectEx Segment Segment specifies the logical data segment number Mode Mode specifies the mode for the segment Output None 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 amp C API to obtain a descriptive string for the return value Description mcXCPSetSegmentMode implements the XCP command SET_SEGMENT_MODE and sets the selected segment into the specified mode If Mode 0 the segment disables the FREEZE mode if Mode the segment is set to FREEZE mode through an XCP STORE_CAL_REQ operation Refer to the ASAM XCP Part 2 Protocol Layer Specification for more information on how to set up a request ECU M amp C Toolkit User Manual 6 148 ni com Summary of the CCP Standard Controller Area Network CAN Bosch developed the Controller Area Network CAN in the mid 1980s Using CAN devices controll
72. need administrator rights to install the ECU M amp C Toolkit on your computer Insert the ECU M amp C Toolkit CD into the CD ROM drive Open Windows Explorer Access the CD ROM drive Double click on autorun exe This will launch the software interface pee SE ies 5 Start the installation The installation program will guide you through the rest of the installation process 6 When installation is complete the National Instruments License Manager will launch automatically to activate your license License Management Overview National Instruments License management is the process of controlling access to products based on an explicit license agreement The ECU M amp C Toolkit requires an activated license in order to launch so a license must be acquired and activated before the product can be used The activation process involves using the Activation Wizard to send the following information to National Instruments e The product you are activating ECU Measurement and Calibration Toolkit e The serial number of the product e The version of the product e Your name 2 1 ECU M amp C Toolkit User Manual Chapter 2 Installation and Configuration e Your organization e A computer ID that uniquely identifies your system National Instruments uses this information to generate an activation code which is used to activate the ECU M amp C Toolkit on your system National Instruments does not use this information for an
73. of subsequent applications Because this function clears the Measurement task the Measurement task reference is not given as an output but is transferred into an ECU reference task handle To change properties of a running Measurement task use mcDAQStartStop to stop the task mcSet Property to change the desired DAQ property then mcDAQStartStop to restart the Measurement task ECU M amp C Toolkit User Manual 6 34 ni com Chapter 6 ECU M amp C API for C mcDAQInitialize Purpose Initializes a Measurement task for the specified Measurement channel list Format mcTypeStatus mcDAQInitialize cstr MeasurementNames mcTypeTaskRef ECURefNum i32 DAQMode u32 DTO_ID 64 SampleRate mcTypeTaskRef DAQRefNum Input MeasurementNames Comma separated list of Measurement names to initialize as a task You can type in the channel list as a string constant or you can obtain the list from an A2L database file by using the mcGetNames function ECURefNum ECURe Num is the task reference which links to the selected ECU This reference is originally returned from mcECUSelectEx DAQMode DAQMode specifies the I O mode for the task For an overview of the I O modes including figures refer to the Basic Programming Model section of Chapter 4 Using the ECU M amp C API mcDAQModeDAQList Data is transmitted automatically by the ECU using DAQ lists The data can be read back with the mcDAQRead as Single point data using sample rate 0
74. of zero means to sample immediately If the Mode is defined as DAQ list a sample rate of zero means that MC DAQ Read vi returns a single point from the most recent message received and greater than zero means that MC DAQ Read vi returns samples timed at the specified rate If the Mode is defined as Polling the sample rate is ignored Error in is a cluster which describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out status is TRUE if an error occurred This VI will not execute when status is TRUE 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 DTO_ID is the CAN identifier for the Data Transmission Object DTO used by the ECU to transmit the DAQ list data to the host If the DTO_ID terminal is unwired the ECU will use the same identifier for sending the DAQ list data as for the normal CCP communication National Instruments 5 45 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW Output DAQ ref out is a task reference for the M
75. or as waveform using a sample rate gt 0 Input channel data is received from the DAQ messages mcDAQModePolling National Instruments In this mode the data from the Measurement task are uploaded from the ECU whenever mcDAQRead is called 6 35 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C mcDAQModeSTIMList For XCP this defines a DAQ list for data stimulation STIM Within a DAQ task initialized with this parameter you can call mcDAQWrite to write stimulation data to the ECU Calling mcDAQRead is not allowed For CCP an error is returned mcDAQModeDAQListTimeStamped The data is transmitted from the ECU in equidistant time intervals as defined in the A2L database The data can be read back with mcDAQReadTimestamped as a timestamped data array Input channel data are received from the DAQ messages Use mcDAQReadTimestamped to obtain input samples as an array of sample timestamp pairs Use this input mode to read samples with timestamps that indicate when each channel is received from the network DTO_ID DTO_ID is the CAN identifier for the Data Transmission Object DTO used to transmit the data from the DAQ lists to the host The default value is 1 which means that the DTO ID used to transmit the DAQ list data is the same that is used for the rest of the CCP communication SampleRate SampleRate specifies the timing to use for samples of the NI CAN task The sample rate is specified in Hertz sa
76. or read and write accessible 4 2 ni com Chapter 4 Using the ECU M amp C API ECU M amp C CCP and XCP Functions The ECU M amp C Channel functions do not expose the method used for ECU memory access However some applications may need specific CCP or XCP command sequences or custom designed commands which are not supported by the CCP or XCP protocols For these applications the ECU M amp C CCP functions and the ECU M amp C XCP functions provide access to the ECU information at a very low level Basic Programming Model The flowchart in Figure 4 2 illustrates the process to initiate communication to an ECU with the ECU M amp C Channel functions A description of each step in the decision process follows the flowchart National Instruments 4 3 ECU M amp C Toolkit User Manual Chapter 4 Using the ECU M amp C API A2L file contains communication properties Yes Using CCP or XCP on CAN Yes No Set CRO ID Set IP Address or Hostname Set DTO ID Set Port Number Set Station Address Set Baudrate ECU Connect Eoo l Yes No y Measurement Characteristic Generic CCP Generic XCP Task Read Write Functions Functions ECU Disconnect ECU Close Figure 4 2 ECU Communication Decision Chart ECU M amp C Toolkit User Manual 4 4 ni com ECU Open Chapter 4 Using the ECU M amp C API The ECU Open function combines the opening of a selecte
77. order of channel entries in SampleArray is the same as the order in the original Channe1List If you need to determine the number of channels in the task after initialization get the mcPropDAQ_NumChannels property for the task reference If no message has been received since you started the task 0 is returned as default value for of the channel in all entries of SampleArray NumberOfSamplesReturned NumberOfSamplesReturned indicates the number of samples returned for each channel in SampleArray The remaining entries are left unchanged zero National Instruments 6 41 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C 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 amp C API to obtain a descriptive string for the return value Description If the initialized SampleRate is greater than zero this function returns an array of samples each of which indicates the value of the CAN channel at a specific point in time The mcDAQRead function waits for these samples to arrive in time before returning In other words the SampleRate specifies a virtu
78. originally returned from MC ECU Open vi or MC ECU Select vi and then wired through subsequent VIs Session status is the new status to be set in the ECU Error in is a cluster which describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out status is TRUE if an error occurred This VI is not executed when status is TRUE 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 ECU ref out is the same as ECU ref in Wire the task reference to subsequent VIs for this task 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 5 28 ni com Description This VI implements the CCP SET_S_STATUS command and is used to keep the ECU informed about the current state of the calibration session The session status bits of an ECU can be read and written Possible conditions are reset on power up session log off and in applicable error cond
79. receives the uploaded data information from the 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 amp C API to obtain a descriptive string for the return value ECU M amp C Toolkit User Manual 6 128 ni com Chapter 6 ECU M amp C API for C Description If you are using the CCP protocol mcUp1oad implements the CCP command UPLOAD A data block of the specified length starting at the specified address is uploaded from the ECU This function sets the Memory Transfer Address pointer MTAO to the appropriate value as defined in the Address struct If you are using the XCP protocol mcUpload implements the XCP command UPLOAD A data block of the specified length starting at the specified address is uploaded from the ECU The Memory Transfer Address pointer MTAO is post incremented by the given number of data elements If the slave device does not support block transfer mode all uploaded data is transferred in a single response packet If block transfer mode is supported the uploaded data is transferred in multiple responses on the same request packet There are no li
80. ref out error out Input A Bau National Instruments DAQ List No specifies which DAQ list entry number should be used for the defined Measurement channel list for the selected ECU To query the available DAQ List numbers on the ECU use MC Get Property vi and select DAQ List Number in the Poly VI Measurement list is the array of channel names to initialize as a Measurement task Each channel name is provided in an array entry ECU ref in is the task reference which links to the selected ECU This reference is originally returned from MC ECU Open vi or MC ECU Select vi and then wired through subsequent VIs Mode specifies the I O mode for the task For an overview of the I O modes including figures refer to the Basic Programming Model section of Chapter 4 Using the ECU M amp C API Mode 0 DAQ List The data is transmitted from the ECU in equidistant time intervals as defined in the A2L database The data can be read back with the MC DAQ Read vi as Single point data using a sample rate 0 or as waveform using a sample rate gt 0 Input channel data are received from the DAQ messages Use MC DAQ Read vi to obtain input samples as single point array or waveform 5 47 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW ECU M amp C Toolkit User Manual Mode 1 Polling In this mode the data from the Measurement task are acquired from the ECU whenever the MC DAQ Read vi is called Mode
81. ref out is the task reference that links to the opened database file 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 5 63 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW code is the error code number identifying an error A value of 0 pase 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 Creates an A2L Database Use MC Database Create vi to create ECU and measurement objects in memory if you do not have access to a valid A2L database file MC Database Create vi does not start communication After creating an A2L database in memory you typically create an ECU object using MC ECU Create vi a scaling object using MC Conversion Create vi a measurement object using MC Measurement Create vi and an event using MC Event Create vi ay Note MC Database Create vi does not support creating objects to access characteristics To access a characteristic assign a valid A2L database file with defined characteristics
82. source identifies the VI where the error occurred Description If you are using the XCP protocol MC Program Reset vi implements the XCP command PROGRAM_ RESET This optional command indicates the end of a non volatile memory programming sequence and may or may not have a response from the ECU In either case the slave device will go into a disconnected state MC Program Reset vi may be used to reset a slave device for other purposes For further information on how to use program ECU memory and to use the MC Program Reset vi command refer to the ASAM XCP Part 2 Protocol Layer Specification National Instruments 5 153 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW MC Program Start vi Purpose Indicates the start of a programming sequence Format ECU ref in ECU ref out error in error out Input ECU M amp C Toolkit User Manual ECU ref in is the task reference which links to the selected ECU This reference is originally returned from MC ECU Open vi or MC ECU Select vi and then wired through subsequent VIs Error in is a cluster which describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out status is TRUE if an error occurred This VI is not executed when status is TRUE code is the error code number identifying an error A value of 0 means success A negative value means error VI did not
83. status is TRUE if an error occurred This VI will not execute when status is TRUE 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 ECU ref out is the same as ECU ref in Wire the task reference to subsequent VIs for this task 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 MC XCP Set Cal Page vi implements the XCP command SET_CAL_PAGE and sets the access mode for a calibration data segment if the slave device supports calibration data
84. supported The end of the memory segment is indicated when BlockSize is set to 0 The end of the overall programming sequence is indicated by a using the mcProgramReset command which executes the XCP command PROGRAM_RESET causing the slave device to move into a disconnected state Usually a hardware reset of the slave device is executed This command may support block transfer similar to the commands DOWNLOAD and DOWNLOAD_NEXT For further information on how to use mcProgram and details on block mode transfers refer to the ASAM XCP Part 2 Protocol Layer Specification National Instruments 6 109 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C mcProgramReset Purpose Indicates the end of a programming sequence Format mcTypeStatus mcProgramReset mcTypeTaskRef ECURefNum Input ECURefNum ECURe Num is the task reference which links to the selected ECU This reference is originally returned from mcECUSelectEx Output 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 amp C API to obtain a descriptive string for the return value
85. the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out status is TRUE if an error occurred This VI will not execute when status is TRUE National Instruments 5 181 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW Output 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 ECU ref out is the same as ECU ref in Wire the task reference to subsequent VIs for this task Error out describes error conditions If the Error in cluster indicated an Page returns the logical data page number error the Error out cluster contains the same information Otherwise Error out describes the error status of this VI Description 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
86. the OUT MEASUREMENT keyword within the related Function 14 Function LocMeasurement Names returns a list of Measurement names referred by the LOC_MEASUREMENT keyword within the related Function 15 Function SubFunction Names returns a list of Function names referred by the SUB_FUNCTION keyword within the related Function 16 Group Function List Names returns a list of Function names referred by the FUNCTION_LIST keyword within the related Group Reference in must be an ECU M amp C task reference or an A2L database reference ECU name If a valid A2L database reference is passed to the reference in terminal the ECU name terminal is used to select one of the ECUs inside the A2L database Then MC Get Names vi will report the names of all objects of the specified type inside the ECU based on the name provided If you do not provide a name the first ECU in the A2L file is selected Error in is a cluster which describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out status is TRUE if an error occurred This VI will not execute when status is TRUE National Instruments 5 99 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW 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 wa
87. the decimal representation of the page number within the segment 0 M 1 where M is the number returned from the mcPropECU_XCP_NumPages property for this segment National Instruments 6 91 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C Table 6 4 Values for PropertyID Continued Data Type Name Description ug mcPropECU_XCP_ Returns a flag indicating XCP Write access PageXCPWriteAccess rights for the memory segment page specified in the Name input Defined values are 0 XCP Write access not allowed 1 XCP Write access allowed without ECU access only 2 XCP Write access allowed with ECU access only 3 XCP Write access allowed always Specify the page by the string SEGMENT lt n gt PAGE lt m gt where lt n gt is the decimal representation of the segment number 0 N 1 where N is the number returned from the mcPropECU_XCP_NumSegments property and lt m gt is the decimal representation of the page number within the segment 0 M 1 where M is the number returned from the mcPropECU_XCP_NumPages property for this segment ug mcPropECU_XCP_ Returns the number of the segment that PageInitSegment initializes the memory segment page specified in the Name input Specify the page by the string SEGMENT lt n gt PAGE lt m gt where lt n gt is the decimal representation of the segment number 0 N 1 where N is the number returned from the mcPropECU_XCP_NumS
88. the defined session configuration ID ECU ref out is the same as ECU ref in Wire the task reference to subsequent VIs for this task Session status returns the current status of the selected ECU National Instruments 5 185 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW Resource mask is the current resource protection status of the selected ECU 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 MC XCP Get Status vi implements the XCP command GET_STATUS and returns all current status information of the selected ECU slave device including the status of the resource protection pending store requests and the general status of data acquisition and stimulation Current Session Status Session status contains a bit mask which is described below Bit Number F
89. the double value is returned ECU M amp C Toolkit User Manual 6 54 ni com Chapter 6 ECU M amp C API for C mecDownload Purpose Downloads data to an ECU Format mcTypeStatus mcDownload mcTypeTaskRef ECURefNum mcAddress Address u32 BlockSize u8 Data Input ECURefNum ECURe Num is the task reference which links to the selected ECU This reference is originally returned from mcECUSelectEx Address Configures the target address for the download operation in the ECU mcAddress is a C struct consisting of Address Specifies the address part of the target address Extension Extension contains the extension part of the target address BlockSize BlockSize determines the size of the data block to be downloaded Output Data Data pointer to the information to be downloaded 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 amp C API to obtain a descriptive string for the return value National Instruments 6 55 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C Description mcDownload downloads data to an ECU The data is stor
90. the host You may use just the filename without the folder if the bitfile is in the same folder as the LabVIEW Project vproj DB path is a path to a A2L database file from which to get channel names The file must use a A2L extension You can generate A2L database files with several 3rd party tools Error in is a cluster which describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out status is TRUE if an error occurred This VI will not execute when status is TRUE 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 CE source identifies the VI where the error occurred CAN interface specifies the CAN interface to use for this task For compatibility reasons if you are using the CCP protocol you can only National Instruments 5 85 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW Description specify the CAN interface to use for this CCP task The interface input uses a ring typedef in which value 0 selects CANO value 1 selects CAN1 and so on As the ECU M amp C API is based on t
91. to the slave mcXCPProgramVerify implements the optional XCP PROGRAM_VERIFY command defined by the XCP specification For further information on how to program non volatile ECU memory refer to the ASAM XCP Part 2 Protocol Layer Specification National Instruments 6 143 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C mcXCPSetCalPage Purpose Sets a calibration page Format mcTypeStatus mcXCPSetCal Page mcTypeTaskRef ECURefNum u8 Mode u8 Segment u8 Page Input ECURefNum ECURefNum is the task reference which links to the selected ECU This reference is originally returned from mcECUSelectEx Mode Mode is a bit mask described below Bit Description 0 The given page is used by the slave device application 1 The slave device XCP driver will access the given page 2 Unused 3 Unused 4 Unused 5 Unused 6 Unused 7 The logical segment number is ignored The command applies to all segments Segment Segment specifies the selected logical data segment number Page Page specifies the logical data page number Output None ECU M amp C Toolkit User Manual 6 144 ni com Chapter 6 ECU M amp C API for C 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
92. to transmit handshake messages data and status information from the slave device to the host Each of these message objects is assigned a unique CAN ID Messages that are returned from the slave as a message to a command are called CommandReturnMessages CRM A Command Receive Object is a CAN message consisting of eight bytes The first byte of a CRO is the command code followed by the command counter byte The command counter is generated for reference by the host to make sure that the CRM returned by a slave device corresponds to the correct host command The rest of the message builds the parameter and data fields The structure is as follows 0 1 2 3 4 5 6 7 CMD CTR Parameter and Data Field A DataTransmissionObject has a PacketID PID as the first byte This PID determines how the rest of the message is interpreted CCP differentiates between three types of DTOs PID Type 0x00 OxFD Data Acquisition Message OxFE Event Message OxFF Command Return Message Command Return Messages and Event Messages have the following structure 0 1 2 3 4 5 6 7 PID ERR Parameter and Data Field National Instruments A 3 ECU M amp C Toolkit User Manual Appendix A Summary of the CCP Standard In the case of an Event Message the Counter field does not contain valid data and must be ignored by the host For Command Return Messages the Counter fie
93. use this value to display units such as volts or RPM along with the samples of the ECU ref out is the task reference that links to the selected ECU 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 Use MC Conversion Create vi to create a conversion object in memory instead of referring to measurement properties defined in the A2L database National Instruments 5 41 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW MC DAQ Clear vi Purpose Stops communication for the Measurement task and then clears the configuration Format DAG retin ECU ref out error in error out Input ECU M amp C Toolkit User Manual DAQ ref in is the task reference which links to the Measurement task This reference is originally returned from MC DAQ Initialize vi and then wired through subsequent VIs E
94. 00 ni com Chapter 6 ECU M amp C API for C Table 6 4 Values for PropertyID Continued Data Type Name Description keyword within the A2L file using a free keyword within the A2L file using interpolation between x y pairs 4 Formula The related scaling is based on the FORMULA formula to calculate the values 5 Table Using Interpolation The related scaling is based on the TAB_INTP 6 Table Without Interpolation The related scaling is based on the TAB_NOINTP keyword within the A2L file using x y pairs without interpolation u32 mcPropMeas_Scale_ TextValues_Size request the length needed to store the mcPropMeas_Scale_TextValues property If the scaling type is 2 Enumeration Text or 3 Range Text you can use this property to comma separated list of text values that can be converted into raw values refer to the str mcPropMeas_Scale_ TextValues If the scaling type is 2 Enumeration Text or request the comma separated list of text values which can be converted into raw values 3 Range Text you can use this property to u32 mcPropOptCmd_ACTION_ SERVICE Returns whether the ECU supports the optional CCP Command ACTION_SERVICE u32 mcPropOptCmd_BUILD_ CHKSUM Returns whether the ECU supports the optional CCP Command BUILD_CHKSUM u32 mcPropOptCmd_CLEAR_ MEMORY Returns whether the ECU supports the optional CCP Command CLEAR_ME
95. 1 Sub 2 Param Description ECU CCP Cal Pages Page Flags 1 2 4 8 32 64 128 256 Returns the page flags of the page selected with the name input The value returned is a bitmask ored from the following values RAM page ROM page FLASH page EEPROM page RAM_INIT_BY_ ECU RAM page initialized at ECU startup RAM_INIT_BY_ TOOL RAM page that the calibration tool initializes AUTO_FLASH_ BACK RAM page automatically flashed back FLASH_BACK RAM page that the calibration tool can flash back DEFAULT Page is standard fallback National Instruments 5 121 ECU M amp C Toolkit User Manual Chapter 5 ECU M amp C API for LabVIEW Table 5 5 Poly Values for Value Output Continued Type Hierarchy Sub Hierarchy Sub 1 Sub 2 Param Description ECU CCP Cal Pages Page Address Returns the memory address and extension of the page selected with the name input ECU ECU XCP XCP Cal Pages Cal Pages Number of Segments Number of Pages Returns the number of XCP memory segments found for this ECU Returns the number of memory pages defined for the memory segment specified in the segment input 0 N 1 where N is the value returned from the Number of Segments property ECU XCP Cal Pages Address Extension Returns the address extension for the memory segment
96. 3 Launch the License Activation Wizard If you installed your software for the first time and the installer did not launch the License Activation Wizard for you perform the following steps a Launch the NI License Manager by selecting Start Programs National Instruments NI License Manager b Click the Activate button on the toolbar The wizard will guide you through the activation process 4 Save your activation code for future use optional You can reactivate your software at any time The activation wizard provides you with the option to receive an email confirmation of your activation code To apply this activation code in the future launch the Activation Wizard and choose to apply a 20 character activation code If you reinstall your software on the same computer the same activation code will work For more information on activation refer to your product documentation or visit ni com activate National Instruments uses activation to better support evaluation of our software to enable additional software features and to support license management in large organizations To find out more about National Instruments software licensing visit ni com activate to find frequently asked questions resources and technical support Terms Table 1 Definition of Activation Terms Serial Number A 9 character alphanumeric string that uniquely identifies your purchase of a single copy of software included in your
97. 32 mcPropGroup_Comment_ Size Returns the number of bytes to be allocated if you call mcGet Property with the parameter mcPropGroup_Comment str mcPropFunction_Comment Returns the comment of the selected Function u32 mcPropFunction_Comment_ Size Returns the number of bytes to be allocated if you call mcGet Property with the parameter mcPropFunction_Comment National Instruments 6 103 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C mcMeasurementCreate Purpose Creates a Measurement object in memory Format mcTypeStatus mcMeasurementCreate mcTypeTaskRef ECURefNum char MeasurementName mcAddress Address 132 DataType u8 DataSize char ConversionName Input ECURefNum ECURe Num is the task reference which links to the selected ECU This reference is originally returned from mcECUCreate Address Configures the target address for the programming operation in the ECU mcAddress is a C struct consisting of Address Specifies the address part of the programming address Extension Extension contains the extension part of the address DataType DataType sets the data type of the measurement task DataType Data Format Unsigned byte Signed byte Unsigned word Signed word Unsigned long Signed long Float 32 nun BW NY KF O ECU M amp C Toolkit User Manual 6 104 ni com Chapter 6 ECU M amp C API for C DataSize Sets the size of the me
98. 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 amp C API to obtain a descriptive string for the return value Description mcCharacteristicWrite writes the value s of a named Characteristic to an ECU identified by the ECU reference handle ECURefNum ECU M amp C Toolkit User Manual 6 28 ni com Chapter 6 ECU M amp C API for C mcCharacteristicWriteSingleValue Purpose Writes a single value to a named Characteristic on the ECU Format mcTypeStatus mcCharacteristicWriteSingleValue mcTypeTaskRef ECURefNum char CharacteristicName 64 Value u32 X u32 Y Input ECURefNum ECURe fNun is the task reference which links to the selected ECU This reference is originally returned from mcECUSelectEx CharacteristicName CharacteristicName is the name of the Characteristic defined in the A2L database file to which the values are written Value Value contains the value which is sent to the ECU X X refers to the array offset of the Characteristic defined in the A2L database file as 1 or 2 dimensional If the Characteristic is defined as 0 dimensional you can set x to 0 Y y refers to the array offset of the Characteristic defined
99. 5000 and 500000 are specified as the numeric rate Advanced baud rates are specified as 8000XXYY hex where YY is the value of Bit Timing Register 0 BTRO and XX is the value of Bit Timing Register 1 BTR1 of the CAN controller chip ECU XCP CAN CRO Id Sets the CRO ID Command Receive Object which is used to send commands and data from the host to the slave device ECU XCP CAN DTO Id Sets the DTO ID Data Transmission Object which is used by the ECU to respond to XCP commands and send data and status information to the XCP master ECU M amp C Toolkit User Manual 5 168 ni com Chapter 5 ECU M amp C API for LabVIEW Table 5 6 ECU Specific Property Value Types for the POLY Input Value Continued Type Hierarchy Sub Hierarchy Sub 1 Sub 2 Param Description ECU XCP Ethernet IP Address Sets the IP address of the slave device A slave device connected by Ethernet and TCP IP or UDP IP protocol is addressed by its IP Address and Port number ECU XCP Ethernet IP Port Sets the IP Port number of the slave device A slave device connected by Ethernet and TCP IP or UDP IP protocol is addressed by its IP Address and Port number ECU XCP Timeout T1 T2 T3 T5 T6 T7 Sets one of the seven timeout values in milliseconds defined in the XCP standard for the various XCP commands For details of which timeo
100. 6 ni com Chapter 6 ECU M amp C API for C Table 6 4 Values for PropertyID Continued Data Type Name Description u32 mcPropECU_CCP_Timeout_ Returns the timeout value in milliseconds for T_pgm the CCP programming commands For details of which timeout applies to a specific command refer to the CCP standard Default 120 Standard 100 The default is chosen slightly higher to allow for slower ECUs Note that the mcPropECU_TimingFactor property might modify this value u32 mcPropECU_CCP_Timeout_ Returns the timeout value in milliseconds for T_mem the CCP memory commands For details of which timeout applies to a specific command refer to the CCP standard Default and Standard 30000 Note that the mcPropECU_TimingFactor property might modify this value u32 mcPropECU_CCP_Timeout_ Returns the timeout value in milliseconds for T_diag the CCP DIAG_SERVICE command Default and Standard 500 Note that the mcPropECU_TimingFactor property might modify this value u32 mcPropECU_CCP_Timeout_ Returns the timeout value in milliseconds for T_act the CCP ACTION_SERVICE command Default 500 Standard 5000 Note that the mcPropECU_TimingFactor property might modify this value u32 mcPropGen_Version_ Returns the build number of the ECU M amp C Build software This number applies to Development Alpha and Beta phase only and should be ignored for Release phase str mcPropGen_
101. 9 Set Get Properties 4 16 application development on CompactRIO or R Series using NI 985x or NI 986x C Series module 3 4 ASAM definition 1 1 ASAM MCD 2MC communication properties Baudrate 4 6 CRO ID 4 5 DTO ID 4 5 Station Address 4 5 with CAN 4 5 with UDP or TCP 4 6 overview 1 1 National Instruments l 1 B basic programming model 4 3 Characteristic Read and Write 4 7 communication figure 4 4 ECU Close 4 7 ECU Connect 4 6 ECU Disconnect 4 7 ECU Open 4 5 Measurement tasks 4 9 Baudrate property 4 6 C C functions list of functions 6 2 mcBuildChecksum 6 6 mcCalculateChecksum 6 10 mcCCPActionService 6 12 mcCCPDiagService 6 14 mcCCPGetActiveCalPage 6 16 mcCCPGetResult 6 17 mcCCPGetSessionStatus 6 18 mcCCPGetVersion 6 19 mcCCPMoveMemory 6 20 mcCCPSelectCalPage 6 22 mcCCPSetSessionStatus 6 23 options table 6 23 mcCharacteristicRead 6 25 mcCharacteristicReadSingle Value 6 26 mcCharacteristicWrite 6 28 mcCharacteristicWriteSingle Value 6 29 mcClearMemory 6 31 mcConversionCreate 6 32 mcDAQClear 6 34 mcDAQInitialize 6 35 mcDAQListInitialize 6 38 mcDAQRead 6 40 ECU M amp C Toolkit User Manual Index mcDAQReadTimestamped 6 43 mcDAQStartStop 6 46 mcDAQWrite 6 48 mcDatabaseClose 6 50 mcDatabaseOpen 6 51 mcDatabaseOpenEx 6 52 mcDoubleToText 6 53 mcDownload 6 55 mcECUConnect 6 57 mcECUCreate 6 58 mcECUDeselect 6 62 mcECUDisconnect 6 63 mcECUSelectEx 6 64
102. A Summary of the CCP Standard Appendix B Technical Support and Professional Services Glossary Index National Instruments xi ECU M amp C Toolkit User Manual About This Manual This manual provides instructions for using the ECU Measurement amp Calibration ECU M amp C Toolkit It contains information about installation configuration and troubleshooting and also contains ECU M amp C function references for Lab VIEW based and C based APIs Use the ECU M amp C Toolkit Installation Guide in the jewel case of the program CD to install the ECU M amp C Toolkit software Use this manual to learn the basics of ECU Measurement and Calibration as well as how to develop an application Related Documentation National Instruments The following documents contain information that you may find helpful as you read this manual ANSIAISO Standard 11898 1993 Road Vehicles Interchange of Digital Information Controller Area Network CAN for High Speed Communication CAN Specification Version 2 0 1991 Robert Bosch GmbH Postfach 106050 D 70049 Stuttgart 1 CiA Draft Standard 102 Version 2 0 CAN Physical Layer for Industrial Applications CAN Calibration Protocol Specification Version 2 1 ASAP Arbeitskreis zur Standardisierung von Applikationssystemen Standardization of Application Calibration Systems task force Interface Specification Interface 2 ASAM MCD 2MC ASAP2 Version 1 51 Release 2003 03 11 Application
103. 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 identi fies the VI where the error occurred ECU M amp C Toolkit User Manual 5 200 ni com Chapter5 ECU M amp C API for LabVIEW ECU ref out is the same as ECU ref in Wire the task reference to subsequent VIs for this task 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 MC XCP Set Segment Mode vi implements the XCP command SET_SEGMENT_MODE and sets the selected segment into the specified mode If Mode 0 the segment disables the FREEZE mode if Mode the segment is set to
104. AN 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 BTRO and XX is the value of Bit Timing Register 1 BTR1 For more information refer to the Interface Properties dialog in MAX Output ECURef Num 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 amp 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 is the name of the protocol and interface the selected ECU
105. AN interface 1 and so on with the form CANx e CCP CAN256 uses CCP on virtual CAN interface 256 e CCP CAN257 uses CCP on virtual CAN interface 257 e XCP CAN0 uses XCP on CAN interface 0 e XCP CAN1 uses XCP on CAN interface 1 and so on with the form CANx ECU M amp C Toolkit User Manual 5 86 ni com Chapter5 ECU M amp C API for LabVIEW XCP UDP uses XCP on UDP XCP TCP uses XCP on TCP Using NI XNET hardware with NI XNET Frame Input Output based sessions CCP CAN1 nixnet uses CCP on CAN interface 1 CCP CAN2 nixnet uses CCP on CAN interface 2 and so on with the form CANx XCP CANI1 nixnet uses XCP on CAN interface 1 XCP CAN1 nixnet uses XCP on CAN interface 2 and so on with the form CANx XCP UDP uses XCP on UDP XCP TCP uses XCP on TCP Using NI XNET hardware with NI XNET Stream Input Output based sessions CCP CAN1 ni_genie_nixnet uses CCP on CAN interface 1 CCP CAN2 ni_genie_nixnet uses CCP on CAN interface 2 and so on with the form CANx XCP CANI1 ni_genie_nixnet uses XCP on CAN interface 1 XCP CANI1 ni_genie_nixnet uses XCP on CAN interface 2 and so on with the form CANx Using CompactRIO or R Series CCP CAN1 RIO1 c temp MyF pgaBitfile lvbitx uses CCP on named target RIO1 as compiled into the bitfile at c temp MyFpgaBitfile lvbitx XCP CAN1 RIO1 c temp MyF pgaBitfile lvbitx uses XCP on named target RIO1 as compiled into the bitfile at c temp MyFpgaBitfile lvbitx
106. Baudrate Returns the Baud Rate in use by the NI CAN Interface Basic baud rates such as 125000 and 500000 are specified as the numeric rate Advanced baud rates are specified as 8000XXYY hex where YY is the value of Bit Timing Register 0 BTRO and XX is the value of Bit Timing Register 1 BTR1 of the CAN controller chip For more information refer to the Interface Properties dialog in MAX The value of this property is originally set within MAX but it can be changed using MC Set Property vi ECU XCP CAN CRO Id Returns the CRO ID Command Receive Object which is used to send commands and data from the host to the slave device ECU XCP CAN DTO Id Returns the DTO ID Data Transmission Object which is used by the ECU to respond to XCP commands and send data and status information to the XCP master National Instruments 5 117 ECU M amp C Toolkit User Manual Chapter 5 ECU M amp C API for LabVIEW Table 5 5 Poly Values for Value Output Continued Type Hierarchy Sub Hierarchy Sub 1 Sub 2 Param Description ECU XCP Ethernet IP Address Returns the IP address of the slave device A slave device connected by Ethernet and TCP IP or UDP IP protocol is addressed by its IP Address and Port number ECU XCP Ethernet IP Port Returns the IP Port number of the slave device A slave device connected by E
107. C API for C mcDAQListinitialize Purpose Defines a DAQ list on a specific DAQ list number and initializes the Measurement task for the specified Measurement channel list Initializes a Measurement task for the specified Measurement channel list Format mcTypeStatus mcDAQListInitialize cstr MeasurementNames mcTypeTaskRef ECURefNum i116 DAQListNo 132 DAQMode u32 DTO_ID 64 SampleRate mcTypeTaskRef DAQRefNum Input MeasurementNames Comma separated list of Measurement names to initialize as a task You can type in the channel list as a string constant or you can obtain the list from an A2L database file by using the mcGetNames function ECURefNum ECURefNum is the task reference which links to the selected ECU This reference is originally returned from mcECUSelectEx DAQListNo DAQListNo specifies which DAQ list entry number should be used for the defined Measurement channel list for the selected ECU To query the available amount of DAQ List numbers on the ECU use mcPropECU_NumberOfDefinedDAQLists with the function mcGet Property To query the defined DAQ list numbers use mcPropECU_DAQListNumbers with mcGetProperty DAQMode DAQMode specifies the I O mode for the task For an overview of the I O modes including figures refer to the Basic Programming Model section of Chapter 4 Using the ECU M amp C API mcDAQModeDAQList Data is transmitted automatically by the ECU using DAQ lists The data
108. C Toolkit User Manual Chapter 6 ECU M amp C API for C mcGetNames Purpose Retrieves a comma separated list of ECU names Measurement names Characteristic names Event names Characteristic pages or Group names from a specified A2L database Format mcTypeStatus mcGetNames mcTypeTaskRef RefNum u32 Type cstr ECUName u32 SizeOfNamesList str NameList Input RefNum RefNum is any ECU M amp C task reference which consists of a valid link to the opened A2L database DBRef Num a selected ECU ECURefNum or a Measurement task DAQRefNum RefNum must be valid for the related Type Type Specifies the Type of names to return 0 imcTypeECUNames Returns a list of ECU names You can pass one of the returned names to mcECUSelectEx 1 mcTypeMeasurementNames Returns a list of Measurement names You can pass the returned NamesList to mcDAQInitialize 2 mceTypeCharacteristicNames Returns a list of Characteristic names You can pass a single name out of the NamesList to mcCharacteristicWrite or mcCharacteristicRead 3 mceTypeEventChannelNames Returns a list of Event Channel names 4 mcTypeDefinedPagesNames Returns a list of Calibration page names 5 mcTypeGroupNames Returns a list of Group names ECU M amp C Toolkit User Manual 6 72 ni com National Instruments Chapter 6 ECU M amp C API for C 6 mcTypeGroup_SubGroupNames Returns a list of Subgroup names of the specified Group nam
109. CAN ECU Measurement and Calibration Toolkit User Manual July 2014 7 NATIONAL 371601N 01 INSTRUMENTS Worldwide Technical Support and Product Information ni com Worldwide Offices Visit ni com niglobal to access the branch office websites which provide up to date contact information support phone numbers email addresses and current events National Instruments Corporate Headquarters 11500 North Mopac Expressway Austin Texas 78759 3504 USA Tel 512 683 0100 For further support information refer to the Technical Support and Professional Services appendix To comment on National Instruments documentation refer to the National Instruments website at ni com info and enter the Info Code feedback 2005 2014 National Instruments All rights reserved Legal Information Limited Warranty This document is provided as is and is subject to being changed without notice in future editions For the latest version refer to ni com manuals NI reviews this document carefully for technical accuracy however NI MAKES NO EXPRESS OR IMPLIED WARRANTIES AS TO THE ACCURACY OF THE INFORMATION CONTAINED HEREIN AND SHALL NOT BE LIABLE FOR ANY ERRORS NI warrants that its hardware products will be free of defects in materials and workmanship that cause the product to fail to substantially conform to the applicable NI published specifications for one 1 year from the date of invoice For a period of ninety 90 days from the date
110. CCP or XCP With the database task reference it is possible to create an ECU task reference which links to the selected ECU Depending on the application scenario the ECU task reference can be used for the following e Creation of a Measurement task to measure ECU internal data continuously or on demand e Direct read write of 0 to 2 dimensional Characteristics e Read write of single Measurement values on demand What is an ECU Measurement An ECU Measurement called ECU Data Acquisition DAQ in the CCP and XCP specifications is a definition of specific procedures and CAN messages sent from the slave device ECU to the master device for fast data acquisition DAQ The XCP protocol supports synchronous data transfer in both directions from Master to Slave DAQ list and from Slave to Master STIM list XCP allows several DAQ lists which may be simultaneously active The sampling and transfer of each DAQ list is triggered by individual events in the slave To allow reduction of the transfer rate a transfer rate prescaler may be applied to the DAQ lists What is an ECU Characteristic An ECU Characteristic represents an ECU internal memory range with defined access methods through the CCP protocol The memory range of a single Characteristic can be structured in three ways e 0Q dimensional a single value e _ dimensional a curve of values e 2 dimensional a field of values A Characteristic may be defined as read only
111. CP command GET_ID and returns session configuration or slave device identification information of the selected ECU slave device The supported types are implementation specific of the ECU slave device The identification string is ASCII text format ECU M amp C Toolkit User Manual 5 184 ni com Chapter5 ECU M amp C API for LabVIEW MC XCP Get Status vi Purpose Queries the current session status from an ECU slave device Format session id ECU ref out session status resource mask error out ECU ref in error in ECU ref in is the task reference which links to the selected ECU This reference is originally returned from MC ECU Open vi or MC ECU Select vi and then wired through subsequent VIs Error in is a cluster which describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out status is TRUE if an error occurred This VI will not execute when status is TRUE 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 Session Id returns
112. CP on TCP Using NI XNET hardware with NI XNET Stream Input Output based sessions CCP CAN1 ni_genie_nixnet uses CCP on CAN interface 1 CCP CAN2 ni_genie_nixnet uses CCP on CAN interface 2 and so on with the form CANx XCP CANI1 ni_genie_nixnet uses XCP on CAN interface 1 XCP CANI1 ni_genie_nixnet uses XCP on CAN interface 2 and so on with the form CANx Using CompactRIO or R Series CCP CAN1 RIO1 c temp MyF pgaBitfile lvbitx uses CCP on named target RIO1 as compiled into the bitfile at c temp MyFpgaBitfile lvbitx XCP CAN1 RIO1 c temp MyF pgaBitfile lvbitx uses XCP on named target RIO1 as compiled into the bitfile at c temp MyFpgaBitfile lvbitx National Instruments 5 91 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW MC ECU Set Calibration Page vi Purpose Sets the appropriate RAM or ROM calibration page on the ECU Format ECU ref in ECU ref out use RAM error out map Addresses error in Input ECU ref in is the task reference that links to the selected ECU This reference is originally returned from MC ECU Open vi or MC ECU Create vi and then wired through subsequent VIs use RAM indicates which page should be set Set this input to TRUE for E the RAM page or FALSE for the ROM page map Addresses activates address mapping from the ROM page to the E target page specified in use RAM Error in is a cluster which describes error conditions o
113. CP_ADD_22 Add WORD into a WORD checksum ignore overflows blocksize must be modulo 2 0x05 XCP_ADD_24 Add WORD into a DWORD checksum ignore overflows blocksize must be modulo 2 ECU M amp C Toolkit User Manual 5 10 ni com Chapter 5 ECU M amp C API for LabVIEW Type Name Description 0x06 XCP_ADD_44 Add DWORD into DWORD ignore overflows blocksize must be modulo 4 0x07 XCP_CRC_16 See CRC error detection algorithms 0x08 XCP_CRC_16_CITT See CRC error detection algorithms 0x09 XCP_CRC_32 See CRC error detection algorithms OxFF XCP_USER_DEFINED User defined algorithm in externally calculated function For a detailed description of the checksum algorithm refer to the MC Build Checksum vi or the XCP Part 2 Protocol Layer Specification For more detailed information about CRC algorithms refer to the following site http www repairfaq org filipg LINK F_crce_v34 html National Instruments ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW MC CCP Action Service vi Purpose Calls an implementation specific action service on the ECU CCP only Format ECU ref in ECU ref out service no data type result error out params error in Input ECU ref in is the task reference which links to the selected ECU This reference is originally returned from MC ECU Open vi or MC ECU Select vi and then wired through subsequent VIs Service No determines th
114. CT Returns a Boolean value Commands CAL PAGE that indicates whether the ECU supports the optional CCP Command SELECT_CAL_PAGE ECU CCP Optional SETS Returns a Boolean value Commands STATUS that indicates whether the ECU supports the optional CCP Command SET_S_STATUS ECU CCP Optional SHORT UP Returns a Boolean value Commands that indicates whether the ECU supports the optional CCP Command SHORT_UP ECU M amp C Toolkit User Manual 5 114 ni com Chapter 5 ECU M amp C API for LabVIEW Table 5 5 Poly Values for Value Output Continued Hierarchy Sub Hierarchy Sub 1 Sub 2 Param Description BIE TF ECU CCP Optional Commands START STOP ALL Returns a Boolean value that indicates whether the ECU supports the optional CCP Command START_STOP_ALL TF ECU CCP Optional Commands TEST Returns a Boolean value that indicates whether the ECU supports the optional CCP Command TEST H m ECU CCP Optional Commands UNLOCK Returns a Boolean value that indicates whether the ECU supports the optional CCP Command UNLOCK E ECU Misc Timing Factor Returns the used timing factor which you can use to increase CCP or XCP command timeout values For details on the default Command Timeout values refer to the CCP or XCP Protocol Specification ECU XCP Compression Method Returns the selected compression method used for MC Progra
115. CU M amp C API for LabVIEW Description Use MC ECU Create vi to create an ECU object in memory instead of referring to an ECU object defined in the A2L database MC ECU Create vi provides an alternative in which you create the ECU and DAQ List configuration within the application without using an A2L database MC ECU Create vi creates an ECU reference handle linked to the selected ECU name MC ECU Create vi does not start communication This enables you to use MC Set Property vi to change the properties of an ECU task and to create an event channel object manually using MC Event Create vi create a measurement object using MC Measurement Create vi and create a conversion rule using MC Conversion Create vi After you change properties use MC ECU Connect vi to start communication for the task and logically connect to the selected ECU National Instruments 5 79 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW MC ECU Deselect vi Purpose Deselects an ECU and invalidates the ECU reference handle Format ECU ref in DB ref out error in error out Input ECU ref in is the task reference is originally reference which links to the selected ECU This returned from MC ECU Open vi or MC ECU Select vi and then wired through subsequent VIs Error in is a cluster which describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in clu
116. DAQ list configuration that might already be stored in non volatile memory 3 Request to clear all DAQ lists in non volatile memory All ODT entries reset to address 0 extension 0 size 0 and bit_offset FF Session configuration ID reset to 0 4 Unused 5 Unused 6 Unused 7 Unused SessionID SessionID is a session configuration ID that is stored in non volatile memory together with the information requested by the Mode parameter ECU M amp C Toolkit User Manual 6 146 ni com Chapter 6 ECU M amp C API for C Output None 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 amp C API to obtain a descriptive string for the return value Description mcXCPSetRequest implements the XCP command SET_REQUEST and is used to save session configuration information into non volatile memory in the ECU Refer to the ASAM XCP Part 2 Protocol Layer Specification for more information on how to setup a request National Instruments 6 147 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C mcXCPSetSegmentMode Purpose Sets the
117. DAQListInitialize Defines a DAQ list on a specific DAQ list number and initializes the Measurement task for the specified Measurement channel list Initializes a Measurement task for the specified Measurement channel list mcDAQRead Reads samples from a Measurement task Samples are obtained from received CAN messages mcDAQReadTimestamped Reads timestamped samples from a DAQ task initialized with the selected mode of mcDAQModeDAQListTimeStamped mcDAQStartStop Starts or stops the transmission of the DAQ lists for the specified Measurement task mcDAQWrite Writes samples to an ECU DAQ list National Instruments 6 3 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C Table 6 2 Functions for the ECU M amp C API for C Continued Function Purpose mcDatabaseClose Stops transmission of the DAQ lists for the specified Measurement task mcDatabaseClose Closes a specified A2L Database reference mcDatabaseOpen Opens a specified A2L Database za P mcDatabaseOpen Creates an A2L database in memory for using the ECU M amp C Toolkit functions without access to a valid ASAM A2L file mcDoubleToText Converts a numerical value to a text string using an enumeration or range text type scaling mcDownload Downloads data to an ECU mcECUConnect Establishes communication to the selected ECU through CCP After a successful ECU Connect you can
118. DAQRefNum StartStopMode ECU M amp C Toolkit User Manual mcDAQStartStop mcTypeTaskRef DAQRefNum u32 StartStopMode DAQRe Nun is the task reference from the previous Measurement task function The task reference is originally returned from mcDAQInitialize and then reused by subsequent Measurement task functions StartStopMode indicates the type of function to be performed O0 mcStartStopModeStop Configures the ECU to stop transmitting a DAQ task If stopped properties of the DAQ task can be changed using mcSetProperty This function is performed automatically before mcDAQClear 1 mcStartStopModeStart Configures the ECU to start sending data for a Measurement task Ensure that the DAQ list has not yet been transferred to the ECU first Once started properties of the DAQ list can no longer be changed using mcSet Property This function is performed automatically before the first read of the DAQ list with mcDAQRead 2 mcStartStopModeTransmitDAQ Transfers the DAQ list to the ECU but does not start it For example use this mode if you want to change the session status before starting the DAQ list For some ECUs this is necessary 6 46 ni com Chapter 6 ECU M amp C API for C Output 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 e
119. DLL Name Checksum DLL used for verifying the checksum ECU Logfile Path Sets a filename full path where the CCP or XCP protocol traffic is logged in ASCII format for debugging purposes Setting this parameter to an empty path disables logging default Note that on RT and cRIO systems the logfile is created on the target system and must be transferred to the host after logging has been completed Note that no additional CAN port is used for the logging which makes this method superior to any other method such as running a bus monitor parallel National Instruments 5 159 ECU M amp C Toolkit User Manual Chapter 5 ECU M amp C API for LabVIEW Table 5 6 ECU Specific Property Value Types for the POLY Input Value Continued Type Hierarchy Sub Hierarchy Sub 1 Sub 2 Param Description ECU CCP Baud Rate Sets the Baud Rate in use by the interface This property applies to all tasks initialized with the 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 also can specify advanced baud rates in the form 8000XXYY hex where YY is the value of Bit Timing Register 0 BTRO and XX is the value of Bit Timing Register 1 BTR1 ECU CCP CRO ID Sets the CRO ID Command Receive Object which is used to send commands and data from the hos
120. E REMEDIES SET FORTH ABOVE ARE EXCLUSIVE AND THE CUSTOMER S SOLE REMEDIES AND SHALL APPLY EVEN IF SUCH REMEDIES FAIL OF THEIR ESSENTIAL PURPOSE EXCEPT AS EXPRESSLY SET FORTH HEREIN PRODUCTS ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND AND NI DISCLAIMS ALL WARRANTIES EXPRESSED OR IMPLIED WITH RESPECT TO THE PRODUCTS INCLUDING ANY IMPLIED WARRANTIES OF MERCHANTABILITY FITNESS FOR A PARTICULAR PURPOSE TITLE OR NON INFRINGEMENT AND ANY WARRANTIES THAT MAY ARISE FROM USAGE OF TRADE OR COURSE OF DEALING NI DOES NOT WARRANT GUARANTEE OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF OR THE RESULTS OF THE USE OF THE PRODUCTS IN TERMS OF CORRECTNESS ACCURACY RELIABILITY OR OTHERWISE NI DOES NOT WARRANT THAT THE OPERATION OF THE PRODUCTS WILL BE UNINTERRUPTED OR ERROR FREE In the event that you and NI have a separate signed written agreement with warranty terms covering the products then the warranty terms in the separate agreement shall control Copyright Under the copyright laws this publication may not be reproduced or transmitted in any form electronic or mechanical including photocopying recording storing in an information retrieval system or translating in whole or in part without the prior written consent of National Instruments Corporation National Instruments respects the intellectual property of others and we ask our users to do the same NI software is protected by copyright and other intellectual property laws Wher
121. ECU CCP Optional DIAG Returns a Boolean value Commands SERVICE that indicates whether the ECU supports the optional CCP Command DIAG_SERVICE ECU CCP Optional DNLOAD 6 Returns a Boolean value Commands that indicates whether the ECU supports the optional CCP Command DNLOAD_6 ECU CCP Optional GET Returns a Boolean value Commands ACTIVE that indicates whether the CAL PAGE ECU supports the optional CCP Command GET_ACTIVE_CAL_ PAGE ECU CCP Optional GETS Returns a Boolean value Commands STATUS that indicates whether the ECU supports the optional CCP Command GET_S_STATUS National Instruments 5 113 ECU M amp C Toolkit User Manual Chapter 5 ECU M amp C API for LabVIEW Table 5 5 Poly Values for Value Output Continued Sub Hierarchy Type Hierarchy Sub 1 Sub 2 Param Description ECU CCP Optional GET SEED Returns a Boolean value Commands that indicates whether the ECU supports the optional CCP Command GET_SEED ECU CCP Optional MOVE Returns a Boolean value Commands that indicates whether the ECU supports the optional CCP Command MOVE ECU CCP Optional PROGRAM Returns a Boolean value Commands that indicates whether the ECU supports the optional CCP Command PROGRAM ECU CCP Optional PROGRAM Returns a Boolean value Commands 6 that indicates whether the ECU supports the optional CCP Command PROGRAM_6 ECU CCP Optional SELE
122. ECU M amp C Toolkit User Manual 5 64 ni com Chapter5 ECU M amp C API for LabVIEW MC Database Open vi Purpose Opens a specified A2L Database Format DB path DB ref out error in error out Input National Instruments DB path is a path to a A2L database file from which to get channel names The file must use a A2L extension You can generate A2L database files with several 3rd party tools Error in is a cluster which describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out status is TRUE if an error occurred This VI will not execute when status is TRUE 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 DB reference out is the task reference which links to the opened database file 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 5 65 ECU M amp C
123. ECU Open vi or MC ECU Select vi and then wired through subsequent VIs Session ID is a session configuration ID that is stored in non volatile memory together with the information requested by the Mode parameter Error in is a cluster which describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out status is TRUE if an error occurred This VI will not execute when status is TRUE 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 ECU ref out is the same as ECU ref in Wire the task reference to subsequent VIs for this task 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 operati
124. ECUName and Type After calling mcGetNamesLength you can allocate an array of size SizeofNamesList then pass that array to mcGetNames using the same input parameters This ensures that mcGetNames will return all names without error 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 amp C API to obtain a descriptive string for the return value Description After calling mcGetNamesLength you can allocate an array of size SizeofNamesList then pass that array to mcGetNames using the same input parameters This ensures that mcGetNames will return all names without error If using mcGetNamesLength to query the length of the list of supported event channels on an ECU the event channels might be stored inside the ECU instead of the A2L file To query these event channel names from the ECU directly connect to the ECU using mcECUConnect before calling mcGetNamesLength National Instruments 6 77 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C mcGetProperty Purpose Retrieves a property of the driver the database the ECU a Characteristic a
125. ECU_Single_Byte_ Determines if an ECU supports single byte or DAQ_Lists multi byte DAQ list entries u32 mcPropECU_Station Returns the station address of the slave device 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 u32 mcPropECU_XCP_Timeout Returns one of the seven timeout values in T1 milliseconds defined in the XCP standard for mcPropECU_XCP_Timeout the various XCP commands For details of 1 which timeout applies to a specific command Beret U_ACP_ Timeout refer to the XCP standard The values are 2 X E typically read from an A2L file but may be mcPropECU_XCP_Timeout T4 overridden manually R U_XCP_Timeout Note that the mcPropECU_TimingFactor RE E E property might modify this value T6 mcPropECU_XCP_Timeout T7 u32 mcPropECU_CCP_Timeout Returns the timeout value in milliseconds for T_std most of the CCP commands For details of which timeout applies to a specific command refer to the CCP standard Default 40 Standard 25 The default is chosen slightly higher to allow for slower ECUs Note that the mcPropECU_TimingFactor property might modify this value ECU M amp C Toolkit User Manual 6 9
126. 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 Characteristic value returns a single sample for the specified 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 MC Characteristic Read Single Value vi reads a value from a specified Characteristic on the ECU which is identified by the ECU Reference handle The value to be read is identified by the x and y indices If the Characteristic array has 0 or 1 dimensions y and or x can be left unwired National Instruments 5 33 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW MC Characteristic Write vi Purpose Writes the value s of a named Characteristic to an ECU identified by the ECU ref handle The Poly VI writes the selected type double 1D or 2D array Format characteristic name ECU ref in ECU ref out characteristic t error in error ou Input Characteristic nam
127. FIRST Motorola byte ordering str mcPropECU_Checksum Sets the file name of the Checksum DLL used for verifying the checksum u32 mcPropECU_CmdByteOrder Sets the byte order for multi byte command parameters 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 National Instruments 6 115 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C Table 6 5 ECU Specific Value Types for the PropertyID Input Value Continued Data Type Name Description u32 mc PropECU_CRO_ID Sets the CAN identifier for the CRO ID Command Receive Object which is used to send commands and data from the host to the slave device u32 mc PropECU_DTO_ID Sets the DTO ID Data Transmission Object which is used by the ECU to respond to CCP commands and send data and status information to the CCP master u32 mcPropECU_MasterID Sets CCP master ID information This ID information is optional and specific to the ECU implementation For more information about the CCP master ID information refer to the documentation for the ECU str mcPropECU_SeedChkD11 Determines the directory where the ECU M amp C Path Toolkit expects to find the Seedkey or Checksum DLL If the property is an empty string default the ECU M amp C Toolkit expects the DLLs in the same directory as the A2L file If you
128. 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 ECU ref out is the same as ECU ref in Wire the task reference to subsequent VIs for this task Major version returns the major version number of the CCP implementation Minor version returns the minor version number of the CCP implementation 5 22 ni com Chapter5 ECU M amp C API for LabVIEW Error out describes error conditions If the Error in cluster indicated an 2H 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 MC CCP Get Version vi can be used to query the CCP version implemented in the ECU This command performs a mutual identification of the protocol version in the slave device to agree on a common protocol version MC CCP Get Version vi implements the CCP command GET_CCP_VERSION defined by the CCP s
129. GE PI G2V1 s s a A E A AS ME GetNimeS Vinresa a n a a AES SA MC Get Property Vinai iie a o a eia aR eaa MC Measurement Create vi ccccccccccccessscccceeesssseeceesssseeeceesssseeeceeesstseeeeeees MC Measurement Read vi cccccscccccesssssecccesssscecceeesssseeccesssseeeceeestaeeceeeeses MC Measurement Wite Vi ccccsccccccessssecceeessseeeecesssseeeceesssseeeeesesseeeeeees ECU M amp C Toolkit User Manual viji ni com Contents MC Pro Sr aim Vieiesso seias aeei eoi aR Ea EEEE REEE 5 150 MC Program RESCt Viiisicessssscstessebtstesessessscassesdbesseceaeassadde aiaia 5 152 MC Program Start Vlooie eireta is EE E E RE 5 154 MC Set Property vies sooten eios triar EE A ERT 5 156 MC Text To Double Virsien cen snd n eia aeaaea Eai 5 175 MC Upload Vi rai rat enaere anisar arane s niao R den lati ESEESE PEREP ESIOS 5 177 MC XCP Copy Call Page Vissiin iepa nE e EE E 5 179 MC XCP Get Cal Page Visserie n a T A 5 181 MCE XCP Get ID Viene nenns a ea e a NEAR RAEAN 5 183 MC XCP Get Status vi i cccscecsecssdestecceisccades absesshsdesissaassadiodstacesesdpsnssaauteecsassay 5 185 MC XCP Program Prepare vi s evicsicscesteevecssees eveed veucbesiestase ceecesubescutaasveeuaeestot 5 190 MG XCP Program Verity Visiscoscseseesssseciestscessscasesstessadseetesosateesteaessee ai aia 5 192 MC XCP Set Cal Page Vie cis citi deta ciciiened Aas hatin nies eaaa 5 195 MC XCP Set Request Viinin aara inira a onerarias 5 197 MC XCP Set Segment
130. IES AIRCRAFT NAVIGATION AIR TRAFFIC CONTROL SYSTEMS LIFE SAVING OR LIFE SUSTAINING SYSTEMS OR SUCH OTHER MEDICAL DEVICES OR ANY OTHER APPLICATION IN WHICH THE FAILURE OF THE PRODUCT OR SERVICE COULD LEAD TO DEATH PERSONAL INJURY SEVERE PROPERTY DAMAGE OR ENVIRONMENTAL HARM COLLECTIVELY HIGH RISK USES FURTHER PRUDENT STEPS MUST BE TAKEN TO PROTECT AGAINST FAILURES INCLUDING PROVIDING BACK UP AND SHUT DOWN MECHANISMS NI EXPRESSLY DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY OF FITNESS OF THE PRODUCTS OR SERVICES FOR HIGH RISK USES Contents About This Manual Relat d Documentation korsana n eene E sea EE conde EEEE ne xiii Activating Your Software How Do I Activate My Software oo eee eeeesecseceeeseeeseesecsseeseesaeeneoeeeaesneseaesseseaeenees XV Whats Activation 2 3 cscccccntncessshostedccs otviedas eere dees ada Hesnerddides aS E e ES r arii XV What is the NI Activation Wizard ccccccccssccesscccssseceseneeeesseeecsseeeesseeeessneessseeeessaeeenes XV What Information Do I Need to Activate ccccccecseeessceeesneecsseeeeneeeesseeesseeeesseeeeee XV How Do I Find My Product Serial Number ssssssesseesssesseerseesesrsresreresresrsresresesresrsses xvi Whatas a Computer ID rona e aA a ee ate gal nna eas xvi How Can I Evaluate NI Software ccccccccccccsssceesseeessseeeesneeessneeessneeeeneneeesseeessaeens xvi Moving Software After Activation esseseseseesesssessesesesrsrrsresrsresrsresre
131. LabVIEW error handling VI such as the Simple Error Handler source identifies the VI where the error occurred MC XCP Get Cal Page vi implements the XCP command GET_CAL_PAGE and queries the logical number for the calibration data page that is currently activated for the specified access mode and data segment Refer to the ASAM XCP Part 2 Protocol Layer Specification for more information on how to set up a request ECU M amp C Toolkit User Manual 5 182 ni com MC XCP Get ID vi Chapter5 ECU M amp C API for LabVIEW Purpose Queries session configuration or slave device identification Format reference in type error in Input Reference in is the reference to any opened A2L database a selected ECU or an ECU which is already connected with MC Database Open vi MC ECU Select vi MC ECU Open vi or MC ECU Connect vi The type of this reference depends on the property you want to get Type specifies the type of the requested identification Type Description 0 ASCII text 1 ASAM MC2 filename without path and extension 2 ASAM MC 2 filename with path and extension 3 URL where the ASAM MC2 file can be found 4 ASAM MC 2 file to upload 128 255 User defined National Instruments Error in is a cluster which describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out status is T
132. LabWindows CVI The examples are installed in the LabWindows CVI directory under samples ecumc Each example provides a complete LabWindows CVI project prj file A description of each example is provided in comments at the top of the c file The ECU M amp C Toolkit software supports Microsoft Visual C C 6 The header file for Visual C C 6 is in the Program Files National Instruments Shared ExternalCompilerSupport C include folder To use the ECU M amp C API include the nieme h header file in the code then link with the niemcc 1ib library file The niemcc 1ib library file is in the Program Files National Instruments Shared ExternalCompilerSupport C 1ib32 msve folder For C applications files with a c extension include the header file by adding a include to the beginning of the code like this include niemc h For C applications files with a cpp extension define __ cplusplus before including the header like this define _ cplusplus include niemc h The _ cplusplus define enables the transition from C to the C language functions The reference for each API function is in Chapter 6 ECU M amp C API for C On Windows Vista with Standard User Account the typical path to the C examples folder is Users Public Documents National Instruments ECU Measurement and Calibration Toolkit Examples MS Visual C On Windows XP 2000 the typical path to the C examples folder is Documents and Sett
133. MORY u32 mcPropOptCmd_DIAG_ SERVICE Returns whether the ECU supports the optional CCP Command DIAG_SERVICE u32 mcPropOptCmd_DNLOAD_6 Returns whether the ECU supports the optional CCP Command DNLOAD_6 National Instruments 6 101 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C Table 6 4 Values for PropertyID Continued Data Type Name Description u32 mcPropOptCmd_GET_ Returns whether the ECU supports the optional ACTIVE_CAL_PAGE CCP Command GET_ACTIVE_CAL_PAGE u32 mcPropOptCmd_GET_S_ Returns whether the ECU supports the optional STATUS CCP Command GET_S_STATUS u32 mcPropOptCmd_GET_SEED Returns whether the ECU supports the optional CCP Command GET_SEED u32 mcPropOptCmd_MOVE Returns whether the ECU supports the optional CCP Command MOVE u32 mcPropOptCmd_PROGRAM Returns whether the ECU supports the optional CCP Command PROGRAM u32 mcPropOptCmd_PROGRAM_6 Returns whether the ECU supports the optional CCP Command PROGRAM _6 u32 mcPropOptCmd_SELECT_ Returns whether the ECU supports the optional CAL_PAGE CCP Command SELECT_CAL_PAGE u32 mcPropOptCmd_SET_S_ Returns whether the ECU supports the optional STATUS CCP Command SET_S_STATUS u32 mcPropOptCmd_SHORT_UP Returns whether the ECU supports the optional CCP Command SHORT_UP u32 mcPropOptCmd_START_ Returns whether the ECU supports the optional STOP
134. N channel at a specific point in time In other words the sample rate specifies a virtual clock that copies the most recent value from CAN messages for each sample time The changes in sample values from message to message enable you to view the CAN channel over time such as for comparison with other CAN or DAQ input channels This VI waits until all samples arrive in time before returning The start time of a waveform indicates the time of the first CAN sample in the array The delta time of a waveform indicates the time between each sample in the array as determined by the original sample rate National Instruments 5 53 ECU M amp C Toolkit User Manual Chapter 5 ECU M amp C API for LabVIEW If the initialized sample rate is zero this poly VI returns an error If the intent is to simply read the most recent sample for a task use the 7 Chan 1Samp Dbl type If no message has been received since you started the task a 0 is returned in all entries of the value waveform You can use error out to determine whether a new message has been received since the previous call to MC DAQ Read vi or MC DAQ Start Stop vi If no message has been received the warning code 3FF60009 hex is returned in error out If a new message has been received the success code 0 is returned in error out Unless an error occurs the number of samples returned is equal to number of samples to read NChan NSamp 1D Wfm Returns an array one entry for each channel initializ
135. NETIC 5555 5 cea e EE E A E E E EE OE EERE ads 6 70 TCGELN AMES iiaei ea E E E O EEA T 6 72 mceGetNamesLength soriire ea ieai iaa i a aa o Eaa 6 75 MEGetProperty enaere lees al aaea aae p a aos earo AE eaaa op Esa ERRE ieat 6 78 MCMeAaSUrEMENtCreale aie isiro cans eane oE EE a EREE VEET 6 104 meMeasurementR ad s c0s2cisiscenaivesisegosdas is a ae RE E TN 6 106 meMeasurement Writes asirni ea a E a EE E 6 107 MC PLO STAM aineeton as aaa aaas T S E aaa a R EAE EE raap eai 6 108 meProgramReset orcarina e NE E E a E 6 110 meProgramStart sssnoisotnun anan a a a A R teas 6 111 MCSetProperty seision ei i ie eea E a RE a EAE aAa S R en i 6 112 MCStatus KoRn a1 ol AEE 6 124 MCTEXtPODOUD es visi cases ie e EA EEEN E EEEa 6 126 meUpload Serenes ea a devas Hepes EEE E 6 128 meXCPCopyCal Page nenea aaeain eea a ReneS a 6 130 MCX CPGetCalPage ensi insa inita ai a E E EEES 6 132 meXEPGetld onna s e a ete EE E E E EE eee A 6 134 MEXCPGeiStAUS nn oa n i E E S 6 136 mcXCPPropramPrepare scscssiccetes ness ineei aioa ii anaa o aa 6 140 MCX CPProgram Verify wise visesscssescscseeseelesssadeschodessbeasedaessosssecesssaeetuaysedicassaasade 6 142 mcX CPSEtCalPageis sects anana a pE E hapless au bens cy E metas ls 6 144 MCX CPSELREGUECSE 2 ss2 scsscseesesceccssagsioisenses eens hash E A R ak 6 146 mcXCPSetSegmentMode eee eecesseeeesecseceseeseeesecsecsseesecesecesesesseseaeeaees 6 148 ECU M amp C Toolkit User Manual X ni com Contents Appendix
136. NING flag indicates that at least one DAQ list has been started and is in RUNNING mode The RESUME flag indicates that the slave is in RESUME mode ResourceMask contains the current resource protection status as a bit mask described below Bit Number Flag Description 0 CAL PAG REQuest to STORE CALibration data 0 STORE_CAL_REQ mode is reset 1 STORE_CAL_REQ mode is set Unused DAQ DAQ list commands DIRECTION DAQ 0 DAQ list commands are not protected with SEED amp Key mechanism 1 DAQ list commands are protected with SEED amp Key mechanism STIM DAQ list commands DIRECTION STIM 0 DAQ list commands are not protected with SEED amp Key mechanism 1 DAQ list commands are protected with SEED amp Key mechanism PGM ProGraMming commands 0 ProGraMming commands are not protected with SEED amp Key mechanism 1 ProGraMming commands are protected with SEED amp Key mechanism Unused ECU M amp C Toolkit User Manual 6 138 ni com Chapter 6 ECU M amp C API for C Bit Number Flag Description 6 Unused 7 Unused The CAL PAG flags indicates that all commands of the CALibration PAGing group are protected and will return an ERR_ACCESS_LOCKED upon an attempt to execute the command without a previous successful GET_SEED UNLOCK sequence The PGM flags indicates that all the commands of the ProGraMmi
137. P commands and send data and status information to the CCP master nctType mcPropECU_DTO_Task NI CAN Task reference to the CAN Task Taskref assigned to the DTO ID 132 mcPropECU_EventChannel Translates the event channel name to the event channel number Pass the event channel name in the Name parameter of Get Property u8 mcPropECU_ID Returns the slave device identifier This ID information is optional and specific to the ECU implementation For more information about the CCP slave ID information refer to the documentation for the ECU u8 mcPropECU_ID_DataType Returns a data type qualifier of the slave device ID information This ID information is optional and specific to the ECU implementation For more information about the CCP slave ID information refer to the documentation for the ECU National Instruments 6 87 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C Table 6 4 Values for PropertyID Continued Data Type Name Description ug mcProp l ECU_ID_Length Returns the length of the slave device identifier in bytes u32 mcPropl ECU_Interface Returns the interface initialized for the task such as with mcDAQInitialize u8 str mcPropl mcPropl ECU_MasterID ECU_Name Returns CCP master ID information This ID information is optional and specific to the ECU implementation For more information about the CC
138. P master ID information refer to the documentation for the ECU Returns the name of the selected ECU opened by mcECUSelectEx str mcPropl ECU_Comment Returns the comment of the selected ECU opened by mcECUSelectEx u32 mcPropl ECU_Comment_Size Returns the number of bytes to be allocated if you call mcGet Property with the parameter mcPropECU_Comment ug mcProp l ECU_XCP_ NumSegments Returns the number of XCP memory segments found for this ECU ug mcPropl ECU_XCP_NumPages Returns the number of memory pages defined for the memory segment specified in the Name input Specify the segment by the string SEGMENT lt n gt where lt n gt is the decimal representation of the segment number 0 N 1 where N is the number returned from the mcPropECU_XCP_NumSegments property ug mcProp l ECU_XCP_ AddressExtension Returns the memory address extension for the memory segment specified in the Name input Specify the segment by the string SEGMENT lt n gt where lt n gt is the decimal representation of the segment number 0 N 1 where N is the number returned from the mcPropECU_XCP_NumSegments property ECU M amp C Toolkit User Manual 6 88 ni com Chapter 6 ECU M amp C API for C Table 6 4 Values for PropertyID Continued Data Type Name Description u8 mcPropECU_XCP_ Returns the compression method for the Compressio
139. PI in the NI CAN Hardware and Software User Manual NI XNET By default the ECU Measurement and Calibration Toolkit uses NI CAN for CAN communication This means you must define an NI CAN interface for your NI XNET hardware NI CAN compatibility mode to use your XNET hardware for CAN communication However to use your NI XNET interface in the native NI XNET mode meaning it does not use the NI XNET Compatibility Layer you must define your interface under NI XNET Devices in MAX and pass the NI XNET interface name that the ECU Measurement and Calibration Toolkit will use To do this add 5 75 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW nixnet to the Protocol and Interface string for example CCP CAN1 nixnet The interface name is related to the NI XNET hardware naming under Devices and Interfaces in MAX 3 Note By selecting nixnet as Protocol and Interface string the ECU Measurement and Calibration Toolkit uses the Frame Input and Output Queued sessions To force the ECU Measurement and Calibration Toolkit to use Frame Input and Output Stream sessions instead select ni_genie_nixnet as Protocol and Interface string for example CCP CAN1 ni_genie_nixnet An application instance can use only one Frame Input Stream Session and one Frame Output Stream Session at a time so use the default name nixnet as Protocol and Interface string so that multiple NI XNET Frame Queued Sessions can coexist on a single interface
140. POLICY aonet ana E e E E ERE SE RE Ea 2 4 National Instruments v ECU M amp C Toolkit User Manual Contents LabVIEW Real Time RT Configuration cc eeeeeseeseeeeneceeeeeeeceaeeeeeeceaeeeseeeeaeesaes 2 5 PXI Systeman aaa a eens a diated 2 5 NI CAN n PXI RT System rosos a e E E E EE ER 2 5 NI XNET on PXI RT Syst Me iessen iinr a aa 2 5 CompactRIO Systemes a5 iieiea n ena v EEE e aE SEAE E ASS 2 5 DOS Command Prompt ii csssisscscecascatsscsectescaces cvbcstecescobessicesceaedessncapseansasiese 2 6 Web Browser S niesi mi iea a ius EE AE EET eutes sans aE seen 2 7 LabVIEW Real Time Graphical File Transfer Utility eee 2 7 Dab V DEW E E E E T eae dh tiels wal cateen tees 2 9 Hardware and Software Requirements cece eseeseceseesseeseceeeeseesseesscnsesseeneeeseenaes 2 10 Chapter 3 Application Development Choose the Programming Language 0 0 0 0 eee eeceeseeseeeseeseceseeaeeeseeaeceseeseseeeeseeseeeaeeseens 3 1 LabVIEW ortir a E thai ati aa a ia 3 1 LabWindows CVI ureint eiti a A AE ated Raut aiaa 3 1 Misya CPR Oiee na aE E TO a ck achs shaded CobSatasaz RES 3 2 Other Programming Languages esseeesssrssesrsrrerseestesrsresrerrsresrnesrsresrssenreere 3 3 Application Development on CompactRIO or R Series Using an NI 985x or NI 986 C Series MOdUle cise ii e5 rinsio iie E EE EE EA ovdassscuaces 3 4 Debugging An Applications icscsccisissesssestzscssusticteastssestapeceagessseeseeshdeapavee gets as 3 6 NIVO Tr
141. PropECU_SeedChkD11 Determines the directory where the ECU M amp C Path Toolkit expects to find the Seedkey or Checksum DLL If the property is an empty string default the ECU M amp C Toolkit expects the DLLs in the same directory as the A2L file If your DLLs are in a different directory set this property pointing to this directory str mcPropECU_SeedChkD11 Returns the required buffer size to read the Path_Size mcPropECU_SeedChkD11Path property str mcPropECU_SeedKey_Cal Returns the filename of the SeedKey DLL used for Calibration purposes If SeedKey is configured for remote access the output is RSK lt server ip address gt lt port gt u32 mcPropECU_SeedKey_Cal_ Returns the number of bytes to be allocated if Size you call mcGet Property with the parameter mcPropECU_SeedKey_Cal ECU M amp C Toolkit User Manual 6 94 ni com Chapter 6 ECU M amp C API for C Table 6 4 Values for PropertyID Continued Data Type Name Description str mcPropECU_SeedKey_DAQ Returns the filename of the SeedKey DLL used for DAQ purposes If SeedKey is configured for remote access the output is RSK lt server ip address gt lt port gt u32 mcPropECU_SeedKey_DAQ_ Returns the number of bytes to be allocated if Size you call mcGet Property with the parameter mcPropECU_SeedKey_DAQ str mcPropECU_SeedKey_Prog_ Returns the file name of the SeedKey DLL used for programming purposes If See
142. Quest to CLEAR DAQ configuration 0 CLEAR_DAQ_REQ is reset 1 CLEAR_DAQ_REQ is set 4 Unused 5 Unused 6 DAQ_RUNNING Data Transfer 0 The data transfer is not running 1 The data transfer is running 7 RESUME RESUME Mode 0 The slave device is not in RESUME mode 1 The slave device is in RESUME mode The STORE_CAL_REQ flag indicates a pending request to save the calibration data into non volatile memory As soon as the request has been fulfilled the slave will reset the appropriate bit The slave device may indicate this by transmitting an EV_STORE_CAL event packet The STORE_DAQ_ REQ flag indicates a pending request to save the DAQ list setup in non volatile memory As soon as the request has been fulfilled the slave will reset the appropriate bit The slave device may indicate this by transmitting an EV_STORE_DAQ event packet National Instruments 6 137 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C The CLEAR_DAQ_ REQ flag indicates a pending request to clear all DAQ lists in non volatile memory All ODT entries are reset to address 0 extension 0 size 0 and bit_offset FF Session configuration ID is reset to 0 As soon as the request has been fulfilled the slave will reset the appropriate bit The slave device may indicate this by transmitting an EV_CLEAR_DAQ event packet If the slave device does not support the requested mode an ERR_OUT_OF_RANGE is returned The DAQ_RUN
143. RUE if an error occurred This VI will not execute when status is TRUE 5 183 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW 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 Reference out is a copy of the reference in terminal which can be wired through subsequent ECU M amp C VIs Id contains the queried identification string 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 Description 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 MC XCP Get ID vi implements the X
144. RefNum the corresponding ECU name must be referenced in order to access ECU specific properties If RefNum contains an ECURefNum or DAQRefNum the parameter ECUName is ignored and can be set to NULL SizeOfNamesList Size of the buffer provided to take the names list After calling mcGetNamesLength you can allocate an array of size SizeofNamesList and then pass that array to mcGetNames using the same input parameters This ensures that mcGetNames will return all names without error NameList Returns the comma separated list of names specified by Type 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 amp C API to obtain a descriptive string for the return value Description Get a comma separated list of ECU Measurement Characteristic or Event Channel names from a specified A2L database file If using mcGetNames to query the list of supported event channels on an ECU the event channels might be stored inside the ECU instead of the A2L file To query these event channel names from the ECU directly connect to the ECU using mcECUConnect before calling mcGetNam
145. Start Stop vi If no message has been received for one or more channels the warning code 3FF60009 hex is returned in error out If a new message has been received for all channels the success code 0 is returned in error out Unless an error occurs the number of samples returned is equal to number of samples to read If you need to determine the number of channels in the task after initialization get the Number of Channels property for the task reference MC Read Multi Chan Multi Samp 2D Time amp Dbl Returns an array with one entry for each channel initialized in the measurement list Each entry consists of an array of clusters Each cluster corresponds to a received signal for the channels initialized in the measurement list Each cluster contains the sample value and a timestamp that indicates when the measurement channel was received The order of channel entries in samples is the same as the order in the original channel list To use this type you must set the initialized mode to timestamped read The VI does not wait for messages but instead returns samples from the messages received since the previous call to MC DAQ ECU M amp C Toolkit User Manual 5 54 ni com Chapter5 ECU M amp C API for LabVIEW Read vi The number of samples returned is indicated in the number of samples returned output up to a maximum of number of samples to read messages If no new message has been received the number of samples returned is 0 and error out indic
146. Starts or stops transmission of the DAQ lists for the specified Measurement task MC DAQ Write vi Writes samples to a Measurement task MC Database Close vi Closes a specified A2L Database MC Database Create vi Creates an A2L database in memory for using the ECU M amp C Toolkit VIs without access to a valid ASAM A2L file MC Database Open vi Opens a specified A2L Database MC Double to Text vi Converts a numerical value to a text string using an enumeration or range text type scaling MC Download vi Downloads data to an ECU MC ECU Close vi Closes the selected ECU and the associated A2L database MC ECU Connect vi Establishes the communication to the selected ECU through the CCP protocol After a successful ECU Connect you can create a Measurement Task or read write a Characteristic MC ECU Create vi Creates an ECU object in memory MC ECU Deselect vi Deselects an ECU and invalidates the ECU reference handle MC ECU Disconnect vi Permanently disconnects the CCP communication to the selected ECU and ends the calibration session MC ECU Open vi Opens a specified A2L database and selects the first ECU found in the database If there are several ECUs stored in the A2L database use the Database Open and ECU Select VIs MC ECU Select vi Selects an ECU from the names stored in an A2L database MC ECU Set Calibration Page vi Sets the appropriate RAM or ROM calibrat
147. Sub Hierarchy Sub 1 Sub 2 Param Description ECU XCP Cal Pages ECU Access Returns a flag indicating ECU access rights for the memory segment page specified in the segment input 0 N 1 where N is the value returned from the Number of Segments property and page input 0 M 1 where M is the value returned from the Number of Pages property Defined values are 0 ECU access not allowed 1 ECU access allowed without XCP access only 2 ECU access allowed with XCP access only 3 ECU access allowed always ECU M amp C Toolkit User Manual 5 124 ni com Chapter5 ECU M amp C API for LabVIEW Table 5 5 Poly Values for Value Output Continued Sub Hierarchy Type Hierarchy Sub 1 Sub 2 Param Description ECU XCP Cal Pages XCP Read Returns a flag indicating Access XCP Read access rights for the memory segment page specified in the segment input 0 N 1 where N is the value returned from the Number of Segments property and page input 0 M 1 where M is the value returned from the Number of Pages property Defined values are 0 XCP Read access not allowed 1 XCP Read access allowed without ECU access only 2 XCP Read access allowed with ECU access only 3 XCP Read access allowed always National Instruments 5 125 ECU M amp C Toolkit User Manual Chapter 5 ECU M amp C API for LabVIEW Table 5 5 Poly Valu
148. Toolkit User Manual Chapter 4 Using the ECU M amp C API The calling convention is as defined in the WIN32 API Specification for ASAP 1b chapter 2 4 Checksum Algorithm Example The following example shows a possible header file for a library for checksum calculation checksum h Header file for Checksum Algorithm or ifndef _CHECKSUM_H define _CHECKSUM_H ifdef _ cplusplus extern C endif ifndef DllImport define DllImport __declspec dllimport endif ifndef DllExport define D11Export __declspec dllexport endif ifdef CHECKSUMAPI_IMPL only defined by implementor of ChecksumApi define CHECKSUMAPI D11Export __cdecl else define CHECKSUMAPI DllImport __cdecl endif struct TRange char pMem unsigned long lLen F3 ifdef _ cplusplus extern C endif BOOL CHECKSUMAPI CalcChecksum struct TRange ptr int nRanges BYTE pnChecksum int pnSignificant WORD nFlags ifdef _ cplusplus endif endif _CHECKSUM_H ECU M amp C Toolkit User Manual 4 22 ni com Chapter 4 Using the ECU M amp C API Seed and Key and Checksum Algorithms for VxWorks Targets LabVIEW RT users can run the ECU Measurement and Calibration Toolkit on either a LabVIEW RT target such as a PXI controller or an Intel based CompactRIO running the Pharlap operating system which supports Win32 calls or on a PowerPC based CompactRIO controller running a Windriver VxWor
149. U MC XCP Copy Cal Page vi Forces a copy transaction of one calibration page to another MC XCP Get Cal Page vi Queries a calibration page setting MC XCP Get ID vi Queries session configuration or slave device identification MC XCP Get Status vi Queries the current session status from an ECU slave device MC XCP Program Prepares the programming of non volatile memory Prepare vi MC XCP Program Verify vi_ Performs a non volatile memory certification task on the ECU device MC XCP Set Cal Page vi Sets a calibration page ECU M amp C Toolkit User Manual 5 4 ni com Chapter 5 Table 5 1 ECU M amp C API VIs for LabVIEW Continued ECU M amp C API for LabVIEW Mode vi Function Purpose MC XCP Set Request vi Performs a request to save session and device information to non volatile memory MC XCP Set Segment Sets the mode of a specified segment National Instruments ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW MC Build Checksum vi Purpose Calculates a checksum over a defined memory range within the ECU Format ECU ref in ECU ref out address type of checksum block size checksum error in error out Input ECU ref in is the task reference which links to the selected ECU This reference is originally returned from MC ECU Open vi or MC ECU Select vi and then wired through subsequent VIs Address is a cluster which contains the following valu
150. Use the mcStatusToString function of the ECU M amp C API to obtain a descriptive string for the return value Description mcECUSetCalibrationPage tries to identify a single RAM or ROM page on the ECU and select it according to the UseRAM input To identify an appropriate page the function searches for the calibration page information from the A2L file or online information from the ECU If the function identifies a unique calibration page it is activated in the ECU and the function returns success If the function does not identify a unique page an error indicating this is returned and no further action is taken This does not state a fault but just the algorithm s inability to uniquely National Instruments 6 67 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C identify the desired page In this case you can use the calibration page related ECU properties mcGet Property ECU CCP Cal Pages or ECU XCP Cal Pages to gain the information about available calibration pages and manually select the correct page using mcCCPSelectCalPage or mcXCPSetCal Page The mapAddresses parameter activates the address mapping from the ROM page assumed to be the reference page to the target page specified in UseRAM Address mapping is supported for only the CCP protocol and requires a unique ROM and unique RAM page in the A2L file Addresses of measurements and characteristics in the A2L file must point to the ROM page
151. VI such as the Simple Error Handler source identifies the VI where the error occurred Description MC DAQ Clear vi must always be the final ECU M amp C VI called for a Measurement task If you do not use the MC DAQ Clear vi the remaining task configurations can cause problems in execution of subsequent ECU M amp C applications Because this VI clears the Measurement task the Measurement task reference is not wired as an output but is transferred into an ECU reference task handle To change properties of a running Measurement task use MC DAQ Start Stop vi to stop the task MC Set Property vi to change the desired DAQ property and then MC DAQ Start Stop vi to restart the Measurement task again National Instruments 5 43 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW MC DAQ Initialize vi Purpose Initializes a Measurement task for the specified Measurement channel list Format measurement list ECU ref in mode sample rate error in DTO_ID DAQ ref out error out Input E ao ECU M amp C Toolkit User Manual Measurement list is the array of channel names to initialize as a Measurement task Each channel name is provided in an array entry ECU ref in is the task reference which links to the selected ECU This reference is originally returned from MC ECU Open vi or MC ECU Select vi and then wired through subsequent VIs Mode specifies the I O mode for the task For an
152. VI where the error occurred ECU M amp C Toolkit User Manual 5 26 ni com Chapter5 ECU M amp C API for LabVIEW ECU ref out is the same as ECU ref in Wire the task reference to subsequent VIs for this task 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 MC CCP Select Cal Page vi implements the CCP command SELECT_CAL_PAGE The operation of the command depends on the ECU implementation National Instruments 5 27 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW MC CCP Set Session Status vi Purpose Updates the ECU with the current state of the calibration session CCP only Format ECU ref in ECU ref out session status error in error out Input ECU M amp C Toolkit User Manual ECU ref in is the task reference which links to the selected ECU This reference is
153. Value returns a single sample for the Measurement channel initialized in measurement name 5 146 ni com Chapter5 ECU M amp C API for LabVIEW Error out describes error conditions If the Error in cluster indicated an 2H 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 MC Measurement Read vi performs a single point read of a single Measurement from the selected ECU without opening a Measurement task National Instruments 5 147 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW MC Measurement Write vi Purpose Writes a single Measurement value to the ECU Format measurement name ECU ref in value error in ECU ref out error out Input Measurement name is the name of a Measurement channel stored in the A2L database file to which to write a Measurement value ECU ref in is the task reference which links to the selected ECU This
154. Version can be used to query the CCP version implemented in the ECU This command performs a mutual identification of the protocol version in the slave device to agree on a common protocol version mcCCPGetVersion implements the CCP command GET_CCP_VERSION defined by the CCP specification National Instruments 6 19 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C mcCCPMoveMemory Purpose Moves a memory block on the ECU CCP only Format mcTypeStatus mcCCPMoveMemory mcTypeTaskRef ECURefNum mcAddress Source mcAddress Destination u32 BlockSize Input ECURefNum ECURe Num is the task reference which links to the selected ECU This reference is originally returned from mcECUSelectEx Source Configures the source address for the memory move operation in the ECU mcAddress is a C struct consisting of Address Specifies the address part of the source address Extension Extension contains the extension part of the source address Destination Configures the destination address for the memory move operation in the ECU mcAddress is a C struct consisting of Address Specifies the address part of the destination address Extension Extension contains the extension part of the destination address BlockSize BlockSize determines the size of memory block in bytes which should be moved from the source address to the destination address Output Return Value The return value indicates the statu
155. Version_ Returns a comment string for the ECU M amp C Comment software If you received a custom release of ECU M amp C from National Instruments this comment often describes special features of the release National Instruments 6 97 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C Table 6 4 Values for PropertyID Continued Data Type Name Description u32 mcPropGen_Version_ Returns the number of bytes to be allocated if Comment_Size you call mcGet Property with the parameter mcPropGen_Version_Comment u32 mcPropGen_Version_ Returns the major version of the ECU M amp C Major software such as the 1 in version 1 2 5 u32 mcPropGen_Version_ Returns the minor version of the ECU M amp C Minor software such as the 2 in version 1 2 5 u32 mcPropGen_Version_ Returns the update version of the ECU M amp C Update software such as the 5 in version 1 2 5 str mcPropIPAddress Returns the IP address for XCP on Ethernet TCP or UDP as a string u32 mcPropIPAddress_Size Returns the number of bytes to be allocated if you call mcGet Property with the parameter mcPropIPAddress ul6 mcPropIPPort Returns the IP port for XCP on Ethernet TCP or UDP u32 mcPropMeas_Address Returns the address of the selected Measurement in the memory of the control unit u32 mcPropMeas_ByteOrder Returns the specified byte order 0 Intel format Bytes are in little endian order with least significant bit
156. _ALL CCP Command START_STOP_ALL u32 mcPropOptCmd_TEST Returns whether the ECU supports the optional CCP Command TEST u32 mcPropOptCmd_UNLOCK Returns whether the ECU supports the optional CCP Command UNLOCK ECU M amp C Toolkit User Manual 6 102 ni com Chapter 6 ECU M amp C API for C Table 6 4 Values for PropertyID Continued Data Type Name Description ug mcPropPGM_AccessMethod Returns the selected access mode for mcProgram and mcClearMemory 0x00 Absolute Access Mode default The MTA uses physical addresses 0x01 Functional Access Mode The MTA functions as a block sequence number of the new flash content file 0x80 0xFF User defined It is possible to use different access modes for clearing and programming ug mcPropPGM_Compression Method Returns the selected compression method used for mcProgram 0 Data is uncompressed default Ox80 0xFF User defined ug mcPropPGM_Encryption Method Returns the selected encryption method used for mcProgram 0 Data is not encrypted default Ox80 0xFF User defined ug mcPropPGM_Programming Method Returns the selected programming method used for mcProgram 0 Sequential programming default Ox80 0xFF User defined u32 mcPropGroup_IsRoot Returns a nonzero value for Groups being root str mcPropGroup_Comment Returns the comment of the selected Group u
157. _BACK RAM page automatically flashed back 128 FLASH_BACK RAM page that the calibration tool can flash back 256 DEFAULT Page is standard fallback u32 mcPropECU_CCP_ PageAddress Returns the memory address of the page selected with the Name input ug mcPropECU_CCP_ PageAddressExtension Returns the memory address extension of the page selected with the Name input str mcPropECU_Checksum Returns the file name of the Checksum DLL used for verifying the checksum u32 mcPropECU_Checksum_ Size Returns the number of bytes to be allocated if you call mcGet Property with the parameter mcPropECU_Checksum ECU M amp C Toolkit User Manual 6 86 ni com Chapter 6 ECU M amp C API for C Table 6 4 Values for PropertyID Continued Data Type Name Description u32 mcPropECU_CmdByteOrder Returns the byte order for multi byte command parameters O 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 u32 mc PropECU_CRO_ID Returns the CRO ID Command Receive Object which is used to send commands and data from the host to the slave device nctType mcPropECU_CRO_Task NI CAN Task reference to the CAN Task Taskref assigned to the CRO ID u32 mcPropECU_DTO_ID Returns the DTO ID Data Transmission Object which is used by the ECU to respond to CC
158. _RANGE keyword within the A2L file e Read functions return nonscaled numeric values e Write functions accept nonscaled numeric values e Itis possible to use mcDoubleToText and mcTextToDoub1e to convert between range text values and double values 4 Formula The related scaling is based on the FORMULA keyword within the A2L file using a free formula to calculate the values 5 Table Using Interpolation The related scaling is based on the TAB_INTP keyword within the A2L file using interpolation between x y pairs 6 Table Without Interpolation The related scaling is based on the TAB_NOINTP keyword within the A2L file using x y pairs without interpolation ECU M amp C Toolkit User Manual 6 82 ni com Chapter 6 Table 6 4 Values for PropertyID Continued Data Type Name Description u32 mcPropChar_Scale_ TextValues_Size If the scaling type is 2 Enumeration Text or 3 Range Text you can use this property to request the length needed to store the comma separated list of text values that can be converted into raw values refer to the mcPropChar_Scale_TextValues property str mcPropChar_Scale_ TextValues If the scaling type is 2 Enumeration Text or 3 Range Text you can use this property to request the comma separated list of text values that can be converted into raw values u32 mcPropCmd_EXCHANGE_ID Returns whether or not the EXCHANGE_ID comman
159. a DAQ list is running The Program Start function is MC Program Start vi in LabVIEW and mcProgramStart in other languages ECU M amp C Toolkit User Manual 4 14 Figure 4 6 Memory Programming Process Decision Chart ni com National Instruments Chapter 4 Using the ECU M amp C API Clear Memory It might be necessary to clear the memory before it is reprogrammed The details are ECU dependent The Clear Memory function performs the memory clearing operation It is MC Clear Memory vi in LabVIEW or mcClearMemory in other languages Program The Program function actually downloads the new code to the ECU It is MC Program vi in LabVIEW or mcProgram in other languages Program Reset The Program Reset function terminates a programming sequence Note that for the XCP protocol Program Reset performs a hardware reset of the ECU and causes a disconnect You have to reconnect to the ECU using the ECU Connect function to perform further operations The Program Reset function is MC Program Reset vi in LabVIEW and mcProgramReset in other languages Optional Steps for the XCP Protocol XCP Program Prepare An ECU using the XCP protocol might require an XCP PROGRAM_PREPARE command before a programming sequence is started This command can be issued with the XCP Program Prepare function It is MC XCP Program Prepare vi in LabVIEW and mcXCPProgramPrepare in other languages Set XCP Programming Properties XCP allows the programming pr
160. accaad AEE E raabe EEEE A ERRA 4 18 Seed and Key Algorithms isc ceccecissccssiethisessscsuass eed aes a 4 19 Definition for Seed and Key Algorithm eee eee eeeeeeeeeeeees 4 19 Seed and Key Example 00 0 cece ccc ceceseeseceeesseseeeeseeseeeseeseeeaeeaeenes 4 20 Checksum Algorithms i seisein ri irigare pi i 4 21 Seed and Key and Checksum Algorithms for VxWorks Targets 4 23 Chapter 5 ECU M amp C API for LabVIEW Section Headingssnanionain e a a a aSa 5 1 PULPOSC nin ish ei ease NA Ree AAS aE E o a it 5 1 POU ATEST shes eeellees Shasta ed veehesaacepiseaderdseshes 5 1 Inputsand Outputs eiaei ged NE acids ba dh plein bend eens E anaes 5 1 DOSCEIPUON siisi orn n ea r A E ied eaten eel 5 1 National Instruments vij ECU M amp C Toolkit User Manual Contents Eistof Vire deg Rass estes dan soak Sov udh codecs a e acee cea tede ia io A RE la aia MC Build Checksum vi u ccccccccccccssscccesesssscecceesssseecccessnseeeccesesseeecceesssseeeeeees MC Cale Checksum vi sissies ait eee a ee MC CCP Action Service Vinni ennn n n a E MC CCP Diag Service Viesis aesnitistete awed esis T eee ees MC CCP Get Active Cal Page vi issccccisscccsccsescasesesscasseessevesidoesssatsdanescaszesuseesais ME COP Get Res l Virer es Seed E beeen E E TE T cess MC CCP Get Session Status Vinerea oan a na ai MEG CGP G t Version Vi eese e kas Be E E EE ines MC CCP Move Memory iViswissssccssciccscecicscesessahessgsce dessovessdgescendgnesescadeasidessers
161. ace iia eases iad aa See thee du hai oR ah avn 3 6 COP XCRP S py tsiessestess a aa A T AE R E E 3 6 Saving Captured Communication Data 0 0 eee eeeeseeeeeeneeeeees 3 8 Capture Options Sessstes dst sisiatni stn winnie sesiead 3 8 Call History Depthtisccscciscii ees vccsscssiveccentenacodys E AR RR 3 8 Capturing Data sonicne naa i a E R 3 8 Selecting Which CCP and XCP Commands to View 3 8 Chapter 4 Using the ECU M amp C API Structure of the ECU M amp C API croan neo e aa a a ea Eai 4 1 ECU M amp C Channel Functions ssesssesesseeesessseesrestsrrsrsrestssesresesresresesresesresrsee 4 2 What is an ECU Measurement sseesseeeeessreseereresesresreerereserreseee 4 2 What is an ECU Characteristic 0 ee ceeeseceecerereeeeseeneeeeeenees 4 2 ECU M amp C CCP and XCP Functions oo eee ceeeseeseeesecseeeseeeeeseeaeenees 4 3 Basic Programming Models irai dccuscstcoaeedeas e eE E E E 4 3 ECU Openi a E A AA E Aa N 4 5 ASAM MCD 2MC Communication Properties for CCP or XCP with CAN G eane e ae ln he Sas iin a a 4 5 CRO IDo oeda det leat ested beck E tale hea he 4 5 TD TOD ai eee eee Reece 4 5 ECU M amp C Toolkit User Manual vi ni com Contents Staton Address arianas anii a a a a a is 4 5 Bad tate esensia a a e aa IERIE 4 6 ASAM MCD 2MC Communication Properties for XCP With UDP or TCP reornp a heads E a E E ARE 4 6 IP Address or hosth m rec nienie oe aeee i 4 6 Port AUDEN Aat EN sa eta 4 6 ECU Co hectiee oeenn a nde aE AEE E SEEE E E
162. al Instruments 5 177 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW Output ECU ref out is the same as ECU ref in Wire the task reference to subsequent VIs for this task 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 Data is a byte array which receives the uploaded data from the ECU 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 MC Upload vi implements the UPLOAD command A data block of the specified length starting at the specified address is uploaded from the ECU MC Upload vi will set the Memory Transfer Address pointer MTAO to the appropriate value as defined in the Address cluster If you are using the CCP protocol MC Upload vi implements the UPLOAD command A data block of the specified length starting at the specified address is uploaded from the ECU MC Upload vi will set the Memory Transfer Address pointer MTAO to the appropr
163. al clock that copies the most recent value from CAN messages for each sample time The changes in sample values from message to message enable you to view the channel over time such as for comparison with other CAN or DAQ input channels To avoid internal waiting you can use mcGet Property to obtain nctPropSamplesPending property and pass that as the NumberOfSamplesToRead parameter to mcDAQRead If the initialized SampleRate is zero mcDAQRead immediately returns a single sample from the most recent message s received For this single point read you must pass the NumberOfSamplesToRead parameter as 1 You can use the return value of mcDAQRead to determine whether a new message has been received since the previous call to mcDAQRead or mcDAQStartStop Ifno message has been received the warning code CanWarnOldData is returned If a new message has been received the success code 0 is returned If no message has been received since you started the task the default value of the channel nct PropChanDefaultValue is returned in all entries of SampleArray ECU M amp C Toolkit User Manual 6 42 ni com Chapter 6 ECU M amp C API for C mcDAQReadTimestamped Purpose Reads timestamped samples from a DAQ task initialized with the selected mode of mcDAQModeDAQListTimeStamped Format mcTypeStatus mcDAQReadTimestamped mcTypeTaskRef DAQRefNum u32 NumberOfSamplesToRead __int64 TimestampArray double SampleArray u32 NumberOfSamplesRe
164. all channels You can use error out to determine whether a new message has been received since the previous call to MC DAQ Write vi or MC DAQ Start Stop vi If no message has been received for one or more channels the warning code 3FF60009 hex is returned in error out If a new message has been received for all channels the success code 0 is returned in error out Unless an error occurs number of samples returned is one The samples array is indexed by channel and the entry for each channel contains a single sample If you need to determine the number of channels in the task after initialization get the Number of Channels property for the task reference ECU M amp C Toolkit User Manual 5 60 ni com Chapter5 ECU M amp C API for LabVIEW MC Database Close vi Purpose Closes a specified A2L Database Format DB ref in error in error out DB reference in is the task reference from the initial database task VI The task reference is originally returned from MC Database Open vi Error in is a cluster which describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out status is TRUE if an error occurred Unlike other VIs this VI will execute when status is TRUE 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 posi
165. alue 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 amp C API to obtain a descriptive string for the return value Description mcECUDeselect deselects the ECU and clears all internal driver data stored for this ECU After calling this function it is no longer possible to communicate with the specified ECU The task reference ECURefNunm Is transferred into a database handle DBRefNum ECU M amp C Toolkit User Manual 6 62 ni com Chapter 6 ECU M amp C API for C mcECUDisconnect Purpose Disconnects CCP or XCP communication to the selected ECU Format mcTypeStatus mcECUDisconnect mcTypeTaskRef ECURefNum Input ECURe Num ECURefNunm is the task reference which links to the selected ECU This reference is originally returned from mcECUSelectEx Output 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 fun
166. ame ASAP1A CCP_ComputeKeyFromSeed todo replace the prefix ccpecu_ by the name of your module in lower case letters define SEED KEY NAME ccpecu_ASAP1A_CCP_ComputeKeyFromSeed brief defines the name of the Checksum function Here the name of the Checksum function is defined The name of the Checksum function is the name of the module in lower case letters followed by an underscore and the function name CalcChecksum todo replace the prefix ccpecu_ by the name of your module in lower case letters define CALC_CHECKSUM_NAME ccpecu_CalcChecksum struct TRange char pMem unsigned long l1Len a ifdef _ cplusplus extern C endif ECU M amp C Toolkit User Manual 4 24 ni com Chapter 4 Using the ECU M amp C API brief Function to calculate a key from a given seed to unlock an ECU resource This function calculates a key from a given seed so that you are able to unlock the access to an ECU resource The seed is generated by the ECU and needs to be queried before you can unlock an ECU resource bool SEED_KEY_NAME Seed provided by the ECU Size of the seed provided by the ECU Pointer to a buffer to return the key Size of the buffer provided to return the key returns the size of the calculated key unsigned char Seed lt unsigned short SizeSeed lt unsigned char Key lt unsi
167. an no longer change the configuration of the Measurement task with Set Property MC DAQ Start Stop vi is implicitly performed by DAQ Clear to stop transmission of the DAQ lists 4 10 ni com Chapter 4 Using the ECU M amp C API The function to start a DAQ list is MC DAQ Start Stop vi in LabVIEW or mcDAQStartStop in C DAQ Read The application must call the DAQ Read function to obtain floating point samples The application typically calls DAQ Read in a loop until done The Read function is MC DAQ Read vi in LabVIEW all types that do not end in Time amp Dbl or mcDAQRead in other languages The behavior of Read depends on the initialized sample rate and the selected mode sample rate 0 DAQ Read returns a single sample from the most recent message s received from the network One sample is returned for every channel in the DAQ Initialize list Figure 4 4 shows an example of DAQ Read with a sample rate 0 A B and C represent messages for the initialized channels def represents the default value 0 If no message is received after the start of the application the default value 0 is returned along with a warning Start Y y y def A C Read Read Read Figure 4 4 Example of Read With Sample Rate 0 National Instruments 4 11 ECU M amp C Toolkit User Manual Chapter 4 ECU M amp C Toolkit User Manual Using the ECU M amp C API sample
168. aptures all STIM list ECU slave stimulation commands 3 8 ni com Using the ECU M amp C API This chapter helps you get started with the ECU M amp C API Structure of the ECU M amp C API The ECU M amp C API is divided into three main function categories the high level Channel based functions and the generic low level CCP and XCP functions The ECU M amp C Channel functions provide an easy way to access ECU internal data through named channels The ECU M amp C CCP functions provide direct access to the CCP commands on a very low programming level The ECU M amp C XCP functions provide direct access to the XCP commands on a very low programming level Figure 4 1 outlines the three function categories ECU M amp C Toolkit y y y Channel Functions CCP Functions XCP Functions y Database Task y ECU Task Y Yy y Yy Yy Measurement Rw DAQ Task Characteristic Rw CCP Commands XCP Commands Figure 4 1 ECU Architectural Overview National Instruments 4 1 ECU M amp C Toolkit User Manual Chapter 4 Using the ECU M amp C API ECU M amp C Channel Functions ECU M amp C Toolkit User Manual With the ECU M amp C Channel functions there are a number of ways to access memory content in an ECU The starting point is always the creation of a database task which is the link to a valid ASAM MCD 2MC database file A2L file and the selection of the protocol
169. ask reference that links to the selected ECU This reference is originally returned from MC ECU Open vi or MC ECU Select vi and then wired through subsequent VIs object type is a U32 ring that indicates the type of the object named in object name Valid values are EG 1 Measurement Name 2 Characteristic Name value is the numerical value to be converted For example this could have been returned from MC Characteristic Read vi or MC Measurement Read vi Error in is a cluster which describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out H E status is TRUE if an error occurred This VI will not execute when status is TRUE code is the error code number identifying an error A value of 0 means success A negative value means error VI did not execute National Instruments 5 67 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW 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 ECU ref out is the same as ECU ref in Wire the task reference to subsequent VIs for this task TextValue is the resulting converted text string If the value specified is
170. asurement data and corresponds to the selected DataType Data Format DataSize Unsigned byte Signed byte Unsigned word 1 1 2 Signed word 2 Unsigned long 4 Signed long 4 4 Float 32 ConversionName ConversionName identifies the referred conversion object that mcConversionCreate defines Output 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 amp C API to obtain a descriptive string for the return value Description Use mcMeasurementCreate to create a measurement object in memory instead of referring to a predefined measurement in the A2L database National Instruments 6 105 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C mcMeasurementRead Purpose Reads a single Measurement value from the ECU Format mcTypeStatus mcMeasurementRead mcTypeTaskRef ECURefNum char MeasurementName 64 Value Input ECURefNum ECURefNum is the task reference which links to the selected ECU This reference is originally returned from mcECUSelectEx MeasurementName MeasurementName is the name of a Measurement channel stored in t
171. asurement in the A2L database 0 Unknown The type of the scaling could not be derived from the A2L file content 1 Rational Function The related scaling is based on a rational function of second order This also covers the linear scaling given by factor and offset 2 Enumeration Text The related scaling is based on the COMPU_VTAB keyword within the A2L file e Read VIs return nonscaled numeric values e Write VIs accept nonscaled numeric values ECU M amp C Toolkit User Manual 5 140 ni com Chapter5 ECU M amp C API for LabVIEW Table 5 5 Poly Values for Value Output Continued Sub Hierarchy Type Hierarchy Sub 1 Sub 2 Param Description e Itis possible to use MC Double to Text vi and MC Text To Double vi to convert between enumeration text values and double values 3 Range Text The related scaling is based on the COMPU_VTAB_RANGE keyword within the A2L file e Read VIs return nonscaled numeric values e Write VIs accept nonscaled numeric values e Itis possible to use MC Double to Text vi and MC Text To Double vi to convert between range text values and double values 4 Formula The related scaling is based on the FORMULA keyword within the A2L file using a free formula to calculate the values National Instruments 5 141 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW Table 5 5 Poly Values f
172. at of each VI Input and Output The input and output parameters for each VI are listed Description The description section gives details about the purpose and effect of each VI List of Vis The following table is an alphabetical list of the ECU M amp C Toolkit VIs Table 5 1 ECU M amp C API VIs for LabVIEW Function Purpose MC Build Checksum vi Calculates a checksum over a defined memory range within the ECU MC Calc Checksum vi Calculates the checksum of a data block in memory MC CCP Action Service vi Calls an implementation specific action service on the ECU National Instruments 5 1 ECU M amp C Toolkit User Manual Chapter 5 ECU M amp C API for LabVIEW Table 5 1 ECU M amp C API VIs for LabVIEW Continued Function Purpose MC CCP Diag Service vi Calls a diagnostic service on the ECU MC CCP Get Active Cal Page vi Retrieves the ECU Memory Transfer Address pointer to the calibration data page MC CCP Get Result vi Uploads requested data MC CCP Get Session Status vi Retrieves the current calibration status of the ECU MC CCP Get Version vi Retrieves the version of the CCP implemented in the ECU MC CCP Move Memory vi Moves a memory block on the ECU MC CCP Select Cal Page vi Sets the beginning of the calibration data page MC CCP Set Session Status vi Updates the ECU with the current state of the calibration session
173. ata type listed in the description of the property Value Provides the property value PropertyId determines the data type of the value Output 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 amp C API to obtain a descriptive string for the return value ECU M amp C Toolkit User Manual 6 112 ni com Chapter 6 ECU M amp C API for C Description There are four types of properties which can be modified in the poly input value ECU specific properties DAQ specific properties Characteristic specific properties and Measurement specific properties ECU Specific Properties You cannot set an ECU property while the application is connected to the ECU If you need to change a ECU property prior to connecting call mcECUSelectEx followed by mcSetProperty and then mcECUConnect After you connect to the ECU you also can change a property by calling mcECUDisconnect followed by mcSet Property and then mcECUConnect to restart the task Table 6 5 contains a listing of ECU specific values for PropertyID DAQ Specific Properties You cannot set a DAQ property wh
174. ates success Because the timing of values in samples is determined by when the message is received the sample rate input is not used with this poly VI type To determine the number of channels in the task after initialization get the Number of Channels property for the task reference MC Read NChan NSamp Time Value XY Array Returns an array of clusters with one entry for each channel initialized in the measurement list Each entry consists of a cluster of a timestamp array and a value double array The timestamp and value arrays have N data points each one for each sample returned The timestamp sample indicates when the respective measurement sample was received The order of channel entries in samples is the same as the order in the original channel list You can wire the output of this type directly to a LabVIEW XY graph display To use this type you must set the initialized mode to timestamped read The VI waits for Number of samples messages The number of samples returned is indicated in the number of samples returned output up to a maximum of number of samples to read messages If no new message has been received the number of samples returned is 0 and error out indicates success To avoid blocking use mcPropDAQ_SamplesPending to check the number of available data points Because the timing of values in samples is determined by when the message is received the sample rate input is not used with this poly VI type To determine the n
175. ation 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 4 5 ECU M amp C Toolkit User Manual Chapter 4 Using the ECU M amp C API Baudrate The baudrate property may be missing in an A2L database file and can be set explicitly within the application This property provides the baud rate at which communication will occur and applies to all tasks initialized with the interface You can specify one of the predefined baud rates or specify advanced baud rates which refer to the settings of the Bit Timing Register 0 BTRO and 1 BTR1 For more information refer to the Interface Properties dialog in MAX or the NJ CAN Hardware and Software Manual The baud rate is originally set within MAX ASAM MCD 2MC Communication Properties for XCP with UDP or TCP ECU Connect ECU M amp C Toolkit User Manual If the XCP communication properties are not stored in the ASAM MCD 2MC file the communication properties must be manually set To establish communication through XCP with UDP or TCP the target ECU slave should be addressed by setting the following properties IP Address or hostname The JP address refers to the identifier for a computer or device on a TCP IP network Networks using the TCP IP protocol route messages ba
176. bitfile that handles the CAN communication between the host system and FPGA To access the CAN module on the FPGA you must specify the bitfile name after the for example CCP CAN1 MyBitfile lvbitx To specify a special RIO target you can specify that target by its name followed by the bitfile name for example XCP CAN1 RIO1 MyBitfile lvbitx Currently only a single CAN interface is supported RJO defines the RIO target name as defined in your LabVIEW Project definition The vbitx filename represents the filename and location of the bitfile on the host You may use just the filename without the folder if the bitfile is in the same folder as the LabVIEW Project vproj DB reference in is the task reference which links to the opened database file ECU name is the ECU name to select out of a A2L Database file with which to initialize all subsequent tasks Error in is a cluster which describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out status is TRUE if an error occurred This VI will not execute when status is TRUE 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 clust
177. bl Returns a single sample for the first channel initialized in channel list If the initialized sample rate is greater than zero this poly VI type waits for the next sample time and then returns a single sample This enables you to execute a control loop at a specific rate If the initialized sample rate is zero this poly VI immediately returns a single sample The samples output returns a single sample from the most recent message received If no message has been received since you started the task the value of 0 is returned in samples You can use error out to determine whether a new message has been received since the previous call to MC DAQ Read vi or MC DAQ Start Stop vi If no message has been received the warning code 3FF60009 hex is returned in error out If a new message has been received the success code 0 is returned in error out Unless an error occurs number of samples returned is one NChan 1Samp 1D Dbl Returns an array one entry for each channel initialized in channel list Each entry consists of a single sample The order of channel entries in samples is the same as the order in the original channel list If the initialized sample rate is greater than zero this poly VI type waits for the next sample time then returns a single sample for each channel This enables you to execute a control loop at a specific rate If the initialized sample rate is zero this poly VI immediately returns a single sample for each channel The sam
178. c Write vi in LabVIEW or mcCharacteristicWrite in C Before writing a Characteristic it may be helpful to verify the dimension of the Characteristic based on the definition in the ASAM MCD 2MC database file Depending on the dimension of the Characteristic use the appropriate Write function for writing a double a 1D array of doubles or a 2D array of doubles The function to verify a dimension of a named Characteristic is MC Get Property vi with the parameter Characteristic Dimension in LabVIEW or mcGet Property with the parameter mcPropChar_Dimension in C 4 8 ni com Chapter 4 Using the ECU M amp C API Measurement Task To create a Measurement task you need to select available Measurement signals from an ASAM MCD 2MC database file Create a valid ECU Reference handle as described in the Access Characteristics section The flowchart in Figure 4 3 shows the process to perform an ECU Measurement task A description of each step in the decision process follows the flowchart ECU DAQ Init ECU DAQ Start Stop DAQ list or ECU DAQ Writ Polling mode ene ECU DAQ Read ECU DAQ Clear ECU Close Figure 4 3 ECU Measurement Setup Flowchart National Instruments 4 9 ECU M amp C Toolkit User Manual Chapter 4 Using the ECU M amp C API ECU M amp C Toolkit User Manual DAQ Initialize The DAQ Initialize function initializes a list of Measurement channels as a single Measuremen
179. cCCPGetResult Uploads data from the ECU when the Memory Transfer Address pointer 0 MTAO has been set ECU M amp C Toolkit User Manual 6 2 ni com Chapter 6 ECU M amp C API for C Table 6 2 Functions for the ECU M amp C API for C Continued Function Purpose mcCCPGetSessionStatus Retrieves the current status of the Calibration Session mcCCPGetVersion Retrieves CCP version implemented in the ECU mcCCPMoveMemory Moves a memory block on the ECU mcCCPSelectCalPage Sets the specified address to be the start address of the calibration data page mcCCPSetSessionStatus Updates the ECU with the current state of the calibration session mcCharacteristicRead Reads all data from a named Characteristic on the ECU which is identified by the ECU Reference handle mcCharacteristicReadSi Reads a single value from a named Characteristic on the ECU ngleValue which is identified by the ECU Reference handle mcCharacteristicWrite Downloads data to a Characteristic for a selected ECU mcCharacteristicWriteS Writes a single value to a named Characteristic on the ECU ingleValue mcClearMemory Clears the contents of the specified ECU memory mcConversionCreate Creates a signal conversion object in memory mcDAQClear Stops communication for the Measurement task and clears the task mcDAQInitialize Initializes a Measurement task for the specified Measurement channel list mc
180. can be read back with the mcDAQRead as Single point data using sample rate 0 or as waveform using a sample rate gt 0 Input channel data is received from the DAQ messages ECU M amp C Toolkit User Manual 6 38 ni com Chapter 6 ECU M amp C API for C mcDAQModePolling In this mode the data from the Measurement task are uploaded from the ECU whenever mcDAQRead is called DTO_ID DTO_ID is the CAN identifier for the Data Transmission Object DTO used to transmit the data from the DAQ lists to the host The default value is 1 which means that the DTO ID used to transmit the DAQ list data is the same that is used for the rest of the CCP communication SampleRate SampleRate specifies the timing to use for samples of the NI CAN task The sample rate is specified in Hertz samples per second A sample rate of zero means to sample immediately For a DAQMode of mcDAQModeDAQList SampleRate of zero means that mcDAQRead returns a single sample from the most recent messages received and greater than zero means that mcDAQRead returns samples timed at the specified rate For DAQMode of mcDAQModePolling SampleRate is ignored Output DAQRef Num DAQRefNum is the reference handle for the Measurement task Use this Measurement task reference in subsequent M amp C DAQ functions for this task 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 n
181. ccurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out HEE E status is TRUE if an error occurred This VI will not execute when status is TRUE 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 Ec source identifies the VI where the error occurred ECU M amp C Toolkit User Manual 5 92 ni com Chapter5 ECU M amp C API for LabVIEW ECU ref out is the same as ECU ref in Wire the task reference to subsequent VIs for this task 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 so
182. ccurs which triggers a DAQ list in data stimulation mode the buffered data is transferred to the memory on the slave device Refer to the ASAM XCP Part 2 Protocol Layer Specification for more information on how to configure data stimulation National Instruments 6 49 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C mcDatabaseClose Purpose Closes a specified A2L Database Format mcTypeStatus mcDatabaseClose mcTypeTaskRef DBRefNum Input DBRefNum DBRefNum is the task reference from the initial database task function The database task reference is originally returned from mcDatabaseOpen Output 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 amp C API to obtain a descriptive string for the return value Description mcDatabaseClose must always be the final ECU M amp C function called for each database task If you do not use the mcDatabaseClose function the remaining task configurations can cause problems in the execution of subsequent Measurement and Calibration applications ECU M amp C Toolkit User Manual 6 50 ni com C
183. ce For example you might use this to set CAN properties for this task Handle with extreme care as those properties are usually set correctly by the ECU M amp C Toolkit itself National Instruments 5 107 ECU M amp C Toolkit User Manual Chapter 5 ECU M amp C API for LabVIEW Table 5 5 Poly Values for Value Output Continued Hierarchy Sub Hierarchy Sub 1 Sub 2 Param Description ECU CCP ID Returns the slave device identifier This ID information is optional and specific to the ECU implementation For more information about the CCP slave ID refer to the documentation for the ECU ECU CCP ID Data Byte Returns a data type qualifier of the slave device identifier This ID information is optional and specific to the ECU implementation For more information about the CCP slave ID refer to the documentation for the ECU ECU CCP Interface Returns the interface initialized for the task such as with MC DAQ Initialize vi Eus ECU CCP Master ID Returns CCP Master ID information This ID information is optional and specific to the ECU implementation For more information about the CCP master ID refer to the documentation for the ECU ECU CCP SeedKey Cal Name Returns the filename of the SeedKey DLL used for Calibration purposes If SeedKey is configured for remote access the output is RSK lt serve
184. ce CAN or LIN connector port The Boolean property supports two values TRUE Termination ON and FALSE Termination Off However different CAN or LIN hardware has different termination requirements and the termination values have different meanings Refer to the Termination attribute in the XNET API for more details This property is supported for NI XNET devices only National Instruments 5 163 ECU M amp C Toolkit User Manual Chapter 5 ECU M amp C API for LabVIEW Table 5 6 ECU Specific Property Value Types for the POLY Input Value Continued Hierarchy Sub Hierarchy Sub 1 Sub 2 Param Description ECU CCP Station Address Sets the Station Address of the slave device 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 ECU TE CCP Misc Skip EXCHANGE ID Sets whether or not the CCP command EXCHANGE_ID should be suppressed during connection to the ECU ECU A CCP ACTION SERVICE Optional Commands Sets whether the ECU supports the optional ASAM CCP Command ACTION_SERVICE ECU TE CCP BUILD CHECKSUM
185. ceNo u8 Params 4 u8 ResultLength u8 DataType Input ECURefNum ECURefNum is the task reference which links to the selected ECU This reference is originally returned from mcECUSelectEx ServiceNo ServiceNo determines the service that is executed inside the ECU For more information about the services that are implemented in the ECU refer to the documentation for the ECU Params Params passes the parameters of the service function as an array of bytes to the ECU Since the parameters and their data types are specific to the ECU implementation you are responsible of providing the required parameters in the correct byte ordering Output ResultLength ResultLength indicates the amount of data that can be uploaded from the ECU as a result of the execution of the service The result of this service can be accessed by calling the function mcCCPGetResult right after mcCCPActionService DataType DataType is a data type qualifier that determines the data format of the result 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 amp C API to obtain a descriptive strin
186. cessary size of this buffer If you do not know up front how long your text could become specify a buffer of 256 bytes This is the maximum the ASAM standard allows 6 53 ECU M amp C Toolkit User Manual Chapter 6 Output ECU M amp C API for C TextValue The buffer for the resulting converted text string If the value specified is listed in a COMPU_VTAB scaling for the characteristic or measurement specified in ObjectName the respective text is returned If no such value is available a string representation of the double value is returned 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 amp C API to obtain a descriptive string for the return value Description mcDoubleToText performs text conversion for measurement or characteristic values Especially if the measurement or characteristic has an associated COMPU_VTAB type scaling the textual representation of the value is returned If no such value is present either because the object does not have a text scaling or the value does not have a textual representation in the table a string representation of
187. ch a way that they build independent and unambiguously distinguishable communication channels The ECU M amp C Toolkit abstracts the XCP communication layer so that it is transparent to the user For most cases it is sufficient that the underlying XCP communication is handled by the toolkit kernel Nevertheless the ECU M amp C Toolkit offers direct access to the low level XCP commands if a non standard timing behavior or independent user defined command sequence is required XCP Protocol Version The ECU M amp C Toolkit supports the XCP Calibration Protocol Specification version 1 0 For further information related to the XCP protocol refer to the XCP Calibration Protocol Specification version 1 0 The Universal Measurement and Calibration Protocol Family Part 1 by ASAM e V National Instruments 1 3 ECU M amp C Toolkit User Manual Chapter 1 Introduction Measurement and Calibration Databases The ASAP description file ASAP2 or ASAM MCD 2MC is used to describe the ECU internal memory configuration An ASAM MCD 2MC description file with the file extension A2L contains information and access locations for the relevant data objects in the ECU such as e Project relevant information e ECU data structure e Conversion procedures for representation in physical units e Descriptions of the available Measurement channels inside the ECU e Descriptions of the available Characteristics inside the ECU e Descriptions of how to acc
188. command should be suppressed during connection to the ECU u32 mcPropCROID Sets the CRO CAN Identifier Command Receive Object for CCP or XCP on CAN which is used to send commands and data from the host to the slave device u32 mcPropDTOID Sets the DTO CAN Identifier Data Transfer Object for CCP or XCP on CAN which is used to send commands and data from the slave device to the host ECU M amp C Toolkit User Manual 6 114 ni com Chapter 6 ECU M amp C API for C Table 6 5 ECU Specific Value Types for the PropertylD Input Value Continued Data Type Name Description u32 mcPropECU_BaudRate Sets the 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 BTRO and XX is the value of Bit Timing Register 1 BTR1 For more information refer to the Interface Properties dialog in MAX The value of this property is originally set within MAX but it can be changed using mcSet Property u32 mcPropECU_ByteOrder Sets the Byte Order of the slave device O MSB_LAST The Slave device uses the MSB_LAST Intel byte ordering 1 MSB_FIRST The Slave device uses the MSB_
189. controls are available in the LabVIEW palettes In LabVIEW the ECU M amp C Toolkit palette is located e Within the All Functions palette for LabVIEW 7 1 e Within the Addons palette for LabVIEW 8 0 and 8 1 The reference for each ECU M amp C Toolkit API function is in Chapter 5 ECU M amp C API for LabVIEW To access the reference for a function from within LabVIEW press lt Ctrl H gt to open the Help window click the appropriate ECU M amp C function and then follow the link The ECU M amp C Toolkit software includes a full set of examples for LabVIEW These examples teach programming basics as well as advanced topics The example help describes each example and includes a link you can use to open the VI Within LabWindows CVI the ECU M amp C Toolkit function panel is in Libraries ECU Measurement and Calibration Toolkit Like other LabWindows CVI function panels the ECU M amp C Toolkit function panel provides help for each function and the ability to generate code The reference for each API function is located in Chapter 6 ECU M amp C API for C You can access the reference for each function directly from within the function panel The header file for the ECU M amp C Toolkit APIs is niemc h The library for the ECU M amp C Toolkit APIs is niemcc 1ib 3 1 ECU M amp C Toolkit User Manual Chapter 3 Application Development Visual C 6 ECU M amp C Toolkit User Manual The toolkit software includes a full set of examples for
190. ct Descriptor Table A list of elements variables used for organization of data acquisition DAQ PacketID The first byte of a DTO corresponding to the ODT to which the DTO is assigned The values for DAQ list PIDs range from 0x00 0xFD The PIDs OxFE and OxFF are reserved for Event Messages and Command Return Messages A factor defined to allow reduction of the desired transmission rate The prescaler is applied to the Event Channel The prescaler value factor must be greater than or equal to 1 A Dynamic Link Library that implements a function to calculate a key to a given seed to unlock access to ECU resources An ECU specific array of bytes used by the master device to identify the ECU A property which specifies an address to generate a logical point to point connection with a selected slave station for the master slave command protocol One ECU may support several station addresses An identifier returned as an output parameter of Database ECU or Measurement initialization functions G 5 ECU M amp C Toolkit User Manual Index A accessing Characteristics 4 7 activating the ECU toolkit home computer use 2 4 moving software after installation 2 4 online activation 2 4 privacy policy 2 4 procedure 2 2 terms defined 2 3 volume licensing 2 4 activating your software xv additional programming topics 4 16 generic CCP functions 4 17 generic XCP functions 4 18 Get Names 4 16 seed and key algorithm 4 1
191. ction performed as expected but a condition arose that may require attention Use the mcStatusToString function of the ECU M amp C API to obtain a descriptive string for the return value Description mcECUDisconnect implements the CCP or XCP command DISCONNECT mcECUDisconnect disconnects the specified CCP or XCP slave from the actual communication and ends the calibration session When the calibration session is terminated all CCP or XCP DAQ lists of the device are stopped and cleared and the protection masks of the device are set to their default values mcECUDisconnect is an optional command as disconnecting from the ECU is performed by the function mcECUDeselect National Instruments 6 63 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C mcECUSelectEx Purpose Selects an ECU from the names stored in an A2L database Format mcTypeStatus mcECUSelectEx mcTypeTaskRef DBRefNum cstr ECUName cstr Interface mcTypeTaskRef ECURefNum Input DBRefNum DBRefNun is the task reference from the initial database task function The database task reference is originally returned from mcDatabaseOpen ECUName ECUName is the selected ECU name out of an A2L Database file with which to initialize all subsequent tasks Interface Specifies the protocol and optional interface to use for this task Output ECURefNum ECURefNum is the task reference which links to the selected ECU Return Value
192. cts the ECU and closes the remaining database reference handle MC ECU Close vi must always be the final M amp C VI If you do not use MC ECU Close vi the remaining task configurations can cause problems in the execution of subsequent M amp C applications If you just want to deselect the ECU connections call MC ECU Deselect vi ECU M amp C Toolkit User Manual 5 72 ni com Chapter5 ECU M amp C API for LabVIEW MC ECU Connect vi Purpose Establishes the communication to the selected ECU through the CCP or XCP protocol After a successful ECU Format Connect you can create a Measurement Task or read write a Characteristic ECU ref in ECU ref out error in error out National Instruments ECU ref in is the task reference which links to the selected ECU This reference is originally returned from MC ECU Open vi or MC ECU Select vi and then wired through subsequent VIs Error in is a cluster which describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out status is TRUE if an error occurred This VI will not execute when status is TRUE 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 descriptio
193. curring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out He status is TRUE if an error occurred This VI is not executed when status is TRUE 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 ECU M amp C Toolkit User Manual 5 150 ni com Chapter5 ECU M amp C API for LabVIEW ECU ref out is the same as ECU ref in Wire the task reference to subsequent VIs for this task 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 identi
194. d contents on the remote RT target while the lower section gives information for the host or local machine To copy a file TestECU a21 for instance to the RT target complete the following steps referring to Figure 2 4 for details 1 Inthe Current Directory section navigate through the tree structure to the System folder 2 Inthe local directory section navigate through the tree structure to the location of the file you want to transfer and highlight the file 3 Click the To Remote button to copy the file 2 8 ni com i gt File Transfer Target IP Address 10 0 47 69 Current Remote Directory Chapter 2 INI RT SYSTEM Installation and Configuration LABVIEW DATA STARTUP ERRORS ETHERNET lt D niemc dil D niemcazl aml D niemcazl dll D nipalp dll D nipalpg dll D nirpe dll PY one imi lt 143360 24263 294912 350812 3584 41050 maa Current Local Directory C Program Files National Instruments LabVIEW 7 0examples ECUMC express File general LabVIEW D MCAdvancedExamples lib D McBasicExamples lib D MccharacteristicsEditors llb D ReadMe txt D TestECU a2l M Te etre ot lt 576487 131098 684092 1119 6 9 20 6 9 20 6 9 20 6 9 20 Select All Figure 2 4 Transferring Files With the FTP Utility You also can use LabVIEW to programmatically access the FTP server of a LabVIEW Real Time target T
195. d ASAM MCD 2MC database file with the A21 file extension and the selection of a stored ECU name The required parameters are the ASAM MCD 2MC database path and filename and the dedicated CAN interface if you are using CCP or XCP with CAN The CAN interface is used for communication with the ECU If you are using XCP with UDP or TCP a port number and IP address or hostname must be defined in the A2L database The function to open and select an ECU is MC ECU Open vi in LabVIEW or mcDatabaseOpen followed by mcECUSelectEx in C 3 Note The import of ASAM MCD 2MC database files into MAX is not supported ASAM MCD 2MC Communication Properties for CCP or XCP with CAN National Instruments If your ASAM MCD 2MC database file already contains communication properties you can directly open the communication to your selected ECU If the communication properties are not stored in the ASAM MCD 2MC file the communication properties must be manually set To establish communication through CCP or XCP with CAN the target ECU slave should be addressed by setting the following properties CRO ID The CRO ID Command Receive Object is used to send commands and data from the host to the slave device DTO ID The DTO ID Data Transmission Object is used by the ECU to respond to CCP commands and to send data and status information to the CCP master Station Address CCP is based on the idea that several ECUs can share the same CAN Arbitr
196. d should be suppressed during connection to the ECU u32 mc PropCROID Returns the CRO CAN Identifier Command Receive Object for CCP or XCP on CAN which is used to send commands and data from the host to the slave device u32 mcPropDAQ DTO_ID Returns the DTO ID Data Transmission Object which is used by the ECU to respond to send data from the DAQ lists to the CCP master nctType Taskref mcPropDAQ_DTO_Task NI CAN task reference to the CAN Task assigned to the DTO ID of the Measurement task str mcPropDAQ_EventChannel Name Returns the selected event channel name to which the Measurement task is assigned u32 mcPropDAQ_EventChannel Name_Size Returns the number of bytes to be allocated if you call mcGet Property with the parameter EventChannelName mcPropDAQ National Instruments 6 83 ECU M amp C API for C ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C Table 6 4 Values for PropertyID Continued Data Type Name Description u32 mcPropDAQ_ Mode Returns the selected mode of an M amp C Measurement task 0 DAQ List The data is transmitted from the ECU in equidistant time intervals as defined in the A2L database The data can be read back with mcDAQRead as Single point data using sample rate 0 or as waveform using a sample rate gt 0 Input channel data is received from the DAQ messages Use mcDAQRead to obta
197. d to one or more slave devices The host must establish a logical point to point connection to the slave device before the slave device may accept commands from the host The slave device must acknowledge each command received from the host within a specified time after the connection between host and slave has been established CCP defines two function sets one for control memory transfer and one for data acquisitions that are independent of each other and may run asynchronously The control commands are used to carry out functions in the slave device and may use the slave to perform tasks on other devices The data acquisition commands are used for continuous data acquisition from a slave device The devices continuously transmit internal data according to a list that has been configured by the host Data acquisition is initiated by the host then executed by the slave device and may be based on a fixed sampling rate or be event driven The communication of controllers with a master device through CCP is based on the CAN 2 0B standard 11 bit and 29 bit identifier which includes 2 0A 11 bit identifier for data acquisition from the controllers memory transfers to the controllers and control functions in the controllers for calibration The ECU M amp C Toolkit abstracts the CCP communication layer so that it is transparent to the user For most cases it is sufficient that the underlying CCP communication is handled by the toolkit kernel
198. dKey is configured for remote access the output is RSK lt server ip address gt lt port gt u32 mcPropECU_SeedKey_ Returns the number of bytes to be allocated if Prog_Size you call mcGet Property with the parameter mcPropECU_SeedKey_Prog str mcPropECU_SeedKey_XCP Returns the file name of the SeedKey DLL for XCP If SeedKey is configured for remote access the output is RSK lt server ip address gt lt port gt str mc PropECU_LogFileName Returns the filename full path where the CCP or XCP protocol traffic is logged in ASCII format for debugging purposes An empty path indicates no logging default Note that on RT and cRIO systems the logfile is created on the target system and must be transferred to the host after logging has been completed Note that no additional CAN port is used for the logging which makes this method superior to any other method such as running a bus monitor parallel u32 mcPropECU_LogFileName_ Returns the size of the buffer needed to retrieve Size the mcPropECU_LogFileName property u32 mcPropECU_SeedKey_XCP__ Returns the number of bytes to be allocated if Size you call mcGet Property with the parameter mcPropECU_SeedKey_xXCP National Instruments 6 95 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C Table 6 4 Values for PropertyID Continued Data Type Name Description ug mcProp
199. defined for this Characteristic in the A2L database 0 Unknown The scaling type could not be derived from the A2L file content 1 Rational Function The related scaling is based on a rational function of second order This covers also the linear scaling given by factor and offset 2 Enumeration Text The related scaling is based on the COMPU_VTAB keyword within the A2L file e Read VIs return nonscaled numeric values e Write VIs accept nonscaled numeric values ECU M amp C Toolkit User Manual 5 130 ni com Chapter5 ECU M amp C API for LabVIEW Table 5 5 Poly Values for Value Output Continued Sub Hierarchy Type Hierarchy Sub 1 Sub 2 Param Description e Itis possible to use MC Double to Text vi and MC Text To Double vi to convert between enumeration text values and double values 3 Range Text The related scaling is based on the COMPU_VTAB_RANGE keyword within the A2L file e Read VIs return nonscaled numeric values e Write VIs accept nonscaled numeric values e Itis possible to use MC Double to Text vi and MC Text To Double vi to convert between range text values and double values 4 Formula The related scaling is based on the FORMULA keyword within the A2L file using a free formula to calculate the values National Instruments 5 131 ECU M amp C Toolkit User Manual Chapter 5 ECU M amp C API for LabVIEW Tabl
200. e 7 mcTypeGroup_MeasurementNames Returns a list of Measurement names within the specified Group 8 mcTypeGroup_CharacteristicNames Returns a list of Characteristic names within the specified Group 9 mcTypeFuncNames Returns a list of Function names within the specified ECU 10 mcTypeFunc_DefCharacNames Returns a list of Characteristic names referred by the DEF_CHARACTERISTIC keyword within the related Function 11 mcTypeFunc_RefCharacNames Returns a list of Characteristic names referred by the REF_CHARACTERISTIC keyword within the related Function 12 mceTypeFunc_InMeasNames Returns a list of Measurement names referred by the IN_MEASUREMENT keyword within the related Function 13 mcecTypeFunc_OutMeasNames Returns a list of Measurement names referred by the OUT_MEASUREMENT keyword within the related Function 14 mceTypeFunc_LocMeasNames Returns a list of Measurement names referred by the LOC_MEASUREMENT keyword within the related Function 15 meTypeFunc_SubFuncNames Returns a list of Function names referred by the SUB_FUNCTION keyword within the related Function 16 mcTypeGroup_FunctionListNames Returns a list of Function names referred by the FUNCTION_LIST keyword within the related Group 6 73 ECU M amp C Toolkit User Manual Chapter 6 Output ECU M amp C API for C ECUName If the Type mcTypeMeasurementNames or Type mcTypeCharacteristicNames and RefNum contains a DB
201. e 5 5 Poly Values for Value Output Continued Type Hierarchy Sub Hierarchy Sub 1 Sub 2 Param Description 5 Table Using Interpolation The related scaling is based on the TAB_INTP keyword within the A2L file using interpolation between x y pairs 6 Table Without Interpolation The related scaling is based on the TAB_NOINTP keyword within the A2L file using x y pairs without interpolation Characteristic Sail abc Scaling Text Values If the scaling type is 2 Enumeration Text or 3 Range Text you can use this property to request the list of text values that can be converted into raw values Group TF Is Root Returns whether the selected Group is a root level Group entity Group Comment Returns the Comment string of the selected Group Function Comment Returns the Comment string of the selected Function DAQ Event Channel Name Returns the selected event channel name to which the Measurement task is assigned ECU M amp C Toolkit User Manual 5 132 ni com Chapter5 ECU M amp C API for LabVIEW Table 5 5 Poly Values for Value Output Continued Sub Hierarchy Type Hierarchy Sub 1 Sub 2 Param Description DAQ Mode Returns the selected I O mode for the M amp C Measurement task 0 DAQ List The data is transmitted by the ECU based on an event channel which can be
202. e 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 5 82 ni com Chapter5 ECU M amp C API for LabVIEW code is the error code number identifying an error A value of 0 J 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 MC ECU Disconnect vi implements the CCP or XCP command DISCONNECT MC ECU Disconnect vi permanently disconnects the specified CCP or XCP slave from the communication and ends the calibration session When the calibration session is terminated all DAQ lists of the device are stopped and cleared and the protection masks of the device are set to their default values MC ECU Disconnect vi is an optional function and is automatically performed prior to any MC ECU Deselect vi or MC ECU Close vi call National Instruments 5 83 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW MC ECU Open vi Purpose Opens a specified A2L database and selects the first ECU found in the database If there are several ECUs stored in the A2L database use the Da
203. e NI XNET Frame Queued Sessions can coexist on a single interface and the Frame Input and Output Stream Sessions may be used for example for a Frame logging replay use case CompactRI0O or R Series If you are using CompactRIO or R Series hardware you must provide a bitfile that handles the CAN communication between the host system and the FPGA To access the CAN module on the FPGA you must specify the bitfile name after the for example CCP CAN1 MyBitfile lvbitx To specify a special RIO target you can specify that target by ECU M amp C Toolkit User Manual 6 60 ni com Chapter 6 ECU M amp C API for C its name followed by the bitfile name for example XCP CAN RIO1 MyBitfile lvbitx Currently only a single CAN interface is supported RIO1 defines the RIO target name as defined in your LabVIEW Project definition The vbitx filename represents the filename and location of the bitfile on the host You may use just the filename without the folder if the bitfile is in the same folder as the LabVIEW Project vproj National Instruments 6 61 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C mcECUDeselect Purpose Deselects an ECU and invalidates the ECU reference handle Format mcTypeStatus mcECUDeselect mcTypeTaskRef ECURefNum Input ECURefNum ECURefNum is the task reference which links to the selected ECU This reference is originally returned from mcECUSelectEx Output Return V
204. e NI software may be used to reproduce software or other materials belonging to others you may use NI software only to reproduce materials that you may reproduce in accordance with the terms of any applicable license or other legal restriction End User License Agreements and Third Party Legal Notices You can find end user license agreements EULAs and third party legal notices in the following locations e Notices are located in the lt National Instruments gt _Legal Information and lt National Instruments gt directories e EULAs are located in the lt National Instruments gt Shared MDF Legal license directory e Review lt National Instruments gt _Legal Information txt for information on including legal information in installers built with NI products U S Government Restricted Rights If you are an agency department or other entity of the United States Government Government the use duplication reproduction release modification disclosure or transfer of the technical data included in this manual is governed by the Restricted Rights provisions under Federal Acquisition Regulation 52 227 14 for civilian agencies and Defense Federal Acquisition Regulation Supplement Section 252 227 7014 and 252 227 7015 for military agencies Trademarks Refer to the NJ Trademarks and Logo Guidelines at ni com trademarks for more information on National Instruments trademarks ARM Keil and Vision are trademarks or registered of ARM Ltd or i
205. e end of a non volatile memory programming sequence is indicated by using the MC Program Start vi function For further information on how to use program ECU memory and to use the MC Program Start vi command refer to the ASAM XCP Part 2 Protocol Layer Specification National Instruments 5 155 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW MC Set Property vi Purpose Sets a property for the specified A2L database file Measurement Task or Characteristic referenced by the reference in terminal The poly VI selection determines the property to set Format name reference in value error in reference out error out Input E E FOLYT ECU M amp C Toolkit User Manual Name is not used and can be left unwired This parameter may be used for further extensions Reference in specifies a valid task handle depending on the information which must be set If a generic property must be set a DB ref handle is needed If a Measurement property must be set a valid DAQ ref handle must be wired into reference in If an ECU property must be set a valid ECU ref handle must be wired into reference in Value is a poly input that specifies the property value You select the property to set as value by selecting the poly VI type The data type of value is also determined by the poly VI selection For information on the different properties provided by MC Set Property vi refer to the Poly VI T
206. e 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 If you use NI XNET hardware and select the xxx yyy syntax the ECU M amp C Toolkit uses the XNET NI CAN compatibility library XCL internally if the XNET interface is defined in MAX under NI CAN Devices To force use of the native XNET API you must use the xxx yyy nixnet syntax The interface name is related to the NI XNET hardware naming under Devices and Interfaces in MAX 5 88 ni com Chapter5 ECU M amp C API for LabVIEW B Note By selecting nixnet as Protocol and Interface string the ECU Measurement and Calibration Toolkit uses the Frame Input and Output Queued sessions To force the ECU Measurement and Calibration Toolkit to use Frame Input and Output Stream sessions instead select ni_genie_nixnet as Protocol and Interface string for example CCP CAN1 ni_genie_nixnet An application instance can use only one Frame Input Stream Session and one Frame Output Stream Session at a time so use the default name nixnet as Protocol and Interface string so that multiple NI XNET Frame Queued Sessions can coexist on a single interface and the Frame Input and Output Stream Sessions may be used for example for a Frame logging replay use case National Instruments CompactRIO or R Series If using CompactRIO or R Series hardware you must provide a
207. e is the name of a Characteristic stored in the A2L database file to which one or more values may be written ECU ref in is the task reference which links to the selected ECU This reference is originally returned from MC ECU Open vi or MC ECU Select vi and then wired through subsequent VIs Characteristic writes the data for the Characteristic channel initialized by Characteristic name Characteristic values are listed in the Poly VI Types section or Error in is a cluster which describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out He Ed status is TRUE if an error occurred This VI is not executed when status is TRUE 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 ECU M amp C Toolkit User Manual 5 34 ni com Chapter5 ECU M amp C API for LabVIEW ECU ref out is the same as ECU ref in Wire the task reference to subsequent VIs for this task Error out describes error conditions If the Error in cluster indicated an error the Error out cluste
208. e may indicate that the Master which calculates the checksum must use a user defined algorithm implemented in an externally calculated function for instance Win32 DLL UNIX shared object file etc The master retrieves the name of the external function file to be used for this slave from the ASAM MCD 2MC description file The CRC algorithms are specified by the following parameters Name Width Poly Init Refin Refout XORout XCP_CRC_16 16 0x8005 0x0000 TRUE TRUE 0x0000 XCP_CRC16_CITT 16 0x1021 OxFFFF FALSE FALSE 0x0000 XCP_CRC_32 32 32 0x04C11DB7 OxFFFFFFFF TRUE TRUE OxFFFFFFFF Name The name of the algorithm A string value starting with XCP_ Width The width of the algorithm expressed in bits This is one less than the width of the Poly Poly The polynomial This is a binary value specified as a hexadecimal number The top bit of the Poly should be omitted For example if the Poly is 0x10110 you should specify 0x06 An important aspect of this parameter is that it represents the unreflected polynomial The bottom of this parameter is always the least significant bit LSB of the divisor during the division regardless of whether the algorithm is reflected Init This parameter specifies the initial value of the register when the algorithm starts This is the value to be assigned to the register in the direct table algorithm In the table algorithm we may think of the register alway
209. e 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 TA source identifies the VI where the error occurred Description MC CCP Get Active Cal Page vi retrieves the ECU Memory Transfer Address pointer of the active calibration data page MC CCP Get Active Cal Page vi implements the CCP command GET_ACTIVE_CAL_PAGE defined by the CCP specification National Instruments 5 17 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW MC CCP Get Result vi Purpose Uploads requested data CCP only Format ECU ref in block size error in ECU ref out data error out ECU ref in is the task reference which links to the selected ECU This reference is originally returned from MC ECU Open vi or MC ECU Select vi and then wired through subsequent VIs Error in is a cluster which describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out Block size is the size of the data block in bytes to be uploaded status is TRUE if an error occurred This VI is not executed when status is TRUE code is
210. e service that is executed inside the ECU For more information about the services that are implemented in the ECU refer to the documentation for the ECU Params passes an array to the ECU that might be needed by the ECU to run the service Since this VI has no knowledge about how the data is interpreted by the ECU you are responsible for providing the data in the correct byte ordering Aa E Error in is a cluster which describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out A status is TRUE if an error occurred This VI is not executed when status is TRUE 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 ECU M amp C Toolkit User Manual 5 12 ni com Output E E E Description Chapter5 ECU M amp C API for LabVIEW ECU ref out is the same as ECU ref in Wire the task reference to subsequent VIs for this task Data type is a data type qualifier that determines the data format of the result Result returns information from the action service
211. e target address to be cleared in the ECU mcAddress is a C struct consisting of Address Specifies the address part of the target address Extension Extension contains the extension part of the target address BlockSize BlockSize determines the size of the block on which the checksum must be calculated Output 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 amp C API to obtain a descriptive string for the return value Description mcClearMemory can be used to clear the contents of the non volatile memory prior to reprogramming it The Memory Transfer Address 0 MTA 0 is set to the start of the memory block automatically by this function The size parameter is the size of the block to be erased If you are using the XCP protocol mcClearMemory implements the PROGRAM_CLEAR command Refer to the ASAM XCP specification for further information on how to clear parts of non volatile memory in the ECU National Instruments 6 31 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C mcConversionCreate Purpose Creates a signal conversion obj
212. eas_Scale_ Returns the scaling factor defined for this Factor Measurement in the A2L database f64 mcPropMeas_Scale_ Returns the scaling offset defined for this Offset Measurement in the A2L database National Instruments 6 99 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C Table 6 4 Values for PropertyID Continued Data Type Name Description u32 mcPropMeas_Scale_Type Returns the scaling type defined for this Measurement in the A2L database 0 Unknown The type of the scaling could not be derived from the A2L file content 1 Rational Function The related scaling is based on a rational function of second order This covers also the linear scaling given by factor and offset 2 Enumeration Text The related scaling is based on the COMPU_VTAB keyword within the A2L file e Read functions return nonscaled numeric values e Write functions accept nonscaled numeric values e Itis possible to use mcDoubleToText and mcTextToDouble to convert between enumeration text values and double values 3 Range Text The related scaling is based on the COMPU_VTAB_RANGE keyword within the A2L file e Read functions return nonscaled numeric values e Write functions accept nonscaled numeric values e Itis possible to use mcDoubleToText and mcTextToDoub1e to convert between range text values and double values ECU M amp C Toolkit User Manual 6 1
213. easurement task created Wire this task reference to subsequent VIs for this Measurement task 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 MC DAQ Initialize vi does not start the transmission of the DAQ lists from the ECU to or from the application through CCP or XCP This enables you to use MC Set Property vi to change the properties of a Measurement task After you change properties use MC DAQ Start Stop vi to start the communication for the Measurement task ECU M amp C Toolkit User Manual 5 46 ni com Chapter5 ECU M amp C API for LabVIEW MC DAQ List Initialize vi Purpose Defines a DAQ list on a specific DAQ list number and initializes the Measurement task for the specified Measurement channel list Format DAQ List No measurement list ECU ref in mode sample rate error in DTO_ID DAQ
214. eated on the target system and must be transferred to the host after logging has been completed Note that no additional CAN port is used for the logging which makes this method superior to any other method such as running a bus monitor parallel ECU Command Byte Order Returns the byte order for the defined Measurement or Characteristic o 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 National Instruments 5 105 ECU M amp C Toolkit User Manual ECU M amp C API for LabVIEW Chapter 5 ECU M amp C API for LabVIEW Table 5 5 Poly Values for Value Output Continued Type Hierarchy Sub Hierarchy Sub 1 Sub 2 Param Description ECU Name Returns the Name of the selected ECU opened by MC ECU Open vi or MC ECU Select vi ECU Comment Returns the Comment string of the selected ECU amp ECU DAQ List Number Returns an array of DAQ list numbers for all DAQ lists defined in the A2L file E ECU Event Channel Translates the event channel name to the event channel number Pass the event channel name in the Name parameter of Get Property E ECU CCP Baud Rate Returns the Baud Rate in use by the Interface Basic baud rates such as 125000 and 500000 are specified as t
215. ecessary Error in is a cluster which describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out status is TRUE if an error occurred This VI will not execute when status is TRUE 5 56 ni com Chapter5 ECU M amp C API for LabVIEW 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 DAQ ref out is the same as DAQ ref in Wire the task reference to subsequent VIs for this task 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 Sim
216. econds during which a specified command must complete ECU ref in is the task reference which links to the selected ECU This reference is originally returned from MC ECU Open vi or MC ECU Select vi and then wired through subsequent VIs Command is the CCP or XCP command to be sent to the ECU Data contains a 1 dimensional array of byte information to send to the ECU Buffer size for return value sets the maximum length of the Return value data array Error in is a cluster which describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out HEE BE status is TRUE if an error occurred This VI is not executed when status is TRUE 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 Taped source identifies the VI where the error occurred ECU M amp C Toolkit User Manual 5 96 ni com Output E E R E Description Chapter5 ECU M amp C API for LabVIEW ECU ref out is the same as ECU ref in Wire the task reference to subsequent VIs for this task Error code describes the error returned from the ECU dur
217. ect in memory Format mcTypeStatus mcConversionCreate mcTypeTaskRef ECURefNum char ConversionName 64 Factor 64 Offset char Unit Input ECURefNum ECURe Num is the task reference that links to the selected ECU This reference is originally returned from mcECUCreate ConversionName ConversionName identifies the conversion object that handles measurement scaling Use this name as a reference in mcConversionCreate Factor Factor configures the scaling factor used to convert raw measurement data in the message to from scaled floating point units The factor is the A in the linear scaling formula AX B where X is the raw data and B is the scaling offset Offset Offset configures the scaling offset used to convert raw data in the measurement message to from scaled floating point units The scaling offset is the B in the linear scaling formula AX B where X is the raw data and A is the scaling factor Unit Configures the measurement channel unit string You can use this value to display units such as volts or RPM along with the channel samples Output 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
218. ed in channel list Each entry consists of a single waveform The order of channel entries in value is the same as the order in the original channel list The initialized sample rate must be greater than zero for this poly VI because each sample in the array of a waveform indicates the value of the CAN channel at a specific point in time In other words the sample rate specifies a virtual clock that copies the most recent value from CAN messages for each sample time The changes in sample values from message to message enable you to view the M amp C DAQ channel over time such as for comparison with other CAN or DAQ input channels This VI waits until all samples arrive in time before returning The start time for each waveform indicates the time of the first CAN sample in the array The delta time of a waveform indicates the time between each sample in the array as determined by the original sample rate If the initialized sample rate is zero this poly VI returns an error If the intent is simply to read the most recent samples for a task use the NChan 1Samp 1D Dbi type If no message has been received for a channel since you started the task a 0 is returned in value You can specify channels in channel list that span multiple messages At each point in time a sample from the most recent message is returned for all channels You can use error out to determine whether anew message has been received since the previous call to MC DAQ Read vi or MC DAQ
219. ed starting at the selected Address and Extension in the ECU memory The function can download more than 5 data bytes to the ECU If you are using the CCP protocol and the selected BlockSize is higher than 5 bytes mcDown1load performs several CCP DNLOAD commands until all data bytes are downloaded to the ECU mcDownload implements the CCP DNLOAD command defined by the CCP specification If you are using the XCP protocol the Data block of the specified BlockSize is copied into the ECU memory starting at the MTA The MTA is post incremented by the number of downloaded data bytes If the slave device does not support Block Transfer Mode all downloaded data is transferred in a single command packet If Block Transfer Mode is supported the downloaded data is transferred in multiple command packets For the slave however there might be limitations concerning the maximum number of consecutive command packets so the number of data elements may be within a limited range The master device has two additional consecutive DOWNLOAD_NEXT command packets The slave device will acknowledge only the last DOWNLOAD_NEXT command packet The separation time between the command packets and the maximum number of packets are specified in the response for the CONNECT command ECU M amp C Toolkit User Manual 6 56 ni com Chapter 6 ECU M amp C API for C mcECUConnect Purpose Establishes communication to the selected ECU through CCP or XCP After a succes
220. eference which links to the selected ECU This reference is originally returned from MC ECU Open vi or MC ECU Select vi and then wired through subsequent VIs x is an input that refers to the array offset if the Characteristic is defined in the A2L database file as 1 or 2 dimensional If the Characteristic is defined as having 0 dimensions the input can be left unwired y is an input that refers to the array offset if the Characteristic is defined in the A2L database file as 2 dimensional If the Characteristic is defined as having 0 or 1 dimensions the input can be left unwired Error in is a cluster which describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out EE Eg status is TRUE if an error occurred This VI is not executed when status is TRUE 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 ECU M amp C Toolkit User Manual 5 36 ni com Chapter5 ECU M amp C API for LabVIEW source identifies the VI where the error occurred Characteristic value is the value to be set for the Characteristic ECU ref o
221. efined in the destination cluster to appropriate values MC CCP Move Memory vi implements the CCP command MOVE defined by the CCP specification National Instruments 5 25 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW MC CCP Select Cal Page vi Purpose Sets the beginning of the calibration data page CCP only Format ECU ref in ECU ref out address error in error out Input ECU ref in is the task reference which links to the selected ECU This reference is originally returned from MC ECU Open vi or MC ECU Select vi and then wired through subsequent VIs Address is a cluster which contains the following values i Address specifies the address part of the address Extension contains the extension part of the address Error in is a cluster which describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out status is TRUE if an error occurred This VI is not executed when status is TRUE 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
222. egative 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 amp C API to obtain a descriptive string for the return value Description If an ECU offers a reduced and specific range of DAQ list entry numbers use the mcDAQListInitialize function to setup your Measurement list mcDAQListInitialize does not start the transmission of the DAQ lists from the ECU to the application or vice versa through CCP or XCP This enables you to use mcSet Property to change the properties of a Measurement task After you change properties use mcDAQStartStop to start the communication for the Measurement task To query the available DAQ list entry numbers use mcGetProperty with the property mcPropECU_DAQListNumbers National Instruments 6 39 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C mcDAQRead Purpose Reads samples from a Measurement task Samples are obtained from received CAN messages Format mcTypeStatus Input DAQRefNum mcDAQRead mcTypeTaskRef DAQRefNum u32 NumberOfSamplesToRead mcTypeTimestamp StartTime mcTypeTimestamp DeltaTime 64 SampleArray u32 NumberOfSamplesReturned DAQRefNun is the task reference from the previous Measurement task function The tas
223. egments property and lt m gt is the decimal representation of the page number within the segment 0 M 1 where M is the number returned from the mcPropECU_XCP_NumPages property for this segment u16 mcPropECU_DAQList Returns an array of DAQ list numbers for all Numbers DAQ lists defined in the A2L file ECU M amp C Toolkit User Manual 6 92 ni com Chapter 6 ECU M amp C API for C Table 6 4 Values for PropertyID Continued Data Type Name Description u32 mcPropECU_TimingFactor Returns the used timing factor which you can use to increase CCP or XCP command timeout values For details on the default Command Timeout values refer to the CCP or XCP Protocol Specification ul6 mcPropDAQList_Max Returns the maximum length of the DAQ list Length u32 mcPropDAQList_CANId Returns how to select the CAN ID for the SelectMode specified DAQ list 0 CAN_ID_FIXED The CAN Identifier is a predefined fixed number 1 CAN_ID_VARIABLE The CAN Identifier is a variable number 2 CAN_ID_DTO_ID The CAN Identifier is the same as the DTO identifier u32 mcPropDAQList_CANId Returns the CAN ID for the specified DAQ list if mcPropDAQList_CANIdSelectMode CAN_ID_FIXED u8 mcPropDAQList_FirstPID Returns the first Packet ID for the specified DAQ list u32 mcPropDAQList_NumberOf Returns the number of allowed event channels EventChannels for the specif
224. ement and Automation Explorer MAX For example if you are using the CCP protocol on NI CAN interface CAN1 the value passed to Interface is CCP CAN1 The special string values CAN256 and CAN257 refer to virtual interfaces Refer to the NI CAN Hardware and Software User Manual for detailed information on how to use virtual NI CAN ports If you are using the XCP protocol YYY can be associated with a XCP transport layer The transport layers may defined as follows e CANxx e TCP e UDP Using NI CAN If you select CAN as the transport layer you must specify the NI CAN interface CANO CANI up to CAN63 CAN network interface names are associated with physical CAN ports using the Measurement and Automation Explorer MAX For example if you are using the XCP on NI CAN interface CAN2 the value passed to Interface is XCP CAN2 If you are using the XCP on UDP the value passed to Interface is XCP UDP If you are using the XCP on TCP the value passed to Interface is XCP TCP The special string values CAN256 and CAN257 refer to virtual interfaces Refer to the NI CAN Hardware and Software User Manual for detailed information on how to use virtual NI CAN ports Using NI XNET If you are using NI XNET hardware and select the xxx yyy syntax the ECU M amp C Toolkit uses the XNET NI CAN compability library XCL internally if the XNET interface is defined in MAX under NI CAN Devices To force use of the native XNET API you
225. ended 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 i source identifies the VI where the error occurred ECU M amp C Toolkit User Manual 5 144 ni com Chapter5 ECU M amp C API for LabVIEW Data Type sets the measurement task data type Data Type can contain the following values Data Type Data Format 0 Unsigned byte 1 Signed byte nsigned word U Signed word Unsigned long Signed long Float 32 nH nn A W N ECU ref out is the task reference that links to the selected ECU 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 Use MC Measurement Create vi to create a measurement object in memory instead of referrin
226. enresrstesrerestesrstes xvii Deactiyatnge a Product eiia ies iea E E E TA O ETERA xvii Using Windows Guest Accounts sseeseseesseresesreresrerestesrsrtsteresteststesteresresrntesreeestrsrsees xvii Chapter 1 Introduction CAN Calibration Protocol CCP Overview ssesseseessessssesseressresssressseesereeseresssessseee 1 2 CCP Protocol Version c e3sccssci vce ciateasicasieeescteient gedtele wna 1 2 Universal Measurement and Calibration Protocol XCP Overview cccssceeeseees 1 3 XCP Protocol Version lt 2 scsi decsess nedeeisisseds eases n i ie inpe esk 1 3 Measurement and Calibration Databases cccscccesssceseneeeeeseeeesneeecseeeesseeeseseeeesaees 1 4 ECU Measurements 0 22 evssscyes cecistecs EK EE PEE EE E EEEE ROEN E Rara 1 4 ECU Characteristies 25 4 s2sccsnseshesasevessetsrsativesi steeueescesiyec R E E E ESE 1 4 Chapter 2 Installation and Configuration Tnistallati om sseni aana A othe aa aio iE e aea E EEEE E KETSE EES 2 1 License Management Overview 1 0 00 ceceseseeseceeseceeseesseesecseeeseeseeeaecneceaecseseserseeseeenees 2 1 Activate ECU M amp C Toolkit rsisi erener ineei npor sE ENEA Ei E 2 2 Term Sroa E T R R E E ER E AE 2 3 Moving Software After Activation s eesseeseseesrsersresrsersrsresresrsresesresreereresrse 2 4 Volume License Pr graM serasa aeae aaea a oa e a aa Saa 2 4 Online Activation iein e e EEE R E E A 2 4 Home Computer Ugenini aa ienn oa a E a E a 2 4 Privacy
227. ention is as defined in the WIN32 API Specification for ASAP 1b section 2 4 National Instruments ECU M amp C Toolkit User Manual Chapter 4 Using the ECU M amp C API Seed and Key Example The following example shows a possible header file for a library for key calculation k Header file for ASAPla CCP V2 1 Seed and Key Algorithm Af ifndef _SEEDKEY define _SEEDKEY ifndef DllImport define DllImport __declspec dllimport endif ifndef D11Export define DllExport __declspec dllexport Hendif ifdef SEEDKEYAPI_IMPL only defined by implementor of SeedKeyApi define SEEDKEYAPI D1lExport _ cdecl else define SEEDKEYAPI DllImport _ cdecl endif ifdef _ cplusplus w 2H _H_ extern C Hendif BOOL SEEDKEYAPI ASAP1A CCP_ComputeKeyFromSeed BYTE Seed unsigned short SizeSeed BYTE Key unsigned short MaxSizeKey unsigned short SizeKey Seed Pointer to seed data SizeSeed Size of seed data length of Seed Key Pointer where DLL should insert the calculated key data MaxSizeKey Maximum size of Key SizeKey Should be set from DLL corresponding to the number of data inserted to Key at most MaxSizeKey Result The value FALSE 0 indicates that the key could not be calculated from seed data for example MaxSizeKey is too small TRUE 0 indicates success of key calculation ifdef _ cplusplus endif e
228. entries National Instruments 5 161 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW Table 5 6 ECU Specific Property Value Types for the POLY Input Value Continued Type Hierarchy Sub Hierarchy Sub 1 Sub 2 Param Description ECU CCP Termination For all XNET devices the termination is software selectable XNET provides the option of 80 Q between Bus Plus and Bus Minus or no termination The Termination property configures the onboard termination of the NI XNET interface CAN connector port The Boolean property supports two values TRUE Termination ON and FALSE Termination Off However different CAN or LIN hardware has different termination requirements and the termination values have different meanings Refer to the Termination attribute in the XNET API for more details This property is supported for NI XNET devices only ECU M amp C Toolkit User Manual 5 162 ni com Chapter5 ECU M amp C API for LabVIEW Table 5 6 ECU Specific Property Value Types for the POLY Input Value Continued Sub Hierarchy Type Hierarchy Subl Sub 2 Param Description ECU XCP CAN Termination For all XNET devices the termination is software selectable XNET provides the option of 80 Q between Bus Plus and Bus Minus or no termination The Termination property configures the onboard termination of the NI XNET interfa
229. er 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 amp C API to obtain a descriptive string for the return value Description mcCCPSetSessionStatus implements the CCP command SET_S_STATUS and is used to keep the ECU informed about the current state of the calibration session The session status bits of an ECU can be read and written Possible conditions are reset on power up session log off and in applicable error conditions The calibration session status is organized as a bit mask with the following assignment Table 6 3 Bit Mask Assignments for Calibration Session Status Bit Name Description 0 CAL Calibration data initialized 1 DAQ DAQ list s initialized 2 RESUME Request to save DAQ set up during shutdown in CCP slave CCP slave automatically restarts DAQ after start up National Instruments 6 23 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C Table 6 3 Bit Mask Assignments for Calibration Session Status Continued Bit Name Description 3 Reserved 4 Reserved 5 Reserved 6 STORE Request to save calibration data during shut down in CCP slave 7 RUN Sessi
230. er 6 ECU M amp C API for C mcCCPGetSessionStatus Purpose Retrieves the current status of the Calibration Session CCP only Format mcTypeStatus mcCCPGetSessionStatus mcTypeTaskRef ECURefNum u8 SessionStatus u8 StatusQualifier u8 AdditionalStatus Input ECURefNum ECURe fNum is the task reference which links to the selected ECU This reference is originally returned from mcECUSelectEx Output SessionStatus The current SessionStatus which is returned from the ECU StatusQualifier The additional StatusQual1i fier is manufacturer and or project specific and is not part of the CCP protocol specification AdditionalStatus If the StatusQualifier does not contain additional status information AdditionalStatus must be set to FALSE If AdditionalStatus is not FALSE it may be used to determine the type of the additional status information 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 amp C API to obtain a descriptive string for the return value Description mcCCPGetSessionStatus retrieves the current calibration session status of the ECU The
231. er Manual Index MC XCP Program Prepare vi 5 190 MC XCP Program Verify vi 5 192 MC XCP Set Cal Page vi 5 195 MC XCP Set Request vi 5 197 MC XCP Set Segment Mode vi 5 200 mcBuildChecksum 6 6 mcCCPActionService 6 12 mcCCPCalculateChecksum 6 10 mcCCPDiagService 6 14 mcCCPGetActiveCalPage 6 16 mcCCPGetResult 6 17 mcCCPGetSessionStatus 6 18 mcCCPGetVersion 6 19 mcCCPMoveMemory 6 20 mcCCPSelectCalPage 6 22 mcCCPSetSessionStatus 6 23 options table 6 23 mcCharacteristicRead 6 25 mcCharacteristicReadSingleValue 6 26 mcCharacteristicWrite 6 28 mcCharacteristicWriteSingle Value 6 29 mcClearMemory 6 31 mcConversionCreate 6 32 mcDAQClear 6 34 mcDAQInitialize 6 35 mcDAQListInitialize 6 38 mcDAQRead 6 40 mcDAQReadTimestamped 6 43 mcDAQStartStop 6 46 mcDAQWrite 6 48 mcDatabaseClose 6 50 mcDatabaseOpen 6 51 mcDatabaseOpenEx 6 52 mcDoubleToText 6 53 mcDownload 6 55 mcECUConnect 6 57 mcECUCreate 6 58 mcECUDeselect 6 62 mcECUDisconnect 6 63 mcECUSelectEx 6 64 ECU M amp C Toolkit User Manual l 6 mcECUSetCalibrationPage 6 67 mcEventCreate 6 69 mcGeneric 6 70 mcGetNames 6 72 mcGetNamesLength 6 75 mcGetProperty 6 78 options table 6 79 mcMeasurementCreate 6 104 mcMeasurementRead 6 106 mcMeasurementWrite 6 107 mcProgram 6 108 mcProgramReset 6 110 mcProgramStart 6 111 mcSetProperty 6 112 Characteristic specific options table 6 123 DAQ specific options table 6 122 ECU s
232. er VIs MC Database Close vi will execute when status is TRUE in Error in Because this VI clears the task the task reference is not wired as an output ECU M amp C Toolkit User Manual 5 62 ni com Chapter5 ECU M amp C API for LabVIEW MC Database Create vi Purpose Creates an ASAM A2L database in memory Format DB name DB ref out error in ri error out Input National Instruments DB name is a database name associated with the database created in memory Use the string syntax lt myname gt for the A2L database if using multiple databases in memory For example if using two databases in memory use MyDatabase1 as the DB name for the first database and MyDatabase2 for the second DB name created in memory Error in is a cluster which describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out status is TRUE if an error occurred This VI is not executed when status is TRUE 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 DB
233. er 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 Poly VI Types The name of each Poly VI type uses the following conventions e The first term is either 7 Chan or NChan This indicates whether the type returns data for a single channel or multiple channels NChan types return an array of analogous 7 Chan types one entry for each channel initialized in channel list of MC DAQ Initialize vi 1Chan types are convenient because no array indexing is required but you are limited to reading only one channel e The second term is either Samp or NSamp This indicates whether the type returns a single sample or an array of multiple samples Samp types are often used for single point control applications such as within LabVIEW RT e The third term indicates the data type used for each sample The type Dbl indicates double precision 64 bit floating point The type W m indicates the waveform data type The types D and 2D indicate one and two dimensional arrays respectively National Instruments 5 51 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW 1Chan 1Samp D
234. er to a LabVIEW error handling VI such as the Simple Error Handler source identifies the VI where the error occurred 5 89 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW CAN interface specifies the CAN interface to use for this task For compatibility reasons if you are using the CCP protocol you can only specify the CAN interface to use for this CCP task The interface input uses a ring typedef in which value 0 selects CANO value 1 selects CAN1 and so on As the ECU M amp C API is based on the NI CAN Channel API the NI CAN Frame API cannot be used on the same CAN network interface simultaneously If the CAN network interface is already initialized in the Frame API this function returns an error ECU ref out is the task reference which links to the selected ECU 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 occ
235. ernal checksum DLL If you are using XCP the following values for TypeOfChecksum are defined in the XCP specification Type Name Description 0x01 XCP_ADD_11 Add BYTE into a BYTE checksum ignore overflows 0x02 XCP_ADD_12 Add BYTE into a WORD checksum ignore overflows 0x03 XCP_ADD_14 Add BYTE into a DWORD checksum ignore overflows 0x04 XCP_ADD_22 Add WORD into a WORD checksum ignore overflows blocksize must be modulo 2 0x05 XCP_ADD_24 Add WORD into a DWORD checksum ignore overflows blocksize must be modulo 2 0x06 XCP_ADD_44 Add DWORD into DWORD ignore overflows blocksize must be modulo 4 0x07 XCP_CRC_16 Refer to CRC error detection algorithms 0x08 XCP_CRC_16_CITT Refer to CRC error detection algorithms 0x09 XCP_CRC_32 Refer to CRC error detection algorithms OxFF XCP_USER_ DEFINED User defined algorithm in externally calculated function For a detailed description of the checksum algorithm refer to the mcBuildChecksum command or the XCP Part 2 Protocol Layer Specification For more detailed information about CRC algorithms please refer to http www repairfaq org filipg LINK F_crc_v34 html National Instruments 6 11 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C mcCCPActionService Purpose Calls an implementation specific action service on the ECU CCP only Format mcTypeStatus mcCCPActionService mcTypeTaskRef ECURefNum ul6 Servi
236. error in cluster to error out status is TRUE if an error occurred This VI will not execute when status is TRUE 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 ECU ref out is the task reference that links to the selected ECU National Instruments 5 77 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW Error out describes error conditions If the Error in cluster indicated an poe o 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 ECU M amp C Toolkit User Manual 5 78 ni com Chapter5 E
237. ers sensors and actuators are connected on a common serial bus This network of devices can be thought of as a scaled down real time low cost version of the networks used to connect personal computers Any device on a CAN network can communicate with any other device using a common pair of wires As CAN implementations increased in the automotive industry CAN was standardized internationally as ISO 11898 CAN chips were created by major semiconductor manufacturers such as Intel Motorola and Philips With these developments manufacturers of industrial automation equipment began to consider CAN for use in industrial applications Comparison of the requirements for automotive and industrial device networks showed numerous similarities including the transition away from dedicated signal lines low cost resistance to harsh environments and high real time capabilities CAN Calibration Protocol CCP The amount of electronics introduced into the automobile has increased significantly This trend is expected to continue as automobile manufacturers initiate further advances in safety reliability and comfort The introduction of advanced control systems combining multiple sensors actuators and electronic control units has begun to place extensive demands on the existing Controller Area Network CAN communication bus To enable the new generation of automotive electronics new and highly sophisticated software calibration measurement
238. es Address specifies the address part of the source address Extension contains the extension part of the source address Block size determines the size of the block for which the checksum must be calculated Error in is a cluster which describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out status is TRUE if an error occurred This VI is not executed when status is TRUE code is the error code number identifying an error A value of 0 i 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 ECU M amp C Toolkit User Manual 5 6 ni com Chapter5 ECU M amp C API for LabVIEW Output ECU ref out is the same as ECU ref in Wire the task reference to subsequent VIs for this task Type of checksum returns the type of the calculated checksum If you are using the CCP protocol type of checksum is OxFF For XCP refer to the Description section Checksum returns the calculated checksum Error out describes error conditions If the Error in cluster indicated an error the Error out cluster contains the same information Otherw
239. es ECU M amp C Toolkit User Manual 6 74 ni com Chapter 6 ECU M amp C API for C mcGetNamesLength Purpose Retrieves the amount of memory required to store the names returned by mcGetNames Format mcTypeStatus mcGetNamesLength mcTypeTaskRef RefNum u32 Type cstr ECUName u32 SizeOfNamesList Input RefNum RefNum is any ECU M amp C task reference which consists of a valid link to the opened A2L database DBRefNum a selected ECU ECURefNum or a Measurement task DAQRefNum RefNum must be valid for the related Type Type Specifies the Type of names to return National Instruments 0 mcTypeECUNames Returns a list of ECU names 1 mcTypeMeasurementNames Returns a list of Measurement names 2 mceTypeCharacteristicNames Returns a list of Characteristic names 3 mcTypeEventChannelNames Returns a list of Event Channel names 4 mcTypeDefinedPagesNames Returns a list of Calibration page names 5 mcTypeGroupNames Returns a list of Group names 6 mcTypeGroup_SubGroupNames Returns a list of Subgroup names of the specified Group name 7 mcTypeGroup_MeasurementNames Returns a list of Measurement names within the specified Group 6 75 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C ECUName ECU M amp C Toolkit User Manual 8 mcTypeGroup_CharacteristicNames Returns a list of Characteristic names within the specified Group 9 mcTypeFuncNames Returns a list of Fu
240. es for Value Output Continued Type Hierarchy Sub Hierarchy Sub 1 Sub 2 Param Description ECU XCP Cal Pages XCP Write Access Returns a flag indicating XCP Write access rights for the memory segment page specified in the segment input 0 N 1 where N is the value returned from the Number of Segments property and page input 0 M 1 where M is the value returned from the Number of Pages property Defined values are 0 XCP Write access not allowed 1 XCP Write access allowed without ECU access only 2 XCP Write access allowed with ECU access only 3 XCP Write access allowed always ECU XCP Cal Pages Page InitSegment Returns the number of the segment that initializes the memory segment page specified in the segment input 0 N 1 where N is the value returned from the Number of Segments property and page input 0 M 1 where M is the value returned from the Number of Pages property ECU M amp C Toolkit User Manual 5 126 ni com Chapter 5 Table 5 5 Poly Values for Value Output Continued Type Hierarchy Sub Hierarchy Sub 1 Sub 2 Param Description Characteristic Address Returns the address of the selected Characteristic in the memory of the ECU Characteristic Byte Order Returns the specified byte order 0 Intel format Bytes are in little endian order with least signif
241. escribes 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 MC Download vi is used to download data to an ECU The data is stored starting at the location specified by the Address and Extension parameters On XCP protocol when the slave supports the block mode ECU sends the data in blocks using the DOWNLOAD_NEXT command ECU M amp C Toolkit User Manual 5 70 ni com Chapter5 ECU M amp C API for LabVIEW MC ECU Close vi Purpose Closes the selected ECU and the associated A2L database Format ECU ref in error in error out Input ECU ref in is the task reference which links to the selected ECU This reference is originally returned from MC ECU Open vi or MC ECU Select vi and then wired through subsequent VIs Error in is a cluster which describes error conditions occurring before the VI executes If an error has a
242. ess the ECU over CAN 3 Note Use ofthe ECU M amp C Toolkit requires an existing ASAM MCD 2MC database file These files can be generated by various third party utilities A database editor for ASAM MCD 2MC databases is not part of the ECU M amp C Toolkit ECU Measurements The ECU M amp C Toolkit provides the user access to ECU internal physical values defined by their names in the ASAM MCD 2MC database file Based on this information the ECU M amp C Toolkit communicates through CCP or XCP to the ECU A DAQ data acquisition list can be set up which sends ECU internal data synchronously or asynchronously to the CCP or XCP master The ECU M amp C Toolkit provides a way to configure several Measurement channels into a single Measurement task The term task refers to a list of measurements channels read or written together A common use of the task concept is to read DAQ channels available on the ECU ECU Characteristics ECU M amp C Toolkit User Manual ECU Characteristics are maps of ECU internal variables which may be used as calibration information or set point information The ECU memory content of Characteristics can be read or even changed with the help of the ECU M amp C Toolkit 1 4 ni com Installation and Configuration Installation This chapter explains how to install and configure the ECU M amp C Toolkit This section discusses the installation of the ECU M amp C Toolkit for Microsoft Windows 3 Note You
243. fies the VI where the error occurred Description If you are using the CCP protocol MC Program vi implements the CCP command PROGRAM The command is used to program the specified data into nonvolatile ECU memory Flash EEPROM etc Programming starts at the selected MTAO address and extension defined in the Address cluster If you are using the XCP protocol MC Program vi implements the XCP command PROGRAM The command is used to program a non volatile memory segment in the ECU slave The end of the programming sequence is indicated by using the MC Program Reset vi command which executes the XCP command PROGRAM_RESET The slave device will move into a disconnected state Usually a hardware reset of the slave device is executed This command may support block transfer similar to the commands DOWNLOAD and DOWNLOAD_NEXT For further information on how to use the MC Program vi and details on block mode transfers refer to the ASAM XCP Part 2 Protocol Layer Specification National Instruments 5 151 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW MC Program Reset vi Purpose Indicates the end of a programming sequence Format ECU ref in ECU ref out error in error out Input ECU M amp C Toolkit User Manual ECU ref in is the task reference which links to the selected ECU This reference is originally returned from MC ECU Open vi or MC ECU Select vi and then wired through subsequent VIs Erro
244. file 0x80 0xFF User defined It is possible to use different access modes for clearing and programming ug mcPropPGM_Compression Selects the selected compression method used Method for mcProgram 0 Data is uncompressed default Ox80 0xFF User defined ECU M amp C Toolkit User Manual 6 120 ni com Chapter 6 ECU M amp C API for C Table 6 5 ECU Specific Value Types for the PropertylD Input Value Continued Data Type Name Description u8 mcPropPGM_Encryption Selects the selected encryption method used for Method mcProgram 0 Data is not encrypted default 0x80 0xFF User defined u8 mcPropPGM_Programming Selects the selected programming method used Method for mcProgram 0 Sequential programming default Ox80 0xFF User defined National Instruments 6 121 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C Table 6 6 DAQ Specific Value Types for the PropertyID Input Value Data Type Name Description u32 mcPropDAQ_DTO_ID Sets the DTO ID Data Transmission Object which is used by the ECU to respond to send data from the DAQ lists to the CCP master str mcPropDAQ_EventChannel Sets the event channel name to which the Name Measurement task is assigned If there is no event channel name defined in the A2L file you can set the Event Channel Number manually by passing a decimal number as a string 132 mcPropDAQ
245. first 1 Motorola format Bytes are in big endian order with most significant bit first ug mcPropMeas_Datatype Returns the data type of the Measurement task ug mcPropMeas_Extension Returns the address extension of the ECU address This optional parameter may contain additional address information defined in the A2L database For instance it can be used to distinguish different address spaces of an ECU multi microcontroller devices ECU M amp C Toolkit User Manual 6 98 ni com Chapter 6 ECU M amp C API for C Table 6 4 Values for PropertyID Continued Data Type Name Description u32 mcPropMeas_IsVirtual Returns whether the Measurement is virtual Virtual Measurements are not transmitted by the ECU but are calculated in the application They return an error when opened in a DAQ list f64 mcPropMeas_Maximum Returns the maximum value of the Measurement f64 mcPropMeas_Minimum Returns the minimum value of the Measurement u32 mcPropMeas_ReadOnly Returns TRUE if the selected Measurement is read only and can only be accessed through mcMeasurementRead or returns FALSE if the Measurement can be accessed through mcMeasurementWrite as well str mcPropMeas_Unit Returns the unit string defined for this Measurement in the A2L database u32 mcPropMeas_Unit_Size Returns the number of bytes to be allocated if you call mcGet Property with the parameter mcPropMeas_Unit f64 mcPropM
246. floating point values in physical units such as Volts rpm km h C and so on that is converted to from a raw value in measurement hardware The ECU M amp C API Read and Write functions provide access to Characteristic or Measurement channels When a CAN message is received ECU M amp C Toolkit converts raw fields in the message into physical units which you then obtain using the ECU M amp C API Read function When you call a ECU M amp C API Write function you provide floating point values in physical units which ECU M amp C Toolkit converts into raw fields and transmits as a CAN message based on the CCP protocol Reference handle to a selected ECU See ECU reference Specifies the generic signal source that effectively determines the data transmission timing A 29 bit arbitration ID Frames that use extended IDs are often referred to as CAN 2 0 Part B the specification which defines them A 6 byte string identifying the CCP master device See DAQ A collection of DAQ channels that you can read or write Address pointer in the ECU that holds the source target address for data sent or received via CCP The address extension depends on the slave controller s organization and may identify a switchable memory bank or a memory segment See Memory Transfer Address G 4 ni com ODT PID Prescaler S SeedKey DLL slave device identifier Station Address T task reference National Instruments Glossary Obje
247. g for the return value ECU M amp C Toolkit User Manual 6 12 ni com Chapter 6 ECU M amp C API for C Description mcCCPActionService implements the CCP command ACTION_SERVICE The ECU carries out the requested service and automatically sets the Memory Transfer Address MTAO to the location from which the CCP master may upload the requested action service return information if applicable The result of this service can be accessed by calling the function mcCCPGetResult right after mcCCPActionService National Instruments 6 13 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C mcCCPDiagService Purpose Calls an implementation specific diagnostic service on the ECU CCP only Format mcTypeStatus mcCCPDiagService mcTypeTaskRef ECURefNum ul6 ServiceNo u8 Params 4 u8 ResultLength u8 DataType Input ECURefNum ECURefNum is the task reference which links to the selected ECU This reference is originally returned from mcECUSelectEx ServiceNo ServiceNo determines the diagnostic service that is executed inside the ECU For more information about the services that are implemented in the ECU refer to the documentation for the ECU Params Params passes an array of bytes to the ECU that might be needed by the ECU to run the diagnostic service Since the definition of the parameters is specific to the implementation of the ECU the parameters can only be passed as an array of bytes It is your responsibil
248. g Captured Communication Data To save the information displayed in the CCP XCP Spy capture window select File Save As In the dialog box that appears select a name for the capture file A x1g extension usually is used for saving CCP XCP Spy capture information The CCP XCP Spy log is stored in ASCII format so you can view the x1g file in any ASCII editor Capture Options To view or modify the CCP XCP Spy capture options select Spy Options By default CCP XCP Spy displays 250 calls in the capture window Call History Depth The call history depth reflects the maximum number of API calls that CCP XCP Spy can display When the number of captured API calls exceeds the call history depth only the most recent calls are kept Capturing Data By default capture is activated when you open CCP XCP Spy When capture is off the blue arrow start button is enabled When capture is on the red X stop button is enabled To turn capture on click the blue arrow button on the toolbar To turn capture off click the red button on the toolbar Selecting Which CCP and XCP Commands to View You can specify which command you want to spy on at any time By default CCP XCP commands are enabled To select deselect the CCP XCP commands to spy on select Spy Options then select the commands under Capture Commands Captures all CCP XCP commands DAQ Messages Captures all DAQ list commands ECU measurement commands STIM Messages C
249. g at the selected Address If you are using the CCP protocol mcBuildChecksum implements the CCP BUILD_CHKSUM command The checksum algorithm is not specified by CCP and the checksum algorithm may be different on different devices If you are using the XCP protocol mcBuildChecksum implements the BUILD_CHECKSUM command of the XCP specification The result of the checksum calculation is returned in Checksum regardless of the checksum type The following values for ChecksumType are defined in the XCP specification Type Name Description 0x01 XCP_ADD_11 Add BYTE into a BYTE checksum ignore overflows 0x02 XCP_ADD_12 Add BYTE into a WORD checksum ignore overflows 0x03 XCP_ADD_14 Add BYTE into a DWORD checksum ignore overflows 0x04 XCP_ADD_22 Add WORD into a WORD checksum ignore overflows blocksize must be modulo 2 0x05 XCP_ADD_24 Add WORD into a DWORD checksum ignore overflows blocksize must be modulo 2 0x06 XCP_ADD_44 Add DWORD into DWORD ignore overflows blocksize must be modulo 4 0x07 XCP_CRC_16 Refer to CRC error detection algorithms 0x08 XCP_CRC_16_CITT Refer to CRC error detection algorithms 0x09 XCP_CRC_32 Refer to CRC error detection algorithms OxFF XCP_USER_ DEFINED User defined algorithm in externally calculated function National Instruments 6 7 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C With ChecksumType XCP_USER_DEFINED the Slav
250. g to a predefined measurement in the A2L database National Instruments 5 145 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW MC Measurement Read vi Purpose Reads a single Measurement value from the ECU Format measurement name ECU ref in ECU ref out value re error out Input ECU M amp C Toolkit User Manual Measurement name is the name of a measurement channel stored in the A2L database file you want to read ECU ref in is the task reference which links to the selected ECU This reference is originally returned from MC ECU Open vi or MC ECU Select vi and then wired through subsequent VIs Error in is a cluster which describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out status is TRUE if an error occurred This VI will not execute when status is TRUE 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 ECU ref out is the same as ECU ref in Wire the task reference to subsequent VIs for this task
251. gland Microsoft defines its UTC time FILETIME as a 64 bit counter of 100 ns intervals that have elapsed since 12 00 a m January 1 1601 Because the timestamp is compatible with Win32 FILETIME you can pass it into the Win32 FileTimeToLocalFileTime function to convert it to the local timezone and then pass the resulting local time to the Win32 FileTimeToSystemTime function to convert to the Win32 SYSTEMTIME type SYSTEMTIME is a struct with fields for year month day and so on For more information about Win32 time types and functions refer to the Microsoft Win32 documentation SampleArray SampleArray returns the sample value s for each received CAN message The samples are returned as an array of arrays a 2D array one array for each channel initialized in the DAQ task The array of each channel must have NumberOfSamplesToRead entries allocated You must allocate SampleArray exactly as TimestampArray and the order of channel entries is the same for both NumberOfSamplesReturned Indicates the number of samples returned for each channel in SampleArray and the number of timestamps returned for each channel in TimestampArray The remaining entries are left unchanged zero 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 val
252. gned short MaxSizeKey lt lt unsigned short SizeKey lt __attribute__ section export brief Function to calculate a checksum over a given memory range This function calculates a checksum over a given memory range The function is used for example to verify data after a download or programming action bool CALC _CHECKSUM_NAME struct TRange ptr lt Description of the memory area lt to be checked int nRanges lt Number of memory blocks to be checked unsigned char pnCheckSum lt Pointer to a buffer to return lt the checksum int pnSignificant lt Size of the buffer to lt return the checksum unsigned short nFlags lt flags for calculating the checksum attribute__ section export ifdef _ cplusplus endif endif __CCPECU_h__ National Instruments 4 25 ECU M amp C Toolkit User Manual ECU M amp C API for LabVIEW This chapter lists the LabVIEW VIs for the ECU M amp C API and describes the format purpose and parameters for each VI The VIs in this chapter are listed alphabetically Unless otherwise stated each VI suspends execution of the calling thread until it completes Section Headings The following are section headings found in the ECU M amp C API for LabVIEW VIs Purpose Each VI description includes a brief statement of the purpose of the VI Format The format section describes the form
253. gramming address Extension Extension contains the extension part of the address BlockSize BlockSize determines the size of the data block which is transferred to the ECU and used for programming from the MTAO target Data data contains the byte array that is transmitted to the ECU Output 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 amp C API to obtain a descriptive string for the return value ECU M amp C Toolkit User Manual 6 108 ni com Chapter 6 ECU M amp C API for C Description If you are using the CCP protocol mcProgram implements the CCP command PROGRAM The command is used to program the specified data into non volatile ECU memory Flash EEPROM etc Programming starts at the selected MTAO address and extension defined in the Address struct The mcProgram function auto increments the ECU MTAO address If you are using the XCP protocol mcProgram implements the XCP command PROGRAM The command is used to program a non volatile memory segment inside the ECU slave Depending on the access mode defined by PROGRAM_FORMAT two different concepts are
254. h as the Simple Error Handler source identi fies the VI where the error occurred 5 94 ni com Chapter5 ECU M amp C API for LabVIEW ECU ref out is the task reference that links to the selected ECU 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 Use MC Event Create vi to create an Event object in memory instead of referring to a predefined measurement in the A2L database Assign the event channel object by name to a DAQ List in MC Measurement Create vi National Instruments 5 95 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW MC Generic vi Purpose Sends a generic CCP or XCP command Format timeout ms ECU ref in ECU ref out command error code data return value error in error out buffer size for return value Input Timeout is the time limit in millis
255. h timeout applies to a specific command Ber ares U_XCP_Timeout_ refer to the XCP standard The values are Ss typically read from an A2L file but may be mcPropECU_XCP_Timeout_ T4 overridden manually mcPropECU_XCP_Timeout_ Note that the mcPropECU_TimingFactor T5 l property might modify this value mcPropECU_XCP_Timeout_ T6 mcPropECU_XCP_Timeout_ T7 u32 mcPropECU_CCP_Timeout_ Sets the timeout value in milliseconds for most T_std of the CCP commands For details of which timeout applies to a specific command refer to the CCP standard Default 40 Standard 25 The default is chosen slightly higher to allow for slower ECUs Note that the mcPropECU_TimingFactor property might modify this value u32 mcPropECU_CCP_Timeout_ Sets the timeout value in milliseconds for the T_pgm CCP programming commands For details of which timeout applies to a specific command refer to the CCP standard Default 120 Standard 100 The default is chosen slightly higher to allow for slower ECUs Note that the mcPropECU_TimingFactor property might modify this value u32 mcPropECU_CCP_Timeout_ Sets the timeout value in milliseconds for the T_mem CCP memory commands For details of which timeout applies to a specific command refer to the CCP standard Default and Standard 30000 Note that the mcPropECU_TimingFactor property might modify this value ECU M amp C Toolkit User Manual 6 118 ni com Chapter 6 ECU M amp C API for C
256. hapter 6 ECU M amp C API for C mcDatabaseOpen Purpose Opens a specified A2L Database Format mcTypeStatus mcDatabaseOpen cstr Database mcTypeTaskRef DBRefNum Input Database Database is a path to an A2L database file from which to get Measurement or calibration channel names The file must use a A2L extension You can generate A2L database files with several 3rd party tools Output DBRefNum DBRefNun is the task reference from the initial database task function The database task reference is originally returned from mcDatabaseOpen 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 amp C API to obtain a descriptive string for the return value Description The mcDatabaseOpen function does not start communication This enables you to query all defined ECU names in the A2L Database using the mcGetNames function and selecting the property value ECU Names To use the ECU M amp C Toolkit on a LabVIEW RT system you must download your ASAM MCD 2MC database A2L file to the RT target National Instruments 6 51 ECU M amp C Toolkit User Manual
257. he A2L database file from which a Measurement value is to be read Output Value Returns a single sample for the Measurement channel initialized Return Value in MeasurementName 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 amp C API to obtain a descriptive string for the return value Description mcMeasurementRead performs a single point read upload of a single Measurement from the selected ECU without opening a Measurement task ECU M amp C Toolkit User Manual 6 106 ni com Chapter 6 ECU M amp C API for C mcMeasurementWrite Purpose Writes a single Measurement value to the ECU Format mcTypeStatus mcMeasurementWrite mcTypeTaskRef ECURefNum char MeasurementName 64 Values Input ECURe Num ECURefNum is the task reference which links to the selected ECU This reference is originally returned from mcECUSelectEx MeasurementName MeasurementName is the name of a Measurement channel stored in the A2L database file to which a Measurement value is to be written Values Writes a single sample for the Measurement channel initialized in MeasurementName
258. he DataSocket Read function has the ability to read raw text tabbed text and wav files from an FTP server For more information on this refer to the LabVIEW User Manual The LabVIEW Internet Developers Toolkit allows you to send files or raw data to an FTP server as well as sending emails and adding security to your web based applications National Instruments 2 9 ECU M amp C Toolkit User Manual Chapter 2 Installation and Configuration Hardware and Software Requirements You can use the ECU M amp C Toolkit on the following hardware e National Instruments NI CAN hardware Series 1 or 2 with the NI CAN driver software version 2 3 or later installed e National Instruments NI XNET hardware with the NI XNET driver software version 1 0 or later installed e National Instruments CompactRIO or R Series Multifunction RIO hardware and the NI 9853 or NI 9852 CompactRIO CAN modules 3 Note You can use the ECU M amp C Toolkit with LabVIEW 2009 or newer on CompactRIO systems or National Instruments R Series Multifunction RIO hardware ECU M amp C Toolkit User Manual 2 10 ni com Application Development This chapter explains how to develop an application using the ECU M amp C API Choose the Programming Language LabVIEW LabWindows CVI National Instruments The programming language you use for application development determines how to access the ECU M amp C Toolkit APIs ECU M amp C Toolkit functions and
259. he NI CAN Channel API the NI CAN Frame API cannot used on the same CAN network interface simultaneously If the CAN network interface is already initialized in the Frame API this function returns an error If you use NI XNET or CompactRIO R Series hardware use the protocol and interface parameter instead ECU ref out is the task reference which links to the selected ECU 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 MC ECU Open vi opens a specified A2L database and selects the first ECU found in the database If there are several ECUs stored in the A2L database use MC Database Open vi and MC ECU Select vi to select a specific ECU Possible selections for the interface and protocol parameter for the various hardware targets are as follows Using CAN hardware e CCP CAN0 uses CCP on CAN interface 0 e CCP CAN1 uses CCP on C
260. he debugging of an application To launch this tool open the Software branch of the MAX configuration tree right click NI I O Trace and select Launch NI I O Trace If you have more than one National Instruments driver installed on your computer you can specify which APIs you want to monitor at any time By default all installed APIs are enabled To select the APIs to monitor select Tools Options select the View Selection tab and select the desired APIs under Installed API Choices CCP XCP Spy The CCP XCP Spy tool monitors CCP and XCP protocol communication to aid in the debugging of an application Launch this tool from the Start menu in Start Programs National Instruments ECU Measurement and Calibration Toolkit CCP and XCP Spy ECU M amp C Toolkit User Manual 3 6 ni com Chapter 3 Application Development National Instruments Figure 3 1 CCP XCP Spy Is Logfile xig CCP XCP Spy o File View Spy Help DE Ref Protocol Time Sender Command Parameters Command Counter 0 CCP 14 53 49 442 Master CONNECT Station 0x0051 00 1 CCP 14 53 49 442 ECU gt OK 00 E 2 CCP 14 53 49 442 Master EXCHANGEID CCP Master ID 00 00 00 00 00 00 01 H 3 CCP 14 53 49 442 ECU gt OK CAL DAQ PROGRAM 01 4 CCP 14 53 49 442 Master GET_SEED CAL 02 5 CCP 14 53 49 457 ECU gt OK protected Seed DE DD 00 00 02 6 CCP 14 53 49 457 Master UNLOCK Key DE DE E3 0B FF 00 03 7 CCP 14 53 49 457 ECU gt OK CAL DAQ PROGRAM
261. he existing FPGA code or create a custom bitfile For example to use additional I O on the FPGA target you must add these I O to the FPGA VI You must install the LabVIEW FPGA Module to create these files Modify the FPGA VI according to the following guidelines e Do not modify remove or rename any block diagram controls and indicators named __ CANO Rx Data _ CANO Rx Ready _ CANO Tx Data Frame _ CANO Tx Ready _ CANO Bit Timing _ CANO FPGA Is Running _ CANO Start _ CANO FIFO Full or __ CANO FIFO Empty If you intend to use multiple CAN 985x modules on your FPGA you need to duplicate and rename all controls and indicators accordingly e Do not modify the CAN read and write code except to filter CAN IDs on the receiving side to minimize the amount of CAN data transfers to the host e As you create controls or indicators ensure that each control name is unique within the VI Refer to the LabVIEW FPGA Module documentation for more information about creating FPGA VIs and bitfiles for an FPGA target When using the ECU M amp C Toolkit on CompactRIO with an NI 985x C Series module the interface name is based on the bitfile you use and the interface name you set For example MyInterface MyBitfile lvbitx CAN lvbitfile lvbitx or CANO mybitfile lvbitx 3 4 ni com Chapter 3 Application Development The interface name you use must be part of all parameters in the FPGA code for the CAN communication Also the ECU M amp C Toolk
262. he numeric rate Advanced baud rates are specified as 8000XXYY hex where YY is the value of Bit Timing Register 0 BTRO and XX is the value of Bit Timing Register 1 BTR1 of the CAN controller chip For more information refer to the Interface Properties dialog in MAX The value of this property is originally set within MAX but it can be changed using MC Set Property vi ECU M amp C Toolkit User Manual 5 106 ni com Chapter 5 ECU M amp C API for LabVIEW Table 5 5 Poly Values for Value Output Continued Type Hierarchy Sub Hierarchy Sub 1 Sub 2 Param Description ECU CCP CRO ID Returns the CRO ID Command Receive Object which is used to send commands and data from the host to the slave device ECU CCP CRO Task Returns the NI CAN task reference for the CRO Command Receive Object the CAN task writing frames to the slave device For example you might use this to set CAN properties for this task Handle with extreme care as those properties are usually set correctly by the ECU M amp C Toolkit itself ECU CCP DTO ID Returns the DTO ID Data Transmission Object which is used by the ECU to respond to CCP commands and send data and status information to the CCP master ECU CCP DTO Task Returns the NI CAN task reference for the DTO ID Data Transmission Object the CAN task reading frames from the slave devi
263. i ECU M amp C Toolkit User Manual 5 176 ni com Chapter5 ECU M amp C API for LabVIEW MC Upload vi Purpose Uploads data from an ECU Format ECU ref in ECU ref out address data block size error out error in Input ECU ref in is the task reference which links to the selected ECU This reference is originally returned from MC ECU Open vi or MC ECU Select vi and then wired through subsequent VIs Address is a cluster which contains the following values Address specifies the address part of the source address in the ECU from which the memory block is copied Extension specifies the extension part of the source address Lust P j Block size is the size of the data block in bytes to be uploaded Error in is a cluster which describes error conditions occurring before the VIexecutes If an error has already occurred the VI returns the value of the error in cluster to error out status is TRUE if an error occurred This VI is not executed when status is TRUE 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 Nation
264. i 5 146 MC Measurement Write vi 5 148 MC Program Reset vi 5 152 MC Program Start vi 5 154 MC Program vi 5 150 MC Set Property vi 5 156 Characteristic specific input values table 5 174 DAQ specific poly input values table 5 172 ECU specific poly input values table 5 158 Measurement specific input values table 5 174 MC Text To Double vi 5 175 MC Upload vi 5 177 MC XCP Copy Cal Page vi 5 179 MC XCP Get Cal Page vi 5 181 MC XCP Get ID vi 5 183 MC XCP Get Status vi 5 185 MC XCP Program Prepare vi 5 190 MC XCP Program Verify vi 5 192 MC XCP Set Cal Page vi 5 195 MC XCP Set Request vi 5 197 MC XCP Set Segment Mode vi 5 200 ni com LabVIEW Real Time RT configuration 2 5 CompactRIO system 2 5 DOS prompt 2 6 FTP transfers table 2 6 LabVIEW 2 9 LabVIEW RT graphical file transfer utility 2 7 NI CAN on PXI RT system 2 5 NI XNET on PXI RT system 2 5 PXI system 2 5 web browsers 2 7 license management overview 2 1 list of C functions 6 2 list of LabVIEW VIs 5 1 MC Build Checksum vi 5 6 MC Calc Checksum vi 5 9 MC CCP Action Service vi 5 12 MC CCP Diag Service vi 5 14 MC CCP Generic vi 5 96 MC CCP Get Active Cal Page vi 5 16 MC CCP Get Result vi 5 18 MC CCP Get Session Status vi 5 20 MC CCP Get Version vi 5 22 MC CCP Move Memory vi 5 24 MC CCP Select Cal Page vi 5 26 MC CCP Set Session Status vi 5 28 options table 5 29 MC Characteristic Read Single Va
265. i Refer to Table 5 7 for a list of DAQ specific properties that can be used to define the poly input value Poly VI Types Table 5 6 ECU Specific Property Value Types for the POLY Input Value Type Hierarchy Sub Hierarchy Sub 1 Sub 2 Param Description ECU Byte Order Sets the byte order of the CCP slave device O0O 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 ECU Command Byte Order Sets the byte order of the CCP or XCP commands O0O 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 ECU M amp C Toolkit User Manual 5 158 ni com Chapter5 ECU M amp C API for LabVIEW Table 5 6 ECU Specific Property Value Types for the POLY Input Value Continued Sub Hierarchy Type Hierarchy Subl Sub 2 Param Description ECU Seedkey Determines the directory Checksum where the ECU M amp C DLL Path Toolkit expects to find the Seedkey or Checksum DLL If the property is an empty string default the ECU M amp C Toolkit expects the DLLs in the same directory as the A2L file If your DLLs are in a different directory set this property pointing to this directory ECU Checksum Sets the file name of the
266. iate value as defined in the Address cluster If you are using the XCP protocol MC Upload vi implements the XCP command UPLOAD A data block of the specified length starting at the specified address is uploaded from the ECU The Memory Transfer Address pointer MTAO is post incremented by the given number of data elements If the slave device does not support block transfer mode all uploaded data is transferred in a single response packet If block transfer mode is supported the uploaded data is transferred in multiple responses on the same request packet For the master there are no limitations allowed concerning the maximum block size For further information on how to upload data and to use the MC Upload vi command refer to the ASAM XCP Part 2 Protocol Layer Specification ECU M amp C Toolkit User Manual 5 178 ni com Chapter5 ECU M amp C API for LabVIEW MC XCP Copy Cal Page vi Purpose Forces a copy transaction of one calibration page to another Format source page source segment ECU ref in destination segment destination page error in ECU ref out error out Input Source page specifies the logical page number of the source data page Source segment specifies the logical segment number of the source data page ECU ref in is the task reference which links to the selected ECU This reference is originally returned from MC ECU Open vi or MC ECU Select vi and then wired through subsequent VIs Dest
267. icant bit first 1 Motorola format Bytes are in big endian order with most significant bit first Characteristic Comment Returns the Comment string of the selected Characteristic Characteristic Data Type Returns the data type of the Characteristic National Instruments 5 127 ECU M amp C Toolkit User Manual ECU M amp C API for LabVIEW Chapter 5 ECU M amp C API for LabVIEW Table 5 5 Poly Values for Value Output Continued Type Hierarchy Sub Hierarchy Sub 1 Sub 2 Param Description Characteristic Dimension Returns the dimension of a Characteristic 0 0 dimension The Characteristic can be accessed read write through a double value 1 1 dimension The Characteristic can be accessed read write through a one dimensional array of double values 2 2 dimensions The Characteristic can be accessed read write through a two dimensional array of double values Characteristic Extension Returns additional address information For instance it can be used to distinguish different address spaces of an ECU multi microcontroller devices Characteristic Maximum Returns the maximum value of the Characteristic Characteristic Minimum Returns the minimum value of the Characteristic AE IE TE Characteristic Read Only Returns if a Characteristic is se
268. ied DAQ list u32 mcPropDAQList_ Returns whether or not the specified DAQ list ReductionAllowed allows reduction u32 mcPropDAQList_NumberOf Returns the length of the array containing the ExcludedDAQLists numbers of DAQ lists not working together with the current DAQ list ul6 mcPropDAQList_Excluded Returns an array containing the numbers of DAQLists DAQ lists not working together with the current DAQ list National Instruments 6 93 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C Table 6 4 Values for PropertyID Continued Data Type Name Description str mcPropDAQList_Name Name of the DAQ list measurement source Pass the DAQ list number converted to a string in the Name parameter of Get Property The available DAQ list number can be obtained by the ECU_DAQListNumbers property str mcPropDAQList_Name_ Call this property before calling Size mcPropDAQList_Name to find the amount of storage needed to get the name value str mcPropDAQList_Display Optional property you can use as a display name Identifier as an alternative to the DAQList_Name property str mcPropDAQList_Display Call this property before calling Identifier_Size mcPropDAQList_DisplayIdentifier to find the amount of storage needed to get the display identifier value u32 mcPropECU_Name_Size Returns the number of bytes to be allocated if you call mcGet Property with the parameter mcPropECU_Name str mc
269. iginally returned from mcECUSelectEx BlockSize BlockSize determines the size of the block on which the checksum must be calculated TypeOfChecksum TypeOfChecksum specifies the type of the calculated checksum Output Data Data is a byte array upon which the checksum calculation is performed SizeofChecksum SizeofChecksum returns the size in bytes of the calculated checksum Checksum Checksum is the calculated checksum 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 amp C API to obtain a descriptive string for the return value ECU M amp C Toolkit User Manual 6 10 ni com Chapter 6 ECU M amp C API for C Description mcCalculateChecksum implements a checksum calculation over a given data block The checksum algorithm is performed over a dedicated checksum function provided by a specific DLL The name of the Checksum DLL is defined in the A2L data base and can be changed by the application by the mcSet Property function using the mcPropECU_Checksum property If you are using the CCP protocol TypeOfChecksum must be set to OxFFh since CCP only supports an ext
270. ile a Measurement task is running If you need to change a property prior to starting a Measurement task call mcDAQInitialize followed by mcSetProperty and then mcDAQStartStop After you start the Measurement task you also can change a property by calling mcDAQStart Stop followed by mcSet Property and then mcDAQStartStop to restart the task Table 6 6 contains a listing of ECU specific values for PropertyID National Instruments 6 113 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C Properties Table 6 5 ECU Specific Value Types for the PropertylD Input Value Data Type Name Description u32 mcPropCANBaudRate Sets the CAN Baud rate for CCP or XCP on CAN which is used to send commands and data from the host to the slave device ug mcPropCANTermination For all XNET devices the termination is software selectable XNET provides the option of 80 Q between Bus Plus and Bus Minus or no termination The Termination property configures the onboard termination of the NI XNET interface CAN connector port The Boolean property supports two values TRUE Termination ON and FALSE Termination Off However different CAN hardware has different termination requirements and the termination values have different meanings Refer to the Termination attribute in the XNET API for more details This property is supported for NI XNET devices only u32 mcPropCmd_EXCHANGE_ID Sets whether or not the EXCHANGE_ID
271. in input samples as single point array or waveform 1 Polling In this mode the data from the Measurement task is uploaded from the ECU whenever mcDAQRead is called u32 mcPropDAQ_NumChannels Returns the number of channels initialized in a DAQ channel list of a M amp C Measurement task This is the number of array entries required when using mcDAQRead ul6 mcPropDAQ_Prescaler Prescaler for the Measurement task on the ECU 64 mcPropDAQ_ SampleRate Returns the selected Sample Rate in Hz for the M amp C Measurement task u32 mcPropDAQ_ Samples Pending Returns the number of samples available for read in DAQ tasks defined with sample rate gt 0 If this property is queried before the DAQ list is started it always returns 0 Start the DAQ list first with mcDAQStartStop before you query this property 64 mcPropDAQ_TimeSince LastFrame Indicates how much time has passed in seconds since the measurement session received the last DAQ frame You can reuse this property to restart the measurement when the value increases a threshold for example 0 5 seconds assuming the ECU stopped sending DAQ messages and must be restarted ECU M amp C Toolkit User Manual 6 84 ni com Chapter 6 ECU M amp C API for C Table 6 4 Values for PropertyID Continued Data Type Name Description str mcPropDB_Filename Returns the A2L Database file name with which the task has bee
272. in the A2L database The data can be read back with the MC DAQ Read vi as Single point data using sample rate 0 or as a waveform using a sample rate gt O Input channel data is received from the DAQ messages Use MC DAQ Read vi to obtain input samples as single point array or waveform 1 Polling In this mode the data from the Measurement task is uploaded from the ECU whenever MC DAQ Read vi is called DAQ Prescaler Sets the prescaling factor which reduces the desired transmission frequency of the associated DAQ list ECU M amp C Toolkit User Manual 5 172 ni com Chapter5 ECU M amp C API for LabVIEW Table 5 7 DAQ Specific Property Value Types for the POLY Input Value Continued Type Hierarchy Sub Hierarchy Sub 1 Sub 2 Param Description DAQ Sample Rate SampleRate specifies the timing to use for the samples of the NI CAN task The sample rate is specified in Hertz samples per second A sample rate of zero means to sample immediately For a DAQMode of mcDAQModeDAQList SampleRate of zero means that MC DAQ Read vi returns a single sample from the most recent messages received and greater than zero means that MC DAQ Read vi returns samples timed at the specified rate For DAQMode of mcDAQModePolling SampleRate is ignored DAQ CCP DTO ID Sets the DTO ID Data Transmission Object which is used by
273. ination page specifies the logical segment number of the destination data page Destination segment specifies logical page number of the destination data page Error in is a cluster which describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out EEE EER status is TRUE if an error occurred This VI will not execute when status is TRUE National Instruments 5 179 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW 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 ECU ref out is the same as ECU ref in Wire the task reference to subsequent VIs for this task 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 operatio
274. ing the communication Return value may contain an array of bytes returned from the ECU as a response to the CCP command sent 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 MC Generic vi implements any generic CCP or XCP command that can be used to execute user defined commands that are not defined in the CCP or XCP standard or not covered by the available LabVIEW CCP XCP VIs National Instruments 5 97 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW MC Get Names vi Purpose Gets an array of ECU names Measurement names Characteristic names Event names Calibration page names or Group names from a specified A2L database file Format type reference in reference out ECU name names list out error in error out Input ECU M amp C Toolkit User Manual Type mode i
275. ing under Devices and Interfaces in MAX 5 84 ni com Chapter5 ECU M amp C API for LabVIEW B Note By selecting nixnet as Protocol and Interface string the ECU Measurement and Calibration Toolkit uses the Frame Input and Output Queued sessions To force the ECU Measurement and Calibration Toolkit to use Frame Input and Output Stream sessions instead select ni_genie_nixnet as Protocol and Interface string for example CCP CAN1 ni_genie_nixnet An application instance can use only one Frame Input Stream Session and one Frame Output Stream Session at a time so use the default name nixnet as Protocol and Interface string so that multiple NI XNET Frame Queued Sessions can coexist on a single interface and the Frame Input and Output Stream Sessions may be used for example for a Frame logging replay use case CompactRIO or R Series If using CompactRIO or R Series hardware you must provide a bitfile that handles the CAN communication between the host system and FPGA To access the CAN module on the FPGA you must specify the bitfile name after the for example CCP CAN1 MyBitfile lvbitx To specify a special RIO target you can specify that target by its name followed by the bitfile name for example XCP CAN1 RIO1 MyBitfile lvbitx Currently only a single CAN interface is supported RJO defines the RIO target name as defined in your LabVIEW Project definition The vbitx filename represents the filename and location of the bitfile on
276. ings All Users Documents National Instruments ECU Measurement and Calibration Toolkit Examples MS Visual C 3 2 ni com Chapter 3 Application Development Each example is in a separate folder A description of each example is in comments at the top of the c file At the command prompt after setting MSVC environment variables such as with MS vevars32 bat you can build each example using a command such as cl I lt HDir gt measure c lt LibDir gt niemcc 1lib lt HDir gt is the folder where niemc h can be found lt LibDir gt is the folder where niemcc 1ib can be found Other Programming Languages National Instruments The ECU M amp C Toolkit software does not provide formal support for programming languages other than those described in the preceding sections If the programming language provides a mechanism to call a Dynamic Link Library DLL you can create code to call ECU M amp C Toolkit functions All functions for the ECU M amp C API are located in niemcc d11 If the programming language supports the Microsoft Win32 APIs you can load pointers to ECU M amp C Toolkit functions in the application The following text demonstrates use of the Win32 functions for C C environments other than Visual C C 6 For more detailed information refer to Microsoft documentation The following C language code fragment illustrates how to call Win32 LoadLibrary to load the DLL for the ECU M amp C API include lt windows h gt
277. 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 ECU ref out is the same as ECU ref in Wire the task reference to subsequent VIs for this task value returns the numeric value to be transferred to the ECU in subsequent 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 Write requests Description 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 MC Text To Double vi performs the conversion from the text input value into a double value You can use this especially if the measurement or characteristic has an associated enumeration or range text type scaling before writing the double values to the ECU using the regular Write VIs MC DAQ Write vi MC Measurement Write vi MC Characteristic Write v
278. ion page on the ECU MC Event Create vi Creates an Event object in memory MC Generic vi Sends a generic CCP or XCP command National Instruments 5 3 ECU M amp C Toolkit User Manual Chapter 5 ECU M amp C API for LabVIEW Table 5 1 ECU M amp C API VIs for LabVIEW Continued Function Purpose MC Get Names vi Gets an array of ECU names Measurement names Characteristic names Event names Calibration page names or Group names from a specified A2L database file MC Get Property vi Gets a property for the object referenced by the reference in terminal The poly VI selection determines the property to get MC Measurement Create vi Creates a Measurement object in memory MC Measurement Read vi Reads a single Measurement value from the ECU MC Measurement Write vi Writes a single Measurement value to the ECU MC Program vi Programs a memory block on the ECU MC Program Reset vi Indicates the end of a programming sequence MC Program Start vi Indicates the start of a programming sequence MC Set Property vi Sets a property for the specified A2L database file Measurement task or Characteristic The poly VI selection determines the property to set MC Text To Double vi Converts a text value into the numeric representation using an enumeration or range text type scaling MC Upload vi Uploads data from an EC
279. ionCreate a measurement object using mcMeasurementCreate and an event using mcEventCreate 53 Note mcDatabaseOpenEx does not support creating objects to access characteristics To access a characteristic assign a valid A2L database file with defined characteristics ECU M amp C Toolkit User Manual 6 52 ni com mcDoubleToText Chapter 6 ECU M amp C API for C Purpose Converts a numerical value to a text string using an enumeration or range text type scaling Format mcTypeStatus Input ECURefNum ObjectType ObjectName Value SizeOfTextValue National Instruments mcDoubleToText mcTypeTaskRef ECURefNum u32 ObjectType cstr ObjectName double Value u32 SizeOfTextValue str TextValue ECURe Num is the task reference which links to the selected ECU This reference is originally returned from mcECUSelectEx Indicates the type of the object named in ObjectName Valid values are 1 Measurement Name 2 Characteristic Name Indicates the object measurement or characteristic for which the COMPU_VTAB scaling is performed If no COMPU_VTAB scaling is available for the object Text Value is just a string representation of the value specified in Value The numerical value to be converted For example this could have been returned from mcCharacteristicRead or mcMeasurementRead Must contain the number of bytes in the buffer passed to TextValue Note that there is no way of requesting the ne
280. ise Error out describes the error status of this VI if GE 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 MC Build Checksum vi calculates the checksum of a specified memory block inside the ECU starting at the selected Memory Transfer Address MTA The checksum algorithm is not specified by CCP and the checksum algorithm may be different on different devices If you are using the CCP protocol MC Build Checksum vi implements the CCP BUILD_CHKSUM command The checksum algorithm is not specified by CCP and the checksum algorithm may be different on different devices National Instruments 5 7 ECU M amp C Toolkit User Manual Chapter 5 ECU M amp C API for LabVIEW If you are using the XCP protocol MC Build Checksum vi implements the BUILD_CHECKSUM command of the XCP specification The result of the checksum calculation is returned in Checksum regardless of the checksum type The following values for type of checksum are defined in the XCP specification Type Name Desc
281. it needs the interface name for correct functionality If you define the interface name to be CANO you must name the parameters as follows e _ CANO Rx Data e __CANO Rx Ready e __CANO Tx Data Frame e __CANO Tx Ready e __CANDO Bit Timing e __CANO FPGA Is Running e _ CANDO Start e __CANO FIFO Full e __CANO FIFO Ready In addition you need to set the name of the internally used FIFO to __CAN0 FIFO the FIFO is set to U32 1029 elements target scoped and block memory After recompiling your FPGA VI copy the bitfile to the root directory of your CompactRIO controller and specify the bitfile in the interface name Or copy the file to any location on the CompactRIO controller and specify an absolute path or path relative to the root for the bitfile If you are using an NI XNET 986x C Series module on your CompactRIO target you need to start an FPGA VI on the target before accessing the port with the ECU M amp C Toolkit Refer to the Getting Started with CompactRIO section in the NI XNET Hardware and Software Manual for more information about compiling the FPGA VI When the VI is running you can access the NI 986x module as you would program on a Windows or PXI LabVIEW Real Time target National Instruments 3 5 ECU M amp C Toolkit User Manual Chapter 3 Application Development Debugging An Application NI 1 0 Trace The NI I O Trace formerly NI Spy tool monitors function calls to the ECU M amp C API to aid in t
282. itions The calibration session status is organized as a bit mask with the following assignment Chapter5 ECU M amp C API for LabVIEW 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 Table 5 2 Bit Mask Assignment for Calibration Session Status Bit Name Description 0 CAL Calibration data initialized 1 DAQ DAQ list s initialized 2 RESUME Request to save DAQ set up during shutdown in CCP slave CCP slave automatically restarts DAQ after start up 3 Reserved 4 Reserved 5 Reserved 6 STORE Request to save calibration data during shut down in CCP slave 7 RUN Session in progress National Instruments 5 29 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW MC Characteristic Read vi Purpose Reads data from a named Characteristic on the ECU which is identified by the ECU Reference handle The Poly VI returns a specific double 1D or 2D double array Format characteristic name ECU ref in ECU ref out characteristic error
283. ity to pass the correct number of parameters in the correct byte ordering to this function Output ResultLength ResultLength returns the number of bytes that can be uploaded from the ECU as a result of the execution of the service The result of this service can be accessed by calling the function mcCCPGetResult right after mcCCPDiagService DataType DataType is a data type qualifier which provides information about the data type of the result of the diagnostic service ECU M amp C Toolkit User Manual 6 14 ni com Chapter 6 ECU M amp C API for C 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 amp C API to obtain a descriptive string for the return value Description mcCCPDiagService implements the CCP command DIAG_SERVICE which calls a diagnostic service on the ECU and waits until it is finished The selected ServiceNo specifies the diagnostic service that must be executed inside the ECU For more information about the available services that are implemented in the ECU refer to the documentation for the ECU The result of this service can be accessed by ca
284. k reference is originally returned from mcDAQInitialize and then reused by subsequent Measurement task functions NumberOfSamplesToRead Output StartTime ECU M amp C Toolkit User Manual Specifies the number of samples to read for the task For single sample input pass to this parameter If the initialized sample rate is zero you must pass NumberOfSamplesToRead no greater than 1 SampleRate of zero Means mcDAQRead immediately returns a single sample from the most recent message s received Returns the time of the first CAN sample in SampleArray This parameter is optional If you pass NULL for the StartTime parameter the mcDAQRead function proceeds normally If the initialized sample rate is greater than zero the Start Time is determined by the sample timing If the initialized SampleRate is zero the StartTime is zero because the most recent sample is returned regardless of timing StartTime uses the mcTypeTimestamp data type The mcTypeTimestamp data type is a 64 bit unsigned integer compatible with the Microsoft Win32 FILETIME type This absolute time is kept in a Coordinated Universal Time UTC 6 40 ni com Chapter 6 ECU M amp C API for C format UTC time is loosely defined as the current date and time of day in Greenwich England Microsoft defines its UTC time FILETIME as a 64 bit counter of 100 ns intervals that have elapsed since 12 00 a m January 1 1601 Because mcTypeTimestamp is compatible
285. ks operating system If you are using a CompactRIO target with a PowerPC controller running a VxWorks operating system you cannot use any Win32 function calls based on a DLL However the GNU tool chain distributed with VxWorks can compile shared libraries for controllers running Wind River VxWorks including the CompactRIO 901x and 907x series You can access the shared libraries OUT modules for VxWorks through the ECU Measurement and Calibration Toolkit by using a C C function definition that is slightly different from the ASAM specification due to the differences between Win32 DLLs and VxWorks OUT modules You can obtain the GNU tool chain for VxWorks by either purchasing a VxWorks development license from Wind River or downloading the redistributable GNU tool chain from ni com If you purchase VxWorks you can use the Wind River Workbench IDE featuring source code level debugging and build management The redistributable GNU tool chain downloadable on ni com offers debugging only at the assembly code level and you must use the included GNU Make to build binaries 3 Note LabVIEW 2009 RT installs version 6 3 of the VxWorks OS to compatible targets All builds should be targeted to corresponding versions and use corresponding header files As new versions of LabVIEW RT become available different versions of VxWorks may be installed and may require you to rebuild your libraries Refer to the readme file for LabVIEW RT to find the cor
286. l support options in your area Visit ni com services or contact your local office at ni com contact e Training and Certification Visit ni com training for training and certification program information You can also register for instructor led hands on courses at locations around the world e System Integration If you have time constraints limited in house technical resources or other project challenges National Instruments B 1 ECU M amp C Toolkit User Manual Appendix B Technical Support and Professional Services Alliance Partner members can help To learn more call your local NI office or visit ni com alliance You also can visit the Worldwide Offices section of ni com niglobal to access the branch office websites which provide up to date contact information support phone numbers email addresses and current events ECU M amp C Toolkit User Manual B 2 ni com Glossary Symbol Prefix Value m milli 10 3 k kilo 103 M mega 106 Numbers 2MC A2L See ASAM MCD 2MC database file A A2L file address extension API arbitration ID ASAM ASAM MCD 2MC National Instruments ECU device database file in ASAM MCD 2MC format An additional parameter to the address that may be used to switch between data of several memory banks Application Program Interface A set of routines protocols and tools for building software applications An 11 or 29 bit ID transmit
287. lag Description 0 STORE_CAL_REQ REQuest to STORE CALibration data 0 STORE_CAL_REQ mode is reset 1 STORE_CAL_REQ mode is set 1 Unused 2 STORE_DAQ_REQ REQuest to STORE DAQ list 0 STORE_DAQ_REQ mode is reset 1 STORE_DAQ_REQ mode is set ECU M amp C Toolkit User Manual 5 186 ni com Chapter5 ECU M amp C API for LabVIEW Bit Number Flag Description 3 CLEAR_DAQ_ REQ REQuest to CLEAR DAQ configuration 0 CLEAR_DAQ_ REQ is reset 1 CLEAR_DAQ_REQ is set 4 Unused _ 5 Unused 6 DAQ_RUNNING Data Transfer 0 The data transfer is not running 1 The data transfer is running 7 RESUME RESUME Mode 0 The slave device is not in RESUME mode 1 The slave device is in RESUME mode The STORE_CAL_REQ flag indicates a pending request to save the calibration data into non volatile memory As soon as the request has been fulfilled the slave will reset the appropriate bit The slave device may indicate this by transmitting an EV_STORE_CAL event packet The STORE_DAQ_ REQ flag indicates a pending request to save the DAQ list setup in non volatile memory As soon as the request has been fulfilled the slave will reset the appropriate bit The slave device may indicate this by transmitting an EV_STORE_DAQ event packet The CLEAR _DAQ_ REQ flag indicates a pending request to clear all DAQ lists in non volatile memory All ODT entries are reset to address 0 extension 0 size
288. lave and ends the measurement and calibration session When the measurement and calibration session is terminated all DAQ lists for the device are stopped and cleared and the protection masks of the device are set to their default values The function to disconnect an ECU is MC ECU Disconnect vi in LabVIEW or mcECUDisconnect in C The MC ECU Close function deselects the ECU and closes the remaining database reference handle MC ECU Close must always be the final ECU M amp C function call If you do not use MC ECU Close the remaining task configurations can cause problems in the execution of subsequent ECU M amp C applications The function to close an ECU is MC ECU Close vi in LabVIEW To deselect the ECU and close the database reference handle in C call the function mcECUDeselect followed by mcDatabaseClose Characteristic Read and Write National Instruments Access Characteristics To access the Characteristics of an ECU you must select and connect to the specified ECU through the procedure given above The function to open and select an ECU is MC ECU Open vi in LabVIEW or mcDatabaseOpen followed by mcECUSelectEx in C Once the ECU has been connected an ECU Reference handle ECU ref out in LabVIEW ECURefNum in C must be acquired before any additional actions can be performed 4 7 ECU M amp C Toolkit User Manual Chapter 4 Using the ECU M amp C API ECU M amp C Toolkit User Manual Characteristic Read The app
289. ld must have the same value as the counter field of the corresponding CRO The error field contains information about the error state The parameter and data fields contain the data returned from the slave device to the host Command Return Messages and Event Messages consist of eight bytes Data Acquisition Messages DAQ Messages or DAMs have a PID in the first byte and the rest of the message contains data DAMs may be shorter than eight bytes 2 3 4 5 6 7 PID Parameter and Data Field ECU M amp C Toolkit User Manual Since the PIDs 0x00O OxFD are reserved for Data Acquisition Messages a CCP slave device can send up to 253 different DAMs Each DAQ message can transfer up to seven bytes of data The number of DAQ Messages supported by a slave device depends on the device itself Data acquisition is performed through a CCP slave device by reading data from a device s memory and copying it into the data field of a DAQ message So the CCP slave device keeps a list of entries for each DAM These lists are called ObjectDefinitionTables ODTs Each ODT entry holds information about the memory address where data is stored inside the device and the size of the data to be sent The data of the first ODT entry is placed in the first byte of the data field of the DAQ message The data of the next entry is placed at the first free byte of the DAQ message and so on A 4 ni com Technical Support a
290. le DAQ list number can be obtained by the ECU DAQ List Numbers property DAQ List Display Identifier Optional property you can use as a display name as an alternative to the DAQ List Name property Measurement Address Returns the address part of the address of the selected Measurement in the memory of the control unit Measurement Byte Order Returns the specified byte order O Intel format Bytes are in little endian order with least significant bit first 1 Motorola format Bytes are in big endian order with most significant bit first Measurement Comment Returns the Comment string of the selected Measurement Measurement Data Type Returns the data type of the Measurement task National Instruments 5 137 ECU M amp C Toolkit User Manual ECU M amp C API for LabVIEW Chapter 5 ECU M amp C API for LabVIEW Table 5 5 Poly Values for Value Output Continued Type Hierarchy Sub Hierarchy Sub 1 Sub 2 Param Description Measurement Extension Returns the extension part of the address This optional parameter may contain additional address information defined in the A2L database For instance it can be used to distinguish different address spaces of an ECU multi microcontroller devices Measurement Is Virtual Indicates whether the Measurement is virtual Virtual Measurements are no
291. lication must call the Read Characteristic function to obtain scaled floating point samples The application typically calls Read Characteristic on demand Calling Read Characteristic in a loop can cause significant CAN network traffic as Characteristics may contain large amounts of data The function to read 0 to 2 dimensional Characteristics is MC Characteristic Read vi in LabVIEW or mcCharacteristicRead in C The function to read single double values as Characteristics is MC Characteristic Read Single Value vi in LabVIEW or mcCharacteristicReadSingleValue in C Before reading a Characteristic it may be helpful to verify the dimension of the Characteristic based on the definition in the ASAM MCD 2MC database file Depending on the dimension of the Characteristic use the appropriate Read function for reading a double a 1D array of doubles or a 2D array of doubles The function to verify a dimension of a named Characteristic is MC Get Property vi with the parameter Characteristic Dimension in LabVIEW or mcGet Property with the parameter mcPropChar_Dimension in C Characteristic Write The application must call the Write Characteristic function to output scaled floating point samples The application typically calls Write Characteristic on demand Calling Write Characteristic in a loop can cause significant network traffic as Characteristics may contain large amounts of data The function to write a Characteristic is MC Characteristi
292. lications Because this function clears the Measurement task the Measurement task reference is transferred into an ECU reference task handle To change the properties of a running Measurement task use DAQ Start Stop to stop the task Set Property to change the desired DAQ property then DAQ Start Stop to restart the Measurement task again The function to clear a DAQ list is MC DAQ Clear vi in LabVIEW or mcDAQClear in C Memory Programming National Instruments The ECU Measurement and Calibration Toolkit allows you to issue a memory programming sequence for your ECU after you create an ECU Reference handle as described in the Basic Programming Model section The flowchart in Figure 4 6 illustrates the general process of a memory programming sequence of an ECU with the ECU M amp C functions A description of each step in the decision process follows the flowchart 4 13 ECU M amp C Toolkit User Manual Chapter 4 Using the ECU M amp C API Loo No y Optional XCP Program Prepare y Optional Set XCP Program Properties e Clear Memory before Programming Program Program Reset Clear Memory Optional XCP Program Verify Program Start The Program Start function sets the ECU into the memory programming mode Note that in this mode specific features might be restricted for instance the ECU might refuse to change into the programming mode while
293. listed in a COMPU_VTAB scaling for the characteristic or measurement specified in object name the respective text is returned If no such value is available a string representation of the double value is returned 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 MC Double To Text vi performs text conversion for measurement or characteristic values Especially if the measurement or characteristic has an associated enumeration or range text type scaling the textual representation of the value is returned If no such value is present either because the object does not have a text scaling or the value does not have a textual representation in the table a string representation of the double value is returned ECU M amp C Toolkit User Manual 5 68 ni com Chapter5 ECU M amp C API for LabVIEW MC Download vi P
294. lkit User Manual 4 18 ni com Chapter 4 Using the ECU M amp C API Table 4 2 Overview of the XCP Commands with Related VIs and C Functions Continued XCP Command LabVIEW VI Name C Function Name SET_SEGMENT_MODE MC XCP Set Segment mcXCPSetSegmentMode Mode vi UPLOAD MC Upload vi mcUpload Seed and Key Algorithm To restrict access to an ECU you can add a defined login mechanism to ECU software The Association for Standardization of Automation and Measuring Systems ASAM defines this seed which may be stored in the A2L file A typical login mechanism may happen as follows Connect to the ECU 1 WP eM Exchange station identifications Get the seed for the key Calculate the key using a seed and key DLL as ASAM defines Unlock the ECU protection by sending the calculated key ASAM AE Common defines the seed and key algorithm in the Seed and Key and Checksum Calculation API Version 1 0 The specification defines the Win32 APIs for seed and key calculation and checksum calculation Definition for Seed and Key Algorithm Function name ASAP1A_CCP_ComputeKeyFromSeed Parameter Description 1 Pointer to the seed data retrieved from the ECU GET_SEED command Seed data size in number of bytes Pointer to key data returning the calculated Key data size in number of bytes na BR wy bd Key data size in number of bytes The calling conv
295. lling the function mcCCPGetResult right after mcCCPDiagService National Instruments 6 15 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C mcCCPGetActiveCalPage Purpose Retrieves the ECU Memory Transfer Address pointer to the calibration data page CCP only Format mcTypeStatus mcCCPGetActiveCal Page mcTypeTaskRef ECURefNum mcAddress Address Input ECURefNum ECURefNum is the task reference which links to the selected ECU This reference is originally returned from mcECUSelectEx Output Address Returns the address for the active calibration page in the ECU mcAddress is a C struct consisting of Address Specifies the address part of the address Extension Extension contains the extension part of the address 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 amp C API to obtain a descriptive string for the return value Description mcCCPGetActiveCal Page retrieves the start address of the active calibration data page in the ECU memory ECU M amp C Toolkit User Manual 6 16 ni com Chapter 6 ECU M amp C API for C
296. lready occurred the VI returns the value of the error in cluster to error out status is TRUE if an error occurred Unlike other VIs this VI will execute when status is TRUE 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 National Instruments 5 71 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW code is the error code number identifying an error A value of 0 AEEA 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 MC ECU Close vi is the very last VI which must be called It desele
297. lue vi 5 32 MC Characteristic Read vi 5 30 options table 5 31 MC Characteristic Write Single Value vi 5 36 MC Characteristic Write vi 5 34 options table 5 35 MC Clear Memory vi 5 38 MC Conversion Create vi 5 40 MC DAQ Cleat vi 5 42 MC DAQ Initialize vi 5 44 MC DAQ List Initialize vi 5 47 National Instruments l 5 Index MC DAQ Read vi 5 50 MC DAQ Start Stop vi 5 56 MC DAQ Write vi 5 58 MC Database Close vi 5 61 MC Database Create vi 5 63 MC Database Open vi 5 65 MC Double To Text vi 5 67 MC Download vi 5 69 MC ECU Close vi 5 71 MC ECU Connect vi 5 73 MC ECU Create vi 5 75 MC ECU Deselect vi 5 80 MC ECU Disconnect vi 5 82 MC ECU Open vi 5 84 MC ECU Select vi 5 88 MC ECU Set Calibration Page vi 5 92 MC Event Create vi 5 94 MC Get Names vi 5 98 MC Get Property vi 5 102 poly output values table 5 104 MC Measurement Create vi 5 144 MC Measurement Read vi 5 146 MC Measurement Write vi 5 148 MC Program Reset vi 5 152 MC Program Start vi 5 154 MC Program vi 5 150 MC Set Property vi 5 156 Characteristic specific input values table 5 174 DAQ specific poly input values table 5 172 ECU specific poly input values table 5 158 Measurement specific input values table 5 174 MC Text To Double vi 5 175 MC Upload vi 5 177 MC XCP Copy Cal Page vi 5 179 MC XCP Get Cal Page vi 5 181 MC XCP Get ID vi 5 183 MC XCP Get Status vi 5 185 ECU M amp C Toolkit Us
298. m vi 0 data is uncompressed 0x80 0xFF User defined ECU XCP Encryption Method Returns the selected encryption method used for MC Program vi 0x00 data is not encrypted 0x80 0xFF User defined National Instruments 5 115 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW Table 5 5 Poly Values for Value Output Continued Sub Hierarchy Type Hierarchy Sub 1 Sub 2 Param Description ECU XCP Access Returns the selected access Method mode 0x00 Absolute Access Mode default The MTA uses physical addresses 0x01 Functional Access Mode The MTA functions as a block sequence number of the new flash content file 0x80 0xFF User defined It is possible to use different access modes for clearing and programming ECU XCP Programming Returns the selected Method programming method used for MC Program vi 0x00 Sequential programming 0x80 0xFF User defined ECU XCP SeedKey Returns the filename of the DLL SeedKey DLL If SeedKey is configured for remote access the output is RSK lt server ip address gt lt port gt ECU M amp C Toolkit User Manual 5 116 ni com Chapter 5 ECU M amp C API for LabVIEW Table 5 5 Poly Values for Value Output Continued Type Hierarchy Sub Hierarchy Sub 1 Sub 2 Param Description ECU XCP CAN
299. mStart implements the XCP command PROGRAM_ START This optional command the beginning of a programming sequence into a non volatile memory area If the slave device is not in a state which permits programming an error is returned The memory programming commands The end of a non volatile memory programming sequence is indicated by using the mcSet Property function For further information on how to use program ECU memory and to use the mcProgramStart command refer to the ASAM XCP Part 2 Protocol Layer Specification National Instruments 6 111 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C mcSetProperty Purpose Sets a property of the driver the database the ECU a Characteristic a Measurement or a Measurement task Format mcTypeStatus mcSetProperty mcTypeTaskRef RefNum cstr Name u32 PropertyID u32 SizeOfValue void Value Input RefNum RefNum is any ECU M amp C task reference which consists of a valid link to the opened A2L database DBRefNum a selected ECU ECURefNum or a Measurement task DAQRefNum RefNum must be valid for the related PropertyID type Name Name is not used and can be set to NULL This parameter maybe used for further extensions PropertyID Selects the property to set For a description of each property including its data type and PropertyId refer to the Properties section SizeOfValue Number of bytes allocated for the Value output This size normally depends on the d
300. ming flow control and passes it to the slave MC XCP Program Verify vi implements the optional XCP PROGRAM_VERIFY command defined by the XCP specification For further information on how to program non volatile ECU memory refer to the ASAM XCP Part 2 Protocol Layer Specification ECU M amp C Toolkit User Manual 5 194 ni com Chapter5 ECU M amp C API for LabVIEW MC XCP Set Cal Page vi Purpose Sets a calibration page Format mode ECU ref in ECU ref out segment page error out error in Input Mode is a bit mask described below Bit Description The given page is used by the slave device application The slave device XCP driver will access the given page nused nused nused U U Unused U U nused The logical segment number is ignored The command applies to all segments ECU ref in is the task reference which links to the selected ECU This reference is originally returned from MC ECU Open vi or MC ECU Select vi and then wired through subsequent VIs Segment specifies the selected logical data segment number Page specifies the logical data page number National Instruments 5 195 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW Error in is a cluster which describes error conditions occurring before the eee VI executes If an error has already occurred the VI returns the value of the error in cluster to error out
301. mitations allowed concerning the maximum block size for the master Refer to the ASAM XCP Part 2 Protocol Layer Specification for more information on how to upload data and to use the mcUpload command National Instruments 6 129 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C mcXCPCopyCalPage Purpose Forces a copy transaction of one calibration page to another Format mcTypeStatus mcXCPCopyCal Page mcTypeTaskRef ECURefNum u8 SourceSegment u8 SourcePage u8 DestinationSegment u8 DestinationPage Input ECURefNum ECURefNum is the task reference which links to the selected ECU This reference is originally returned from mcECUSelectEx SourceSegment SourceSegment specifies the logical data segment number source SourcePage SourcePage specifies the logical page number source DestinationSegment DestinationSegment specifies the logical data segment number destination DestinationPage DestinationPage specifies the logical page number destination Output None 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 am
302. mory Transfer Address 0 MTAO has been set by a previous VI like MC Generic vi with the command SET_MTA National Instruments 5 19 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW MC CCP Get Session Status vi Purpose Retrieves the current calibration status of the ECU CCP only Format status qualifier ECU ref in ECU ref out session status error In error out additional status Input ECU ref in is the task reference which links to the selected ECU This reference is originally returned from MC ECU Open vi or MC ECU Select vi and then wired through subsequent VIs Error in is a cluster which describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out status is TRUE if an error occurred This VI is not executed when status is TRUE 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 status qualifier describes an additional status qualifier The additional status qualifier is manufacturer and or project specific
303. mples per second A sample rate of zero means to sample immediately For a DAQMode of mcDAQModeDAQList SampleRate of zero means that mcDAQRead returns a single sample from the most recent messages received and greater than zero means that mcDAQRead returns samples timed at the specified rate For DAQMode of mcDAQModePolling SampleRate is ignored Output DAQRefNum DAQRefNum is the reference handle for the Measurement task Use this Measurement task reference in subsequent M amp C DAQ functions for this task 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 amp C API to obtain a descriptive string for the return value ECU M amp C Toolkit User Manual 6 36 ni com Chapter 6 ECU M amp C API for C Description mcDAQInitialize does not start the transmission of the DAQ lists on the ECU This enables you to use mcSet Property to change the properties of a Measurement task After you change properties use mcDAQStartStop to start the transmission of the Measurement task National Instruments 6 37 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp
304. mputer you will need a new activation code Refer to How Do I Activate My Software to acquire a new activation code and reactivate your software Deactivating a Product To deactivate a product and return the product to the state it was in before you activated it right click the product in the NI License Manager tree and select Deactivate If the product was in evaluation mode before you activated it the properties of the evaluation mode may not be restored Using Windows Guest Accounts NI License Manager does not support Microsoft Windows Guest accounts You must log in to a non Guest account to run licensed NI application software National Instruments xvii ECU M amp C Toolkit User Manual Introduction The ECU Measurement and Calibration ECU M amp C Toolkit contains a development system for an electronic control unit ECU based on existing ASAM standards The function set of the ECU M amp C Toolkit enables engineers to optimize and verify the functionality of electronic controller devices Most ECUs interact with other ECUs external sensors and actuators in a Controller Area Network CAN During the development and verification phase of an ECU engineers access the ECU for acquired data Measurement or to adjust parameters inside the ECU itself calibration Since the bandwidth and number of identifiers for a CAN network are limited the Association for Standardization of Automation and Measuring Systems ASAM e V
305. mputer on which you run NI software have Internet or email access Home Computer Use Privacy Policy National Instruments permits you to use this software at home Refer to the NI License Manager help file or the software end user license agreement in the installer or online at ni com legal license for more information National Instruments respects your privacy For more information about the National Instruments activation information privacy policy go to ni com activate privacy Upon successful activation you can use the product immediately 3 Note Ifthe ECU M amp C Toolkit was in use before you began the activation process you may need to restart it for the change to take effect G Tip In the NI License Manager products that have not been activated are denoted either by a yellow stoplight or a red stoplight depending whether the product is in evaluation mode or is unusable Activated products are denoted by a green stoplight ECU M amp C Toolkit User Manual 2 4 ni com Chapter 2 Installation and Configuration LabVIEW Real Time RT Configuration PXI System LabVIEW Real Time RT combines easy to use LabVIEW programming with the power of real time systems When you use a National Instruments PXI controller as a LabVIEW RT system you can install a PXI CAN or PXI XNET card and use the ECU M amp C Toolkit to develop real time applications for CCP or XCP As with any other NI product for LabVIEW RT you must downl
306. must define a unique interface name that differs from the NI CAN compatible interface name under XNET Devices or use the xxx yyy nixnet syntax The interface name is related to the NI XNET hardware naming under Devices and Interfaces in MAX The extension nixnet directs the ECU M amp C Toolkit to use the native NI XNET API 3 Note By selecting nixnet as Protocol and Interface string the ECU Measurement and Calibration Toolkit uses the Frame Input and Output Queued sessions To force the ECU National Instruments 6 65 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C Measurement and Calibration Toolkit to use Frame Input and Output Stream sessions instead select ni_genie_nixnet as Protocol and Interface string for example CCP CAN1 ni_genie_nixnet An application instance can use only one Frame Input Stream Session and one Frame Output Stream Session at a time so use the default name nixnet as Protocol and Interface string so that multiple NI XNET Frame Queued Sessions can coexist on a single interface and the Frame Input and Output Stream Sessions may be used for example for a Frame logging replay use case CompactRI0O or R Series If you are using CompactRIO or R Series hardware you must provide a bitfile that handles the CAN communication between the host system and the FPGA To access the CAN module on the FPGA you must specify the bitfile name after the for example CCP CAN1 MyBitfile lvbitx To specify
307. must be set to zero A SampleRate of zero means mcDAQWrite immediately writes a single sample to the ECU when calling the mcDAQWrite function You must pass NumberOfSamplesTowWrite no greater than 1 SampleArray SampleArray specifies a 2D array one array for each channel initialized in the task The array of each channel must have NumberOfSamplesToWrite entries allocated The order of channel entries in SampleArray is the same as the order in the original ChannelList If you must determine the number of channels in the task after initialization get the mcPropDAQ_NumChannels property for the task reference Output 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 amp C API to obtain a descriptive string for the return value ECU M amp C Toolkit User Manual 6 48 ni com Chapter 6 ECU M amp C API for C Description For XCP STIM lists refer to mcDAQInitialize mcDAQWrite transfers an array of samples to the ECU These samples are called data stimulation packets STIM On the ECU side the STIM processor buffers incoming data stimulation packets When an event o
308. n 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 MC XCP Copy Cal Page vi implements the XCP command COPY_CAL_PAGE and forces the slave to copy one calibration page to another This command is only available if more than one calibration page is defined In principal any page of any segment can be copied to any page of any other segment but there may be restrictions Refer to the ASAM XCP Part 2 Protocol Layer Specification for more information on how to set up a request ECU M amp C Toolkit User Manual 5 180 ni com Chapter5 ECU M amp C API for LabVIEW MC XCP Get Cal Page vi Purpose Queries a calibration page setting Format mode ECU ref in ECU ref out segment page error in error out Input Mode specifies the access mode Mode 1 The given page is used by the slave device application Mode 2 The slave device XCP driver will access the given page ECU ref in is the task reference which links to the selected ECU This reference is originally returned from MC ECU Open vi or MC ECU Select vi and then wired through subsequent VIs Segment specifies the selected logical data segment number Error in is a cluster which describes error conditions occurring before
309. n object used to send commands and data from a host device to a slave device The CRO is 8 bytes wide consisting of a Command byte a Command Counter byte and a 6 byte parameter data field CommandReceiveObject A CCP communication object used to send commands and data from a host device to a slave device The CRO is 8 bytes wide consisting of a Command byte a Command Counter byte and a 6 byte parameter data field CAN identifier of the Command Receive Object CRO Data Acquisition A single DAQ Measurement entry in a DAQ list A list of DAQ channels that is transmitted by the ECU Data acquisition mode A message sent from the slave device to the master device Command Return Message Event Message or Data Acquisition Message A task reference handle to the selected ASAM MCD 2MC database file Dynamic Link Library See Data Transfer Object CAN identifier of the DTO G 3 ECU M amp C Toolkit User Manual Glossary E ECU ECU M amp C Channel functions ECU reference ECU task Event Channel Extended arbitration ID Master ID Measurement Measurement task Memory Transfer Address MTA ECU M amp C Toolkit User Manual Electronic Control Unit An electronic device with a central processing unit performing programmed functions with its peripheral circuitry The part of the ECU M amp C Toolkit API that you use to read and write channels A Characteristic or Measurement channel consists of one more
310. n 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 ECU ref out is the same as ECU ref in Wire the task reference to subsequent VIs for this task 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 5 73 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW code is the error code number identifying an error A value of 0 AEEA 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 If you are using the CCP protocol MC ECU Connect vi implements the CCP CONNECT command If you are using the XCP protocol MC ECU Connect vi implements the XCP command CONNECT It establishes a logical connection to an ECU using the provided ECU Reference handle Unless a slave device ECU is disconnected it must not execute or respond to any command sent by the application Only one CCP slave can be connected to the application at a time from
311. n opened The value of this property cannot be changed using mcSetProperty u32 mcPropDB_Filename_Size Returns the number of bytes to be allocated if you call mcGet Property with the parameter mcPropDB_Filename u32 mcPropDTOID Returns the DTO CAN Identifier Data Transfer Object for CCP or XCP on CAN which is used to send commands and data from the slave device to the host u32 mcPropECU_BaudRate Returns the baud rate in use u32 mcPropECU_ByteOrder Returns the byte order of the slave device O MSB_LAST The Slave device uses the MSB_LAST Intel byte ordering 1 MSB_FIRST The Slave device uses the MSB_FIRST Motorola byte ordering u32 mcPropECU_CCP_NumPages Returns the number of DEFINED_PAGES structures for this ECU in the A2L file u32 mcPropECU_CCP_PageNo Returns the page number of the page selected with the Name input National Instruments 6 85 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C Table 6 4 Values for PropertyID Continued Data Type Name Description u32 mcPropECU_CCP_PageFlags Returns the page flags of the page selected with the Name input The value returned is a bitmask ored from the following values 1 RAM page ROM page FLASH page EEPROM page 16 RAM_INIT_BY_ECU o A N RAM page initialized at ECU startup 32 RAM_INIT_BY_TOOL RAM page that the calibration tool initializes 64 AUTO_FLASH
312. n queries an ASAM MCD 2MC database and returns a list of all channels in that database regarding the selected query mode You can use this list to populate user interface controls The user can then select channels from these controls avoiding the need to type in each name Once the user makes the selections the application can pass the resulting list to the appropriate function such as DAQ Initialize for an ECU Measurement channel list The Get Names function is MC Get Names vi in LabVIEW or mcGetNames in C If you need to change particular parameters within an application such as the DTO ID use the following sequence 1 Initialize the Measurement task as stopped The Initialize function is MC DAQ Initialize vi in LabVIEW or mcDAQInitialize in C 2 Use Set Property to specify the new value for the DTO_ID property The Set Property function is MC Set Property vi in LabVIEW or mcSetProperty in C 3 Start the Measurement task with the DAQ Start Stop function The DAQ Start Stop function is MC DAQ Start Stop vi in LabVIEW or mcDAQStartStop in C You can also start the Measurement task implicitly by issuing DAQ Read 4 16 ni com Chapter 4 Using the ECU M amp C API After the task is started you may need to change properties again To change properties within the application use the DAQ Start Stop function to stop the Measurement task Set Property to change properties then start the task again You also can use the Get Property f
313. nMethod memory segment specified in the Name input A value of 0 means no compression Other values are user defined Specify the segment by the string SEGMENT lt n gt where lt n gt is the decimal representation of the segment number 0 N 1 where N is the number returned from the mcPropECU_XCP_NumSegments property u8 mcPropECU_XCP_ Returns the encryption method for the memory EncryptionMethod segment specified in the Name input A value of 0 means no encryption Other values are user defined Specify the segment by the string SEGMENT lt n gt where lt n gt is the decimal representation of the segment number 0 N 1 where N is the number returned from the mcPropECU_XCP_NumSegments property u8 mcPropECU_XCP_PageNo Returns the logical page number for the memory segment page specified in the Name input Specify the page by the string SEGMENT lt n gt PAGE lt m gt where lt n gt is the decimal representation of the segment number 0 N 1 where N is the number returned from the mcPropECU_XCP_NumSegments property and lt m gt is the decimal representation of the page number within the segment 0 M 1 where M is the number returned from the mcPropECU_XCP_NumPages property for this segment National Instruments 6 89 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C Table 6 4 Values for PropertyID Continued Data Type Name Desc
314. nce which links to the selected ECU This reference is originally returned from mcECUSelectEx Mode Mode describes the verification mode Value Description 0 Request to start internal routine 1 Send a Verification Value stored in VerValue VerType VerType specifies the Verification Type of the requested program verification The Verification Type is a bit mask described below Verification Type Description 0x0001 Calibration area s of the flash 0x0002 Code area s of the flash 0x0004 Complete flash content 0x0008 0x0080 Reserved 0x0100 OxFFOO User defined VerValue VerValue contains the selected verification value if Mode 1 Output None ECU M amp C Toolkit User Manual 6 142 ni com Chapter 6 ECU M amp C API for C 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 amp C API to obtain a descriptive string for the return value Description mcXCPProgramVerify implements the XCP command PROGRAM_VERIFY and performs a flash program verification If verMode 0 the master can request the slave to start internal test routines to check whether the new flash
315. nction names within the specified ECU 10 mcTypeFunc_DefCharacNames Returns a list of Characteristic names referred by the DEF_CHARACTERISTIC keyword within the related Function 11 mcTypeFunc_RefCharacNames Returns a list of Characteristic names referred by the REF_CHARACTERISTIC keyword within the related Function 12 mcTypeFunc_InMeasNames Returns a list of Measurement names referred by the IN_MEASUREMENT keyword within the related Function 13 mcTypeFunc_OutMeasNames Returns a list of Measurement names referred by the OUT_MEASUREMENT keyword within the related Function 14 mcTypeFunc_LocMeasNames Returns a list of Measurement names referred by the LOC_MEASUREMENT keyword within the related Function 15 mcTypeFunc_SubFuncNames Returns a list of Function names referred by the SUB_FUNCTION keyword within the related Function 16 mcTypeGroup_FunctionListNames Returns a list of Function names referred by the FUNCTION_LIST keyword within the related Group If the Type mcTypeMeasurementNames or Type mcTypeCharacteristicNames and RefNum contains a DBRefNum the corresponding ECU name must be referenced in order to access ECU specific properties If RefNum contains an ECURefNum or DAQRefNum the parameter ECUName is ignored and can be set to NULL 6 76 ni com Output Chapter 6 ECU M amp C API for C SizeOfNamesList Number of bytes required for mcGetNames to return all names for the specified
316. nd Professional Services National Instruments Log in to your National Instruments ni com User Profile to get personalized access to your services Visit the following sections of ni com for technical support and professional services e Support Technical support at ni com support includes the following resources Self Help Technical Resources For answers and solutions visit ni com support for software drivers and updates a searchable KnowledgeBase product manuals step by step troubleshooting wizards thousands of example programs tutorials application notes instrument drivers and so on Registered users also receive access to the NI Discussion Forums at ni com forums NI Applications Engineers make sure every question submitted online receives an answer Standard Service Program Membership tThis program entitles members to direct access to NI Applications Engineers via phone and email for one to one technical support as well as exclusive access to self paced online training modules at ni com self paced training All customers automatically receive a one year membership in the Standard Service Program SSP with the purchase of most software products and bundles including NI Developer Suite NI also offers flexible extended contract options that guarantee your SSP benefits are available without interruption for as long as you need them Visit ni com ssp for more information For information about other technica
317. nd GET_S_STATUS u32 mcPropOptCmd_GET_SEED Sets whether the ECU supports the optional CCP Command GET_SEED u32 mcPropOptCmd_MOVE Sets whether the ECU supports the optional CCP Command MOVE National Instruments 6 119 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C Table 6 5 ECU Specific Value Types for the PropertyID Input Value Continued Data Type Name Description u32 mcPropOptCmd_PROGRAM Sets whether the ECU supports the optional CCP Command PROGRAM u32 mcPropOptCmd_PROGRAM_6 Sets whether the ECU supports the optional CCP Command PROGRAM _6 u32 mcPropOptCmd_SELECT_ Sets whether the ECU supports the optional CAL_PAGE CCP Command SELECT_CAL_PAGE u32 mcPropOptCmd_SET_S_ Sets whether the ECU supports the optional STATUS CCP Command SET_S_STATUS u32 mcPropOptCmd_SHORT_UP Sets whether the ECU supports the optional CCP Command SHORT_UP u32 mcPropOptCmd_START_ Sets whether the ECU supports the optional STOP_ALL CCP Command START_STOP_ALL u32 mcPropOptCmd_TEST Sets whether the ECU supports the optional CCP Command TEST u32 mcPropOptCmd_UNLOCK Sets whether the ECU supports the optional CCP Command UNLOCK ug mcPropPGM_AccessMethod Selects the selected access mode for mcProgram and mcClearMemory 0x00 Absolute Access Mode default The MTA uses physical addresses 0x01 Functional Access Mode The MTA functions as a block sequence number of the new flash content
318. ndif _SEEDKEY_H_ ECU M amp C Toolkit User Manual 4 20 ni com National Instruments Chapter 4 Using the ECU M amp C API Checksum Algorithm ASAM proposed a WIN32 API function to have a common interface to implement the checksum algorithms for verifying ECU calibration and program data For details refer to the ASAM Seed and Key and Checksum Calculation API Version 1 0 Definition for a Checksum Algorithm Function name BOOL CalcChecksum struct TRange ptr int nRanges BYTE pnChecksum int pnSignificant WORD nFlags Parameter Description 1 Pointer to an array of ranges stored in structures of type TRange 2 Number of ranges stored in the array that parameter 1 points to 3 Pointer to a byte array where the checksum must be stored The DLL writes a maximum of 8 bytes so the caller should reserve space for 8 bytes of data 4 Length of actually calculated checksum 1 8 5 Flag field for commanding how the algorithm works Currently only bit 0 is defined Bit 0 0 pnchecksum receives the algorithm checksum calculation result Bit 0 1 pnChecksum points to a checksum that is compared within the DLL with the checksum that the algorithm calculates Returns TRUE if the checksums are identical FALSE otherwise All other bits are reserved and should be set to 0 TRange is defined as follows struct TRange char pMem unsigned long lLen 4 21 ECU M amp C
319. ng group are protected and will return a ERR_ACCESS_LOCKED upon an attempt to execute the command without a previous successful GET_SEED UNLOCK sequence The parameter SessionId contains the Session configuration ID The session configuration ID must be set by a prior mcXCPSetRequest call with STORE_DAQ_REQ set This allows the master device to verify that automatically started DAQ lists contain the expected data transfer configuration National Instruments 6 139 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C mcXCPProgramPrepare Purpose Prepares the programming of non volatile memory Format mcTypeStatus mcXCPProgramPrepare mcTypeTaskRef ECURefNum mcAddress Address ul6 CodeSize Input ECURefNum ECURe Num is the task reference which links to the selected ECU This reference is originally returned from mcECUSelectEx Address Address is the task reference which links to the selected ECU This reference is originally returned from mcECUSelectEx Address Specifies the address part of the target address Extension Contains the extension part of the target address CodeSize CodeSize determines the size of data to be downloaded Output 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
320. ng sequence mcProgramStart Indicates the start of a programming sequence mcSet Property Sets a property of the driver the database the ECU a Characteristic a Measurement or a Measurement task mcStatusToString Converts a status code into a descriptive string mcTextToDouble Converts a text string to a numerical value using an enumeration or range text scaling mcUpload Uploads data from an ECU mcXCPCopyCalPage Forces a copy transaction of one calibration page to another mcXCPGetCalPage Queries a calibration page setting mcXCPGetId Queries session configuration or slave device identification mcXCPGetStatus Queries the current session status from an ECU slave device mcXCPProgramPrepare Prepares the programming of non volatile memory mcXCPProgramVerify Performs a non volatile memory certification task on the ECU device mcXCPSetCalPage Sets a calibration page mcXCPSetRequest Performs a request to save session and device information to non volatile memory mcXCPSetSegmentMode Sets the mode of a specified segment National Instruments 6 5 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C mcBuildChecksum Purpose Calculates a checksum over a defined memory range within the ECU Format mcTypeStatus mcBuildChecksum mcTypeTaskRef ECURefNum mcAddress Address u32 BlockSize u8 ChecksumType u8 SizeOfChecksum u32 Checksum Inp
321. ngth returns the string length of the Id string Id Id contains the queried identification string 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 amp C API to obtain a descriptive string for the return value ECU M amp C Toolkit User Manual 6 134 ni com Chapter 6 ECU M amp C API for C Description mcXCPGetId implements the XCP command GET_ID and returns session configuration or slave device identification information of the selected ECU slave device The supported types are implementation specific of the ECU slave device The identification string is ASCII text format National Instruments 6 135 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C mcXCPGetStatus Purpose Queries the current session status from an ECU slave device Format mcTypeStatus mcXCPGetStatus mcTypeTaskRef ECURefNum u8 SessionStatus u8 ResourceMask ul6 SessionId Input ECURefNum ECURe f Num is the task reference which links to the selected ECU This reference is originally returned from mcECUSelectEx Output SessionStatus SessionStatus ret
322. nstallation and Configuration Note You can use the ECU M amp C Toolkit with LabVIEW 2009 or newer on CompactRIO Systems only To use the ECU M amp C Toolkit on the LabVIEW RT system you must also download the ASAM MCD 2MC database file to the RT target The LabVIEW Real Time Engine that runs on the PXI LabVIEW Real Time controller supports a File Transfer Protocol FTP server You can access the LabVIEW RT target FTP server using any standard FTP utility for transferring files to and from the hard drive or compact flash The following sections demonstrate how to transfer files from and to your LabVIEW Real Time target using various FTP clients DOS Command Prompt 3 You can run a native FTP client from the DOS command prompt on a Windows PC To open the FTP client click Start Run to open the user command dialog box Type commana and click Enter This opens a window with a DOS prompt Then use the following table to enter a sequence of commands that may be used to access the FTP server of your RT target Note w x y z represents the IP address of the RT target in this document Table 2 1 Example of FTP Transfer Command Result ftp Open a connection to the FTP server open w x y Z username Enter your username and password here or press the Enter key twice if these security settings have not been applied password help View a list of commands cd ni rt system www Change to the desired directory
323. oad the ECU M amp C Toolkit software to the LabVIEW RT system using the Remote Systems branch in MAX For more information refer to the LabVIEW RT documentation After installing the PXI CAN cards and downloading the NI CAN or NI XNET and ECU M amp C Toolkit software to the LabVIEW RT system you need to verify the installation NI CAN on PXI RT System Within the MAX Tools menu select NI CAN RT Hardware Configuration The RT Hardware Configuration tool provides features similar to Devices and Interfaces on the local system Use the RT Hardware Configuration tool to self test the CAN cards and assign an interface name to each physical CAN port NI XNET on PXI RT System After you install the PXI XNET cards and download the NI XNET software to the LabVIEW RT system you need to verify the installation Find your PXI target device in MAX under Network Devices and expand the tree Browse to Devices and Interfaces and open the NI XNET Devices group Perform a self test for all installed NI XNET devices On the RT target you can configure your NI XNET hardware the same way as on the local system CompactRIO System National Instruments After you have installed the CompactRIO CAN modules and downloaded the NI RIO and ECU M amp C Toolkit software you need to enable the CompactRIO Reconfigurable Embedded Chassis for use in LabVIEW For more information refer to the MAX help 2 5 ECU M amp C Toolkit User Manual Chapter 2 3 I
324. ocess to be controlled by several variables These are the Compression Method Encryption Method Programming Method and Access Method properties They default to 0 but can be set to any value before the programming process starts The allowed values for these properties are ECU specific If any of these properties is set to a nonzero value an appropriate PROGRAM_FORMAT XCP command is issued before the programming takes place Note that the Access Method property also affects the Clear Memory function 4 15 ECU M amp C Toolkit User Manual Chapter 4 Using the ECU M amp C API XCP Program Verify After the memory programming XCP allows to verify whether the operation was successful by the PROGRAM_VERIFY XCP command The details of this command are highly ECU specific This command can be issued using the XCP Program Verify function It is MC XCP Program Verify vi in LabVIEW and mcxcPProgramVeri fy in other languages Additional Programming Topics Get Names Set Get Properties ECU M amp C Toolkit User Manual The following sections provide information you can use to extend the basic programming model If you are developing an application that another person will use you may not want to specify a fixed channel list for a Measurement task or a fixed channel for a Characteristic in the application Ideally you want the end user to select the channels of interest from user interface controls such as list boxes The Get Names functio
325. ode CAN_ID_FIXED National Instruments 5 135 ECU M amp C Toolkit User Manual ECU M amp C API for LabVIEW Chapter 5 ECU M amp C API for LabVIEW Table 5 5 Poly Values for Value Output Continued Type Hierarchy Sub Hierarchy Sub 1 Sub 2 Param Description E DAQ List CAN ID Select Mode Returns the condition for selecting the CAN ID for the specified DAQ list 0 CAN_ID_FIXED The CAN Identifier is a predefined fixed number 1 CAN_ID_ VARIABLE The CAN Identifier is a variable number 2 CAN_ID_DTO_ID The CAN Identifier is the same as the DTO identifier T g DAQ List Excluded DAQ Lists Returns an array containing the numbers of DAQ lists not working together with the current DAQ list DAQ List First PID Returns the first Packet ID for the specified DAQ list DAQ List MAX Length Returns the maximal length of the DAQ list a EE DAQ List Reduction Allowed Returns whether or not the specified DAQ list allows reduction ECU M amp C Toolkit User Manual 5 136 ni com Chapter 5 Table 5 5 Poly Values for Value Output Continued Type Hierarchy Sub Hierarchy Sub 1 Sub 2 Param Description DAQ List Name Name of the DAQ list measurement source Pass the DAQ list number converted to a string in the Name parameter of Get Property The availab
326. of invoice NI warrants that i its software products will perform substantially in accordance with the applicable documentation provided with the software and ii the software media will be free from defects in materials and workmanship If NI receives notice of a defect or non conformance during the applicable warranty period NI will in its discretion i repair or replace the affected product or ii refund the fees paid for the affected product Repaired or replaced Hardware will be warranted for the remainder of the original warranty period or ninety 90 days whichever is longer If NI elects to repair or replace the product NI may use new or refurbished parts or products that are equivalent to new in performance and reliability and are at least functionally equivalent to the original part or product You must obtain an RMA number from NI before returning any product to NI NI reserves the right to charge a fee for examining and testing Hardware not covered by the Limited Warranty This Limited Warranty does not apply if the defect of the product resulted from improper or inadequate maintenance installation repair or calibration performed by a party other than NI unauthorized modification improper environment use of an improper hardware or software key improper use or operation outside of the specification for the product improper voltages accident abuse or neglect or a hazard such as lightning flood or other act of nature TH
327. olkit User Manual ECU M amp C API for LabVIEW Chapter 5 ECU M amp C API for LabVIEW Table 5 6 ECU Specific Property Value Types for the POLY Input Value Continued Sub Hierarchy Type Hierarchy Sub1 Sub 2 Param Description ECU CCP Optional PROGRAM 6 Sets whether the ECU Commands supports the optional ASAM CCP Command PROGRAM_6 ECU CCP Optional SELECT Sets whether the ECU Commands CAL PAGE supports the optional ASAM CCP Command SELECT_CAL_PAGE ECU CCP Optional SETS Sets whether the ECU Commands STATUS supports the optional ASAM CCP Command SET_S_STATUS ECU CCP Optional SHORT UP Sets whether the ECU Commands supports the optional ASAM CCP Command SHORT_UP ECU CCP Optional START Sets whether the ECU Commands STOP ALL supports the optional ASAM CCP Command START_STOP_ALL ECU CCP Optional TEST Sets whether the ECU Commands supports the optional ASAM CCP Command TEST ECU CCP Optional UNLOCK Sets whether the ECU Commands supports the optional ASAM CCP Command UNLOCK ECU Misc Timing Sets the timing factor to Factor increase the XCP or CCP Command timeouts by this value For details on the default Command Timeout values refer to the CCP or XCP Protocol Specification ECU M amp C Toolkit User Manual 5 166 ni com Chapter5 ECU M amp C API for LabVIEW Table 5 6 ECU Specific Property Value Types for the POLY Input Value Continued Sub Hierarchy
328. om MC ECU Open vi or MC ECU Select vi and then wired through subsequent VIs Address is a cluster which contains the following values Address specifies the address part of the source address Lust H E Extension contains the extension part of the source address Block size determines the size of the block that must be cleared Error in is a cluster which describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out ER status is TRUE if an error occurred This VI is not executed when status is TRUE 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 ECU M amp C Toolkit User Manual 5 38 ni com Chapter5 ECU M amp C API for LabVIEW ECU ref out is the same as ECU ref in Wire the task reference to subsequent VIs for this task 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 occur
329. om message to message enable you to view the CAN channels over time such as for comparison with other CAN or DAQ input channels This VI waits until all samples arrive in time before returning If the initialized sample rate is zero this poly VI returns an error If the intent is simply to read the most recent samples for a task use the NChan 1Samp 1D Dbl type If no message has been received for a channel since you started the task the Default Value of the channel is returned in value You can specify channels in channel list that span multiple messages At each point in time a sample from the most recent message is returned for all channels You can use error out to determine whether a new message has been received since the previous call to MC DAQ Read vi or MC DAQ Start Stop vi If no message has been received for one or more channels the warning code 3FF60009 hex is returned in error out If a new message has been received for all channels the success code 0 is returned in error out Unless an error occurs the number of samples returned is equal to number of samples to read If you need to determine the number of channels in the task after initialization get the Number of Channels property for the task reference 1Chan NSamp Wfm Returns a single waveform for the first channel initialized in channel list The initialized sample rate must be greater than zero for this poly VI because each sample in the array indicates the value of the CA
330. on Address of the slave device 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 ECU CCP Misc Skip EXCHANGE ID Returns a Boolean value that indicates whether or not the EXCHANGE_ID command should be suppressed during connection to the ECU ECU CCP Optional Commands ACTION SERVICE Returns a Boolean value that indicates whether the ECU supports the optional CCP Command ACTION_SERVICE ECU CCP Optional Commands BUILD CHECKSUM Returns a Boolean value that indicates whether the ECU supports the optional CCP Command BUILD_CHKSUM ECU M amp C Toolkit User Manual 5 112 ni com Chapter 5 ECU M amp C API for LabVIEW Table 5 5 Poly Values for Value Output Continued Sub Hierarchy Type Hierarchy Sub 1 Sub 2 Param Description ECU CCP Optional CLEAR Returns a Boolean value Commands MEMORY that indicates whether the ECU supports the optional ASAM CCP Command CLEAR_MEMORY ECU CCP Optional CLEAR Returns a Boolean value Commands MEMORY that indicates whether the ECU supports the optional CCP Command CLEAR_MEMORY
331. on 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 5 198 ni com Chapter5 ECU M amp C API for LabVIEW Description MC XCP Set Request vi implements the XCP command SET_REQUEST and is used to save session configuration information into non volatile memory in the ECU Refer to the ASAM XCP Part 2 Protocol Layer Specification for more information on how to set up a request National Instruments 5 199 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW MC XCP Set Segment Mode vi Purpose Sets the mode of a specified segment Format ECU ref in ECU ref out segment mode error out error in Input ECU ref in is the task reference is originally Segment specifies the Error in is a cluster w HEE E reference which links to the selected ECU This returned from MC ECU Open vi or MC ECU Select vi and then wired through subsequent VIs logical data segment number Mode specifies the mode for the segment hich describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out status is TRUI E if an error occurred This VI will not execute when TF I status is TRUE code is the error code number identifying an error
332. on in progress ECU M amp C Toolkit User Manual 6 24 ni com Chapter 6 ECU M amp C API for C mcCharacteristicRead Purpose Reads all data from a named Characteristic on the ECU which is identified by the ECU Reference handle Format mcTypeStatus mcCharacteristicRead mcTypeTaskRef ECURefNum char CharacteristicName 64 Values u32 NumberOfValues Input ECURefNum ECURefNum is the task reference which links to the selected ECU This reference is originally returned from mcECUSelectEx CharacteristicName CharacteristicName is the name of the Characteristic defined in the A2L database file NumberOfValues Specifies the number of values to read To determine the dimension of the Characteristic use the mcGet Property function upfront using the parameter mcPropChar_Dimension To determine the size of each dimension use the mcGet Property function with the parameter mcPropChar_Sizes Output Values Returns a single value a 1 dimensional array or a 2 dimensional array of values for the selected Characteristic 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 mcStatusToS
333. operty might modify this value National Instruments 5 119 ECU M amp C Toolkit User Manual Chapter 5 ECU M amp C API for LabVIEW Table 5 5 Poly Values for Value Output Continued Type Hierarchy Sub Hierarchy Sub 1 Sub 2 Param Description ECU CCP Timeout T_mem Returns the timeout value in milliseconds for the CCP memory commands For details of which timeout applies to a specific command refer to the CCP standard Default and Standard 30000 Note that the Timing Factor property might modify this value ECU CCP Timeout T_diag Returns the timeout value in milliseconds for the CCP DIAG_SERVICE command Default and Standard 500 Note that the Timing Factor property might modify this value ECU CCP Timeout T_act Returns the timeout value in milliseconds for the CCP ACTION_SERVICE command Default 500 Standard 5000 Note that the Timing Factor property might modify this value ECU CCP Number of Pages Cal Pages Returns the number of DEFINED PAGES structures for this ECU in the A2L file ECU CCP Cal Pages Page Number Returns the page number of the page selected with the name input ECU M amp C Toolkit User Manual 5 120 ni com Chapter 5 Table 5 5 Poly Values for Value Output Continued ECU M amp C API for LabVIEW Type Hierarchy Sub Hierarchy Sub
334. or Value Output Continued Sub Hierarchy Type Hierarchy Sub 1 Sub 2 Param Description 5 Table Using Interpolation The related scaling is based on the TAB_INTP keyword within the A2L file using interpolation between x y pairs 6 Table Without Interpolation The related scaling is based on the TAB_NOINTP keyword within the A2L file using x y pairs without interpolation Measurement Scaling Text Values If the scaling type is fabe 2 Enumeration Text or 3 Range Text you can use this property to request the list of text values that can be converted into raw values Version Build Returns the build number of the ECU M amp C software This number applies to the Development Alpha and Beta phases only and should be ignored for the Release phase Version Comment Returns a comment string for the ECU M amp C software If you received a custom release of ECU M amp C from National Instruments this comment often describes special features of the release ECU M amp C Toolkit User Manual 5 142 ni com Chapter 5 ECU M amp C API for LabVIEW Table 5 5 Poly Values for Value Output Continued Type Hierarchy Sub Hierarchy Sub 1 Sub 2 Param Description Version Major Returns the major version of the ECU M amp C software such as the 1 in version 1 2 5 Version Version Minor Update
335. or in cluster to error out status is TRUI E if an error occurred This VI will not execute when status is TRUE 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 identi fies the VI where the error occurred 5 50 ni com Chapter5 ECU M amp C API for LabVIEW Output DAQ ref out is the same as DAQ ref in Wire the task reference to subsequent VIs for this task Number of samples returned indicates the number of samples returned in the samples output Value is a poly output that returns the samples read from the received CAN messages of the DAQ list The type of the poly output is determined by the poly VI selection For information on the different poly VI types provided by MC DAQ Read vi refer to the Poly VI Types section POL To select the data type right click the VI go to Select Type and select the type by name 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 numb
336. ort the names of all objects of the specified type inside the referenced ECU If type 1 type 2 or type 3 the corresponding ECU name must be referenced in order to access ECU specific properties If type 6 type 7 or type 8 the corresponding Group name must be referenced in order to access the group properties ECU M amp C Toolkit User Manual 5 100 ni com Chapter5 ECU M amp C API for LabVIEW If using MC Get Names vi to query the list of supported event channels on an ECU the event channels might be stored inside the ECU instead of the A2L file To query these event channel names from the ECU directly connect to the ECU using MC ECU Connect vi before using MC Get Names vi If using MC Get Names vi to query the Group names and related hierarchy to build for example a tree user control to query these event channels use MC Get Property vi with the Group Is Root parameter iS Note For more details on how to query the Group information out of an A2L file refer to the installed advanced example Read A2L Group vi in the Example Finder National Instruments 5 101 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW MC Get Property vi Purpose Gets a property for the object referenced by the reference in terminal The poly VI selection determines the property to get Format name reference in reference out value error be error out Input ECU M amp C Toolkit User Manual
337. ory Format ECU ref in ECU ref out data checksum type of checksum error out error in Input ECU ref in is the task reference which links to the selected ECU This reference is originally returned from MC ECU Open vi or MC ECU Select vi and then wired through subsequent VIs Data is a byte array upon which the checksum calculation is performed Type of checksum specifies the kind of checksum which is calculated Error in is a cluster which describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out Hee E status is TRUE if an error occurred This VI is not executed when status is TRUE 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 National Instruments 5 9 ECU M amp C Toolkit User Manual Chapter 5 Output ECU M amp C API for LabVIEW ECU ref out is the same as ECU ref in Wire the task reference to subsequent VIs for this task Checksum is the calculated checksum Error out describes error conditions If the Error in cluster indicated an er
338. out error in Input Characteristic name is the name of the Characteristic defined in the A2L database ECU ref in is the task reference which links to the selected ECU This reference is originally returned from MC ECU Open vi or MC ECU Select vi and then wired through subsequent VIs Error in is a cluster which describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out E BE status is TRUE if an error occurred This VI is not executed when status is TRUE 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 ECU M amp C Toolkit User Manual 5 30 ni com Output Pour Description Poly VI Types Chapter5 ECU M amp C API for LabVIEW ECU ref out is the same as ECU ref in Wire the task reference to subsequent VIs for this task Characteristic is a poly output value which represents the data read from the ECU The type of the poly output is determined by the poly VI selection For information on the different poly VI types provided by MC Characteris
339. 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 Jaf E 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 MC CCP Diag Service vi implements the CCP command DIAG_SERVICE which starts a diagnostic service on the ECU and waits until it is finished The selected Service no specifies the diagnostic service that is executed inside the ECU For more information about the available services that are implemented in the ECU refer to the documentation for the ECU National Instruments 5 15 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW MC CCP Get Active Cal Page vi Purpose Retrieves the ECU Memory Transfer Address pointer to the calibration data page CCP only Format ECU ref in ECU ref out b address error in error out Input ECU ref in is the task reference which links to the selected ECU This reference is originally ret
340. over time such as for comparison with other CAN or DAQ input channels This VI waits until all samples arrive in time before returning ECU M amp C Toolkit User Manual 5 52 ni com Chapter5 ECU M amp C API for LabVIEW If the initialized sample rate is zero this poly VI returns an error If the intent is simply to read the most recent sample for a task use the 7 Chan 1Samp Dbl type If no message has been received since you started the task a 0 is returned in all entries of the samples array You can use error out to determine whether a new message has been received since the previous call to MC DAQ Read vi or MC DAQ Start Stop vi If no message has been received the warning code 3FF60009 hex is returned in error out If a new message has been received the success code 0 is returned in error out Unless an error occurs the number of samples returned is equal to number of samples to read NChan NSamp 2D Dbl Returns an array one entry for each channel initialized in channel list Each entry consists of an array of value The order of channel entries in value is the same as the order in the original channel list The initialized sample rate must be greater than zero for this poly VI because each sample in the array indicates the value of each CAN channel at a specific point in time In other words the sample rate specifies a virtual clock that copies the most recent value from CAN messages for each sample time The changes in sample values fr
341. overview of the I O modes including figures refer to the Basic Programming Model section of Chapter 4 Using the ECU M amp C API Mode 0 DAQ List The data is transmitted from the ECU in equidistant time intervals as defined in the A2L database The data can be read back with the MC DAQ Read vi as Single point data using a sample rate 0 or as waveform using a sample rate gt 0 Input channel data are received from the DAQ messages Use MC DAQ Read vi to obtain input samples as single point array or waveform Mode 1 Polling In this mode the data from the Measurement task are acquired from the ECU whenever the MC DAQ Read vi is called Mode 2 5 44 ni com Chapter5 ECU M amp C API for LabVIEW STIM List In this mode the data from the Measurement task are sent to the ECU whenever MC DAQ Write vi is called Mode 3 Timestamped read The data is transmitted from the ECU in equidistant time intervals as defined in the A2L database The data can be read back with MC DAQ Read vi as timestamped data array Input channel data are received from the DAQ messages Use MC DAQ Read vi to obtain input samples as an array of sample timestamp pairs poly VI types ending in Timestamped Dbl Use this input mode to read samples with timestamps that indicate when each channel is received from the network Sample rate specifies the timing to use for samples of the task The sample rate is specified in Hertz samples per second A sample rate
342. p C API to obtain a descriptive string for the return value ECU M amp C Toolkit User Manual 6 130 ni com Chapter 6 ECU M amp C API for C Description mcXCPCopyCalPage implements the XCP command COPY_CAL_PAGE and forces the slave to copy one calibration page to another This command is only available if more than one calibration page is defined In principal any page of any segment can be copied to any page of any other segment but there may be restrictions Refer to the ASAM XCP Part 2 Protocol Layer Specification for more information on how to set up a request National Instruments 6 131 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C mcXCPGetCalPage Purpose Queries a calibration page setting Format mcTypeStatus mcXCPGetCal Page mcTypeTaskRef ECURefNum u8 Mode u8 Segment u8 Page Input ECURefNum ECURefNum is the task reference which links to the selected ECU This reference is originally returned from mcECUSelectEx Mode Mode specifies the access mode Mode 1 The given page is used by the slave device application Mode 2 The slave device XCP driver will access the given page Segment Segment specifies the selected logical data segment number Output Page Page returns the logical data page number 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 erro
343. page switching A calibration data segment and its pages are specified by logical numbers Refer to the ASAM XCP Part 2 Protocol Layer Specification for more information on how to set up a request ECU M amp C Toolkit User Manual 5 196 ni com Chapter5 ECU M amp C API for LabVIEW MC XCP Set Request vi Purpose Performs a request to save session and device information to non volatile memory Format mode ECU ref in ECU ref out session id error in error out Input Mode is a bit mask described below Bit Description 0 Request to store calibration data in non volatile memory 1 Unused 2 Request to save all DAQ lists which have been selected with START_STOP_DAQ_LIST Select into non volatile memory The slave also must store the session configuration ID in non volatile memory Upon saving the slave first must clear any DAQ list configuration that might already be stored in non volatile memory 3 Request to clear all DAQ lists in non volatile memory All ODT entries reset to address 0 extension 0 size 0 and bit_offset FF Session configuration ID reset to 0 4 Unused 5 Unused 6 Unused 7 Unused National Instruments 5 197 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW HE B ECU M amp C Toolkit User Manual ECU ref in is the task reference which links to the selected ECU This reference is originally returned from MC
344. pecific options table 6 114 Measurement specific options table 6 123 mcStatusToString 6 124 return codes table 6 124 mcTextToDouble 6 126 mcUpload 6 128 mcXCPCopyCalPage 6 130 mcXCPGetCalPage 6 132 mcXCPGetld 6 134 mcXCPGetStatus 6 136 mcXCPProgramPrepare 6 140 mcXCPProgram Verify 6 142 mcXCPSetCalPage 6 144 mcXCPSetRequest 6 146 mcXCPSetSegmentMode 6 148 measurement and calibration databases 1 4 National Instruments support and services B 1 NI Activation Wizard xv ni com 0 online software activation 2 4 P privacy policy 2 4 programming examples NI resources B 1 programming languages LabVIEW 3 1 LabWindows CVI 3 1 other 3 3 Visual C 3 2 R R Series application development on using NI 985x or NI 986x C Series module 3 4 reactivation on another system 2 4 reading Characteristics 4 8 related documentation xiii RT configuration DOS prompt 2 6 FTP transfers table 2 6 LabVIEW 2 9 LabVIEW RT graphical file transfer utility 2 7 web browsers 2 7 S sample rate greater than 0 4 12 read sample timing figure 4 12 sample rate 0 4 11 read sample timing figure 4 11 seed and key algorithm 4 19 definition 4 19 example 4 20 for VxWorks targets 4 23 example 4 23 National Instruments l 7 Index serial number finding xvi Set Get Properties 4 16 setting up an ECU Measurement DAQ Clear 4 13 DAQ Read 4 11 DAQ Start Stop 4 10 DAQ Write
345. pecification National Instruments 5 23 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW MC CCP Move Memory vi Purpose Moves a memory block on the ECU CCP only Format block size ECU ref in ECU ref out source destination error out error in Input Block size determines the size of memory block in bytes which should be moved from the source address to the destination address ECU ref in is the task reference which links to the selected ECU This reference is originally returned from MC ECU Open vi or MC ECU Select vi and then wired through subsequent VIs Source is a cluster which contains the following values E ae Address specifies the address part of the source address from which the memory block is copied Extension specifies the extension part of the source address Destination is a cluster which contains the following values El A Address specifies the address part of the destination address to which the memory block is copied Extension specifies the extension part of the destination address Error in is a cluster which describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out a status is TRUE if an error occurred This VI is not executed when LEE status is TRUE ECU M amp C Toolkit User Manual 5 24 ni com Chapter5 ECU M amp C API for LabVIEW
346. ple Error Handler source identifies the VI where the error occurred Description MC DAQ Start Stop vi is optional to start or stop transmission of the DAQ lists for an M amp C Measurement task to use MC DAQ Read vi If you do not specify MC DAQ Start Stop vi Start DAQ list before your first Read VI it is implicitly performed by the first MC DAQ Read vi call After you start the transmission of the DAQ lists you can no longer change the configuration of the task with MC Set Property vi You must call MC DAQ Start Stop vi Stop DAQ list first National Instruments 5 57 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW MC DAQ Write vi Purpose Writes samples to an ECU DAQ list Format DAQ ref in DAQ ref out number of samples 1Chan 1Samp 1D Dbl error out error in Input H E 7a E a a ECU M amp C Toolkit User Manual DAQ ref in is the task reference from the previous Measurement task VI The task reference is originally returned from MC DAQ Initialize vi and then wired through subsequent Measurement task VIs Number of samples specifies the number of samples to write for the Measurement task For single sample Poly VI types MC DAQ Write vi always returns one sample so this input is ignored Value is a poly output that writes samples to the ECU STIM list The type of the poly output is determined by the poly VI selection For information on the different poly VI types
347. ples output returns a single sample for each channel from the most recent message received If no message has been received for a channel since you started the task a 0 is returned in samples You can specify channels in channel list that span multiple messages A sample from the most recent message is returned for all channels You can use error out to determine whether a new message has been received since the previous call to MC DAQ Read vi or MC DAQ Start Stop vi If no message has been received for one or more channels the warning code 3FF60009 hex is returned in error out If a new message has been received for all channels the success code 0 is returned in error out Unless an error occurs number of samples returned is one The samples array is indexed by channel and the entry for each channel contains a single sample If you need to determine the number of channels in the task after initialization get the Number of Channels property for the task reference 1Chan NSamp 1D Dbl Returns an array of samples for the first channel initialized in channel list The initialized sample rate must be greater than zero for this poly VI because each sample in the array indicates the value of the CAN channel at a specific point in time In other words the sample rate specifies a virtual clock that copies the most recent value from CAN messages for each sample time The changes in sample values from message to message enable you to view the CAN channel
348. provided by MC DAQ Write vi refer to the Poly VI Types section To select the data type right click the VI go to Select Type and select the type by name Error in is a cluster which describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out status is TRUE if an error occurred This VI will not execute when status is TRUE 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 5 58 ni com Chapter5 ECU M amp C API for LabVIEW source identifies the VI where the error occurred DAQ ref out is the same as DAQ ref in Wire the task reference to subsequent VIs for this task 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 opera
349. r 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 amp C API to obtain a descriptive string for the return value Description mcXCPGetCalPage implements the XCP command GET_CAL_PAGE and queries the logical number for the calibration data page that is currently activated for the specified access mode and data segment ECU M amp C Toolkit User Manual 6 132 ni com Chapter 6 ECU M amp C API for C Refer to the ASAM XCP Part 2 Protocol Layer Specification for more information on how to set up a request National Instruments 6 133 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C mcXCPGetld Purpose Queries session configuration or slave device identification Format mcTypeStatus mcXCPGetId mcTypeTaskRef ECURefNum u8 Type u32 Length char Id Input ECURefNum ECURefNum is the task reference which links to the selected ECU This reference is originally returned from mcECUSelectEx Type Type specifies the type of the requested identification Type Description 0 ASCII text 1 ASAM MC2 filename without path and extension 2 ASAM MC2 filename with path and extension 3 URL where the ASAM MC72 file can be found 4 ASAM MC72 file to upload128 255 User defined Output Length Le
350. r DLLs are in a different directory set this property pointing to this directory str mc PropECU_SeedkKey_Cal Sets the filename of the SeedKey DLL used for Calibration purposes For Remote Seedkey access refer to the Lab VIEW examples set the name to RSK lt server ip address gt lt port gt str mc PropECU_SeedKey_DAQ Sets the filename of the SeedKey DLL used for DAQ purposes For Remote Seedkey access refer to the LabVIEW examples set the name to RSK lt server ip address gt lt port gt str mcPropECU_SeedKey Prog Sets the filename of the SeedKey DLL used for programming purposes For Remote Seedkey access refer to the Lab VIEW examples set the name to RSK lt server ip address gt lt port gt str mc PropECU_SeedKey_XCP Sets the filename of the SeedKey DLL for XCP For Remote Seedkey access refer to the LabVIEW examples set the name to RSK lt server ip address gt lt port gt ECU M amp C Toolkit User Manual 6 116 ni com Chapter 6 ECU M amp C API for C Table 6 5 ECU Specific Value Types for the PropertylD Input Value Continued Data Type Name Description str mcPropECU_LogFileName Sets a filename full path where the CCP or XCP protocol traffic is logged in ASCII format for debugging purposes Setting this value to an empty path NULL or empty string disables logging default Note that on RT and cRIO systems the logfile is created on the target sys
351. r Manual 5 174 ni com Chapter5 ECU M amp C API for LabVIEW MC Text To Double vi Purpose Converts a text value into the numeric representation using an enumeration or range text type scaling Format object name ECU ref in object type TextValue error in Input object name indicates the object measurement or characteristic for which the enumeration or range text scaling is performed ECU ref in is the task reference that links to the selected ECU This reference is originally returned from MC ECU Open vi or MC ECU Select vi and then wired through subsequent VIs object type is a U32 ring that indicates the type of the object named in object name Valid values are E HE 1 Measurement Name 2 Characteristic Name TextValue is the text value you want to convert Use MC Get Property vi Scaling Text Values to request the available values Error in is a cluster which describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out H E status is TRUE if an error occurred This VI will not execute when status is TRUE National Instruments 5 175 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW 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
352. r 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 Poly VI Types Table 5 4 Poly VI Types for the Characteristic Parameter VI Type Description Parameter DBL Writes a single double value to the selected Characteristic name Curve 1D Writes a 1 dimensional array of double values to the selected Characteristic name Field 2D Writes a 2 dimensional array of double values to the selected Characteristic name National Instruments 5 35 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW MC Characteristic Write Single Value vi Purpose Writes a value to a named Characteristic on the ECU Format characteristic name ECU ref in x error in characteristic value ECU ref out error out Input Characteristic name is the name of a Characteristic stored in the A2L database file to which one value may be written ECU ref in is the task r
353. r in is a cluster which describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out status is TRUE if an error occurred This VI is not executed when status is TRUE 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 ECU ref out is the same as ECU ref in Wire the task reference to subsequent VIs for this task 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 5 152 ni com Chapter5 ECU M amp C API for LabVIEW code is the error code number identifying an error A value of 0 J 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
354. r ip address gt lt port gt ECU M amp C Toolkit User Manual 5 108 ni com Chapter 5 Table 5 5 Poly Values for Value Output Continued Type Hierarchy Sub Hierarchy Sub 1 Sub 2 Param Description ECU CCP SeedKey DAQ Name Returns the filename of the SeedKey DLL used for DAQ purposes If SeedKey is configured for remote access the output is RSK lt server ip address gt lt port gt ECU CCP SeedKey Prog Name Returns the filename of the SeedKey DLL used for programming purposes If SeedKey is configured for remote access the output is RSK lt server ip address gt lt port gt ECU CCP Single Byte DAQ List Determines if an ECU supports single byte or multi byte DAQ list entries National Instruments 5 109 ECU M amp C Toolkit User Manual ECU M amp C API for LabVIEW Chapter5 ECU M amp C API for LabVIEW Table 5 5 Poly Values for Value Output Continued Sub Hierarchy Type Hierarchy Sub 1 Sub 2 Param Description ECU CCP Termination For all XNET devices the termination is software selectable XNET provides the option of 80 Q between Bus Plus and Bus Minus or no termination The Termination property configures the onboard termination of the NI XNET interface CAN connector port The Boolean property supports two values TRUE Termination ON and FALSE Termination Off Ho
355. rate gt 0 DAQ Read returns an array of samples for every channel in the DAQ Initialize list Each time the clock ticks at the specified rate a sample from the most recent message s is inserted into the arrays In other words the samples are repeated in the array at the specified rate until a new message is received By using the same sample rate with NI DAQ Analog Input channels or NI DAQmx Analog Input channels you can compare ECU DAQ and NI DAQ NI DAQmx samples over time Figure 4 5 shows an example of DAQ Read with a sample rate gt 0 A B and C represent messages for the initialized channels delta t represents the time between samples as specified by the sample rate def represents the default value 0 Start At Figure 4 5 Example of Read With Sample Rate gt 0 DAQ Write If you are using XCP and the DAQ initialize mode is set to STIM list the application must call the DAQ Write function to output floating point samples The application typically calls DAQ Write in a loop until done The DAQ Write function is MC DAQ Write vi in LabVIEW or mcDAQWrite in other languages 4 12 ni com Chapter 4 Using the ECU M amp C API DAQ Clear DAQ Clear must always be the final function called for a specific Measurement task If you do not use DAQ Clear the remaining Measurement task configuration can cause problems in the execution of subsequent ECU M amp C app
356. red 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 MC Clear Memory vi can be used to erase the FLASH EPROM prior to reprogramming If you are using CCP the CCP Memory Transfer address MTAO pointer is set to the memory location to be erased specified by the parameters Address and Extension MC Clear Memory vi implements the CCP CLEAR_MEMORY command defined by the CCP specification If you are using the XCP protocol MC Clear Memory vi implements the PROGRAM_CLEAR command For further details on how to clear parts of non volatile memory in the ECU refer to the ASAM XCP Protocol Layer Specification National Instruments 5 39 ECU M amp C Toolkit User Manual Chapter 5 ECU M amp C API for LabVIEW MC Conversion Create vi Purpose Creates a signal conversion object in memory Format Conversion Name ECU ref in ECU ref out Factor sip Offset eB error out error in Unit Input E Ee B A ECU M amp C Toolkit User Manual Conversion Name identifies the conversion object that handles the scaling of a measuremen
357. responding VxWorks OS version National Instruments Example of a Header for a Seed and Key and Checksum Algorithm for a VxWorks Target The module name of the compiled out file must correspond to the seed and key and checksum function name defined in the ASAM A2L database The following example uses the seed and key module name ccpecu out Therefore the seed and key function is named ccpecu_ASAP1A_CCP_ComputeKeyFromSeed The example uses the prefix in addition to the ASAM standard because the VxWorks OS requires unique function names across all loaded modules Therefore multiple 4 23 ECU M amp C Toolkit User Manual Chapter 4 Using the ECU M amp C API modules must not export functions with the same names To support multiple ECUs with the ECU Measurement and Calibration Toolkit each seed and key and checksum function must have a unique name To achieve unique function names for the seed and key and checksum functions these functions have the module name in lower case followed by an underline as a prefix The following example shows a possible header file for a module used for seed and key and checksum calculation under VxWorks targets ifndef _ CCPECU_h__ define _ CCPECU_h__ brief defines the name of the Seed Key function Here the name of the seed key function is defined The name of the seed key function is the name of the module in lower case letters followed by an underscore and the function n
358. ription 0x01 XCP_ADD_11 Add BYTE into a BYTE checksum ignore overflows 0x02 XCP_ADD_12 Add BYTE into a WORD checksum ignore overflows 0x03 XCP_ADD_14 Add BYTE into a DWORD checksum ignore overflows 0x04 XCP_ADD_22 Add WORD into a WORD checksum ignore overflows block size must be modulo 2 0x05 XCP_ADD_24 Add WORD into a DWORD checksum ignore overflows block size must be modulo 2 0x06 XCP_ADD_44 Add DWORD into DWORD ignore overflows block size must be modulo 4 0x07 XCP_CRC_16 Refer to CRC error detection algorithms 0x08 XCP_CRC_16_CITT Refer to CRC error detection algorithms 0x09 XCP_CRC_32 Refer to CRC error detection algorithms OxFF XCP_USER_DEFINED User defined algorithm in externally calculated function If type of checksum is returned as OxFF XCP_USER_DEFINED the slave can indicate that the master for calculating the checksum must use a user defined algorithm implemented in an externally calculated function for instance Win32 DLL UNIX shared object file etc The master gets the name of the external function file to be used for this slave from the ASAM MCD 2MC description file or from a property which can be set For a detailed description of the checksum algorithm refer to the XCP Part 2 Protocol Layer Specification ECU M amp C Toolkit User Manual 5 8 ni com Chapter5 ECU M amp C API for LabVIEW MC Calc Checksum vi Purpose Calculates the checksum of a data block in mem
359. ription ug mcPropECU_XCP_ Returns a flag indicating ECU access rights for PageECUAccess the memory segment page specified in the Name input Defined values are 0 ECU access not allowed 1 ECU access allowed without XCP access only 2 ECU access allowed with XCP access only 3 ECU access allowed always Specify the page by the string SEGMENT lt n gt PAGE lt m gt where lt n gt is the decimal representation of the segment number 0 N 1 where N is the number returned from the mcPropECU_XCP_NumSegments property and lt m gt is the decimal representation of the page number within the segment 0 M 1 where M is the number returned from the mcPropECU_XCP_NumPages property for this segment ECU M amp C Toolkit User Manual 6 90 ni com Chapter 6 ECU M amp C API for C Table 6 4 Values for PropertyID Continued Data Type Name Description u8 mcPropECU_XCP_ Returns a flag indicating XCP Read access PageXCPReadAccess rights for the memory segment page specified in the Name input Defined values are 0 XCP Read access not allowed 1 XCP Read access allowed without ECU access only 2 XCP Read access allowed with ECU access only 3 XCP Read access allowed always Specify the page by the string SEGMENT lt n gt PAGE lt m gt where lt n gt is the decimal representation of the segment number 0 N 1 where N is the number returned from the mcPropECU_XCP_NumSegments property and lt m gt is
360. ristic Wite caet tesdehivessresseanehsesadeeasseeeintaiiaveeteateenuaees 6 28 mcCharacteristic WriteSingle Value ec eeeceeeeseeeeceeeeeeeseseeetaeeeeeeseseeeeaees 6 29 MeClearMeMoOry sirais ri asarana sesioa iesi ra i aoada E E ioe 6 31 M ConyersionCreate oionn a E E E E E E EEEE 6 32 mMmeDAQClea aa no E oon ee 6 34 National Instruments ix ECU M amp C Toolkit User Manual Contents mcDAQImitiali Ze 21 03 242s cake Bde a EL ee eet eae eda hed 6 35 MCDA OLrstlnitialiZe aaa a sb hikes dae disk aE aa raS 6 38 mcDAQReadinii7 unk eid einai aa ee ae ee 6 40 mcDAQReadTimestamped 0 eee ec eeeeseesesseceseeeeeeseeseeeseeeeeaecneesseeseeeaeeaees 6 43 MCDAQS tartS topei a i hiii Sets anes dates Mats hoe E Ea S ia 6 46 McDAQWiile E a TT 6 48 McD atabaseClose res sa eioan EEE E a E E EE E E Meas E EEAS 6 50 meDatab se Open rronin er aeaa Raa E E aE aaa 6 51 mceDatabaseOpenEX insisi oireen eich aR E E sede E E 6 52 MCDoOUbD IE TOTEX Cs cscssveisdias de a a E E Estai 6 53 meDow load monsone ienen eee ee na e a a vans oadee E ET ERE eae 6 55 MCECUCONNEC etiri sei eo aaa aE ATOSE O ERE denies 6 57 MCECU Create riena eaaa a a ae ei a a eke 6 58 MCE CUDESEl CCH sisciehisiacinleaavcaeeatievscsisadesssoussvaa EA T eavtecas diate gt 6 62 MCECUDISCONNECE eeii aeia hans aeo aae EELEE E EE E Hale E EE 6 63 MCECUSElectER inia e E E E E E A 6 64 mcECUSetCalibrationPa gensins aiia 6 67 TCE VENUICTE ALE aenar E R ss IR aE TR OREERT RES 6 69 MICGE
361. rivers NI resources B 1 ECU M amp C Toolkit User Manual Index K KnowledgeBase B 1 L LabVIEW list of VIs 5 1 MC Build Checksum vi 5 6 MC Calc Checksum vi 5 9 MC CCP Action Service vi 5 12 MC CCP Diag Service vi 5 14 MC CCP Generic vi 5 96 MC CCP Get Active Cal Page vi 5 16 MC CCP Get Result vi 5 18 MC CCP Get Session Status vi 5 20 MC CCP Get Version vi 5 22 MC CCP Move Memory vi 5 24 MC CCP Select Cal Page vi 5 26 MC CCP Set Session Status vi 5 28 options table 5 29 MC Characteristic Read Single Value vi 5 32 MC Characteristic Read vi 5 30 options table 5 31 MC Characteristic Write Single Value vi 5 36 MC Characteristic Write vi 5 34 options table 5 35 MC Clear Memory vi 5 38 MC Conversion Create vi 5 40 MC DAQ Clear vi 5 42 MC DAQ Initialize vi 5 44 MC DAQ List Initialize vi 5 47 MC DAQ Read vi 5 50 MC DAQ Start Stop vi 5 56 MC DAQ Write vi 5 58 MC Database Close vi 5 61 MC Database Create vi 5 63 MC Database Open vi 5 65 MC Double To Text vi 5 67 ECU M amp C Toolkit User Manual l 4 MC Download vi 5 69 MC ECU Close vi 5 71 MC ECU Connect vi 5 73 MC ECU Create vi 5 75 MC ECU Deselect vi 5 80 MC ECU Disconnect vi 5 82 MC ECU Open vi 5 84 MC ECU Select vi 5 88 MC ECU Set Calibration Page vi 5 92 MC Event Create vi 5 94 MC Get Names vi 5 98 MC Get Property vi 5 102 poly output values table 5 104 MC Measurement Create vi 5 144 MC Measurement Read v
362. rmational 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 MC XCP Program Prepare vi may be used to indicate a data download as a pre condition for non volatile memory reprogramming The Memory Transfer address MTA pointer is set to the volatile memory location specified by the parameters Address and Extension The download itself is done by using subsequent standard commands like MC Download vi The slave device must ensure that the target memory area is available and it is in an operational state which permits the download of code If not an error will be returned MC XCP Program Prepare vi implements the optional XCP PROGRAM_PREPARE command defined by the XCP specification For further information on how to program non volatile ECU memory refer to the ASAM XCP Part 2 Protocol Layer Specification National Instruments 5 191 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW MC XCP Program Verify vi Purpose Performs a non volatile memory certification task on the ECU device Format verification mode ECU ref in ECU ref out verification type verification value error out error in Input Verification mode specifies the type of the requested identification Type Description 0 Request to start internal routine 1 Send a Verification
363. rning 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 Reference out is a copy of the reference which was passed to the reference in terminal Names list out returns the array of names one string entry per name To start a Measurement task or access a Characteristic for all channels returned from MC Get Names vi wire channel list to MC DAQ Initialize vi 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 MC Get Names vi is used to query the names contained within an A2L file The ECU name terminal is ignored if a valid ECU reference is connected to the reference in terminal In that instance MC Get Names vi will rep
364. ror 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 MC Calc Checksum vi implements a checksum calculation over a given data block The checksum algorithm is performed by the ECU M amp C toolkit using a predefined algorithm XCP only or over a dedicated checksum function provided by a specific DLL The Checksum DLL is defined in the A2L data base and can be changed by the application by the MC Set Property vi using the Checksum DLL Name property If you are using the CCP protocol type of checksum must always be set to OxFF as CCP supports an external checksum DLL only If using XCP the following values for type of checksum are defined in the XCP specification Type Name Description 0x01 XCP_ADD_11 Add BYTE into a BYTE checksum ignore overflows 0x02 XCP_ADD_12 Add BYTE into a WORD checksum ignore overflows 0x03 XCP_ADD_14 Add BYTE into a DWORD checksum ignore overflows 0x04 X
365. rror in is a cluster which describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out status is TRUE if an error occurred Unlike other VIs this VI will execute when status is TRUE 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 ECU ref out is the ECU reference upon which MC DAQ Initialize vi was called Wire this to subsequent ECU operations 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 5 42 ni com Chapter5 ECU M amp C API for LabVIEW code is the error code number identifying an error A value of 0 J 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
366. rty applies only to tasks initialized with mode of Input and sample rate greater than zero For all other configurations it returns an error If this property is queried before the DAQ list is started it always returns zero Start the DAQ list first with MC DAQ Start Stop vi before you query this property ECU M amp C Toolkit User Manual 5 134 ni com Chapter 5 Table 5 5 Poly Values for Value Output Continued Type Hierarchy Sub Hierarchy Sub 1 Sub 2 Param Description DAQ Time Since Last Frame Indicates how much time has passed in seconds since the measurement session received the last DAQ frame You can reuse this property to restart the measurement when the value increases a threshold for example 0 5 seconds assuming the ECU stopped sending DAQ messages and must be restarted DAQ CCP DTO ID Returns the DTO ID Data Transmission Object which is used by the ECU to send DAQ list data to the CCP master DAQ CCP DTO Task Returns the NI CAN task reference for the DTO ID Data Transmission Object the CAN task reading frames from the slave device For example you might use this to set CAN properties for this task Handle with extreme care as those properties are usually set correctly by the ECU M amp C Toolkit itself DAQ List CAN ID Returns the CAN ID for the specified DAQ list if mcPropDAQList_ CANIdSelectM
367. s Systems Standardization Working Group XCP Version 1 0 The Universal Measurement and Calibration Protocol Family Association for Standardization of Automation and Measuring Systems Part 1 Overview Part2 Protocol Layer Specification Part3 XCP on CAN Transport Layer Specification Part3 XCP on Ethernet Transport Layer Specification Part4 Interface Specification NI CAN Hardware and Software Manual xiii ECU M amp C Toolkit User Manual Activating Your Software This section describes how to use the NI Activation Wizard to activate your software How Do Activate My Software Use the NI Activation Wizard to obtain an activation code for your software You can launch the NI Activation Wizard two ways e Launch the product and choose to activate your software from the list of options presented e Launch NI License Manager by selecting Start All Programs National Instruments NI License Manager Click the Activate button in the toolbar Notes If your software is a part of a Volume License Agreement VLA contact your VLA administrator for installation and activation instructions NI software for Mac OS X and Linux operating systems does not require activation What is Activation Activation is the process of obtaining an activation code to enable your software to run on your computer An activation code is an alphanumeric string that verifies the software version and computer ID
368. s an input that specifies the type of names to return The value of Type mode is an enumeration o ECU Names returns a list of ECU names You can write this list to MC ECU Select vi This is the default value 1 Measurement Names returns a list of Measurement names 2 Characteristic Names returns a list of Characteristic names 3 Event Channel Names returns a list of Event Channel names 4 Defined Pages Names returns a list of Calibration page names 5 Group Names returns a list of Group names 6 Group Subgroup Names returns a list of Subgroup names of the specified Group name 7 Group Measurement Names returns a list of Measurement names within the specified Group 8 Group Characteristic Names returns a list of Characteristic names within the specified Group 9 Function Names returns a list of Function names within the specified ECU 5 98 ni com Chapter5 ECU M amp C API for LabVIEW 10 Function DefCharacteristic Names returns a list of Characteristic names referred by the DEF_CHARACTERISTIC keyword within the related Function 11 Function RefCharacteristic Names returns a list of Characteristic names referred by the REF_CHARACTERISTIC keyword within the related Function 12 Function InMeasurement Names returns a list of Measurement names referred by the IN MEASUREMENT keyword within the related Function 13 Function OutMeasurement Names returns a list of Measurement names referred by
369. s commencing with the value zero and this value being XORed into the register after the nth bit iteration This parameter should be specified as a hexadecimal number Refin A Boolean parameter If it is FALSE input bytes are processed with bit 7 being treated as the most significant bit MSB and bit 0 being treated as the least significant bit If this parameter is TRUE each byte is reflected before being processed ECU M amp C Toolkit User Manual 6 8 ni com Chapter 6 ECU M amp C API for C Refout A Boolean parameter If it is set to FALSE the final value in the register is fed into the XORout stage directly If this parameter is TRUE the final register value is reflected first XORout This is a width bit value that should be specified as hexadecimal number It is XORed to the final register value after the Refout stage before the value is returned as the official checksum For more detailed information about CRC algorithms refer to http www repairfaq org filipg LINK F_crc_v34 html National Instruments 6 9 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C mcCalculateChecksum Purpose Calculates the checksum of a data block in memory Format mcTypeStatus mcCalculateChecksum mcTypeTaskRef ECURefNum u32 BlockSize u8 Data u8 TypeOfChecksum u8 SizeOfChecksum u32 Checksum Input ECURefNum ECURe Num is the task reference which links to the selected ECU This reference is or
370. s 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 ECU M amp C Toolkit User Manual 6 20 ni com Chapter 6 ECU M amp C API for C Use the mcStatusToString function of the ECU M amp C API to obtain a descriptive string for the return value Description mcCCPMoveMemory is used to move the memory contents of an ECU from one memory location to another Before calling the CCP MOVE command this function sets the Memory Transfer Address pointers MTAO as defined in the source struct and MTA1 as defined in the destination struct to appropriate values mcCCPMoveMemory implements the CCP command MOVE defined by the CCP specification National Instruments 6 21 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C mcCCPSelectCalPage Purpose Sets the specified address to be the start address of the calibration data page CCP only Format mcTypeStatus mcCCPSelectCalPage mcTypeTaskRef ECURefNum mcAddress Address Input ECURefNum ECURefNum is the task reference which links to the selected ECU This reference is originally returned from mcECUSelectEx Address Configures the target address for the programming operation in the ECU mcAddre
371. s the VI where the error occurred ECU ref out is the same as ECU ref in Wire the task reference to subsequent VIs for this task 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 MC XCP Program Verify vi may be used to verify the success of non volatile memory reprogramming With Verification mode set to 00 the master may request the slave to begin internal test routines to check whether the new flash contents fits to the rest of the flash Only the result is of interest With Verification mode set to 01 the master may tell the slave that it will be sending a Verification value to the slave The definition of the Verification mode is National Instruments 5 193 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW project specific The master receives the Verification mode from the project specific program
372. sed on the IP address of the destination A hostname describes the unique name by which a device is known on a network Hostnames are used by various naming systems NIS DNS SMB etc Hostnames are high level aliases which ultimately correlate to unique network hardware MAC addresses Port number In TCP IP and UDP networks a port is an end point to a logical connection through which a client program specifies a server program on a computer in a network Port numbers range from 0 to 65536 but only port numbers 0 to 1024 are reserved for privileged services and designated as well known ports The ECU Connect function establishes communication to the selected ECU through CCP using the CCP CONNECT command or through XCP using the CONNECT command It establishes a logical connection to an ECU Unless a slave device ECU is unconnected it must not execute or respond to any command sent by the application The only exception to this 4 6 ni com ECU Disconnect ECU Close Chapter 4 Using the ECU M amp C API rule is the Test command in which case the slave with the specified address may acknowledge the command Only a single slave can be connected to the application at a time After a successful ECU Connect you can create a Measurement Task or read write a Characteristic The function to open and select an ECU is MC ECU Connect vi in LabVIEW and mcECUConnect in C The ECU Disconnect function permanently disconnects the specified s
373. sful ECU Connect you can create a Measurement task or read write a Characteristic mcTypeStatus mcECUConnect mcTypeTaskRef ECURefNum ECURefNum ECURe Num is the task reference which links to the selected ECU This reference is originally returned from mcECUSelectEx 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 amp C API to obtain a descriptive string for the return value Description mcECUConnect implements the CCP or XCP CONNECT command It establishes a logical connection to an ECU using the provided ECU Reference handle ECURefNum Unless a slave device ECU is unconnected it must not execute or respond to any command sent by the application The only exception to this rule is the Test command to which the CCP or XCP slave with the specific address may return an acknowledgement Only a single CCP or XCP slave can be connected to the application at a time National Instruments 6 57 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C mcECUCreate Purpose Creates an ECU object in memory Format mcTypeStatus
374. side the ECU status qualifier specifies the additional status information additional status contains the additional status information The content of these parameters is project specific and not defined by CCP For more information about these parameters refer to the documentation for the ECU MC CCP Get Session Status vi implements the CCP command GET_S_STATUS defined by the CCP specification National Instruments 5 21 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW MC CCP Get Version vi Purpose Retrieves version of the CCP implemented in the ECU CCP only Format ECU ref in ECU ref out major version error in minor version error out Input Output ECU M amp C Toolkit User Manual ECU ref in is the task reference which links to the selected ECU This reference is originally returned from MC ECU Open vi or MC ECU Select vi and then wired through subsequent VIs Error in is a cluster which describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out status is TRUE if an error occurred This VI is not executed when status is TRUE 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
375. software kit on your Certificate of Ownership The serial number for hardware products is printed either on the product box or on the device Computer ID or A 16 character ID that uniquely identifies your computer or NI hardware Device ID generated during the activation process Activation Code A 20 character code that enables NI software to run on your computer based on your serial number and computer ID You generate and install an activation code by completing the activation process National Instruments 2 3 ECU M amp C Toolkit User Manual Chapter 2 Installation and Configuration Moving Software After Activation To transfer your software to another computer install and reactivate it on the second computer You are not prohibited from transferring your software from one computer to another Because activation codes are unique to each computer you will need a new activation code Follow the steps on the previous page to acquire a new activation code and reactivate your software Volume License Program Online Activation National Instruments offers volume licenses through the NI Volume License Program The NI Volume License Program makes managing software licenses and maintenance easy For more information refer to ni com vlp Activation is available on ni com activate 24 hours a day 7 days a week You can retrieve an activation code from any computer that has an Internet connection NI does not require that the co
376. specified in the segment input 0 N 1 where N is the value returned from the Number of Segments property ECU XCP Cal Pages Compression Method Returns the compression method for the memory segment specified in the segment input 0 N 1 where N is the value returned from the Number of Segments property A value of 0 means no compression Other values are user defined ECU M amp C Toolkit User Manual 5 122 ni com Chapter5 ECU M amp C API for LabVIEW Table 5 5 Poly Values for Value Output Continued Type Hierarchy Sub Hierarchy Sub 1 Sub 2 Param Description ECU XCP Cal Pages Encryption Method Returns the encryption method for the memory segment specified in the segment input 0 N 1 where N is the value returned from the Number of Segments property A value of 0 means no encryption Other values are user defined ECU XCP Cal Pages Page Number Returns the logical page number for the memory segment page specified in the segment input 0 N 1 where N is the value returned from the Number of Segments property and page input 0 M 1 where M is the value returned from the Number of Pages property National Instruments 5 123 ECU M amp C Toolkit User Manual Chapter 5 ECU M amp C API for LabVIEW Table 5 5 Poly Values for Value Output Continued Type Hierarchy
377. 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 amp C API to obtain a descriptive string for the return value Description mcXCPProgramPrepare may be used to indicate a data download as a pre condition for non volatile memory reprogramming The Memory Transfer address MTA pointer is set to the volatile memory location specified by the parameters Address and Extension The download itself is done by using subsequent standard commands like mcDown1load The slave device must ensure that the target memory area is available and it is in an operational state which permits the download of code If not an error will be returned ECU M amp C Toolkit User Manual 6 140 ni com Chapter 6 ECU M amp C API for C mcXCPProgramPrepare implements the optional XCP PROGRAM_PREPARE command defined by the XCP specification For further information on how to program non volatile ECU memory refer to the ASAM XCP Part 2 Protocol Layer Specification National Instruments 6 141 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C mcXCPProgramVerify Purpose Verifies the programming of non volatile ECU memory Format mcTypeStatus mcXCPProgramVeri fy mcTypeTaskRef ECURefNum u8 Mode ul6 VerType u32 VerValue Input ECURefNum ECURe Nun is the task refere
378. ss is a C struct consisting of Address Specifies the address part of the target address Extension Extension contains the extension part of the address Output 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 amp C API to obtain a descriptive string for the return value Description mcCCPSelectCalPage implements the CCP command SELECT_CAL_PAGE This command sets the beginning of the calibration data page to the specified address within the ECU ECU M amp C Toolkit User Manual 6 22 ni com Chapter 6 ECU M amp C API for C mcCCPSetSessionStatus Purpose Updates the ECU with the current state of the calibration session CCP only Format mcTypeStatus mcCCPSetSessionStatus mcTypeTaskRef ECURefNum u8 SessionStatus Input ECURef Num ECURe fNum is the task reference which links to the selected ECU This reference is originally returned from mcECUSelectEx SessionStatus SessionStatus contains the new status to be set in the ECU Output Return Value The return value indicates the status of the function call as a signed 32 bit integ
379. ster to error out status is TRUI E if an error occurred Unlike other VIs this VI will execute when status is TRUE 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 DB ref out is the task reference which links to the opened database file Error out describes error conditions If the Error in cluster indicated an error the Error out cl uster contains the same information Otherwise Error out describes the error status of this VI status is TRUE if an error occurred ECU M amp C Toolkit User Manual 5 80 ni com Chapter5 ECU M amp C API for LabVIEW code is the error code number identifying an error A value of 0 Je 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 MC ECU Deselect vi deselects the communication to the ECU
380. t ECU ref in is the task reference that links to the selected ECU This reference is originally returned from MC ECU Open vi or MC ECU Create vi Factor configures the scaling factor used to convert raw measurement data in the message to from scaled floating point units The factor is the A in the linear scaling formula AX B where X is the raw data and B is the scaling offset Offset configures the scaling offset used to convert raw data in the measurement message to from scaled floating point units The scaling offset is the B in the linear scaling formula AX B where X is the raw data and A is the scaling factor Error in is a cluster which describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out status is TRUE if an error occurred This VI is not executed when status is TRUE 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 5 40 ni com Description Chapter5 ECU M amp C API for LabVIEW 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 Unit configures the measurement channel unit string You can
381. t task The communication for that Measurement task is started by the first DAQ Read function The DAQ Initialize function is MC DAQ Initialize vi in LabVIEW or mcDAQInitialize in other languages The DAQ Initialize function uses the following input parameters Measurement list Specifies the list of channels for the task with one string for each channel ECU Reference handle Typically the ECU Reference handle is created by opening the ASAM MCD 2MC database using the ECU Open function then connecting to an ECU using the ECU Connect function Mode Specifies the input mode to use for the task This determines the data transfer for the task Polling DAQ list or STIM list SampleRate Specifies the sampling rate for a specific DAQ list or STIM list The sample rate is specified in Hertz samples per second For more information refer to the DAQ Read section DTO ID If you are using the CCP protocol the DTO ID Data Transmission Object is used by the ECU to respond to CCP commands and to send data and status information to the CCP master DAQ Start Stop The optional function DAQ Start Stop starts or stops the transmission of the DAQ lists for an ECU M amp C Measurement task If you do not specify MC DAQ Start Stop vi before your first DAQ Read or DAQ Write function MC DAQ Start Stop vi is implicitly performed by the first DAQ Read or DAQ Write call After you start the transmission of the DAQ lists or STIM lists you c
382. t to Read Only In this case it is not allowed to call MC Characteristic Write vi for this Characteristic ECU M amp C Toolkit User Manual 5 128 ni com Chapter5 ECU M amp C API for LabVIEW Table 5 5 Poly Values for Value Output Continued Sub Hierarchy Type Hierarchy Sub 1 Sub 2 Param Description Characteristic Sizes Returns the array Sizes for X and Y direction of the Characteristic Characteristic Unit Returns the unit string defined for this Characteristic in the A2L database Characteristic _ X Axis Returns X axis values on which the Characteristic is defined It is valid if the dimension of the selected Characteristic is 1 or 2 Characteristic _ Y Axis Returns Y axis values on which the Characteristic is defined It is valid if the dimension of the selected Characteristic is 2 Characteristic Scaling Factor Returns the scaling factor defined for this Characteristic in the A2L database Characteristic Scaling Offset Returns the scaling offset defined for this Characteristic in the A2L database National Instruments 5 129 ECU M amp C Toolkit User Manual Chapter 5 ECU M amp C API for LabVIEW Table 5 5 Poly Values for Value Output Continued Type Hierarchy Sub Hierarchy Sub 1 Sub 2 Param Description Characteristic Scaling Type Returns the scaling type
383. t to the slave device ECU CCP DTO ID Sets the DTO ID which is the CAN identifier for the Data Transmission Object DTO The DTO is used by the CCP slave devices to return data and status information to the application ECU CCP Master ID Sets the CAN identifier of the CCP master that is used by the CCP command EXCHANGE ID asa parameter ECU M amp C Toolkit User Manual 5 160 ni com Chapter 5 ECU M amp C API for LabVIEW Table 5 6 ECU Specific Property Value Types for the POLY Input Value Continued Type Hierarchy Sub Hierarchy Sub 1 Sub 2 Param Description ECU CCP SeedKey Cal Name Sets the filename of the SeedKey DLL used for Calibration purposes For Remote Seedkey access refer to the LabVIEW examples set the name to RSK lt server ip address gt lt port gt ECU CCP SeedKey DAQ Name Sets the filename of the SeedKey DLL used for DAQ purposes For Remote Seedkey access refer to the LabVIEW examples set the name to RSK lt server ip address gt lt port gt ECU CCP SeedKey Prog Name Sets the filename of the SeedKey DLL used for programming purposes For Remote Seedkey access refer to the LabVIEW examples set the name to RSK lt server ip address gt lt port gt ECU CCP Single Byte DAQ List Sets the ECU to support single byte or multi byte DAQ list
384. t transmitted by the ECU but are calculated in the application They return an error when opened ina DAQ list Measurement Maximum Returns the maximum value of the Measurement Measurement Minimum Returns the minimum value of the Measurement Measurement BEE Read Only Returns TRUE if the selected Measurement is read only and can only be accessed through MC DAQ Read vi or returns FALSE if the Measurement can be accessed through MC Measurement Write vi as well ECU M amp C Toolkit User Manual 5 138 ni com Chapter5 ECU M amp C API for LabVIEW Table 5 5 Poly Values for Value Output Continued Sub Hierarchy Type Hierarchy Sub 1 Sub 2 Param Description Measurement Unit Returns the unit string defined for this Measurement in the A2L database Measurement Scaling Factor Returns the scaling factor defined for this Measurement in the A2L database Measurement Scaling Offset Returns the scaling offset defined for this Measurement in the A2L database National Instruments 5 139 ECU M amp C Toolkit User Manual Chapter 5 ECU M amp C API for LabVIEW Table 5 5 Poly Values for Value Output Continued Type Hierarchy Sub Hierarchy Sub 1 Sub 2 Param Description Measurement Scaling Type Returns the scaling type defined for this Me
385. tabase Open and ECU Select VIs Format protocol and interface DB path ECU ref out error in error out interface Input ECU M amp C Toolkit User Manual protocol and interface selects target communication protocol CCP or XCP and the desired interface to use for this task The interface input uses a string xxx yyy where xxx defines one of the two available protocols CCP or XCP and yyy defines the desired interface to use like CANO for CCP or XCP or UDP or TCP for XCP The protocol and interface input is required as this parameter is 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 NI CAN The special CAN interface values 256 and 257 refer to virtual interfaces For more information on usage of 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 If you use NI XNET hardware and select the xxx yyy syntax the ECU M amp C Toolkit uses the XNET NI CAN compatibility library XCL internally if the XNET interface is defined in MAX under NI CAN Devices To force use of the native XNET API you must use the xxx yyy nixnet syntax The interface name is related to the NI XNET hardware nam
386. task will use This string uses the syntax XXX YYY where X defines the selected protocol The following strings may be used as Y e String CCP refers using the CAN Calibration Protocol CCP e String XCP refers using the Universal Measurement and Calibration Protocol XCP Using NI CAN If you are using the CCP protocol with NI CAN hardware YYY can be associated with a defined NI CAN interface CANO CAN1 up to CAN63 CAN network interface names are associated with physical CAN ports using the Measurement and Automation Explorer MAX For example if you are using the CCP protocol on NI CAN interface CAN1 the value passed to Interface is CCP CAN1 The special string values CAN256 and National Instruments 6 59 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C CAN257 refer to virtual interfaces Refer to the NJ CAN Hardware and Software User Manual for detailed information on how to use virtual NI CAN ports If you are using the XCP protocol YYY can be associated with a XCP transport layer The transport layers may defined as follows e CANxx e TCP e UDP If you select CAN as the transport layer you must specify the NI CAN interface CANO CAN1 up to CAN63 CAN network interface names are associated with physical CAN ports using the Measurement and Automation Explorer MAX For example if you are using the XCP on NI CAN interface CAN2 the value passed to Interface is XCP CAN2 If you are using the
387. te an Event object in memory instead of referring to a predefined Event Channel in the A2L database Assign the event channel object by name to a DAQ List in mcMeasurementCreate National Instruments 6 69 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C mcGeneric Purpose Sends a generic command Format mcTypeStatus mcGeneric mcTypeTaskRef ECURefNum u8 Command u8 Data u32 DataSize u32 Timeout u8 ErrorCode u8 ReturnValue u32 ReturnValueSize Input ECURefNum ECURefNum is the task reference which links to the selected ECU This reference is originally returned from mcECUSelectEx Command Command is the CCP command code to send to the ECU Data Data contains the parameters of the command as an array of bytes For more information about the parameters of the user defined commands implemented in the ECU refer to the documentation for the ECU DataSize DataSize defines the number of bytes the array size passed in the input parameter Data Timeout Timeout specifies the maximum number of milliseconds to wait for a response from the ECU If the Timeout expires before an ECU response occurs the error mcErrorTimeout is returned Output ErrorCode ExrrorCode describes the error returned from the ECU during the communication ReturnValue ReturnValue may contain an array of bytes returned from the ECU as a response to the command sent to the ECU ReturnValueSize ReturnValueSize
388. ted as the first field of a CAN frame The arbitration ID determines the priority of the frame and is normally used to identify the data transmitted in the frame Association of Standardization of Automation and Measurement Systems ASAM MCD 2MC is a file interface standardized by ASAM which describes the internal ECU data interfaces and communication protocols It contains all information about relevant data objects in the ECU like Characteristic variables parameters characteristic curves and maps real virtual measurement variables and variant dependencies For each of these objects information is needed such as storage address record layout data type and conversion rules to convert the data into their physical units G 1 ECU M amp C Toolkit User Manual Glossary baudrate byte order C calibration data page CAN CCP CCP master CCP slave Characteristic Checksum DLL Command Receive Object CRO ECU M amp C Toolkit User Manual A user defined property which provides the baud rate at which communication will occur For more information refer to the Interface Properties dialog in MAX or the NI CAN Hardware and Software Manual The baud rate is originally set within MAX The byte order refers to which bytes are most significant in multi byte data types The term describes the order in which a sequence of bytes is stored in computer memory A portion of the ECU memory containing data that controls the
389. tem and must be transferred to the host after logging has been completed Note that no additional CAN port is used for the logging which makes this method superior to any other method such as running a bus monitor parallel u8 mcPropECU_Single_Byte_ Sets the ECU to support single byte or DAQ Lists multi byte DAQ list entries u32 mcPropECU_Station Sets the station address of the slave device CCP Address 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 u32 mcPropECU_TimingFactor Sets the timing factor which you can use to increase CCP or XCP command timeout values For details on the default Command Timeout values refer to the CCP or XCP Protocol Specification National Instruments 6 117 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C Table 6 5 ECU Specific Value Types for the PropertyID Input Value Continued Data Type Name Description u32 mcPropECU_XCP_Timeout_ Sets one of the seven timeout values in T1 milliseconds defined in the XCP standard for mcPropECU_XCP_Timeout_ the various XCP commands For details of T2 l whic
390. that are implemented in the ECU refer to the documentation for the ECU Params passes an array to the ECU that might be needed by the ECU to run the service Since this VI has no knowledge about how the data is interpreted by the ECU you are responsible for providing the data in the correct byte ordering eG Error in is a cluster which describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out A status is TRUE if an error occurred This VI is not executed when status is TRUE 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 ECU M amp C Toolkit User Manual 5 14 ni com Chapter5 ECU M amp C API for LabVIEW Output ECU ref out is the same as ECU ref in Wire the task reference to subsequent VIs for this task Data Type returns a Data Type Qualifier which provides information about the data type of the result of the diagnostic service Result contains the information returned from the diagnostic service uploaded from the ECU by the CCP master Error
391. the ECU to send DAQ list data to the CCP master National Instruments 5 173 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW Characteristic Specific Properties Table 5 8 Characteristic Specific Property Value Types for the PropertylD Input Value Sub Hierarchy Type Hierarchy Sub 1 Sub 2 Param Description Characteristic X Axis Sets the X axis values on which the Characteristic is defined The Characteristic dimension must be at least 1 Characteristic Y Axis Sets the Y axis values on which the Characteristic is defined The Characteristic dimension must be 2 Characteristic Byte Sets the specified byte order of Order the entire characteristic 0 Intel format Bytes are in little endian order with least significant bit first 1 Motorola format Bytes are in big endian order with most significant bit first Measurement Specific Properties Table 5 9 Measurement Specific Property Value Types for the PropertylD Input Value Sub Hierarchy Type Hierarchy Sub 1 Sub 2 Param Description Measurement Byte Sets the specified byte order of Order the selected Measurement 0 Intel format Bytes are in little endian order with least significant bit first 1 Motorola format Bytes are in big endian order with most significant bit first ECU M amp C Toolkit Use
392. the error code number identifying an error A value of 0 i 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 ECU ref out is the same as ECU ref in Wire the task reference to subsequent VIs for this task Data is a byte array which receives the uploaded data information from the ECU ECU M amp C Toolkit User Manual 5 18 ni com Chapter5 ECU M amp C API for LabVIEW Error out describes error conditions If the Error in cluster indicated an 2H 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 MC CCP Get Result vi uploads data bytes from the ECU It is assumed that the Me
393. the function performed as expected but a condition arose that may require attention Use the mcStatusToString function of the ECU M amp C API to obtain a descriptive string for the return value ECU M amp C Toolkit User Manual 6 26 ni com Chapter 6 ECU M amp C API for C Description mcCharacteristicReadSingleValue reads a value from a named Characteristic on the ECU which is identified by the ECU Reference handle The value to be read is identified by the x and y indices If the Characteristic array is 0 dimensional x and Y can be set to 0 If the Characteristic array is 1 dimensional Y can be set to 0 National Instruments 6 27 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C mcCharacteristicWrite Purpose Downloads data to a Characteristic for a selected ECU Format mcTypeStatus mcCharacteristicWrite mcTypeTaskRef ECURefNum char CharacteristicName 64 Values u32 NumberOfValues Input ECURefNum ECURe f Num is the task reference which links to the selected ECU This reference is originally returned from mcECUSelectEx CharacteristicName CharacteristicName is the name of the Characteristic defined in the A2L database file Values Values contains a pointer to a double a double 1D or 2D array which is sent to the ECU NumberOfValues Specifies the number of values to write for the task Output Return Value The return value indicates the status of the function call as a signed
394. thernet and TCP IP or UDP IP protocol is addressed by its IP Address and Port number ECU XCP Timeout T1 T2 T3 T4 T5 T6 T7 Returns one of the seven timeout values in milliseconds defined in the XCP standard for the various XCP commands For details of which timeout applies to a specific command refer to the XCP standard The values typically are read from an A2L file but may be overridden manually Note that the Timing Factor property might modify this value ECU M amp C Toolkit User Manual 5 118 ni com Chapter5 ECU M amp C API for LabVIEW Table 5 5 Poly Values for Value Output Continued Type Hierarchy Sub Hierarchy Sub 1 Sub 2 Param Description ECU CCP Timeout T_std Returns the timeout value in milliseconds for most of the CCP commands For details of which timeout applies to a specific command refer to the CCP standard Default 40 Standard 25 The default is chosen slightly higher to allow for slower ECUs Note that the Timing Factor property might modify this value ECU CCP Timeout T_pgm Returns the timeout value in milliseconds for the CCP programming commands For details of which timeout applies to a specific command refer to the CCP standard Default 120 Standard 100 The default is chosen slightly higher to allow for slower ECUs Note that the Timing Factor pr
395. tic Read vi refer to the Poly VI Types section To select the data type right click the VI go to Select Type and select the type by name 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 Table 5 3 Poly VI Types for the Value Parameter VI Type Description Parameter DBL Returns a single double value for the selected Characteristic name Curve 1D Returns a 1 dimensional array of double values for the selected Characteristic name Field 2D Returns a 2 dimensional array of double values for the selected Characteristic name National Instruments 5 31 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW MC Characteristic Read Single Value vi Purpose Reads a value from a named Characteristic on the ECU which is identified by the ECU Reference handle
396. time and then writes a single sample This enables you to execute a control loop at a specific rate If the initialized sample rate is zero this poly VI immediately writes a single sample If no message has been received since you started the task the value of 0 is returned in samples You can use error out to determine whether a new message has been received since the previous call to MC DAQ Write vi or MC DAQ Start Stop vi If no message has been received the warning code 3FF60009 hex is returned in error out If a new message has been received the success code 0 is returned in error out NChan 1Samp 1D Dbl Writes an array one entry for each channel initialized in the channel list Each entry consists of a single sample The order of channel entries in samples is the same as the order in the original channel list If the initialized sample rate is greater than zero this poly VI type waits for the next sample time then writes a single sample for each channel This enables you to execute a control loop at a specific rate If the initialized sample rate is zero this poly VI immediately writes a single sample for each channel The samples output returns a single sample for each channel from the most recent message received If no message has been received for a channel since you started the task a 0 is returned in samples You can specify channels in channel list that span multiple messages A sample from the most recent message is returned for
397. tion 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 Poly VI Types The name of each Poly VI type uses the following conventions e The first term is either 7 Chan or NChan This indicates whether the type writes data to a single channel or multiple channels NChan types write an array of analogous 7 Chan types one entry for each channel initialized in channel list of MC DAQ Initialize vi 1Chan types are convenient because no array indexing is required but you are limited to writing only one channel e The second term is either Samp or NSamp This indicates whether the type writes a single sample or an array of multiple samples Samp types are often used for single point control applications such as within LabVIEW RT e The third term indicates the data type used for each sample The type Dbl indicates double precision 64 bit floating point The type W m indicates the waveform data type The types ZD and 2D indicate one and two dimensional arrays respectively National Instruments 5 59 ECU M amp C Toolkit User Manual Chapter 5 ECU M amp C API for LabVIEW 1Chan 1Samp Dbl Writes a single sample for the first channel initialized in the channel list If the initialized sample rate is greater than zero this poly VI type waits for the next sample
398. tive 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 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 National Instruments 5 61 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW code is the error code number identifying an error A value of 0 pase 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 MC Database Close vi must always be the final M amp C VI called for each communication task If you do not use MC Database Close vi the remaining task configurations can cause problems in the execution of subsequent Measurement and Calibration applications MC Database Close vi is an advanced function for database handling In most cases it is sufficient to use MC ECU Close vi instead Unlike oth
399. to enable features on your computer Activation codes are unique and are valid on only one computer What is the NI Activation Wizard The NI Activation Wizard is a part of NI License Manager that steps you through the process of enabling software to run on your machine What Information Do Need to Activate You need your product serial number user name and organization The NI Activation Wizard determines the rest of the information Certain activation methods may require additional information for delivery This information is used only to activate your product Complete disclosure of National Instruments XV ECU M amp C Toolkit User Manual Activating Your Software How Do Find the National Instruments software licensing information privacy policy is available at ni com activate privacy If you optionally choose to register your software your information is protected under the National Instruments privacy policy available at ni com privacy My Product Serial Number Your serial number uniquely identifies your purchase of NI software You can find your serial number on the Certificate of Ownership included in your software kit If your software kit does not include a Certificate of Ownership you can find your serial number on the product packing slip or on the shipping label If you have installed a previous version using your serial number you can find the serial number by selecting the Help About menu
400. tput Type Hierarchy Sub Hierarchy Sub 1 Sub 2 Param Description DB File Name Returns the A2L Database file name with which the task has been opened The value of this property cannot be changed using MC Set Property vi ECU Byte Order Returns 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 ECU Seedkey Checksum DLL Path This property determines the directory where the ECU M amp C Toolkit expects to find the Seedkey or Checksum DLL If the property is an empty string default the ECU M amp C Toolkit expects the DLLs in the same directory as the A2L file If your DLLs are in a different directory set this property pointing to this directory ECU M amp C Toolkit User Manual 5 104 ni com Chapter 5 Table 5 5 Poly Values for Value Output Continued Type Hierarchy Sub Hierarchy Sub 1 Sub 2 Param Description ECU Checksum DLL Name Returns the file name of the Checksum DLL used for verifying the checksum ECU LogFile Path Returns the filename full path where the CCP or XCP protocol traffic is logged in ASCII format for debugging purposes An empty path indicates no logging default Note that on RT and cRIO systems the logfile is cr
401. tring function of the ECU M amp C API to obtain a descriptive string for the return value Description mcCharacteristicRead reads values from a named Characteristic on the ECU which is identified by the ECU Reference handle The function returns a double 1D or 2D array National Instruments 6 25 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C mcCharacteristicReadSingleValue Purpose Reads a single value from a named Characteristic on the ECU which is identified by the ECU Reference handle Format mcTypeStatus mcCharacteristicReadSingleValue mcTypeTaskRef ECURefNum char CharacteristicName 64 Value u32 X u32 Y Input ECURefNum ECURefNum is the task reference which links to the selected ECU This reference is originally returned from mcECUSelectEx CharacteristicName CharacteristicName is the name of the Characteristic defined in the A2L database file x X is the horizontal index if the Characteristic consists of 1 or 2 dimensions Y Y is the vertical index if the Characteristic consists of 2 dimensions Output Value Returns a single value from the selected Characteristic 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
402. ts subsidiaries LEGO the LEGO logo WEDO and MINDSTORMS are trademarks of the LEGO Group TETRIX by Pitsco is a trademark of Pitsco Inc FIELDBUS FOUNDATION and FOUNDATION are trademarks of the Fieldbus Foundation EtherCAT is a registered trademark of and licensed by Beckhoff Automation GmbH CANopen is a registered Community Trademark of CAN in Automation e V DeviceNet and EtherNet IP are trademarks of ODVA Go SensorDAQ and Vernier are registered trademarks of Vernier Software amp Technology Vernier Software amp Technology and vernier com are trademarks or trade dress Xilinx is the registered trademark of Xilinx Inc Taptite and Trilobular are registered trademarks of Research Engineering amp Manufacturing Inc FireWire is the registered trademark of Apple Inc Linux is the registered trademark of Linus Torvalds in the U S and other countries Handle Graphics MATLAB Real Time Workshop Simulink Stateflow and xPC TargetBox are registered trademarks and TargetBox and Target Language Compiler are trademarks of The MathWorks Inc Tektronix Tek and Tektronix Enabling Technology are registered trademarks of Tektronix Inc The Bluetooth word mark is a registered trademark owned by the Bluetooth SIG Inc The ExpressCard word mark and logos are owned by PCMCIA and any use of such marks by National Instruments is under license The mark LabWindows is used under a license from
403. ts the Data Transmission Object DTO ID which the ECU uses to respond to CCP commands and send data and status information to the CCP master application 5 76 ni com Chapter5 ECU M amp C API for LabVIEW Baud rate sets the baud rate in use by the selected CAN interface This property applies to all tasks initialized with the NI CAN 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 the advanced baud rate as 8000XXYY hex where YY is the value of Bit Timing Register 0 BTRO and XX is the value of Bit Timing Register 1 BTR1 Station Address sets the slave device station address A CCP address 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 Byte Order sets the byte order of the CCP slave device i 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 Error in is a cluster which describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the
404. turned Input DAQRef Num DAQRefNum is the task reference that links to the selected measurement task This reference is originally returned from mcDAQInitialize or mcDAQListInitialize NumberOfSamplesToRead Specifies the number of samples to read for the task Output TimestampArray Returns the time at which each corresponding sample in SampleArray was received in a CAN message The timestamps are returned as an array of arrays 2D array one array for each channel initialized in the task The array of each channel must have NumberOfSamplesToRead entries allocated For example if you call mcDAQInitialize with ChannelList of myDAQ1 myDAQ2 then call mcDAQReadTimestamped with NumberOfSamplesToRead of 20 both TimestampArray and SampleArray must be allocated as __int64 mcTypeTimestamp TimestampArray 2 20 double SampleArray 2 20 The order of channel entries in TimestampArray is the same as the order in the original DAQ channel list To determine the number of channels in the DAQ task after initialization get the mcPropDAQ_NumChannels property for the DAQ task reference Each timestamp in TimestampArray uses the___int 64 datatype compatible with the Microsoft Win32 FILETIME type This absolute time is kept in a Coordinated Universal Time UTC National Instruments 6 43 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C format UTC time is loosely defined as the current date and time of day in Greenwich En
405. ue 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 amp C API to obtain a descriptive string for the return value Description Each returned sample corresponds to a received CAN message for the measurement channels initialized in the DAQ channel list For each sample mcDAQReadTimestamped returns the sample value and a timestamp that indicates when the message was received Because the timing of samples returned by mcDAQReadTimestamped is determined by when the message is received the initialized sample rate is not used The function waits until NumberOfSamplesToRead messages have been received The number of samples returned is indicated in the NumberOfSamplesReturned output up toa ECU M amp C Toolkit User Manual 6 44 ni com Chapter 6 ECU M amp C API for C maximum of NumberOfSamplesToRead messages If no new message has been received NumberOfSamplesReturned is 0 and the return value indicates success To avoid blocking a mcDAQReadTimestamped function read the mcPropDAQ_SamplesPending property to check the number of collected sample points before calling mcDAQReadTimestamped National Instruments 6 45 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C mcDAQStartStop Purpose Starts the transmission of the DAQ lists assigned to the Measurement task on the ECU Format mcTypeStatus Input
406. umber of channels in the task after initialization get the Number of Channels property for the task reference National Instruments 5 55 ECU M amp C Toolkit User Manual Chapter 5 ECU M amp C API for LabVIEW MC DAQ Start Stop vi Purpose Starts or stops transmission of the DAQ lists for the specified Measurement task Format Input DAQ ref in DAQ ref out mode error in error out ECU M amp C Toolkit User Manual DAQ ref in is the task reference from the previous Measurement task VI The task reference is originally returned from MC DAQ Initialize vi and then wired through subsequent Measurement task VIs mode indicates the type of function to be performed Stop DAQ List Configures the ECU to stop transmitting a DAQ task If stopped properties of the DAQ task can be changed using MC Set Property vi This function is performed automatically before MC DAQ Clear vi Start DAQ List Configures the ECU to start sending data for a DAQ task Ensure that the DAQ list has not yet been transferred to the ECU first Once started properties of the DAQ list can no longer be changed using MC Set Property vi This function is performed automatically before the first read of the DAQ list with MC DAQ Read vi Transmit DAQ List to ECU Transfers the DAQ list to the ECU but does not start it For example use this mode if you want to change the session status before starting the DAQ list For some ECUs this is n
407. unction to get the value of any property The Get Property function returns values whether the task is running or not The Get Property function is MC Get Property vi in LabVIEW or mcGetProperty in C Generic CCP Functions The generic ECU M amp C CCP functions provide direct access to the CCP commands on a very low programming level For further information for the use and parameters of the CCP commands refer to the CAN Calibration Protocol Specification Version 2 1 Table 4 1 provides an overview of the CCP commands and their corresponding LabVIEW VIs or C functions Table 4 1 Overview of the CCP Commands with Related VIs and C Functions CCP Command LabVIEW VI Name C Function Name ACTION_SERVICE MC CCP Action Service vi mcCCPActionService BUILD_CHKSUM MC Build Checksum vi mcBuildChecksum CLEAR_MEMORY MC Clear Memory vi mcClearMemory DIAG_SERVICE MC CCP Diag Service vi mcCCPDiagService DNLOAD MC Download vi mcDownload GET_ACTIVE_CAL_PAGE MC CCP Get Active Cal mcCCPGetActiveCal Page Page vi GET_CCP_VERSION MC CCP Get Version vi mcCCPGetVersion GET_S_STATUS MC CCP Get Session mcCCPGetSessionStatus Status vi MOVE MC CCP Move Memory vi mcCCPMoveMemory PROGRAM MC Program vi mcProgram SELECT_CAL_PAGE MC CCP Select Cal Page vi mcCCPSelectCalPage National Instruments 4 17 ECU M amp C Toolkit User Manual Chapter 4 Using the ECU M amp C API Table 4 1 Overview of the CCP Commands
408. urce identifies the VI where the error occurred Description MC ECU Set Calibration Page vi tries to identify a single RAM or ROM page on the ECU and select it according to the use RAM input To identify an appropriate page the VI searches the calibration page information from the A2L file or the online information from the ECU If the VI can identify a unique calibration page it is activated in the ECU and the VI returns success If the VI cannot identify a unique page an error is returned indicating this and no further action is taken This does not however state a fault but just the algorithm s inability to uniquely identify the desired page In this case you can use the calibration page related ECU properties MC Get Property vi ECU CCP Cal Pages or ECU XCP Cal Pages to gain the information about available calibration pages and manually select the correct page using MC CCP Select Cal Page vi or MC XCP Set Cal Page vi The map Addresses input activates the address mapping from the ROM page assumed to be the reference page to the target page specified in use RAM Address mapping is supported only for the CCP protocol and requires a unique ROM and unique RAM page in the A2L file Addresses of measurements and characteristics in the A2L file must point to the ROM page as a reference page National Instruments 5 93 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for L MC Event Create vi abVIEW
409. urned from MC ECU Open vi or MC ECU Select vi and then wired through subsequent VIs Error in is a cluster which describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out status is TRUE if an error occurred This VI is not executed when status is TRUE 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 ECU ref out is the same as ECU ref in Wire the task reference to subsequent VIs for this task Address is a cluster which contains the following values Address specifies the address part of the active calibration page address ECU M amp C Toolkit User Manual 5 16 ni com Chapter5 ECU M amp C API for LabVIEW Extension contains the extension part of the active calibration page address 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 cod
410. urns the current status of the selected ECU ResourceMask ResourceMask is the current resource protection status of the selected ECU SessionId SessionId returns the defined session configuration ID 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 amp C API to obtain a descriptive string for the return value Description mcXCPGetStatus implements the XCP command GET_STATUS and returns all current status information of the selected ECU slave device including the status of the resource protection pending store requests and the general status of data acquisition and stimulation ECU M amp C Toolkit User Manual 6 136 ni com Current Session Status SessionStatus contains a bit mask which is described below Chapter 6 ECU M amp C API for C Bit Number Flag Description 0 STORE_CAL_REQ REQuest to STORE CALibration data 0 STORE_CAL_REQ mode is reset 1 STORE_CAL_REQ mode is set 1 Unused 2 STORE_DAQ_REQ REQuest to STORE DAQ list 0 STORE_DAQ_REQ mode is reset 1 STORE_DAQ_REQ mode is set 3 CLEAR_DAQ_REQ RE
411. urpose Downloads data to an ECU Format ECU ref in ECU ref out address data error out error in ECU ref in is the task reference which links to the selected ECU This reference is originally returned from MC ECU Open vi or MC ECU Select vi and then wired through subsequent VIs Address is a cluster which contains the following values Address specifies the address part of the destination address Extension contains the extension part of the destination address Data contains the information to be downloaded Error in is a cluster which describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out status is TRUE if an error occurred This VI is not executed when status is TRUE 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 National Instruments 5 69 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW Output ECU ref out is the same as ECU ref in Wire the task reference to subsequent VIs for this task Error out d
412. urred Description MC ECU Select vi creates an ECU reference handle linked to the selected ECU name MC ECU Select vi does not start communication This enables you to use MC Set Property vi to change the properties of an ECU task After you change properties use MC ECU Connect vi to start communication for the task and logically connect to the selected ECU Prior to calling MC ECU Select vi an available ECU name can be queried by calling MC Get Property vi with the parameter ECU Name Possible selections for the interface and protocol parameter for the various hardware targets are as follows Using NI CAN hardware e CCP CAN0 uses CCP on CAN interface 0 e CCP CAN1 uses CCP on CAN interface 1 and so on with the form CANx e CCP CAN256 uses CCP on virtual CAN interface 256 e CCP CAN257 uses CCP on virtual CAN interface 257 ECU M amp C Toolkit User Manual 5 90 ni com Chapter5 ECU M amp C API for LabVIEW XCP CAN0 uses XCP on CAN interface 0 XCP CAN1 uses XCP on CAN interface 1 and so on with the form CANx XCP UDP uses XCP on UDP XCP TCP uses XCP on TCP Using NI XNET hardware with NI XNET Frame Input Output based sessions CCP CAN1 nixnet uses CCP on CAN interface 1 CCP CAN2 nixnet uses CCP on CAN interface 2 and so on with the form CANx XCP CANI1 nixnet uses XCP on CAN interface 1 XCP CANI1 nixnet uses XCP on CAN interface 2 and so on with the form CANx XCP UDP uses XCP on UDP XCP TCP uses X
413. ut ECURefNum ECURe Num is the task reference which links to the selected ECU This reference is originally returned from mcECUSelectEx Address Configures the target address for the checksum operation in the ECU mcAddress is a C struct consisting of Address Specifies the address part of the target address Extension Extension contains the extension part of the target address BlockSize BlockSize determines the size of the block on which the checksum must be calculated ChecksumType ChecksumType returns the type of the calculated checksum For CCP ChecksumType is OxFF For XCP refer to the Description section Output SizeofChecksum SizeofChecksum returns the size in bytes of the calculated checksum Checksum Checksum is the calculated checksum 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 ECU M amp C Toolkit User Manual 6 6 ni com Chapter 6 ECU M amp C API for C Use the mcStatusToString function of the ECU M amp C API to obtain a descriptive string for the return value Description mcBuildChecksum is used to calculate the checksum of a specified memory block inside the ECU startin
414. ut applies to a specific command refer to the XCP standard The values are typically read from an A2L file but may be overridden manually Note that the Timing Factor property may modify this value National Instruments 5 169 ECU M amp C Toolkit User Manual Chapter 5 ECU M amp C API for LabVIEW Table 5 6 ECU Specific Property Value Types for the POLY Input Value Continued Type Hierarchy Sub Hierarchy Sub 1 Sub 2 Param Description ECU CCP Timeout T_std Sets the timeout value in milliseconds for most of the CCP commands For details of which timeout applies to a specific command refer to the CCP standard Default 40 Standard 25 The default is chosen slightly higher to allow for slower ECUs Note that the Timing Factor property may modify this value ECU CCP Timeout T_pgm Sets the timeout value in milliseconds for the CCP programming commands For details of which timeout applies to a specific command refer to the CCP standard Default 120 Standard 100 The default is chosen slightly higher to allow for slower ECUs Note that the Timing Factor property may modify this value ECU M amp C Toolkit User Manual 5 170 ni com Chapter5 ECU M amp C API for LabVIEW Table 5 6 ECU Specific Property Value Types for the POLY Input Value Continued Type Hierarchy Sub Hierarchy Sub 1 Sub
415. ut is the same as ECU ref in Wire the task reference to subsequent VIs for this task 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 MC Characteristic Write Single Value vi writes a value to a defined Characteristic on the ECU which is identified by the ECU Reference handle The location to which the value is written is identified by the x and y indices If the Characteristic array has 0 or 1 dimensions y and or x can be left unwired National Instruments 5 37 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW MC Clear Memory vi Purpose Clears the contents of a specified memory block Format ECU ref in ECU ref out address block size error out error in Input ECU ref in is the task reference which links to the selected ECU This reference is originally returned fr
416. 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 amp C API to obtain a descriptive string for the return value Description mcXCPSetCalPage implements the XCP command SET_CAL_PAGE and sets the access mode for a calibration data segment if the slave device supports calibration data page switching A calibration data segment and its pages are specified by logical numbers Refer to the ASAM XCP Part 2 Protocol Layer Specification for more information on how to set up a request National Instruments 6 145 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C mcXCPSetRequest Purpose Performs a request to save session and device information to non volatile memory Format mcTypeStatus mcXCPSetRequest mcTypeTaskRef ECURefNum u8 Mode ul6 SessionID Input ECURefNum ECURefNum is the task reference which links to the selected ECU This reference is originally returned from mcECUSelectEx Mode Mode is a bit mask described below Bit Description 0 Request to store calibration data in non volatile memory 1 Unused 2 Request to save all DAQ lists which have been selected with START_STOP_DAQ _LIST Select into non volatile memory The slave also must store the session configuration ID in non volatile memory Upon saving the slave first must clear any
417. wever different CAN or LIN hardware has different termination requirements and the termination values have different meanings Refer to the Termination attribute in the XNET API for more details This property is supported for NI XNET devices only ECU M amp C Toolkit User Manual 5 110 ni com Chapter5 ECU M amp C API for LabVIEW Table 5 5 Poly Values for Value Output Continued Sub Hierarchy Type Hierarchy Sub 1 Sub 2 Param Description ECU XCP CAN Termination For all XNET devices the termination is software selectable XNET provides the option of 80 Q between Bus Plus and Bus Minus or no termination The Termination property configures the onboard termination of the NI XNET interface CAN or LIN connector port The Boolean property supports two values TRUE Termination ON and FALSE Termination Off However different CAN or LIN hardware has different termination requirements and the termination values have different meanings Refer to the Termination attribute in the XNET API for more details This property is supported for NI XNET devices only National Instruments 5 111 ECU M amp C Toolkit User Manual Chapter 5 ECU M amp C API for LabVIEW Table 5 5 Poly Values for Value Output Continued Type Hierarchy Sub Hierarchy Sub 1 Sub 2 Param Description ECU CCP Station Address Returns the Stati
418. with ANSI C functions such as printf For applications written in C or C each ECU M amp C function returns a status code as a signed 32 bit integer The following table summarizes the ECU M amp C use of this status Table 6 9 Description of Return Codes Status Code Definition Negative Error Function did not perform expected behavior Positive Warning Function performed as expected but a condition arose that may require attention Zero Success Function completed successfully ECU M amp C Toolkit User Manual 6 124 ni com Chapter 6 ECU M amp C API for C The application code should check the status returned from every ECU M amp C function If an error is detected you should close all ECU M amp C handles and exit the application If a warning is detected you can display a message for debugging purposes or simply ignore the warning The following piece of code shows an example of handling ECU M amp C status during application debugging status ncDatabaseOpen TestDataBase A2L amp MyDbHandle PrintStat status mcOpenDatabase where the function Print Stat has been defined at the top of the program as void PrintStat mcTypeStatus status char source char statusString 300 if status 0 mcStatusToString status sizeof statusString statusString printf n s nSource s n statusString source if status lt 0 mcDatabaseClose MyDbHand1le exit 1
419. with Related VIs and C Functions Continued CCP Command LabVIEW VI Name C Function Name SET_S_STATUS MC CCP Set Session mcCCPSetSessionStatus Status vi UPLOAD MC Upload vi mcUpload Generic XCP Functions The generic ECU M amp C XCP functions provide direct access to the XCP commands on a very low programming level For more information about the use and parameters of the XCP commands refer to the ASAM XCP Part 2 Protocol Layer Specification Table 4 2 provides an overview of the XCP commands with their corresponding LabVIEW VIs or C functions Table 4 2 Overview of the XCP Commands with Related VIs and C Functions XCP Command LabVIEW VI Name C Function Name BUILD_CHKSUM MC Build Checksum vi mcBuildChecksum CLEAR_MEMORY MC Clear Memory vi mcClearMemory COPY_CAL_PAGE MC XCP Copy Cal Page vi mcXCPCopyCalPage DOWNLOAD MC Download vi mcDownload GET_CAL_PAGE MC XCP Get Cal Page vi mcCCPGetActiveCal Page GET_ID MC XCP Get ID vi mcXCPGetId GET_STATUS MC XCP Get Status vi mcXCPGetStatus PROGRAM MC Program vi mcProgram PROGRAM_PREPARE MC XCP Program mcXCPProgramPrepare Prepare vi PROGRAM_RESET MC Program Reset vi mcProgramReset PROGRAM_START MC Program Start vi mcProgramStart PROGRAM_VERIFY MC XCP Program Verify vi mcXCPProgramVerify SET_CAL_PAGE MC XCP Set Cal Page vi mcXCPSetCalPage SET_REQUEST MC XCP Set Request vi mcXCPSetRequest ECU M amp C Too
420. with Win32 FILETIME you can pass it into the Win32 FileTimeToLocalFileTime function to convert it to the local time zone and then pass the resulting local time to the Win32 FileTimeToSystemTime function to convert to the Win32 SYSTEMTIME type SYSTEMTIME is a struct with fields for year month day and so on For more information on Win32 time types and functions refer to the Microsoft Win32 documentation DeltaTime Returns the time between each sample in SampleArray This parameter is optional If you pass NULL for the DeltaTime parameter the mcDAQRead function proceeds normally If the initialized sample rate is greater than zero the DeltaTime is determined by the sample timing If the initialized sample rate is zero the DeltaTime is zero because the most recent sample is returned regardless of timing DeltaTime uses the mcTypeTimestamp data type The delta time is a relative 64 bit counter of 100 ns intervals not an absolute UTC time Nevertheless you can use functions like the Win32 FileTimeToSystemTime function to convert to the Win32 SYSTEMTIME type In addition you can use the 32 bit LowPart of DeltaTime to obtain a simple 100 ns count because values for SampleRate as slow as 0 4 Hz are still limited to a 32 bit 100 ns count SampleArray Returns a 2D array one array for each channel initialized in the task The array of each channel must have NumberOfSamplesToRead entries allocated The
421. xecute 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 MC Measurement Write vi performs a single point write of a Measurement into the selected ECU without opening a Measurement task MC Measurement Write vi can only be performed if the Measurement is not set to read only To query if an ECU Measurement channel can be accessed by MC Measurement Write vi first call MC Get Property vi with the parameter Measurement Read Only National Instruments 5 149 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW MC Program vi Purpose Programs a memory block on the ECU Format ECU ref in ECU ref out address data error out error in Input ECU ref in is the task reference which links to the selected ECU This reference is originally returned from MC ECU Open vi or MC ECU Select vi and then wired through subsequent VIs Address is a cluster which contains the following values Address specifies the address part of the destination address Lust E E Extension contains the extension part of the destination address Data contains the byte array to be transmitted to the ECU Error in is a cluster which describes error conditions oc
422. xis values on which the Characteristic is defined Valid if the selected Characteristic is 2 dimensional ECU M amp C Toolkit User Manual 6 80 ni com Chapter 6 ECU M amp C API for C Table 6 4 Values for PropertyID Continued Data Type Name Description f64 mcPropChar_Scale_ Returns the scaling factor defined for this Factor Characteristic in the A2L database f64 mcPropChar_Scale_ Returns the scaling offset defined for this Offset Characteristic in the A2L database u32 mcPropChar_Scale_Type Returns the scaling type defined for this Characteristic in the A2L database 0 Unknown The type of the scaling could not be derived from the A2L file content 1 Rational Function The related scaling is based on a rational function of second order This covers also the linear scaling given by factor and offset National Instruments 6 81 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C Table 6 4 Values for PropertyID Continued Data Type Name Description 2 Enumeration Text The related scaling is based on the COMPU_VTAB keyword within the A2L file e Read functions return nonscaled numeric values e Write functions accept nonscaled numeric values e Itis possible to use mcDoubleToText and mcTextToDouble to convert between enumeration text values and double values 3 Range Text The related scaling is based on the COMPU_VTAB
423. xpected 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 amp C API to obtain a descriptive string for the return value Description mcDAQStartStop is an optional command to start or stop communication for an M amp C Measurement task If you do not perform mcDAQStartStop with the parameter mcStartStopModeStart before using mcDAQRead the Measurement task is started by the first call of mcDAQRead After you start the transmission of the DAQ lists you can no longer change the configuration of the Measurement task with mcSet Property You must call mcDAQStartStop with the parameter mcStartStopModeStop first National Instruments 6 47 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C mcDAQWrite Purpose Writes samples to an ECU DAQ list Format mcTypeStatus mcDAQWrite mcTypeTaskRef DAQRefNum u32 NumberofSamplesToWrite 64 SampleArray Input DAQRef Num DAQRe Nun is the task reference from the previous Measurement task function The task reference is originally returned from mcDAQInitialize and then reused by subsequent Measurement task functions NumberofSamplesTowWrite NumberofSamplesToWrite specifies the number of samples to write for the ECU MC DAQ task to the ECU DAQ list For single sample output pass 1 to this parameter The initialized DAQ sample rate
424. y other purpose Refer to the Privacy Policy section for information on the National Instruments privacy policy regarding your personal information The Activation Wizard offers a variety of options you can use to obtain an activation code from National Instruments including an automatic option through an Internet connection or through email by telephone or by fax Activate ECU M amp C Toolkit ECU M amp C Toolkit User Manual The ECU M amp C Toolkit must be activated before using it in accordance with its license agreement To activate the ECU M amp C Toolkit you must first purchase a license For information on purchasing licenses contact your local National Instruments sales representative or visit ni com Once you have purchased a license you can activate your product using the Activation Wizard Activation is simple and you can activate your software 24 hours a day 7 days a week Complete the following steps to activate the ECU M amp C Toolkit 1 Locate your serial number Your serial number uniquely identifies your purchase of NI software You can find it on the Certificate of Ownership included in your software kit If you subscribe to NI Developer Suite or Academic Software Solutions use the original serial number you received with your initial purchase So TMU XXXXXXXXX Certificate of __ Ownership 2 Install your software 2 2 ni com Chapter 2 Installation and Configuration
425. ypes section To select the property right click the VI go to Select Type and select the property by name Error in is a cluster which describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out status is TRUE if an error occurred This VI will not execute when status is TRUE 5 156 ni com Chapter5 ECU M amp C API for LabVIEW 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 Reference out is a copy of the reference in terminal which can be wired through subsequent ECU M amp C VIs 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
Download Pdf Manuals
Related Search
Related Contents
A-61635, User's Guide for Kodak Capture Pro Software Abril de 2015 Supplier Portal Instructions Manual LG 42LB580 42" Full HD Smart TV Wi-Fi Black LED TV Targus TSM084US Sony VPCF13WFX/BC Marketing Specifications Nuvoton VPN User Manual Akai ACVDS935T User Guide Manual Copyright © All rights reserved.
Failed to retrieve file