Home

ECU Measurement and Calibration Toolkit User Manual

image

Contents

1. Purpose Queries a calibration page setting Format mode ECU ref in segment error in 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 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 Segment specifies the selected logical data segment number puis i status is TRUE if an error occurred This VI will not execute when status is TRUE ECU M amp C Toolkit User Manual 5 118 ni com Chapter5 ECU M amp C API for LabVIEW 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 Output ECU ref out is the same as ECU ref in Wire the task reference to subsequent VIs for this task Page returns the lo
2. cccccsssccccsssssceceeeessseeecceesssseecesessseeeeees 4 6 POPE NUMBER a e e r adea epeta a a auier 4 6 ECU Connect Jea t Hes dashed Reese a a ai 4 6 ECU DISCODNCC ss senere share EREE E E EAA EE ER E RA 4 7 ECU Close a a N os eae A I os A ra 4 7 Characteristic Read and Write cccccccssccccceesssceccecesssececceessseeeceeesssseeeeeeeses 4 7 Access Characteristics cisevyss ces cocesesciviavevestesssesdecsactarevencsecseesottedests 4 7 Characteristic Readera a E ves eden ca eeteasoes tees oes 4 8 Characteristic Writer ia nn e a e Era Ea 4 8 Measurement Task ocres nea a e aiya ER 4 9 DAO Intali e i a a a a 4 10 DAQ Stait Stoperi ini a ERT EA REESE 4 10 DAO Read aus EEE E EE A es 4 11 DAO Writes 43 5 Seeds baceeh esc etree divine n aa aA 4 12 DAO Cleats s coed doves cived svesas cai sevens lacie woes ai iadeessvuh e i 4 13 ECU M amp C Toolkit User Manual vi ni com Contents Memory Programming ssc scstsces cass cctscuvadsceteiebds stbesveusicaties vedsovivsenvisasecestedvaes 4 13 Program Start cenre n sb cade eg capes sides asia ieor aaeei apas isisi 4 14 Clea Memory moenia a na A E E E A EAS 4 15 PLO STAM wsi5 ior a a E E AE 4 15 Program Resets i s5 200 5 menee ei E A EA EA 4 15 Optional Steps for the XCP Protocol 00 eee eee eseeeetseeeeeeees 4 15 Additional Programming Topics 0 cece ee eeeeseeseceseeseeeseesecceeaeeseeeaeceeesecseenaeseeseseeaees 4 16 Get Na MeS spani cass E A saskneaced R cedeeae
3. 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 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 Ee 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 H 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 Corporation 5 11 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW Output ECU
4. 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 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 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 ECU M amp C Toolkit User Manual ni com 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 Co
5. Returns the selected event channel name to which the Measurement task is assigned National Instruments Corporation 5 89 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 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 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 ECU M amp C Toolkit User Manual 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 DAQ Pr
6. 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 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 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 XC
7. 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 ug 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 ug mcPropECU_ID_Length Returns the length of the slave device identifier in bytes u32 mcPropECU_Interface Returns the interface initialized for the task such as with mcDAQInitialize u8 mcPropECU_MasterID Returns 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_Name Returns the name of the selected ECU opened by mcECUSelectEx u32 mcPropECU_Name_Size Returns the number of bytes to be allocated if you call mcGet Property with the parameter mcPropECU_Name str mc PropECU_SeedkKey_Cal Returns the file name of the SeedKey DLL used for Calibration purposes ECU M amp C Toolkit User Manual 6 62 ni com Chapter 6 ECU M amp C API for C Table 6 4 Values for PropertyID Continued Data Type Name Description u32 mcPropECU_SeedKey_Cal__ Returns the number of bytes to be allocated if Size you cal
8. status is TRUE status is TRUE if an error occurred This VI is not executed when 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 National Instruments Corporation 5 101 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 FEFA 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 protoc
9. 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 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 M amp C Toolkit User Manual ni com Chapter 5 Table 5 5 Poly Values for Value Output Continued Sub Hierarchy Type 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 implementat
10. 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 mcDAQClear Stops communication for the Measurement task and clears the task mcDAQInitialize Initializes a Measurement task for the specified Measurement channel list mcDAQRead Reads samples from a Measurement task Samples are obtained from received CAN messages mcDAQStartStop Starts or stops the transmission of the DAQ lists for the specified Measurement task mcDAQWrite Writes samples to an ECU DAQ list 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 mcDownload Downloads data to an ECU National Instruments Corporation 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 mcECUConnect Establishes communication to the selected ECU through CCP After a successful ECU Connect
11. 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 such as the Simple Error Handler source identi fies the VI where the error occurred 5 44 ni com Chapter5 ECU M amp C API for LabVIEW 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 FOr 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 V
12. error out error in interface Input HOG 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 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 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 Na
13. source identifies the VI where the error occurred Description 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 parameter interface and protocol are 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 National Instruments Corporation 5 69 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW 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 e XCP UDP uses XCP on UDP e XCP TCP uses XCP on TCP 3 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 ECU M amp C Toolkit User Manual 5 70 ni com MC ECU Select vi Chapter5 ECU M amp C API for LabVIEW Purpose Selects an ECU based upon the names stored in an A2L database Format protocol and interface ECU ref out DB ref in ECU name
14. u32 mcPropMeas_ByteOrder Returns the specified byte order 0 Intel format Bytes are in little endian order with most significant first 1 Motorola format Bytes are in big endian order with least significant first ug mcPropMeas_Datatype Returns the data type of the Measurement task ECU M amp C Toolkit User Manual 6 64 ni com Chapter 6 ECU M amp C API for C Table 6 4 Values for PropertyID Continued Data Type Name Description u8 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 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 mcProp
15. 1 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 National Instruments Corporation 6 101 ECU M amp C Toolkit User Manual Summary of the CCP Standard Controller Area Network CAN Bosch developed the Controller Area Network CAN in the mid 1980s Using CAN devices controllers 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 contin
16. 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 Corporation 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 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 mcXCPGet ID GET_
17. Glossary Index ECU M amp C Toolkit User Manual X ni com About This Manual Conventions 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 z 3 bold italic monospace monospace italic The following conventions appear in this manual The symbol leads you through nested menu items and dialog box options to a final action The sequence File Page Setup Options directs you to pull down the File menu select the Page Setup item and select Options from the last dialog box This icon denotes a tip which alerts you to advisory information This icon denotes a note which alerts you to important information Bold text denotes items that you must select or click in the software such as menu items and dialog box options Bold text also denotes parameter names Italic text denotes variables emphasis a cross reference or an introduction to a key concept Italic text also denotes text that is a placeholder for a word or value that you must s
18. MC CCP Action Service vi 5 11 MC CCP Diag Service vi 5 13 MC CCP Generic vi 5 74 MC CCP Get Active Cal Page vi 5 15 MC CCP Get Result vi 5 17 MC CCP Get Session Status vi 5 19 MC CCP Get Version vi 5 21 MC CCP Move Memory vi 5 23 MC CCP Select Cal Page vi 5 25 MC CCP Set Session Status vi 5 27 options table 5 28 MC Characteristic Read Single Value vi 5 31 MC Characteristic Read vi 5 29 options table 5 30 MC Characteristic Write Single Value vi 5 35 MC Characteristic Write vi 5 33 options table 5 34 MC Clear Memory vi 5 37 MC DAQ Clear vi 5 39 MC DAQ Initialize vi 5 41 MC DAQ Read vi 5 44 MC DAQ Start Stop vi 5 49 MC DAQ Write vi 5 51 MC Database Close vi 5 54 MC Database Open vi 5 56 MC Download vi 5 58 MC ECU Close vi 5 60 MC ECU Connect vi 5 62 MC ECU Deselect vi 5 64 MC ECU Disconnect vi 5 66 MC ECU Open vi 5 68 MC ECU Select vi 5 71 MC Get Names vi 5 76 MC Get Property vi 5 78 poly output values table 5 80 MC Measurement Read vi 5 95 MC Measurement Write vi 5 97 ni com MC Program Reset vi 5 101 MC Program Start vi 5 103 MC Program vi 5 99 MC Set Property vi 5 105 DAQ specific poly input values table 5 112 ECU specific poly input values table 5 107 MC Upload vi 5 114 MC XCP Copy Cal Page vi 5 116 MC XCP Get Cal Page vi 5 118 MC XCP Get ID vi 5 120 MC XCP Get Status vi 5 122 MC XCP Program Prepare vi 5 127 MC XCP Program Veri
19. 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 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 ECU M amp C Toolkit User Manual 5 60 ni com Chapter5 ECU M amp C API for LabVIEW code is the error code number identifying an error A value of 0 pues 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
20. 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 National Instruments Corporation 5 93 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 Unit Returns the unit string defined for this Measurement in the A2L database 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 Version Major Returns the major version of the ECU M amp C software such as the 1 in version 1 2 5 Version Minor Returns the minor version of the ECU M amp C software such as the 2 in version 1 2 5 Version Update Returns the update version of the ECU M amp C software such as the 5 in version 1 1 5 ECU M amp C Toolkit User Manual 5 94 ni com Chapter5 ECU M amp C API for LabVIEW MC Measurement Read vi Purpose
21. 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 E 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 specify the CAN interface to use for this CCP task The interface input uses a ring typedef in which value 0 selects CANO value 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 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
22. 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 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 National Instruments Corporation 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 2M
23. 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 ID vi 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 Corporation 5 121 ECU M amp C Toolkit User Manual 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 in ECU ref out session status error in resource mask 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 occur
24. 24 44 909 ECU Command GET SEED gt OK UNLOCK gt OK GET SEED CLEAR DAQ LIST gt OK SET DAQ PTR gt OK WRITE DAQ gt OK SET DAQ LIST MODE gt OK START STOP DAQ LIST gt OK START STOP SYNCH gt OK DAQ PID 0x10 DAQ PID 0x10 DAQ PID 0x10 Parameters Mode first Resource STIM Length 0x4 Seed 80 81 82 83 Length 0x2 Key 01 Current Protection Status 0x10 Mode first Resource PGM Length 0x4 Seed 80 81 82 83 Length 0x2 Key 01 Current Protection Status 0x0 DAQ_LIST_NUMBER 0x1 DAQ 0x1 ODT 0x0 ENTRY 0x0 Bitoffset 0xFF Size 0x1 Addr 0xE8 Ext 0x0 DAQ 0x1 Mode 0x10 Event 0x0 Prescaler 0x1 Prio 0x0 Mode SELECT DAQ_LIST_NUMBER 0x1 FIRST_PID 0x10 Mode START SELECTED 93 05 80 94 05 80 95 05 80 ECU M amp C Toolkit User Manual Figure 3 1 XCP Spy ni com Chapter 3 Application Development XCP Spy is an application that monitors records and displays XCP communication commands and parameters called by your ECU M amp C application using the XCP protocol Use XCP Spy to analyze your application s XCP communication and to verify that the communication with your ECU slave is correct XCP Spy may slow down the performance of your application communication to your ECU slave and the entire system You should use XCP Spy only while you are debugging or when performance is not critical For further information on the displayed XC
25. API for LabVIEW Table 5 5 Poly Values for Value Output Continued Sub Hierarchy Type Hierarchy Sub 1 Sub 2 Param Description ECU Command Byte Returns the byte order for Order the defined Measurement or Characteristic 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 Name Returns the Name of the selected ECU opened by MC ECU Open vi or MC ECU Select vi ECU CCP Baud Rate Returns the Baud Rate in use by the 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 National Instruments Corporation 5 81 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 CRO ID Returns the CRO ID Command Receive Object which is used to send commands and data from the host to the slave device
26. 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 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 National Instruments Corporation 5 59 ECU M amp C Toolkit User Manual 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
27. 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 MC2 filename with path and extension 3 URL where the ASAM MC72 file can be found 4 ASAM MC7 file to upload 128 255 User defined ECU M amp C Toolkit User Manual 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 120 ni com Chapter5 ECU M amp C API for LabVIEW 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 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
28. 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 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 66 ni com Chapter5 ECU M amp C API for LabVIEW code is the error code number identifying an error A value of 0 pues means success A negative value means erro
29. ECU slave device Format mcTypeStatus mcXCPGet Status mcTypeTaskRef ECURefNum u8 SessionStatus u8 ResourceMask ul6 SessionId Input ECURefNum ECURe fNun is the task reference which links to the selected ECU This reference is originally returned from mcECUSelectEx Output SessionStatus SessionStatus returns 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 National Instruments Corporation 6 89 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C Current Session Status SessionStatus contains a bit mask which
30. 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 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 National Instruments Corporation 5 39 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 FEFA 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 descr
31. INSTRUMENTS TESTING PLATFORMS AND BECAUSE A USER OR APPLICATION DESIGNER MAY USE NATIONAL INSTRUMENTS PRODUCTS IN COMBINATION WITH OTHER PRODUCTS IN A MANNER NOT EVALUATED OR CONTEMPLATED BY NATIONAL INSTRUMENTS THE USER OR APPLICATION DESIGNER IS ULTIMATELY RESPONSIBLE FOR VERIFYING AND VALIDATING THE SUITABILITY OF NATIONAL INSTRUMENTS PRODUCTS WHENEVER NATIONAL INSTRUMENTS PRODUCTS ARE INCORPORATED IN A SYSTEM OR APPLICATION INCLUDING WITHOUT LIMITATION THE APPROPRIATE DESIGN PROCESS AND SAFETY LEVEL OF SUCH SYSTEM OR APPLICATION Contents About This Manual CGOMVENEIONS e Seek nk acces Ei ees E E oye ne is Sead ne soak eee xi Related Documentation sssssessessseeseeetrttrrrerssssssssseserertrereererreressssssesrterrttteeeeeeenrnenessss xii Chapter 1 Introduction CAN Calibration Protocol CCP Overview sessesesssssessssesseressressssessseessreeseresssesssree 1 2 CCP Protocol Version cccccccccccecesessssesesessssnccecescsescsscccecececeseesesessseeeteneneees 1 2 Universal Measurement and Calibration Protocol XCP Overview cccscceeeseees 1 3 XCP Protocol Verslo EB nn ee a a a ER 1 3 Measurement and Calibration Databases c ccccccsesesesescscccscsceesecececeeesseseeesesessnenees 1 4 ECU Measurements ccccccccsccccccccccccccccccesessesessssssscccseseeeesessscececeseseeeeeeseseesncsesseeeaess 1 4 ECU Character sti Gs einn send eee abee dae tes cutee debe oe gsc bee bende La cence E p
32. 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 Eg Address specifies the address part of the source address from which the memory block is copied om Extension specifies the extension part of the source address Destination is a cluster which contains the following values 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 status is TRUE National Instruments Corporation 5 23 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 ne
33. M amp C Toolkit User Manual 5 74 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 Error code describes the error returned from the ECU during 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 HERE 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 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 Corporation 5 75 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 nam
34. MC EGU Des lect yi rronin A MC ECU Disconnect Vi iien eneen erae MC ECU Open Viin aaisan iii MC ECU Select Visori i E EA E MC Generic Vi rait a R a R a MG Get Names Vienes eip ae nae eels A i EEEa MC Get Property Visas cisesssdeadevsstdsasvesdscedisdasedevserts dei eapess MC Measurement Read vi ou eeeeeeceseeeeeceneeeeeeeeneens MC Measurement WYrite Vi cee eeeeceeeeeeseeeteeceneeeneeees MG Pro gram Vises sissies hese fete tess niia eaaa ence MC Program Reset Vissir eeceeeeseeseeeeeeneeeseesseneeeaeenee MC Program Start Vi ow eee eeeeseesecsseeneeeeeeseeeeeeaeeees MC Set Property Vi ss scisesosdeasss iri MG Upload yieee nni i MC XCP Copy Cal Page vi eee eeeseeseeseeseeereeseeees MC XCP Get Cal Page vi oo eee ec ceeeceeseeeeeeeeeeeseeees MCO XCP Get ID Wises cscsgcscssehsticasssestuecdacehctscaasesueeenetess MC XCP Get Status Vi owe eee eseeseeseeseeeseeseenseeaes MC XCP Program Prepare Vie eee eeeeeeeeseeeeeeeeeeeees MC XCP Program Verify vi eee ceeeeeeeseeseeseeeeeeeees MC XCP Set Cal Page Vi acunsinoneyscasruirnienan MC XCP Set Request View eee eeeseeseeseeeeeeeenseeees MC XCP Set Segment Mode vi eee eeseeeereeee ni com Contents MCCEPGECV Eer OM loss cs agencies iiai E stead ocenscvode levee audesvbaetna a as 6 19 MCCCPMOVEMEM OLY 535 25 ses sacascssssretseecadeveaelestbesiestaves dates Goueistestapatieaseacs 6 20 mCCEPSel ctCal Page racic oi cha e EE teed ana hoeivedis EAE E 6 22 MCC
35. 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 always 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 Too
36. Queries the current session status from an ECU slave device mcXCPProgramPrepare Prepares the programming of non volatile memory 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 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 Corporation 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 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 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
37. Reads a single Measurement value from the ECU Format measurement name ECU ref in ECU ref out value error out error in 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 Output ECU ref out is the same as ECU ref in Wire the task reference to subsequent VIs for this task Value returns a single sample for the Measurement channel initialized in measurement name National Instruments Corporation 5 95 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW Error out des
38. 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 Al E E TF Characteristic Read Only Returns if a Characteristic is set 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 88 ni com Chapter 5 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 Characteristic Unit X Axis Returns the unit string defined for this Characteristic in the A2L database Returns X Axis values on which the Characteristic is defined It is valid if the dimension of the selected Characteristic is 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 DAQ Event Channel Name
39. 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 ECU M amp C Toolkit User Manual 5 100 ni com Chapter 5 MC Program Reset vi ECU M amp C API for LabVIEW Purpose Indicates the end of a programming sequence Format ECU ref in ECU ref out error in 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
40. Value vi 5 35 MC Characteristic Write vi 5 33 options table 5 34 MC Clear Memory vi 5 37 MC DAQ Cleat vi 5 39 MC DAQ Initialize vi 5 41 MC DAQ Read vi 5 44 MC DAQ Start Stop vi 5 49 MC DAQ Write vi 5 51 MC Database Close vi 5 54 MC Database Open vi 5 56 MC Download vi 5 58 ECU M amp C Toolkit User Manual Index MC ECU Close vi 5 60 MC ECU Connect vi 5 62 MC ECU Deselect vi 5 64 MC ECU Disconnect vi 5 66 MC ECU Open vi 5 68 MC ECU Select vi 5 71 MC Get Names vi 5 76 MC Get Property vi 5 78 poly output values table 5 80 MC Measurement Read vi 5 95 MC Measurement Write vi 5 97 MC Program Reset vi 5 101 MC Program Start vi 5 103 MC Program vi 5 99 MC Set Property vi 5 105 DAQ specific poly input values table 5 112 ECU specific poly input values table 5 107 MC Upload vi 5 114 MC XCP Copy Cal Page vi 5 116 MC XCP Get Cal Page vi 5 118 MC XCP Get ID vi 5 120 MC XCP Get Status vi 5 122 MC XCP Program Prepare vi 5 127 MC XCP Program Verify vi 5 129 MC XCP Set Cal Page vi 5 132 MC XCP Set Request vi 5 134 MC XCP Set Segment Mode vi 5 137 LabVIEW Real Time RT configuration 2 5 DOS prompt 2 5 FTP transfers table 2 5 LabVIEW 2 9 LabVIEW RT graphical file transfer utility 2 7 web browsers 2 6 license management overview 2 1 list of C functions 6 2 list of LabVIEW VIs 5 1 ECU M amp C Toolkit User Manual l 4 MC Build Checksum vi 5 5 MC Calc Checksum vi 5 8
41. 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 Corporation 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 access the ECU over CAN 3 Note Use of the 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 n
42. 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 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_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 Corporation 6 75 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 whic
43. bytes returned from National Instruments Corporation the ECU passed to ReturnValue 6 51 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 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 ECU M amp C Toolkit User Manua
44. 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 You can run a native FTP client from the DOS command prompt on a Windows PC To open the FTP client click Start gt Run to open the user command dialog box Type command 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 3 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 National Instruments Corporation 2 5 ECU M amp C Toolkit User Manual Chapter 2 Installation and Configuration Table 2 1 Example of FTP Transfer Continued Command Result 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 dir V
45. default all XCP commands are enabled To select deselect the XCP commands to spy on select Spy Options then select the commands under Capture XCP Commands Captures all XCP commands DAQ Messages Captures all DAQ list commands ECU measurement commands STIM Messages Captures all STIM list ECU slave stimulation commands ECU M amp C Toolkit User Manual 3 6 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 Corporation 4 1 ECU M amp C Toolkit User Manual Chapter 4 Using the ECU M amp C API ECU M am
46. determine whether anew 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 ECU M amp C Toolkit User Manual 5 48 ni com Chapter5 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 DAQ ref in DAQ ref out mode error in error out Input 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 start
47. 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 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 mcSet Property 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 National Instruments Corporation 6 71 ECU M amp C Toolkit User Manual 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 ECURefNum 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 expec
48. 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 Destination 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 HEE BHE status is TRUE if an error occurred This VI will not execute when status is TRUE ECU M amp C Toolkit User Manual 5 116 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 LabVI
49. 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 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 a
50. 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 Corporation 5 99 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 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 If you are using the CCP protocol MC Program vi implements the CCP command PROGRAM
51. 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 mc mc ECUI ECUI Disconnect implements the CCP or XCP command DISCONNECT Disconnect 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 mc ECUDisconnect is an optional command as disconnecting from the ECU is performed by the function mcECUDeselect ECU M amp C Toolkit User Manual 6 48 ni com mcECUSelectEx Chapter 6 ECU M amp C API for C 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 DBRefN
52. 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 Corporation 6 83 ECU M amp C Toolkit User Manual 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 ECU M amp C Toolkit User Manual 6 84 ni com 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 ECURe Num 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 dat
53. 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 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 i E 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 H 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 Corporation 5 13 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 t
54. 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 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 Corporation 5 133 ECU M amp C Toolkit User Manual 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 n
55. part of the address of the selected Measurement in the memory of the control unit Measurement Byte Order Returns the specified byte order 0 Intel format Bytes are in little endian order with most significant bit first 1 Motorola format Bytes are in big endian order with least significant bit first Measurement _ Comment Returns the Comment aa Measurement Data Type Returns the data type of the Measurement task ECU M amp C Toolkit User Manual 5 92 ni com Chapter 5 Table 5 5 Poly Values for Value Output Continued Sub Hierarchy Type 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 not 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 A E E TF Read Only Returns TRUE if the selected Measurement is read only
56. 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 Corporation 6 43 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C mecDownload Purpose Downloads data to an ECU Format mcTypeStatus mcDown1load 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 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 ECU M a
57. 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 _1 dimensional a curve of values e 2 dimensional a field of values A Characteristic may be defined as read only 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 Corporation 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 Eo Yes No y Measurement Ch
58. 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 National Instruments Corporation 5 103 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 FEFA 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 The end of a non volatile memory programming sequence is i
59. 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 114 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 is a byte array which receives the uploaded data 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 HE 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 sou
60. sample rate is zero this poly VI immediately returns 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 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 sampl
61. 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 Cale 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 Corporation 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 MC Characteristic Read vi Reads data from a named Characteristic on the ECU which is identified by t
62. select the desired APIs under Installed API Choices National Instruments Corporation 3 3 ECU M amp C Toolkit User Manual Chapter 3 Application Development NI Spy The NI Spy tool monitors function calls to the ECU M amp C API to aid in the debugging of an application To launch this tool open the Software branch of the MAX configuration tree right click NI Spy and select Launch NI Spy 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 Spy Options select the View Selections tab and select the desired APIs under Installed API Choices XCP Spy The XCP Spy tool monitors XCP protocol communication to aid in the debugging of an application Launch this tool from your Start menu in Start Programs National Instruments ECU Measurement and Calibration Toolkit gt XCP Spy I EY Spy ly AED SPY File view Spy Help DHO Time Sender 11 24 44 862 Master 11 24 44 862 ECU 11 24 44 862 Master 11 24 44 862 ECU 11 24 44 862 Master 11 24 44 862 ECU 11 24 44 862 Master 11 24 44 878 ECU 11 24 44 878 Master 11 24 44 070 ECU 11 24 44 878 Master 11 24 44 878 ECU 11 24 44 878 Master 11 24 44 878 ECU 11 24 44 878 Master 11 24 44 878 ECU 11 24 44 878 Master 11 24 44 878 ECU 11 24 44 678 Master 11 24 44 878 ECU 11 24 44 894 ECU 11 24 44 894 ECU 11
63. 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 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 ECU M amp C Toolkit User Manual 5 72 ni com Chapter5 ECU M amp C API for LabVIEW Possible selections for the parameter interface and protocol are CCP CAN0 uses CCP on CAN interface 0 CCP CAN1 uses CCP on CAN interface 1 and so on with the form CANx CCP CAN256 uses CCP on virtual CAN interface 256 CCP CAN257 uses CCP on virtual CAN interface 257 XCP CANO 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 National Instruments Corporation 5 73 ECU M amp C Toolkit User Manual Chapter5 ECU
64. 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 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 ae 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 Corporation 5 33 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 s
65. 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 other 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 National Instruments Corporation 5 55 ECU M amp C Toolkit User Manual 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 ECU M amp C Toolkit User Manual 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 execu
66. 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 Hardware and Software Requirements The ECU M amp C Toolkit requires National Instruments NI CAN hardware Series 1 or 2 and the NI CAN driver software version 2 3 or later installed National Instruments Corporation 2 9 ECU M amp C Toolkit User Manual Application Development This chapter explains how to develop an application using the ECU M amp C API Choose the Programming Language LabVIEW LabWindows CVI 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 controls are available in the LabVIEW palettes In LabVIEW the ECU M amp C Toolkit palette is located within the top level NI Measurements palette 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
67. 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 ECU M amp C Toolkit User Manual 5 20 ni com 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 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 w
68. 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 Hoo EE 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 7 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 National Instruments Corporation 5 35 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW source identifies the VI where the error occurred Latch Characteristic value is the value to be set for the Charac
69. 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 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
70. 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 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 ECU M amp C Toolkit User Manual 6 96 ni com Chapter 6 ECU M amp C API for C mcXCPSetCalPage Purpose Sets a calibration page Format mcTypeStatus mcXCPSetCalPage mcTypeTaskRef ECURefNum u8 Mode u8 Segment u8 Page Input ECURefNum ECURe Num 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 numb
71. 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 niemc 1ib The toolkit software includes a full set of examples for LabWindows CVI The examples are installed in the LabWindows CVI directory under samples ecumc Each example provides a complete LabWindows CVI project prj file National Instruments Corporation 3 1 ECU M amp C Toolkit User Manual Chapter 3 Application Development Visual C 6 ECU M amp C Toolkit User Manual 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 and library for Visual C C 6 are in the MS Visual C folder of the ECU M amp C Toolkit folder The typical path to this folder is ProgramFiles National Instruments ECU Measurement and Calibration Toolkit MS Visual C To use the ECU M amp C API include the
72. 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 ECU M amp C Toolkit User Manual 6 50 ni com 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 ECURe Num 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 ErrorCode 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 contains the number of
73. 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 ECU M amp C Toolkit User Manual 5 128 ni com MC XCP Program Verify vi Chapter5 ECU M amp C API for LabVIEW 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 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 Ox0080 Reserved 0x0100 OXFFOO User defined National Instruments Corporation 5 129 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW Verification value contains the selected ver
74. 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 42 ni com Chapter 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
75. your serial number and computer ID You generate and install an activation code by completing the activation process National Instruments Corporation 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 computer 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 yo
76. 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 National Instruments Corporation 5 9 ECU M amp C Toolkit User Manual Chapter5 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 ECU M amp C Toolkit User Manual 5 10 ni com 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
77. 6 5 contains a listing of ECU specific values for PropertyID DAQ Specific Properties You cannot set a DAQ property while 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 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 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 74 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
78. AL_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 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 ECU M amp C Toolkit User Manual 5 124 ni com 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_
79. C 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 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 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 ECU M amp C Toolkit User Manual 5 54 ni com Chapter5 ECU M amp C API for LabVIEW code is the error code number identifying an error A value of 0 pues 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
80. 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 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 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 112 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
81. C 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 based 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 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
82. CAN ECU Measurement and Calibration Toolkit User Manual May 2006 7 NATIONAL 371601C 01 INSTRUMENTS Worldwide Technical Support and Product Information ni com National Instruments Corporate Headquarters 11500 North Mopac Expressway Austin Texas 78759 3504 USA Tel 512 683 0100 Worldwide Offices Australia 1800 300 800 Austria 43 0 662 45 79 90 0 Belgium 32 0 2 757 00 20 Brazil 55 11 3262 3599 Canada 800 433 3488 China 86 21 6555 7838 Czech Republic 420 224 235 774 Denmark 45 45 76 26 00 Finland 385 0 9 725 725 11 France 33 0 1 48 14 24 24 Germany 49 0 89 741 31 30 India 91 80 41190000 Israel 972 0 3 6393737 Italy 39 02 413091 Japan 81 3 5472 2970 Korea 82 02 3451 3400 Lebanon 961 0 1 33 28 28 Malaysia 1800 887710 Mexico 01 800 010 0793 Netherlands 31 0 348 433 466 New Zealand 0800 553 322 Norway 47 0 66 90 76 60 Poland 48 22 3390150 Portugal 351 210 311 210 Russia 7 095 783 68 51 Singapore 1800 226 5886 Slovenia 386 3 425 4200 South Africa 27 0 11 805 8197 Spain 34 91 640 0085 Sweden 46 0 8 587 895 00 Switzerland 41 56 200 51 51 Taiwan 886 02 2377 2222 Thailand 662 278 6777 United Kingdom 44 0 1635 523545 For further support information refer to the Technical Support and Professional Services appendix To comment on National Instruments documentation refer to the National Instruments Web site at ni com info and enter the info code feedback 2005 2006 National Instruments Corporation All righ
83. CPSEtSESSIONS tatss sisi sciscevts sevaes seasteet ides dacevsaasa A R E E 6 23 MC Character sticReads ic csiseeescdevied exces ladcesdectoa cus E a RA ane 6 25 mecCharacteristicReadSingle Value eee eceeceesecesceeeseeeseceeeeseseeeeseeeeeeaees 6 26 MHC Character Sti WTE nen na ive seed det bes ieeieas EE E E EAS 6 28 mecCharacteristicWriteSingle Value 0 eee eteeeeseeeeceseeeeeeseceeeeseeeseeseseeeeaees 6 29 MCC learMlem Ory sisses iniaiaiai a n aa 6 31 A DYO e EE E Aen envied as usd Aids T 6 32 MCDA Olnitiala Ze eaea een EA E E EE EEE SE 6 33 MCDA QREAd aireta E E E r a S 6 35 mMeDAQSt rtStopi aei iekea aai a e a e a eta 6 38 IMICDAO W A E EE E E E A isn ae eee 6 40 MCDatabase Close ananena ie oes E EEA EEES 6 42 MeDatabascOpen sissors aE i EE E ARS 6 43 meDowno d sene a e E tae E E a E A 6 44 MCECUCONDEC si an aaae aa A a S A ian 6 46 MCECUDESelect osna Taie Sesh S S E ER ARE al EE 6 47 MCECUDISConNect niiin aa a E E EE E aR aa 6 48 MEECUSEleCtEX vanh dent nee SR E a ean eb AE AEE AE 6 49 TCGEM ETC a ea a AR E E Aa EAE E AE ERAR EE 6 51 EANET a E E E E E easedavssevaaenbasees 6 53 mecGetNamesength socsrieaaiiessi erines i p E E Eaa 6 55 MeGetProperty oc lt zeviss cess stecivade codeg ends ee naa EER E EE EE E ERAN 6 57 MmeMeas r ment Rea rea a paea aaar e EA EE EE A EEEE TTR 6 67 MCMeasurement Write 0 eeeeccescceseeeseeeseeceseceaeeeseeceseeeseeeseeeeeseaeessaeeeaeenses 6 68 MOACPLOS TAM pranan aa seas a A a E a i 6 69 cPr
84. CU 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 mm 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 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 Corporation 5 37 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 status is TRU
85. E 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 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 ECU M amp C Toolkit User Manual 5 38 ni com MC DAQ Clear vi Chapter5 ECU M amp C API for LabVIEW Purpose Stops communication for the Measurement task and then clears the configuration Format ECU ref out error in error out Input 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
86. ECU M amp C Toolkit User Manual 6 46 ni com 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 ECURef Num ECURe fNum 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 mcECUDeselect deselects the an 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 ECURefNum is transferred into a database handle DBRefNum National Instruments Corporation 6 47 ECU M amp C Toolkit User Manual 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 ECURefNum ECURefNunm
87. EW 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 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 National Instruments Corporation 5 117 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW MC XCP Get Cal Page vi
88. 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 National Instruments Corporation 5 79 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 Output 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 Checksum DLL Name Returns the file name of the Checksum DLL used for verifying the checksum ECU M amp C Toolkit User Manual ni com Chapter5 ECU M amp C
89. G ae ECU DAQ Read ECU DAQ Clear ECU Close Figure 4 3 ECU Measurement Setup Flowchart National Instruments Corporation 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 Measurement 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 Sto
90. I status is TRUE if an error occurred ETF 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 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 Corporat
91. Is 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 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 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 do
92. L 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 data type listed in the description of the property Value Provides the property value Property1d 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 National Instruments Corporation 6 73 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C Description 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 mcSetProperty and then mcECUConnect to restart the task Table
93. L tesgvece E EE ENE 5 33 MC Characteristic Write Single Value Viu eee eeeceseeseeeeeeseeseeseenseeaes 5 35 MC Clear Memory ivi nis adineciesteene dtthondi telat vevinen eaaeeetaren 5 37 ME DAO Clear ii sign ast AA aes 5 39 ME DAQ Initialize Vie or edvesrnveassce ted eatery ate we eden ener eens 5 41 MG DAQ Readivis 8 ites eis A aati dati eee 5 44 ME DAQ Start StoP VE eresie s estes teed ioe eae S EE ERER 5 49 MCE DAQ Write Wienxash a eae tain Rien ees 5 51 MG Database Closesvi eren nsere ir ueira AE E E EE E EE 5 54 MEG Database Open Vinsnes noem oea a E E ER 5 56 National Instruments Corporation vij ECU M amp C Toolkit User Manual Contents Chapter 6 ECU M amp C API for C Section Headings s ses5 ovis cceses dea leevs ike i eirias Purpose ie soeilen thi Aiea N EEA ATE Format ereke a cance cies n e a ea Input and Output ieia o D SCHIPE OM ss fesse cesiect eats r cee cveis E aE KNEEL List of Data Types ssc areae r Ea a a E aaa Eist Of Functions s ann nna E K EE McBuildChecksum rises eria seia mecCalculateChecksum ccccccccccssssecceesessseeeeeeessseeees MCCCPACTHIONSELVICE ninae ra i a MECCPDIa oService sr EEE ER mcCCPGetActiveCalPage ssseseeesseeeseerereerrresreseseeses meCCPGetRes lt an ete e ea es McCCPGetSessionStatus ccccccccccssssccceeesssseceesessseeees ECU M amp C Toolkit User Manual viji MC Download Visies neiaa aE a MC ECU Close Viisarissa noer MG ECU Connect Vinenennanin nenien
94. 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 milliseconds 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 HERE EE 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
95. 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 str mcPropECU_Checksum Returns the file name of the Checksum DLL used for verifying the checksum u32 mcPropECU_Checksum_ Returns the number of bytes to be allocated if Size you call mcGet Property with the parameter mcPropECU_Checksum u32 mcPropECU_CmdByteOrder Returns 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 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 National Instruments Corporation 6 61 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_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 nctType mcPropECU_DTO_Task NI CAN Task reference to the CAN Task Taskref assigned to the DTO ID u8 mcPropECU_ID Returns the slave device identifier This ID
96. Meas_Unit_Size Returns the number of bytes to be allocated if you call mcGet Property with the parameter mcPropMeas_Unit u8 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 National Instruments Corporation 6 65 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 mcPropPGM_Compression Returns the selected compression method used Method for mcProgram 0 Data is uncompressed default 0x80 0xFF User defined ug mcPropPGM_Encryption Returns the selected encryption method used for Method mcProgram 0 Data is not encrypted default 0x80 0xFF User defined ug mcPropPGM_Programming Returns the selected programming method used Method for mcProgram 0 Sequential programming default 0x80 0xFF User defined ECU M amp C Toolkit User Manual 6 66 ni com 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 Measurem
97. Measurement task or Characteristic The poly VI selection determines the property to set MC Upload vi Uploads data from an ECU National Instruments Corporation 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 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 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 Mode vi ECU M amp C Toolkit User Manual 5 4 ni com 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 EC
98. NG FOR A LEVEL OF RELIABILITY SUITABLE FOR USE IN OR IN CONNECTION WITH SURGICAL IMPLANTS OR AS CRITICAL COMPONENTS IN ANY LIFE SUPPORT SYSTEMS WHOSE FAILURE TO PERFORM CAN REASONABLY BE EXPECTED TO CAUSE SIGNIFICANT INJURY TO A HUMAN 2 IN ANY APPLICATION INCLUDING THE ABOVE RELIABILITY OF OPERATION OF THE SOFTWARE PRODUCTS CAN BE IMPAIRED BY ADVERSE FACTORS INCLUDING BUT NOT LIMITED TO FLUCTUATIONS IN ELECTRICAL POWER SUPPLY COMPUTER HARDWARE MALFUNCTIONS COMPUTER OPERATING SYSTEM SOFTWARE FITNESS FITNESS OF COMPILERS AND DEVELOPMENT SOFTWARE USED TO DEVELOP AN APPLICATION INSTALLATION ERRORS SOFTWARE AND HARDWARE COMPATIBILITY PROBLEMS MALFUNCTIONS OR FAILURES OF ELECTRONIC MONITORING OR CONTROL DEVICES TRANSIENT FAILURES OF ELECTRONIC SYSTEMS HARDWARE AND OR SOFTWARE UNANTICIPATED USES OR MISUSES OR ERRORS ON THE PART OF THE USER OR APPLICATIONS DESIGNER ADVERSE FACTORS SUCH AS THESE ARE HEREAFTER COLLECTIVELY TERMED SYSTEM FAILURES ANY APPLICATION WHERE A SYSTEM FAILURE WOULD CREATE A RISK OF HARM TO PROPERTY OR PERSONS INCLUDING THE RISK OF BODILY INJURY AND DEATH SHOULD NOT BE RELIANT SOLELY UPON ONE FORM OF ELECTRONIC SYSTEM DUE TO THE RISK OF SYSTEM FAILURE TO AVOID DAMAGE INJURY OR DEATH THE USER OR APPLICATION DESIGNER MUST TAKE REASONABLY PRUDENT STEPS TO PROTECT AGAINST SYSTEM FAILURES INCLUDING BUT NOT LIMITED TO BACK UP OR SHUT DOWN MECHANISMS BECAUSE EACH END USER SYSTEM IS CUSTOMIZED AND DIFFERS FROM NATIONAL
99. P 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 process 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 National Instruments Corporation 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 p
100. P commands and parameters refer to the ASAM XCP Part 2 Protocol Layer Specification Saving Captured Communication Data To save the information displayed in the XCP Spy capture window select File Save As In the dialog box that appears select a name for the capture file A x1g extension is usually used for saving XCP Spy capture information The XCP Spy log is stored in ASCII format so you can view the x1lg file in any ASCII editor Capture Options To view or modify the XCP Spy capture options select Spy Options By default XCP Spy displays 1000 calls in the capture window Call History Depth The Call history depth reflects the maximum number of API calls that XCP Spy can display When the number of captured API calls exceeds the Call history depth only the most recent calls are kept If your computer runs out of memory XCP Spy stops capture and displays a message box indicating it is out of memory Capturing Data By default capture is activated when you open 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 on the blue arrow button on the toolbar To turn capture off click on the red button on the toolbar National Instruments Corporation 3 5 ECU M amp C Toolkit User Manual Chapter 3 Application Development Selecting Which XCP Commands to View You can specify which XCP command you want to spy on at any time By
101. 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 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 National Instruments Corporation 5 125 ECU M amp C Toolkit User Manual 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 conta
102. 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 Toolkit 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 National Instruments Corporation 4 19 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 format of each VI Input and Output The input and output parameters for each VI are listed Description The description
103. 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 deselects 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 National Instruments Corporation 5 61 ECU M amp C Toolkit User Manual 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 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 will not execute when status is TRUE code is the error code number identifying an error A value of 0 me
104. Size 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 Corporation 6 17 ECU M amp C Toolkit User Manual Chapter 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 Qualifier0O u8 Qualifierl Input ECURefNum ECURe fNum is the task reference which links to the selected ECU This refer
105. Specification National Instruments Corporation 5 7 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW MC Cale Checksum vi Purpose Calculates the checksum of a data block in memory 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 ECU M amp C Toolkit User Manual 5 8 ni com Chapter5 ECU M amp C API for LabVIEW ECU ref out is the
106. U 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 address Block size determines the size of the block for which the checksum must be calculated EH 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 Corporation 5 5 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 Type of checksum returns the type of the calculated checksum If you are using the CCP protocol type of checksum is OxFF For XCP refe
107. U 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 78 ni com Chapter5 ECU M amp C API for LabVIEW source identifies the VI where the error occurred Output 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 Por Error out describes error conditions If the Error in cluster indicated an error the
108. U Specific Property Value Types for the POLY Input Value Type Sub Hierarchy Hierarchy Sub 1 Sub 2 Param Description ECU Byte Order Sets the byte order of the CCP slave device 0O 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 Checksum DLL Name Sets the file name of the Checksum DLL used for verifying the checksum National Instruments Corporation 5 107 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 SOOOXXYY hex where YY is the value of Bit Timing Reg
109. USelectEx in C Once the ECU has been connected an ECU Reference handle ECU ref out in LabVIEW ECURef Num in C must be acquired before any additional actions can be performed National Instruments Corporation 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 application 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
110. 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 DAQRefNum StartStopMode ECU M amp C Toolkit User Manual mcDAQStartStop mcTypeTaskRef DAQRefNum u32 StartStopMode DAQRefNun 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 0 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 38 ni com Chapter 6 ECU M amp C API for C Output Return Value The return va
111. 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 Characteristic 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 mcGetProperty 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 PPA
112. a 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 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 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 National Instruments Corporation 6 85 ECU M amp C Toolkit User Manual 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 ECU M amp C Toolkit User Manual 6 86 ni com mcXCPGetID Chapter 6 ECU M amp C API for C Purpose Queries session configuration or slave device identification Format mcTypeStatus Input ECURefNum Type mcXCPGetID mcTypeTaskRef ECURefNum u8 Type u32 Length char Id ECURe Num is the task reference which links to the selected ECU This reference is originally returned from mcECUSelectEx Type specifies the type of the request
113. 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 ECU Disconnect The ECU Disconnect function permanently disconnects the specified slave 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 ECU Close 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 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 mcEC
114. alculation is returned in Checksum regardless of the checksum type 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 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
115. ame information Otherwise Error out describes the error status of this VI Description Poly VI Types 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 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 ECU M amp C Toolkit User Manual 5 34 ni com 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 reference which links to
116. ames 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 This chapter explains how to install and configure the ECU M amp C Toolkit Installation This section discusses the installation of the ECU M amp C Toolkit for Microsoft Windows 3 Note You need administrator rights to install the ECU M amp C Toolkit on your computer Fe Oe ie 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 Start the installation The installation program will guide you through the rest of the installation pro
117. 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 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 Generic vi Sends a generic CCP or XCP command MC Get Names vi Gets an array of ECU names Measurement names Characteristic names or Event 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 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
118. ans 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 62 ni com Chapter5 ECU M amp C API for LabVIEW code is the error code number identifying an error A value of 0 FETA 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 Unle
119. aracteristic 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 Chapter 4 Using the ECU M amp C API ECU Open The ECU Open function combines the opening of a selected 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 ay 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 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
120. art Stop 4 10 DAQ Write 4 12 definition 4 2 DTO ID 4 10 ECU DAQ Initialize 4 10 ECU reference handle 4 10 ni com flowchart figure 4 9 list 4 10 mode 4 10 overview 4 9 sample rate 4 10 ECU Open 4 5 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 9 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 5 FTP with LabVIEW 2 9 FTP with LabVIEW RT graphical file transfer utility 2 7 FTP with web browsers 2 6 G generic CCP functions 4 17 Get Names 4 16 H help technical support B 1 home software use 2 4 National Instruments Corporation l 3 Index instrument drivers NI resources B 1 K KnowledgeBase B 1 L LabVIEW list of VIs 5 1 MC Build Checksum vi 5 5 MC Calc Checksum vi 5 8 MC CCP Action Service vi 5 11 MC CCP Diag Service vi 5 13 MC CCP Generic vi 5 74 MC CCP Get Active Cal Page vi 5 15 MC CCP Get Result vi 5 17 MC CCP Get Session Status vi 5 19 MC CCP Get Version vi 5 21 MC CCP Move Memory vi 5 23 MC CCP Select Cal Page vi 5 25 MC CCP Set Session Status vi 5 27 options table 5 28 MC Characteristic Read Single Value vi 5 31 MC Characteristic Read vi 5 29 options table 5 30 MC Characteristic Write Single
121. ask 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 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 HERE 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 ECU M amp C Toolkit User Manual 5 14 ni com Chapter5 ECU M amp C API for LabVIEW MC CCP Get Active Cal Page vi Purpose Retrieves the ECU Memory Transfer Address
122. ask 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 provided by MC DAQ Write vi refer to the Poly VI Types section H E ovr 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 A 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 National Instruments Corporation 5 51 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW source identifies the VI where the error occurred Output DAQ ref out is the same as DAQ ref in Wire the task reference to subsequent V
123. ation and Measuring Systems Part l Overview Part 2 Protocol Layer Specification Part3 XCP on CAN Transport Layer Specification Part3 XOP on Ethernet Transport Layer Specification Part4 Interface Specification NI CAN Hardware and Software Manual xii ni com 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 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 laye
124. ational Instruments Corporation G 3 Command Return Message 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 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 Electronic Control Unit An electronic device with a central processing unit performing programmed functions with its peripheral circuitry ECU M amp C Toolkit User Manual Glossary ECU M amp C Channel functions ECU reference ECU task Event Channel Extended arbitration ID Master ID Measurement Measurement task Memory Transfer Address MTA ODT ECU M amp C Toolkit User Manual The part of the ECU M amp C Toolkit API that you use to read and write
125. atus 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 National Instruments Corporation 5 27 ECU M amp C Toolkit User Manual 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 desc
126. ave 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 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 th
127. berofSamplesToWrite 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 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 NumberOfSamplesTowrite 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 40 ni com Chapter 6 ECU M amp C API for C Description For XCP STIM lists refer to mcDAQInitia
128. building software applications An 11 or 29 bit ID transmitted 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 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
129. cTypeTaskRef ECURefNum mcAddress Source mcAddress Destination u32 BlockSize ECURe Num is the task reference which links to the selected ECU This reference is originally returned from mcECUSelectEx 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 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 determines the size of memory block in bytes which should be moved from the source address to the destination address 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 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 th
130. cess When installation is complete the National Instruments License Manager will launch automatically to activate your license License Management Overview 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 National Instruments Corporation The product you are activating ECU Measurement and Calibration Toolkit 2 0 The serial number of the product The version of the product 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 any 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 Acti
131. channels A Characteristic or Measurement channel consists of one more 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 Object Descriptor Table A list of elements variables used for organization of data acquisitio
132. com 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 Num is the task reference 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 Ox0080 Reserved 0x0100 OxFFOO User defined VerValue VerValue contains the selected verification value if Mode 1 Output None National Instruments Corporation 6 95 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 conditi
133. com training for self paced training eLearning virtual classrooms interactive CDs and Certification program information You also can register for instructor led hands on courses at locations around the world System Integration If you have time constraints limited in house technical resources or other project challenges National Instruments Alliance Partner members can help To learn more call your local NI office or visit ni com alliance If you searched ni com and could not find the answers you need contact your local office or NI corporate headquarters Phone numbers for our worldwide offices are listed at the front of this manual You also can visit the Worldwide Offices section of ni com niglobal to access the branch office Web sites which provide up to date contact information support phone numbers email addresses and current events National Instruments Corporation B 1 ECU M amp C Toolkit User Manual 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 Corporation G 1 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
134. cribes error conditions If the Error in cluster indicated an SH 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 ECU M amp C Toolkit User Manual 5 96 ni com 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 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 initializ
135. cription 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 abc mcPropDAQ_EventChannel Sets the selected event channel name to which Name the Measurement task is assigned 132 mcPropDAQ_ Mode Sets the mode of an M amp C Measurement task 0O 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 78 ni com Chapter 6 ECU M amp C API for C mcStatusToString 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 cod
136. cteristic 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 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 Corporation 5 29 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW Output FOLYT 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 Characteristic Read vi refer to the Poly VI Types section To select the data type rig
137. d Universal Time UTC 6 35 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 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 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 ad
138. d seat othe eeaneds 4 16 Set Get Properties vis eccirni Ades Becta dn aevsevecs Mev alan ieviea E e a ias 4 16 Generic CCP FUNCH NS ii sescesegsecteciessssescdhes fubsavegistaves sides cobigsedesseedesteasedststas 4 17 Generic XCP Functions oreista e Es Aa EE aaa 4 18 Chapter 5 ECU M amp C API for LabVIEW Section HeadihgSuscniyni inonsan a E e i E A TR E 5 1 PUPO SE e a E EAN RE E E EA EA C R 5 1 ODM At v3 Sead A RE EE A E E A e 5 1 Inp tand Output ees en e r e E REEE A EE E R 5 1 DP scfiPt oN ke aaa a E E ata val ee aed tees 5 1 ISt OES VIS eeey a pense ie chads A eos en aca cathe AE T OO 5 1 MC Build Checksum Vie anne e e E a a e 5 5 MC Cale Checks mi Vire eere E aia Eee A E AAE E e a 5 8 MC CCP Action Service Vieno o o A a R EE RA E aia 5 11 MC CCP Diag Service Vicon E ER E EAST E EEEE 5 13 MC CCP Get Active Cal Pag Vicio nreno an a ea i 5 15 MG CCP Get Results Vin e erea ET E EE E E E 5 17 MC CCP Get Session Status Visico ne onre a 5 19 MECCP Get Version Vie enrii a ovens uel oakecs tates eee teddeshevbiawieskedeevtavvecseee 5 21 MC CCP Move Memory iii anea r A A CAAA 5 23 MG CCP Select Cal Page Viou t ua e a a aeai 5 25 MC CCP Set Session Status Viiss ciccceecesseviessvetostes ne a a 5 27 MG Characteristic Redd Vi svesccevs toescacsseteciens cavececastets teenies EE caueeivone 5 29 MC Characteristic Read Single Value vVi eee ec ceeeeeseceeeseeeeeeneeeseeneeaes 5 31 MC Characteristic WIEN Ieee iiei aen e ou
139. deSize 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 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 National Instruments Corporation 6 93 ECU M amp C Toolkit User Manual 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 ECU M amp C Toolkit User Manual 6 94 ni
140. dition 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 order of channel entries in SampleArray is the same as the order in the original ChannelList If you need to determine the number of channels in the task after initialization get the mcPropDAQ_NumChannel1s 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 ECU M amp C Toolkit User Manual 6 36 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 th
141. dress 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 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 ECU M amp C Toolkit User Manual 5 16 ni com 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 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 Block size is the size of the data block in bytes to be uploaded Error in is a cluster wh
142. e 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 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 National Instruments Corporation 6 91 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C
143. e 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 Corporation 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 mcAddress 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
144. e 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 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 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 mcDAQStart Stop If no 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 PropChanDefaul1tValue is returned in all entries of SampleArray National Instruments Corporation 6 37 ECU M amp C Toolkit
145. e 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 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 7 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 National Instruments Corporation 6 79 ECU M amp C Toolkit User Manual 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 Ifa warning is detected you can display a message for debugging purposes or simply ignore the warning The followi
146. e 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 ECU M amp C Toolkit User Manual 5 46 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 copi
147. eater 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 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 Corporation 5 47 ECU M amp C Toolkit User Manual 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 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 n
148. ecific 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 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 National Instruments Corporation 5 53 ECU M amp C Toolkit User Manual 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 Input DB reference in is the task reference from the initial database task VI The task reference is originally returned from M
149. ed 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 necessary 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 sia status is TRUE National Instruments Corporation 5 49 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 Output 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 Oth
150. ed identification Type Description ASCII text ASAM MC2 filename without path and extension ASAM MC72 filename with path and extension URL where the ASAM MC2 file can be found KR w vw ASAM MC72 file to upload128 255 User defined Output Length Id Return Value Length returns the string length of the Id string Id contains the queried identification string 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 National Instruments Corporation 6 87 ECU M amp C Toolkit User Manual 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 mcXCPGet ID 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 ECU M amp C Toolkit User Manual 6 88 ni com Chapter 6 ECU M amp C API for C mcXCPGetStatus Purpose Queries the current session status from an
151. ed 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 BE 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 National Instruments Corporation 5 97 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 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 desc
152. en 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 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 Ev
153. en vi instead National Instruments Corporation 5 57 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW MC Download vi Purpose 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 rm 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 ECU M amp C Toolkit User Manual 5 58 ni com Chapter5 ECU M amp
154. ence is originally returned from mcECUSelectEx Output SessionStatus The current SessionStatus which is returned from the ECU Qualifier0o QualifierO describes an additional status qualifier Qualifierl Qualifier1 describes an additional status qualifier 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 return value SessionStatus is a bit mask that represents several session states inside the ECU Qualifier0 and Qualifier1 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 MinorVers
155. ent 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 Corporation 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 field 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 0xO00O 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 ke
156. entName 64 Value Input ECURef Num ECURefNunm 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 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 National Instruments Corporation 6 67 ECU M amp C Toolkit User Manual 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 ECURefNum ECURefNum is the task reference which links to the selected ECU This reference
157. entified 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 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 attentio
158. eps 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 and Professional Services Visit the following sections of the National Instruments Web site at ni com for technical support and professional services Support Online technical support resources at ni com support include the following Self Help Resources For answers and solutions visit the award winning National Instruments Web site 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 Free Technical Support All registered users receive free Basic Service which includes access to hundreds of Application Engineers worldwide in the NI Developer Exchange at ni com exchange National Instruments Application Engineers make sure every question receives an answer For information about other technical support options in your area Visit ni com services or contact your local office at ni com contact Training and Certification Visit ni
159. er Output None National Instruments Corporation 6 97 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 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 ECU M amp C Toolkit User Manual 6 98 ni com 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 u16 SessionID Input ECURefNum ECURe Num is the task reference which links to the selected ECU This reference is originally returned from mcECUSe
160. erflows 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_crce_v34 html National Instruments Corporation 6 11 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C meCCPActionService Purpose Calls an implementation specific action service on the ECU CCP only Format mcTypeStatus mcCCPActionService mcTypeTaskRef ECURefNum ul6 ServiceNo u8 Params 4 u8 ResultLength u8 DataType Input ECURefNum ECURe fNum 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
161. ervice can be accessed by calling the function mcCCPGetResult right after mcCCPActionService National Instruments Corporation 6 13 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C meCCPDiagService 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 ECURe fNum 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 responsibility 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 i
162. erwise 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 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 ECU M amp C Toolkit User Manual 5 50 ni com 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 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 t
163. es Characteristic names or Event names from a specified A2L database file Format type reference in ECU name error in reference out names list out error out Input Type mode is an input that specifies the type of names to return ype p p yp 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 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 ECU M amp C Toolkit User Manual 5 76 ni com Chapter5 ECU M amp C API for LabVIEW code is the error code number
164. es 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 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 ECU M amp C Toolkit User Manual 6 34 ni com mcDAQRead Chapter 6 ECU M amp C API for C Purpose Reads samples from a Measurement task Samples are obtained fro
165. es 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 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 gr
166. escaler 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 property applies only to tasks initialized with mode of Input and sample rate greater than zero For all other configurations it returns an error 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 National Instruments Corporation 5 91 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 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 Measurement Address Returns the address
167. eturned 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 National Instruments Corporation 6 57 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C Properties Table 6 4 Values for PropertyID 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 ul6 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 most significant first 1 Motorola format Bytes are in big endian order with least significant first ug mcPropChar_Datatype Returns the data type of the Characteristic 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 Characteris
168. 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 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 32 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 refere
169. f 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 limitations 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 ECU M amp C Toolkit User Manual 6 82 ni com 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 ECURe Num 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
170. fines 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 XCP Compression Method Returns the selected compression method used for MC Program vi 0 data is uncompressed Ox80 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 ECU M amp C Toolkit User Manual 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 Access Method Returns the selected access 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 Method Returns the selected programming method used for MC Program vi 0x00 Sequential programming 0x80 0xFF User defined ECU XCP SeedKey DLL Returns the file name of the SeedKey DLL National Instruments Corp
171. 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 mcCCPGetResult 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
172. fy vi 5 129 MC XCP Set Cal Page vi 5 132 MC XCP Set Request vi 5 134 MC XCP Set Segment Mode vi 5 137 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 mcCharacteristic Write 6 28 mcCharacteristicWriteSingle Value 6 29 mcClearMemory 6 31 mcDAQClear 6 32 mcDAQInitialize 6 33 mcDAQRead 6 35 mcDAQStartStop 6 38 mcDAQWrite 6 40 mcDatabaseClose 6 42 National Instruments Corporation l 5 Index mcDatabaseOpen 6 43 mcDownload 6 44 mcECUConnect 6 46 mcECUDeselect 6 47 mcECUDisconnect 6 48 mcECUSelectEx 6 49 mcGeneric 6 51 mcGetNames 6 53 mcGetNamesLength 6 55 mcGetProperty 6 57 options table 6 58 mcMeasurementRead 6 67 mcMeasurementWrite 6 68 mcProgram 6 69 mcProgramReset 6 71 mecProgramStart 6 72 mcSetProperty 6 73 DAQ specific options table 6 78 ECU specific options table 6 74 mcStatusToString 6 79 return codes table 6 79 mcUpload 6 81 mcXCPCopyCalPage 6 83 mcXCPGetCalPage 6 85 mcXCPGetID 6 87 mcXCPGetStatus 6 89 mcXCPProgramPrepare 6 93 mcXCPProgram Verify 6 95 mcXCPSetCalPage 6 97 mcXCPSetRequest 6 99 mcXCPSetSegmentMode 6 101 measurement and calibratio
173. g 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 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 National Instruments Corporation 6 81 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C Description If you are using the CCP protocol mcUp1load 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 o
174. gative 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 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 defined in the destination cluster to appropriate values MC CCP Move Memory vi impleme
175. gical data page number 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 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 National Instruments Corporation 5 119 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW MC XCP Get ID vi Purpose Queries session configuration or slave device identification Format reference in reference out type id string error in error out 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
176. h 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 Corporation 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 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
177. h is used to send commands and data from the host to the slave device u32 mcPropECU_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_SeedKey_Cal Sets the file name of the SeedKey DLL used for Calibration purposes str mcPropECU_SeedKey_DAQ Sets the file name of the SeedKey DLL used for DAQ purposes str mcPropECU_SeedKey_Prog Sets the file name of the SeedKey DLL used for programming purposes str mcPropECU_SeedKey_XCP Sets the file name of the SeedKey DLL for XCP ug mcPropECU_Single_Byte_ DAQ _ Lists Sets the ECU to support single byte or multi byte DAQ list entries u32 mcPropECU_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 st
178. he 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 Writes a value to a named Characteristic on the ECU Single Value vi MC Clear Memory vi Clears the contents of a specified memory block 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 Read vi Reads samples from a Measurement task Samples are obtained from received CAN messages MC DAQ Start Stop vi Starts or stops transmission of the DAQ lists for the specified Measurement task 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 Write vi Writes samples to a Measurement task MC Database Close vi Closes a specified A2L Database MC Database Open vi Opens a specified A2L Database MC Download vi Downloads data to an ECU MC ECU Close vi Closes the selected ECU
179. he 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 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 ECU M amp C Toolkit User Manual 6 70 ni com 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
180. he 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 Corporation 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 Session in progress ECU M amp C Toolkit User Manual 6 24 ni com mcCharacteristicRead Chapter 6 ECU M amp C API for C Purpose Reads all data from a named Characteristic on the ECU which is identified by the ECU Reference handle Format mcTypeStatus Input ECURefNum CharacteristicName NumberOfValues Output Values Return Value mcCharacteristicRead mcTypeTaskRef ECURefNum char CharacteristicName 64 Values u32 NumberOfValues ECURefNum is the task reference which links to the selected ECU Thi
181. here 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 National Instruments Corporation 5 21 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 SH 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 specification ECU M amp C Toolkit User Manual 5 22 ni com Chapter5 ECU M amp C API for
182. ht 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 Description Poly VI Types 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 ECU M amp C Toolkit User Manual 5 30 ni com 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 Format characteristic name ECU ref in ECU ref out x characteristic va
183. ice 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 Ethernet and TCP IP or UDP IP protocol is addressed by its IP Address and Port number Characteristic n 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 most significant bit first 1 Motorola format Bytes are in big endian order with least 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 Corporation 5 87 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 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
184. ich 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 Data is a byte array which receives the uploaded data information from the ECU National Instruments Corporation 5 17 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 SH 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 retur
185. id 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 XCP SeedKey Sets the file name of the XCP DLL SeedKey DLL National Instruments Corporation 5 109 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 XCP Access Method Sets the selected access 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 Compress ion Method Sets the selected compression method used for MC Program vi 0 data is uncompressed 0x80 0xFF User defined ECU XCP Encryptio n Method Sets the selected encryption method used for MC Program vi 0x00 data is not encrypted 0x80 0xFF User defined ECU XCP Program ming Method Sets the selected programming method used for MC Program vi 0x00 Sequential programming 0x80 0xFF Use
186. iew 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 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 zZ To access the external compact flash open Internet Explorer and type the following in the address field ftp w x y z d ECU M amp C Toolkit User Manual 2 6 ni com To enter a directory double click on its icon Right click on a file or folder Chapter 2 Installation and Conf
187. if the selected Characteristic is 2 dimensional u32 mcPropCROID 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 mcPropDAQ_DTO_Task Taskref NI CAN task reference to the CAN Task assigned to the DTO ID of the Measurement task mcPropDAQ_EventChannel Name str 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 mcPropDAQ _ EventChannelName National Instruments Corporation 6 59 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 obtain inpu
188. ification 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 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 identifie
189. iguration and choose cut copy paste or delete to perform those actions LabVIEW Real Time Graphical File Transfer Utility 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 At this point you are prompted for a username and password If these security features have not been enabled check the Anonymous Login box Configuration amp My System Data Neighborhood GB Devices and Interfaces Scales Software 4 Remote Systems Se cr PXI 8175R PW Reboot Data Ne By Lock e Devices yi 3 Scales iew Error Log H Softwar File Transfer X Delete Figure 2 2 FIP Utility Access in MAX as shown in Figure 2 3 National Instruments Corporation gt Username Password Username anonymous TETEE Login Password Figure 2 3 FTP Login Dialog Box 2 7 ECU M amp C Toolkit User Manual Chapter 2 Installation and Configuration The upper section of the utility interface shows the current directory and contents on the remote RT target while the lower section gives information for the host or local mach
190. 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 function 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 COP 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 mceCCPGetActiveCalPage Page vi
191. 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 Corporation 5 105 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 Output 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 returned For a description of the code wire the er
192. in the expected data transfer configuration ECU M amp C Toolkit User Manual 5 126 ni com 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 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 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 whe
193. ine 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 i gt File Transfer Target IP Address 10 0 47 69 Current Remote Directory INI RT SYSTEM LABVIEW DATA STARTUP H ERRORS ETHERNET si gt 2 Current Local Directory D niemca l aml D niemca l dll D nipalp dll D nipalpa dll 3584 D nirpc dll 41050 Eh minam mien GEE 294912 350812 lt To Remote 4 To Local x E Program Files National Instruments LabVIEW 7 0examplesECUMC x express file general y m ECU M amp C Toolkit User Manual 576487 131098 684092 1119 D MCAdvancedExamples lb D MCBasicExamples llb D McCharacteristicsEditors llb D ReadMe txt D TestECU a2l Nore etre i lt 6 9 20 New Folder 6 9 200 6 9 20 6 9 20 6 9 201 Rename File Select All Figure 2 4 Transferring Files With the FTP Utility 2 8 ni com Chapter 2 Installation and Configuration LabVIEW You also can use LabVIEW to programmatically access the FTP server of a LabVIEW Real Time target The DataSocket Read function has
194. ion Input ECURef Num 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 mcCCPGetVersion 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 Corporation 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 Input ECURefNum Source Destination BlockSize Output Return Value mcCCPMoveMemory m
195. ion 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 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 file name of the SeedKey DLL used for Calibration purposes ECU CCP SeedKey DAQ Name Returns the file name of the SeedKey DLL used for DAQ purposes National Instruments Corporation 5 83 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 CCP SeedKey Prog Name Returns the file name of the SeedKey DLL used for programming purposes ECU CCP Single Byte DAQ List Determines if an ECU supports single byte or multi byte DAQ list entries ECU CCP Station Address Returns 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 de
196. ion 5 45 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW 1Chan 1Samp Dbl 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
197. iption 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 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 ECU M amp C Toolkit User Manual 5 40 ni com 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 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 tas
198. is described below 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 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 ECU M amp C Toolkit User Manual ni com 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 siz
199. 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 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 ECU M amp C Toolkit User Manual 6 68 ni com 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 ECURe Num is the tas
200. ist 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 Output 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 ECU M amp C Toolkit User Manual 6 54 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 Measure
201. ister 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 host 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 as a parameter ECU CCP SeedKey Cal Name Sets the file name of the SeedKey DLL used for Calibration purposes ECU M amp C Toolkit User Manual 5 108 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 Sub 1 Sub 2 Param Description ECU CCP SeedKey Sets the file name of the DAQ SeedKey DLL used for DAQ Name purposes ECU CCP SeedKey Sets the file name of the Prog SeedKey DLL used for Name programming purposes ECU CCP Single Sets the ECU to support ByteDAQ single byte or multi byte DAQ List list entries ECU CCP Station Sets the Station Address of the Address slave device CCP is based on the idea that several ECUs can share the same CAN Arbitration IDs for CCP communication To avo
202. k 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 E Ee 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 STIM List In this mode the data from the Measurement task are send to the ECU whenever MC DAQ Write vi is called National Instruments Corporation 5 41 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW ECU M amp C Toolkit User Manual 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 e
203. k 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 programming 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 National Instruments Corporation 6 69 ECU M amp C Toolkit User Manual 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 T
204. l 6 52 ni com Chapter 6 ECU M amp C API for C mcGetNames Purpose Retrieves a comma separated list of ECU Measurement or Characteristic 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 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 0 mcTypeECUNames Return list of ECU names You can pass one of the returned names to mcECUSelectEx 1 mcTypeMeasurementNames Return list of Measurement names You can pass the returned NamesList to mcDAQInitialize 2 mceTypeCharacteristicNames Return list of Characteristic Names You can pass a single name out of the NamesList to mcCharacteristicWrite or mcCharacteristicRead 3 mcTypeEventChannelNames Return list of Event Channel names ECUName If the Type mcTypeMeasurementNames or National Instruments Corporation 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 53 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C SizeOfNamesL
205. l mcGet Property with the parameter mcPropECU_SeedKey_Cal str mcPropECU_SeedKey_DAQ Returns the file name of the SeedKey DLL used for DAQ purposes 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 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 u32 mcPropECU_SeedKey_XCP__ Returns the number of bytes to be allocated if Size you call mcGet Property with the parameter mcPropECU_SeedKey_xXCP u8 mcPropECU_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 mcPropGen_Version_ Returns the build number of the ECU M amp C Build sof
206. lectEx 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 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 reque the Mode parameter sted by National Instruments Corporation 6 99 ECU M amp C Toolkit User Manual 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
207. lize 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 occurs 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 Corporation 6 41 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
208. lkit 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_crce_v34 html National Instruments Corporation 6 9 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C meCalculateChecksum 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 fNum is the task reference which links to the selected ECU This reference is originally 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 Ret
209. ll use This string uses the syntax XXX YYY where X defines the selected protocol The following strings may be used e 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 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 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 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 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
210. lue Y error 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 Select vi and then wir HBR EE reference is originally returned from MC ECU Open vi or MC ECU ed 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 TRUI status is TRUE if an error occurred This VI is not executed when code is the error code number identifying an error A value of 0 means succes s 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 Corporation 5 31 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 Characteristic Error out describes error co
211. lue 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 mcDAQStartStop is an optional command to start or stop communication for an M amp C Measurement task If you do not perform mcDAQStart Stop 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 Corporation 6 39 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 DAQRefNum 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 Num
212. m received CAN messages Format mcTypeStatus Input DAQRefNum mcDAQRead mcTypeTaskRef DAQRefNum u32 NumberOfSamplesToRead nctTypeTimestamp StartTime nctTypeTimestamp DeltaTime 64 SampleArray u32 NumberOfSamplesReturned DAQRe Nunm 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 NumberOfSamplesToRead Output StartTime National Instruments Corporation 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 StartTime is determined by the sample timing If the initialized SampleRate is zero the Start Time 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 Coordinate
213. 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 ECU M amp C Toolkit User Manual 6 100 ni com Chapter 6 ECU M amp C API for C mcXCPSetSegmentMode Purpose Sets the 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 function did not perform the expected behavior A positive value specifies a warning the 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
214. ment task DAQRefNum RefNum must be valid for the related Type Selector Specifies the Type of names to return 0 mcTypeECUNames Return list of ECU names 1 mcTypeMeasurementNames Return list of Measurement names 2 mceTypeCharacteristicNames Return list of Characteristic Names 3 mcTypeEventChannelNames Return list of Event Channel names ECUName If the Type mcTypeMeasurementNames or National Instruments Corporation 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 55 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C Output SizeOfNamesList Number of bytes required for mcGetNames to return all names for the specified 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
215. mp C Toolkit User Manual 6 44 ni com Chapter 6 ECU M amp C API for C Description mcDownload downloads data to an ECU The data is stored 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 mcDownload 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 National Instruments Corporation 6 45 ECU M amp C To
216. n Use the mcStatusToString function of the ECU M amp C API to obtain a descriptive string for the return value National Instruments Corporation 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 the 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 a
217. n 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 Corporation 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 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 u
218. n DAQ G 4 ni com PID Prescaler S SeedKey DLL slave device identifier Station Address T task reference Glossary 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 OxFD 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 toa 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 National Instruments Corporation 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 additional programming topics 4 16 generic CCP functions 4 17 Get Names 4 16 Set Get Prope
219. n 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 report 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 National Instruments Corporation 5 77 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 mn terror out Input ECU M amp C Toolkit User Manual 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 EC
220. n databases 1 4 National Instruments support and services B 1 0 online software activation 2 4 ECU M amp C Toolkit User Manual Index 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 reactivation on another system 2 4 reading Characteristics 4 8 related documentation xii RT configuration DOS prompt 2 5 FTP transfers table 2 5 LabVIEW 2 9 LabVIEW RT graphical file transfer utility 2 7 web browsers 2 6 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 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 4 12 DTO ID 4 10 ECU M amp C Toolkit User Manual l 6 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 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 5 V volume licensing program 2 4 W Web resources B 1 writing Characteristics 4 8 X XCP functions overview 4 3 ni com
221. n 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 Corporation 6 31 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C mcDAQClear Purpose Stops communication for the Measurement task and clears the task Format mcTypeStatus mcDAQClear mcTypeTaskRef DAQRefNum Input DAQRefNum 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
222. nce 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 or as waveform using a sample rate gt 0 Input channel data is received from the DAQ messages mcDAQModePolling National Instruments Corporation In this mode the data from the Measurement task are uploaded from the ECU whenever mcDAQRead is called 6 33 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 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 sampl
223. ncluding 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 Where 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 Trademarks National Instruments NI ni com and LabVIEW are trademarks of National Instruments Corporation Refer to the Terms of Use section on ni com legal for more information about National Instruments trademarks 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 refer to the appropriate location Help Patents in your software the patents txt file on your CD or ni com patents WARNING REGARDING USE OF NATIONAL INSTRUMENTS PRODUCTS 1 NATIONAL INSTRUMENTS PRODUCTS ARE NOT DESIGNED WITH COMPONENTS AND TESTI
224. ndicated 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 ECU M amp C Toolkit User Manual 5 104 ni com 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 reference out value t error in Aror oU Input Nam e 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 LEFI 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 Types section To select the property right click the VI go to Select Type and select the property by name FOr Error
225. nditions 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 ii i 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 ECU M amp C Toolkit User Manual 5 32 ni com 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 pu Input Characteristic name is the name of a Characteristic stored in
226. ned 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 Memory Transfer Address 0 MTAO has been set by a previous VI like MC Generic vi with the command SET_MTA ECU M amp C Toolkit User Manual 5 18 ni com 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 qualifierO ECU ref out session status error out qualifier 1 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 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 clu
227. nformation 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 calling the function mcCCPGetResult right after mcCCPDiagService National Instruments Corporation 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 In
228. ng 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 PrintStat 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 print n s nSource s n statusString source if status lt 0 mcDatabaseClose MyDbHand1le exit 1 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 ECU M amp C Toolkit User Manual 6 80 ni com 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 ECURe Num 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 consistin
229. niemc h header file in the code then link with the niemc 1ib library file 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 _cplusp1lus 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 You can find examples for the C language in the MS Visual C subfolder of the ECU M amp C Toolkit folder 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 measure c niemc lib 3 2 ni com Chapter 3 Application Development Other Programming Languages 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 niemc d11 If the programming language supports the Microsoft Win32 APIs you can load pointe
230. ntil 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 applications 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 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 National Instruments Corporation 4 13 ECU M amp C Toolkit User Manual Chapter 4 Using the ECU M amp C API 4p No y Optional XCP Program Prepare y Optional Set XCP Program Properties
231. nts the CCP command MOVE defined by the CCP specification ECU M amp C Toolkit User Manual 5 24 ni com 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 Address specifies the address part of the address l j Extension contains the extension part of the address 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 National Instruments Corporation 5 25 ECU M amp C Toolkit User Ma
232. nual 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 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 ECU M amp C Toolkit User Manual 5 26 ni com 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 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 Session st
233. 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 string 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 s
234. ogtramMReset riv isiro nioc sdesk ease destin en cketa tas inesegeh Sade edens AAAA 6 71 MICPrOSTAMS AL sis assess csescssseessdbedeustscsedesdeaaseasccsscdacesasezcesvasscsadisebsasessasestdsedovees 6 72 MMCSet Property cise ivesi stds n cdo abana sede EEEE E sta easas EEE 6 73 MEStatus TOS tH ireira are a o EEA R EEATT R E ai 6 79 MCU plOAd sy svsessedsseckeesebe dosecint n n i i a a n a 6 81 meXCPC pyCal Page e igorria an are iaaa aa oa 6 83 MeXCPGetCal Page iyo e e E EE a A S 6 85 MCX CPGCUD onnan aa e A E E E EEES 6 87 MEXCPGEStAUS i ei neee e a waives a E A Add R E 6 89 MmceXCPPr gramPrepare issscccsstslcadesisdescssist saps seusessendssesesdsasacdescotetasesssdsasesdenazes 6 93 MCX CPPrO Sram Verify ceceo cea cesaesecsss cease oveu ies E E a A ai 6 95 mcX CPSetCalP ages sis ca csskscscasvessstcces gs seacei a caztdeed cated ivess ened Hosea eeeeaes 6 97 MCX CPSetRequest jessie gesehn n e sebevived e EAS 6 99 micX CPSetSepsmentMode i siirsin iiine aiana isa 6 101 National Instruments Corporation ix ECU M amp C Toolkit User Manual Contents Appendix A Summary of the CCP Standard Controller Area Network CAN c ccccscccssssceseseceeeneeesseeessteeeessaeenaes CAN Calibration Protocol CCP cccccccssceseeeeesneeeeseeesseeeesseeeessees Scopecof CEP ett ara inlekla lib aula ada RE CCP Protocol Definition ccccceccceeesseeeeseeeesneeeesseeeesseeees Appendix B Technical Support and Professional Services
235. ol 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 ECU M amp C Toolkit User Manual 5 102 ni com Chapter 5 MC Program Start vi ECU M amp C API for LabVIEW Purpose Indicates the start of a programming sequence Format ECU ref in ECU ref out error in 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 status is TRUE status is TRUE if an error occurred This VI is not executed when 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
236. olkit User Manual Chapter 6 ECU M amp C API for C mcECUConnect Purpose Establishes communication to the selected ECU through CCP or XCP After a successful ECU Connect you can create a Measurement task or read write a Characteristic Format mcTypeStatus mcECUConnect mcTypeTaskRef ECURefNum Input ECURefNum ECURefNum 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 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
237. on 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 contents fits to the rest of the flash Only the result is of interest If VerMode 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 mcXCPProgramVeri fy 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
238. on 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 ECU M amp C Toolkit User Manual 5 134 ni com Chapter5 ECU M amp C API for LabVIEW 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 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 cl
239. or 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 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 Measu
240. oration 5 85 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 CAN 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 ECU M amp C Toolkit User Manual 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 XCP Ethernet IP Address Returns the IP address of the slave device A slave dev
241. owing 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 Corporation 6 7 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C With ChecksumType XCP_USER_DEFINED the Slave 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
242. p 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 can 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 Lab VIEW 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 applicatio
243. p 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 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
244. pointer to the calibration data page CCP only Format ECU ref in ECU ref out address 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 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 i Address specifies the address part of the active calibration page address P j National Instruments Corporation 5 15 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API for LabVIEW Extension contains the extension part of the active calibration page ad
245. portion of the ECU memory containing data that controls the 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 ECU N
246. 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 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 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 National Instruments Corporation 5 123 ECU M amp C Toolkit User Manual Chapter 5 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 Unused Unused DAQ_RUNNING Data Transfer 0 The data transfer is not running 1 The data transfer is running RESUME RESUME Mode 0 The slave device is not in RESUME mode 1 The slave device is in RESUME mode The STORE_C
247. put ECURefNum ECURe Num 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 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 Block
248. r mcPropIPAddress Sets the IP address for XCP on Ethernet TCP or UDP as a string ECU M amp C Toolkit User Manual 6 76 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 ul6 mcPropIPPort Sets the IP port for XCP on Ethernet TCP or UDP u8 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 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 0x80 0xFF User defined u8 mcPropPGM_Encryption Selects the selected encryption method used for Method mcProgram 0 Data is not encrypted default Ox80 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 Corporation 6 77 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 PropertylD Input Value Data Type Name Des
249. r 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 Corporation 5 67 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 Database 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 yy
250. r defined ECU M amp C Toolkit User Manual 5 110 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 2 Param Description ECU XCP CAN Baudrate Sets 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 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 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 National Instruments Corporation 5 111 ECU M amp
251. r 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 Otherwise Error out describes the error status of this VI HE EE 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 ECU M amp C Toolkit User Manual 5 6 ni com Chapter5 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 c
252. ramStart 6 72 mcSetProperty 6 73 DAQ specific options table 6 78 ECU specific options table 6 74 mcStatusToString 6 79 return codes table 6 79 mcUpload 6 81 mcXCPCopyCalPage 6 83 mcXCPGetCalPage 6 85 mcXCPGetID 6 87 mcXCPGetStatus 6 89 mcXCPProgramPrepare 6 93 mcXCPProgramVerify 6 95 mcXCPSetCalPage 6 97 mcXCPSetRequest 6 99 mcXCPSetSegmentMode 6 101 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 choosing programming languages 3 1 conventions used in the manual xi CRO ID property 4 5 ECU M amp C Toolkit User Manual l 2 D debugging an application 3 3 definition of activation terms 2 3 developing an application 3 1 diagnostic tools NI resources B 1 documentation conventions used in manual xi NI resources B 1 related documentation xii 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 St
253. ramming Languages eseeessesseesrsrrersstsresreresresesresrnrentesenresresrete 3 3 Debugging An Application ssisiieseiiniiioricaineise aide iee ria aa 3 3 NIS Py deron iiao aieea R E E E a 3 4 MCPS Py ocna 3 oa AEA ARRE E a RETS ii ARRE 3 4 Saving Captured Communication Data sssssseseeeessseerrsrrresreereersee 3 5 Capture Options oi oiaoi A EEE E esas iets 3 5 Call History Depth nsncciaynnnann nonnen aaea 3 5 Capturing D ts sesiis aaa atts eiia 3 5 Selecting Which XCP Commands to View ccccceeeseeseeeeeseeeeees 3 6 Chapter 4 Using the ECU M amp C API Structure of the ECU M amp C API ceccccccccccccccssssccccesssceeeeeesssseeeceessseeeceesssseeeceeeseaees 4 1 ECU M amp C Chann l Functions ssiniresasiunnr n a ati 4 2 What is an ECU Measurement ccccccccccesssceccesessseeeecesssseeeeees 4 2 What is an ECU Characteristic cccccccccccsesssccceeessssceeceeesssseeeeees 4 2 ECU M amp C CCP and XCP Functions cccccccesssccceessssscecceeesssceceeessssseeeees 4 3 Basic Programming Model ECU Opelissa iisa ASAM MCD 2MC Communication Properties for CCP or XCP WIth GAN Ore aeara a r e a Ea esaa e dk ANS 4 5 CRO D a hea A A a ees 4 5 DTO TD irean aar aa Doss Fh e a ea ode oS 4 5 Station Addres Sisian n e a a EASE TEENE AE ARa 4 5 Baudrate de m e a r e a ar ae a acdyess 4 6 ASAM MCD 2MC Communication Properties for XCP with WDP or B S eaaa AEE O EE E E E oe veues des 4 6 IP Address or hostname
254. 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 the ECU to send DAQ list data to the CCP master National Instruments Corporation 5 113 ECU M amp C Toolkit User Manual 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 E E 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 a 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 VI executes If an error has already occurred the VI
255. rce 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 appropriate 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 National Instruments Corporation 5 115 ECU M amp C Toolkit User Manual Chapter5 ECU M amp C API
256. re the error occurred National Instruments Corporation 5 127 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 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 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
257. 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 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 Ig AE 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 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 ECU M amp C Toolkit User Manual 5 12 ni com 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 params result error in error out Input ECU ref in is the task reference which links to the selected ECU This reference is
258. rement 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 such 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
259. rence 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 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 i
260. ring 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 Output Session Id returns 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 F EE ECU M amp C Toolkit User Manual 5 122 ni com Description 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
261. ription 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 ECU M amp C Toolkit User Manual 5 98 ni com 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 i Address specifies the address part of the destination address 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 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
262. ription 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 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 conditions The calibration session status is organized as a bit mask with the following assignment 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 ECU M amp C Toolkit User Manual 5 28 ni com 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 rroma error out Input Characteristic name is the name of the Chara
263. rning 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 cluster 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 64 ni com Chapter5 ECU M amp C API for LabVIEW code is the error code number identifying an error A value of 0 pues 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 After calling this VI you can establish the communication to another ECU defined in the A2L database using MC ECU Select vi National Instruments Corporation 5 65 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
264. ror cluster to a LabVIEW error handling VI such as the Simple Error Handler source identifies the VI where the error occurred Description There are two types of properties which can be modified in the poly input value ECU specific properties and DAQ 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 ECU M amp C Toolkit User Manual 5 106 ni com Chapter5 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 vi 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 EC
265. rovide 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 function 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
266. rror 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 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
267. rs 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 include niemc h HINSTANCE NiMcLib NULL NiMcLib LoadLibrary niemc d11 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 Debugging An Application The NI Spy tool monitors function calls to the ECU M amp C API to aid in debugging an application To launch this tool open the Software branch of the MAX configuration tree right click NI Spy and select Launch NI Spy 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 Spy Options select the View Selections tab and
268. rs 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 Corporation 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 connected 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 f
269. rties 4 16 ASAM definition 1 1 ASAM MCD 2MC communication properties Baudrate 4 6 CRO ID 4 5 DTO ID 4 5 Station Address 4 5 communication properties with CAN 4 5 communication properties with UDP or TCP 4 6 overview 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 National Instruments Corporation l 1 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 mcDAQClear 6 32 mcDAQInitialize 6 33 mcDAQRead 6 35 mcDAQStartStop 6 38 mcDAQWrite 6 40 mcDatabaseClose 6 42 mcDatabaseOpen 6 43 mcDownload 6 44 mcECUConnect 6 46 mcECUDeselect 6 47 mcECUDisconnect 6 48 mcECUSelectEx 6 49 mcGeneric 6 51 mcGetNames 6 53 mcGetNamesLength 6 55 mcGetProperty 6 57 options table 6 58 ECU M amp C Toolkit User Manual Index mcMeasurementRead 6 67 mcMeasurementWrite 6 68 mcProgram 6 69 mcProgramReset 6 71 mcProg
270. s 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 Corporation 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 fNum 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 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 id
271. s 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 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 5 138 ni com 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 eac
272. s reference is originally returned from mcECUSelectEx CharacteristicName is the name of the Characteristic defined in the A2L database file 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 Returns a single value a 1 dimensional array or a 2 dimensional array of values for the selected Characteristic 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 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 Corporation 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 Refe
273. s the VI where the error occurred Description 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 ECU M amp C Toolkit User Manual 5 130 ni com Chapter5 ECU M amp C API for LabVIEW project specific The master receives the Verification mode from the project specific programming 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 National Instruments Corporation 5 131 ECU M amp C Toolkit User Manual 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 Unused Unused Un
274. 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 error the Error out cluster contains the same information Otherwise Error out describes the error status of this VI 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 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 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
275. ss 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 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 National Instruments Corporation 5 63 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 Error in is a cluster which describes error conditions occurring before the Select vi and then wired through subsequent VIs 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 wa
276. ster to a LabVIEW error handling VI such as the Simple Error Handler source identifies the VI where the error occurred Output Qualifier0 describes an additional status qualifier ECU ref out is the same as ECU ref in Wire the task reference to subsequent VIs for this task Session status is the actual session status which is returned from the ECU National Instruments Corporation 5 19 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 SH 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 Qualifier1 describes an additional status qualifier 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 inside the ECU Qualifier0 specifies the additional status information Qualifier1 contains
277. t ECU ref in ECU ref out segment mode 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 Segment specifies the logical data segment number Mode specifies the mode for the segment 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 HEH 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 source identifies the VI where the error occurred National Instruments Corporation 5 137 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 statu
278. t 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 f64 mcPropDAQ_SampleRate Returns the selected Sample Rate in Hz for the M amp C Measurement task u32 mcPropDAQ_Samples Returns the number of samples available for Pending read in DAQ tasks defined with sample rate gt 0 str mcPropDB_Filename Returns the A2L Database file name with which the task has been 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 ECU M amp C Toolkit User Manual 6 60 ni com Chapter 6 ECU M amp C API for C Table 6 4 Values for PropertyID Continued Data Type Name Description 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 mc PropECU_ByteOrder Returns the byte order of the slave device O
279. tained in it EXCEPT AS SPECIFIED HEREIN NATIONAL INSTRUMENTS MAKES NO WARRANTIES EXPRESS OR IMPLIED AND SPECIFICALLY DISCLAIMS ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE CUSTOMER S RIGHT TO RECOVER DAMAGES CAUSED BY FAULT OR NEGLIGENCE ON THE PART OF NATIONAL INSTRUMENTS SHALL BE LIMITED TO THE AMOUNT THERETOFORE PAID BY THE CUSTOMER NATIONAL INSTRUMENTS WILL NOT BE LIABLE FOR DAMAGES RESULTING FROM LOSS OF DATA PROFITS USE OF PRODUCTS OR INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF ADVISED OF THE POSSIBILITY THEREOF This limitation of the liability of National Instruments will apply regardless of the form of action whether in contract or tort including negligence Any action against National Instruments must be brought within one year after the cause of action accrues National Instruments shall not be liable for any delay in performance due to causes beyond its reasonable control The warranty provided herein does not cover damages defects malfunctions or service failures caused by owner s failure to follow the National Instruments installation operation or maintenance instructions owner s modification of the product owner s abuse misuse or negligent acts and power failure or surges fire flood accident actions of third parties or other events outside reasonable control Copyright Under the copyright laws this publication may not be reproduced or transmitted in any form electronic or mechanical i
280. te 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 56 ni com Chapter5 ECU M amp C API for LabVIEW code is the error code number identifying an error A value of 0 FETA 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 Op
281. ted 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 mcProgramStart 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 ECU M amp C Toolkit User Manual 6 72 ni com 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 NUL
282. teristic 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 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 ECU M amp C Toolkit User Manual 5 36 ni com 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 ECU ref in is the task reference which links to the selected ECU This reference is originally returned from MC E
283. 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 ECU M amp C Toolkit User Manual 6 56 ni com Chapter 6 ECU M amp C API for C mcGetProperty Purpose Retrieves a property of the driver the database the ECU a Characteristic a 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 DBRefNum 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 r
284. 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 starting at the selected Address If you are using the CCP protocol mcBuildCchecksum 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 foll
285. 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 ECURe Num ECURefNum 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 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 mcCCPSetSessionStatus implements the CCP command SET_S_STATUS and is used to keep the ECU informed about the current state of the calibration session T
286. tic 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 ug 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 64 mcPropChar_Minimum Returns the Minimum value of the Characteristic ECU M amp C Toolkit User Manual 6 58 ni com Chapter 6 Table 6 4 Values for PropertyID Continued Data Type Name Description u32 mcPropChar_ReadOnly Returns if a Characteristic is set to read only In this case it is not allowed to call mcCharacteristicwrite for this Characteristic u32 mcPropChar_Sizes Returns the Array Sizes for the X and Y directions of the Characteristic str mcPropChar_Unit u32 mcPropChar_Unit_Size Returns the unit string defined for this Characteristic in the A2L database 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 axis values on which the Characteristic is defined Valid
287. tional Instruments Corporation 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 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 ated 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 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 Output 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
288. ts reserved Important Information Warranty The media on which you receive National Instruments software are warranted not to fail to execute programming instructions due to defects in materials and workmanship for a period of 90 days from date of shipment as evidenced by receipts or other documentation National Instruments will at its option repair or replace software media that do not execute programming instructions if National Instruments receives notice of such defects during the warranty period National Instruments does not warrant that the operation of the software shall be uninterrupted or error free A Return Material Authorization RMA number must be obtained from the factory and clearly marked on the outside of the package before any equipment will be accepted for warranty work National Instruments will pay the shipping costs of returning to the owner parts which are covered by warranty National Instruments believes that the information in this document is accurate The document has been carefully reviewed for technical accuracy In the event that technical or typographical errors exist National Instruments reserves the right to make changes to subsequent editions of this document without prior notice to holders of this edition The reader should consult National Instruments if errors are suspected In no event shall National Instruments be liable for any damages arising out of or related to this document or the information con
289. tware This number applies to Development Alpha and Beta phase only and should be ignored for Release phase National Instruments Corporation 6 63 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 mcPropGen_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 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 ul6 mcPropMeas_Address Returns the address of the selected Measurement in the memory of the control unit
290. uble 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 ECU M amp C Toolkit User Manual 5 52 ni com Chapter5 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 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 sp
291. ue 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 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 Corporation 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 sl
292. umber of samples to read NChan NSamp 1D Wfm Returns an array one entry for each channel initialized 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 Dbl 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
293. unm 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 ECURe fNum Is the task reference which 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 func tion 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 mcECUSelect Ex creates an ECU reference handle to the selected ECU name The mcECUSelectEx function does not start communication This enables you to use mcSet Property to change the properties of an ECU task After you change properties use mcECUConnect to start communication for the task and logically connect to the selected ECU National Instruments Corporation 6 49 ECU M amp C Toolkit User Manual Chapter 6 ECU M amp C API for C Interface is the name of the protocol and interface the selected ECU task wi
294. upply Text in this font denotes text or characters that you should enter from the keyboard sections of code programming examples and syntax examples This font is also used for the proper names of disk drives paths directories programs subprograms subroutines device names functions operations variables filenames and extensions Italic text in this font denotes text that is a placeholder for a word or value that you must supply National Instruments Corporation xi ECU M amp C Toolkit User Manual About This Manual Related Documentation The following documents contain information that you might find helpful as you read this manual ECU M amp C Toolkit User 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 Applications Systems Standardization Working Group XCP Version 1 0 The Universal Measurement and Calibration Protocol Family Association for Standardization of Autom
295. ur 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 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 card and use the NI CAN APIs to develop real time applications As with any other NI product for LabVIEW RT you must download 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 you have installed the PXI CAN cards and downloaded the ECU M amp C Toolkit software to the LabVIEW RT system you must verify the installation To use the ECU M amp C Toolkit on the LabVIEW RT system you must also download the ASAM MCD 2MC
296. urn 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 external 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 ov
297. used Unused Unused 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 ECU M amp C Toolkit User Manual 5 132 ni com Chapter5 ECU M amp C API for LabVIEW Error in is a cluster which describes error conditions occurring before the Ett 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
298. uss E E 1 4 Chapter 2 Installation and Configuration Installation naaa iee AR ae O teen eae pee ce 2 1 License Management OVErView iocis nesesario aiea E i E Ai 2 1 Ac vate ECU M amp C Toolkit ea a E A EARTE 2 2 POTTS eein eei e ard ee e e S AE AE E E E A E E eA rE 2 3 Moving Software After Activation sseesssesesessseerrsesrsresrrersrrsresrstrsrsresresestes 2 4 Volume License Programie eeneioe ta E E E REEN 2 4 O line Activatie ee r reaa R E E E AAEE aA 2 4 Home Computer US seper aa a au e aE E E E A E aNG ates 2 4 Privacy POlC Y n a RERE RE EA EEN A 2 4 LabVIEW Real Time RT Configuration sssssssseeessesseeestssrssessressrssresrrssrssresreserseess 2 5 DOS Command Prompt ii ssise neier teins eel Rade i eais 2 5 Web Browsers 1 2 sted ddsceesregsioecyoceweceasbiycasevestusen sv vestesteolitvtv pau sv cestepunell dotevuvens 2 6 LabVIEW Real Time Graphical File Transfer Utility oes 2 7 Ta VIE We en nes E A EA ETRE 2 9 Hardware and Software Requirements 00 0 0 eee eeceeseeeeseceseceeeesesseeesecseeeaecseeesseeeeaes 2 9 Chapter 3 Application Development Choose the Programming Language ee eee eceeseeeseeseceseeseesseeseceseeaseneeesesneeeaeenaes 3 1 Lab VIEW 33 ig sp tive 8 ee T a eee ds en a ane 3 1 Tab Wind OWs CV E ren Sits ieeit ens E AE ER RA 3 1 National Instruments Corporation v ECU M amp C Toolkit User Manual Contents Visal CHE Orinin nosenie iaie Aae anaE devboa Ma REA eines 3 2 Other Prog
299. uster 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 National Instruments Corporation 5 135 ECU M amp C Toolkit User Manual 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 ECU M amp C Toolkit User Manual 5 136 ni com Chapter5 ECU M amp C API for LabVIEW MC XCP Set Segment Mode vi Purpose Sets the mode of a specified segment Forma
300. 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 42 ni com Chapter5 ECU M amp C API for LabVIEW 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 National Instruments Corporation 5 43 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
301. vate ECU M amp C Toolkit 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 Se MAND TIN XXXXXXXXX Certificate of me Ownership 2 Install your software ECU M amp C Toolkit User Manual 2 2 ni com Chapter 2 Installation and Configuration 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
302. y 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 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 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 5 68 ni com Chapter5 ECU M amp C API for LabVIEW 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
303. you can create a Measurement Task or read write a Characteristic 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 mcGeneric Sends a generic CCP command mcGetNames Retrieves a comma separated list of ECU Measurement Characteristic or Event 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 mcMeasurementRead Reads a single Measurement value from the ECU mcMeasurementWrite Writes a single Measurement value to the ECU mcProgram Programs a memory block on the ECU mcProgramReset Indicates the end of a programming 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 mcUpload Uploads data from an ECU mcXCPCopyCal Page Forces a copy transaction of one calibration page to another mcXCPGetCalPage Queries a calibration page setting mcXCPGet ID Queries session configuration or slave device identification mcXCPGetStatus

Download Pdf Manuals

image

Related Search

Related Contents

組立・取扱説明書 ラダーランドリー ワイヤーバスケット  Baixar manual  Assessment Tools - Bronchoscopy International  EMC Test Data - Summit Data Communications  Brew Central™ Coffeemaker DCC-1200  Low Voltage Electrical Safety Policy - Library  Étapes d`installation et procédures de démarrage, suite  Technaxx Imago    EA725AA-1~EA725AA-16 内側面取りゲージ・外側面取り  

Copyright © All rights reserved.
Failed to retrieve file