Home
CAN and LIN Automotive Diagnostic Command Set User Manual
Contents
1. Input diagRef Specifies the handle for the diagnostic session obtained from ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct Output Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value Description ndDoIPDisconnect terminates the TCP IP connection to the connected DolP entity After executing this VI diagnostic services no longer can be executed on that DoIP entity You can reconnect with ndDoIPConnect Automotive Diagnostic Command Set User Manual 6 54 ni com Chapter 6 Automotive Diagnostic Command Set API for C ndDolPEntityStatus Purpose Gets status information from a DolP entity Format long ndDoIPEntityStatus TD1 diagRef unsigned char nodeType unsigned char maxSockets unsigned char curSockets LVBoolean ok Input diagRef Specifies the handle for the diagnostic session obtained from ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manual
2. VIN or EID depends on the DoIP Open Type DoIP Open Type VIN or EID Value VIN VIN or EID is a 17 character Vehicle Identification Number Only DolP entities for this VIN are listed EID VIN or EID is an Entity ID usually a MAC address Only the DoIP entity with this ID is listed Specify the EID as xx xx xx xx xx xx where each x is a hexadecimal digit All VIN or EID is ignored error in is a cluster that 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 the VI did not 5 61 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW execute the intended operation A positive value means warning the 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 Diag reference out is a copy of Diag reference in You can wire it to subsequent diagnostic VIs DolIP Entities is an array of clusters each of which contains the description of one DoIP entity that responded to the command VIN is the
3. 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 the VI did not execute the intended operation A positive value means warning the VI executed intended operation but an informational warning is returned For a description of the code wire the error cluster to a LabVIEW error handling VI such as the Simple Error Handler source identifies the VI where the error occurred 5 77 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW ECUReset vi Purpose Executes the ECUReset service Resets the ECU Format error in no error diag ref in EEE diag ref out mode SUCCESS error out Input El A diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi or Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster mode indicates the reset mode Hex 01 02 03 7F 80 FF Description PowerOn This value identifies the PowerOn ResetMode a simulated PowerOn reset that most ECUs perform after the ignition OFF ON cycle
4. 1 Invalid response is returned as an error in addition 11 Max RspPending Count is the number of times a ReqCorrectlyRcvd RspPending 0x78 Negative Response Message will be accepted to extend the command timeout default 5 If this message is sent more often in response to a request an error 8120 is returned If the ECU implements commands with a long duration for example flash commands you may need to extend this number 12 VWTP Command Time Out is the time in milliseconds the host waits fora VWTP 2 0 command to be executed default 50 ms The specification states this as 50 ms plus the network latency but some ECUs may require higher values Automotive Diagnostic Command Set User Manual 5 18 ni com H Output HE E Description 13 14 15 Chapter 5 Automotive Diagnostic Command Set API for LabVIEW STmin is the minimum time in seconds between the end of transmission of a frame in a diagnostic request message and the start of transmission of the next frame in the diagnostic request message for LIN based diagnostic communication The default is 0 P2min is the minimum time in seconds between reception of the last frame of the diagnostic request and the response sent by the node for LIN based diagnostic communication The default is 0 05 Termination reads the NI XNET Termination property Reflections on the CAN and LIN bus can cause communication failures To prevent reflections termination can be present as e
5. 5 121 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Output diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs success indicates successful receipt of a positive response message for this diagnostic 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 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 the VI did not execute the intended operation A positive value means warning the 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 Automotive Diagnostic Command Set User Manual 5 122 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW UDS DiagnosticSessionControl vi Purpose Executes the UDS DiagnosticSessionControl service Sets up the ECU in a specific diagnostic mode Format error in no error diag ref out session parameter record success error out diag ref in mode National Instruments diag ref in specifies the diagnostic session
6. National Instruments 6 79 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C ndReadMemoryByAddress Purpose Executes the ReadMemoryByAddress service Reads data from the ECU memory Format long ndReadMemoryByAddress TD1 diagRef unsigned long address unsigned char size unsigned char dataOut long len LVBoolean success Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic or ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct address Defines the memory address from which data are read Only three bytes are sent to the ECU so the address must be in the range 0O FFFFFF hex size Defines the length of the memory block to be read Output dataOut Returns the ECU memory data len On input len must contain the dataOut array length On return it contains the number of valid data bytes in the dataOut array Success Indicates successful receipt of a positive response message for this diagnostic service Automotive Diagnostic Command Set User Manual 6 80 ni com Chapter 6 Automotive Diagnostic Command Set API for C Return Value The return value indicates the function call status as a signed 32 bit integer Zero means the function executed successfully A negative value specifies an error which means the functio
7. error in is a cluster that 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 Ho 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 the VI did not execute the intended operation A positive value means warning the 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 Automotive Diagnostic Command Set User Manual 5 98 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Output diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs seed out returns the seed from the ECU success indicates successful receipt of a positive response message for this diagnostic 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 BE 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 the VI did not execute the intende
8. Byte Order indicates the byte ordering for multibyte items 0 MSB_FIRST Motorola default 1 LSB_FIRST Intel This VI interprets the response byte stream according to this description and returns the resulting DTC records in the DTCs cluster array diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi or Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster Automotive Diagnostic Command Set User Manual 5 136 ni com National Instruments Chapter 5 Automotive Diagnostic Command Set API for LabVIEW status mask defines the status of DTCs to be read The values are application specific error in is a cluster that 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 the VI did not execute the intended operation A positive value means warning the 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 diag ref out is a
9. Diag reference out is a copy of Diag reference in You can wire it to subsequent diagnostic VIs Target Address is the logical address of the responding DolIP entity 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 the VI did not execute the intended operation A positive value means warning the 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 DolIP Activate Routing vi establishes a route for the DoIP messages and assigns an endpoint Target Address After successfully establishing a route diagnostic messages can be exchanged with the target DoIP entity using any diagnostic service VI Automotive Diagnostic Command Set User Manual 5 52 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW DoIP Connect vi Purpose Creates a TCP IP connection to a DoIP entity identified by its IP address Format Diag Reference in address error in no error Source Address Target Address Diag reference out error out Di
10. Format diag ref in diag ref out response required gt success error in no error De error out Input diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi or Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster El response required indicates whether the ECU answers this service TRUE default or not FALSE In the latter case success is TRUE error in is a cluster that describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out E 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 the VI did not execute the intended operation A positive value means warning the 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 Automotive Diagnostic Command Set User Manual 5 110 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs success indicates successful recei
11. The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value National Instruments 6 87 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C Description The usual procedure for getting a security access to the ECU is as follows 1 Request a seed from the ECU using ndRequestSeed with access mode n 2 From the seed compute a key for the ECU on the host 3 Send the key to the ECU using ndSendKey with access mode n 1 4 The security access is granted if the ECU validates the key sent Otherwise an error is returned Automotive Diagnostic Command Set User Manual 6 88 ni com Chapter 6 Automotive Diagnostic Command Set API for C ndSendKey Purpose Executes the SecurityAccess service to send a key to the ECU Format long ndSendKey TD1 diagRef unsigned char accessMode unsigned char keyIn long len LVBoolean success Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic or ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions
12. error out Input diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi or Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster El response required indicates whether the ECU answers this service TRUE default or not FALSE In the latter case success is TRUE error in is a cluster that describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out E 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 the VI did not execute the intended operation A positive value means warning the 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 Automotive Diagnostic Command Set User Manual 5 76 ni com Output National Instruments Chapter 5 Automotive Diagnostic Command Set API for LabVIEW diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs success indicates successful receipt of a positive response message for this diagnostic service
13. typedef struct char VIN 18 unsigned short Address unsigned char EID 6 unsigned char GID 6 char IP_Address 16 DOIP_ENTITY VIN Contains the Vehicle Identification Number assigned to the DoIP entity Could be empty if not assigned Address The logical Target DoIP Address of the DoIP Entity EID Contains the Entity ID usually the Hardware MAC address assigned to the DoIP entity Could be empty 0 if not assigned GID Contains the Group ID assigned to the DoIP entity Could be empty 0 if not assigned IP_Address Contains the DoIP Entity IP Address in a b c d notation len Returns the size of the DoIPEntities array in bytes Must be initialized with the size in bytes of the buffer provided for DoIPEntities Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value Description ndDoIPGetEntities uses a UDP broadcast to identify all DoIP entities in the local subnet matching a certain condition The entities responding are returned in the DoIPEntities cluster array The conditions are either a common VIN or E
14. unsigned char memAddrLen unsigned char memSizeLen unsigned long address unsigned long size unsigned char dataOut long len LVBoolean success Input diagRef Specifies the handle for the diagnostic session obtained from ndOpenDiagnostic or ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct memAddrLen Defines the number of address bytes transferred to the ECU This implicitly defines the maximum allowed for the address parameter memSizeLen Defines the number of size bytes transferred to the ECU This implicitly defines the maximum allowed for the size parameter address Defines the memory address from which data are read size Defines the length of the memory block to be read National Instruments 6 149 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C Output dataOut Returns the memory data from the ECU len On input len must contain the dataOut array length On return it contains the number of valid data bytes in the dataOut array success Indicates successful receipt of a positive response message for this diagnostic service Return Value The return value indicates the function call status as a signed 32 bit integer Zero means the function executed successfully A negative value specifies an error which means the function did not pe
15. CAN nixnet The interface name is related to the NI XNET hardware naming under Devices and Interfaces in MAX B Note By selecting nixnet as the interface string the Automotive Diagnostic Command Set uses the Frame Input and Output Queued sessions To force the use of Frame Input and Output Stream sessions instead select ni_genie_nixnet as the interface string for example CANI ni_genie_nixnet An application instance can use only one Frame Input Stream Session and one Frame Output Stream Session at a time so use the default name nixnet as the interface string so that multiple NI XNET Frame Queued Sessions can coexist on a Automotive Diagnostic Command Set User Manual 5 32 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW single interface and the Frame Input and Output Stream Sessions may be used for example for a Frame logging replay use case National Instruments CompactRIO or R Series If using CompactRIO or R Series hardware you must provide a bitfile that handles the CAN communication between the host system and FPGA To access the CAN module on the FPGA you must specify the bitfile name after the for example CAN MyBitfile lvbitx To specify a special RIO target you can specify that target by its name followed by the bitfile name for example CAN RIOI MyBitfile lvbitx Currently only a single CAN interface is supported RIO1 defines the RIO target name as defined in your LabVIEW Project
16. National Instruments 6 93 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C ndStopDiagnosticSession Purpose Executes the StopDiagnosticSession service Returns the ECU to normal mode Format long ndStopDiagnosticSession TD1 diagRef LVBoolean success Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic or ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct Output Success Indicates successful receipt of a positive response message for this diagnostic service Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value Description This function disables the current ECU diagnostic mode A diagnostic session stops only if communication with the ECU is established and a diagnostic session is running If no diagnostic session is running the default session is active ndStopDiagnosticSession cannot disable the default session If the ECU st
17. Normally it is not necessary to manually manipulate the elements of this struct accessMode Indicates the security level to be granted The values are application specific This is an even number usually 2 keyIn Defines the key data to be sent to the ECU len Must contain the number of valid data bytes in keyIn Output success Indicates successful receipt of a positive response message for this diagnostic service Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value National Instruments 6 89 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C Description The usual procedure for getting a security access to the ECU is as follows 1 Request a seed from the ECU using ndRequestSeed with access mode n 2 From the seed compute a key for the ECU on the host 3 Send the key to the ECU using ndSendKey with access mode n 1 4 The security access is granted if the ECU validates the key sent Otherwise an error is returned Automotive Diagnostic Command Se
18. On return it contains the number of valid elements in the DTCs array success Indicates successful receipt of a positive response message for this diagnostic service Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value Description This function reads diagnostic trouble codes by status from the ECU memory If you set the optional groupOfDTC parameter to the above specified codes the ECU reports DTCs only with status information based on the functional group selected by groupOfDTC For further details about this service refer to the ISO 14230 3 standard National Instruments 6 77 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C ndReadECuldentification Purpose Executes the ReadECUlIdentification service Returns ECU identification data Format long ndReadECUIdentification TD1 diagRef unsigned char mode unsigned char dataOut long len LVBoolean success Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic or ndOpe
19. 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 the VI did not execute the intended operation A positive value means warning the VI executed intended operation but an informational warning is returned For a description of the code wire the error cluster to a LabVIEW error handling VI such as the Simple Error Handler source identifies the VI where the error occurred 5 81 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW InputOutputControlByLocalldentifier vi Purpose Executes the InputOutputControlByLocalldentifier service Modifies ECU I O port behavior Format data in diag ref in EEE diag ref out local ID A initia data out mode pa an SUCCESS error in no error i t error out Input data in defines application specific data for this service diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi or Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster local ID defines the local identifier of the I O to be manipulated The values are application specific mode defines the type of I O control The values are application specific The usual values are 0 Re
20. The default is 0 for maximum speed Time between Waits T_W is the number of milliseconds the master waits after sending a WAIT frame The default is 25 6 41 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C 10 11 12 13 14 15 Fill CAN Frames specifies whether a CAN frame is transmitted with 8 bytes or less 0 Short CAN frames are sent with DLC lt 8 1 Short CAN frames are filled to 8 bytes with Fill Byte default Fill Byte specifies the CAN frame content filled with defined data or random data 0 255 Byte is used optionally to fill short CAN frames 256 Short CAN frames are filled optionally with random bytes The default is 255 OxFF Invalid Response as Error specifies how the toolkit handles an invalid ECU response 0 Invalid response is indicated by success FALSE only default 1 Invalid response is returned as an error in addition Max RspPending Count defines the number of times a ReqCorrectlyRcvd RspPending 0x78 Negative Response Message will be accepted to extend the command timeout default 5 If this message is sent more often in response to a request an error 8120 is returned If the ECU implements commands with a long duration for example flash commands you may need to extend this number VWTP Command Time Out is the time in milliseconds the host waits for a VWTP 2 0 command to be executed default 50 ms The specificat
21. When the ECU performs the reset the client tester re establishes communication PowerOnWhileMaintainingCommunication This value identifies the PowerOn ResetMode a simulated PowerOn reset that most ECUs perform after the ignition OFF ON cycle When the ECU performs the reset the server ECU maintains communication with the client tester Reserved ManufacturerSpecific This range of values is reserved for vehicle manufacturer specific use Automotive Diagnostic Command Set User Manual 5 78 ni com Output Description Chapter 5 Automotive Diagnostic Command Set API for LabVIEW error in is a cluster that 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 the VI did not execute the intended operation A positive value means warning the 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 diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs success indicates successful receipt of a positive response
22. but a condition arose that may require attention Use the ndStatusToString function to obtain a descriptive string for the return value Description The WWH OBD ClearDiagnosticInformation service is based on the UDS ClearDiagnosticInformation service ISO 14229 1 Automotive Diagnostic Command Set User Manual 6 170 ni com Chapter 6 Automotive Diagnostic Command Set API for C ndWWHOBDConvertDTCsToJ1939 Purpose Converts DTCs to the J1939 DTC format Format long ndWWHOBDConvertDTCsToJ1939 TD4 DTCs long lenDTCs TD5 DTCsJ1939 long lenDTCsJ1939 Input DTCs The DTC to convert as an array of structs typedef struct unsigned long DTC unsigned long Status unsigned long AddData TD4 lenDTCs Must contain the number of valid data bytes in DTCs Output DTCsJ1939 Returns the converted DTCs to the J1939 format as an array of structs typedef struct unsigned long SPN unsigned long Status unsigned long AddData unsigned long FMI TD5 SPN contains the suspect parameter number for this DTC Status is the DTC status Usually this is a bit field with following meaning Bit Meaning O testFailed 1 testFailedThisOperationCycle 2 pendingDTC 3 confirmedDTC National Instruments 6 171 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C 4 testNotCompletedSinceLastClear 5 testFailedSinceLastClear 6 testNotCompletedThisOperationCycle
23. confirmedDTC testNotCompletedSinceLastClear testFailedSinceLastClear nr WYN KF O testNotCompletedThisMonitoringCycle 7 warningIndicatorRequested AddData contains optional additional data for this DTC Usually this does not contain valid information refer to DTCDescriptor len On input len must contain the DTCs array length in elements On return it contains the number of valid elements in the DTCs array Success Indicates successful receipt of a positive response message for this diagnostic service National Instruments 6 121 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value Description This function executes the ReportDTCByStatusMask subfunction of the UDS ReadDiagnosticTroubleCodeInformation service and reads the selected DTCs from the ECU For further details about this service refer to the ISO 15765 3 standard Automotive Diagnostic Command Set User Manual 6 122 ni com Chapter 6 Automotive Diagno
24. diagRefOut A struct that contains all necessary information about the diagnostic session Pass this struct as a handle to all subsequent diagnostic functions and close it using ndCloseDiagnostic Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value Description ndOpenDiagnosticOnLIN opens a diagnostic communication channel to an ECU This function initializes the LIN port specified as input and stores a handle to it among other internal data into diagRefOut which serves as reference for further diagnostic functions No communication to the ECU takes place at this point To open a diagnostic session on the ECU call ndStartDiagnosticSession or ndUDSDiagnosticSessionControl Automotive Diagnostic Command Set User Manual 6 40 ni com ndSetProperty Chapter 6 Automotive Diagnostic Command Set API for C Purpose Sets a diagnostic global internal parameter Format void ndSetProperty unsigned short propertyID unsigned long propertyValue Input propertyID Defines the parameter whose value is to be modified
25. e CAN1 ni_genie_nixnet uses CAN interface 1 of an NI XNET device e CAN2 ni_genie_nixnet uses CAN interface 2 of an NI XNET device and so on with the form CANx Using R Series e CAN1 RIO1 c temp MyFpgaBitfile lvbitx uses a named target RIO1 as compiled into the bitfile at location c temp MyFpgaBitfile lvbitx Using CompactRIO e CAN1 MyFpgaBitfile lvbitx uses compiled bitfile MyFpgaBitfile 1lvbitx which must be FTP copied to the root of the CompactRIO target Automotive Diagnostic Command Set User Manual 5 34 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW First communication to the ECU is tried on the default 11 bit OBD CAN identifiers if that fails the default 29 bit OBD CAN identifiers are tried If that also fails the VI returns an error You can overwrite the default OBD CAN identifiers optionally with any other identifiers In general it is not necessary to manipulate the diag ref out cluster contents National Instruments 5 35 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Open Diagnostic vi Purpose Opens a diagnostic session on a CAN port Communication to the ECU is not yet started Format CAN interface baudrate transport protocol error in no error transmit ID receive ID diag ref out error out Input CAN interface specifies the CAN interface on which the diagnostic communication
26. error out describes the error status of this VI 18 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 the VI did not execute the intended operation A positive value means warning the 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 UDS RequestTransferExit vi terminates a download or upload process initialized with UDS RequestDownload vi or UDS RequestUpload vi Automotive Diagnostic Command Set User Manual 5 150 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW UDS RequestUpload vi Purpose Initiates an upload of data from the ECU Format data format identifier diag ref in diag ref out memory address s block size memory size pm SUCCESS error in no error 1 t error out memory address length memory size length Input H E HAE National Instruments data format identifier defines the compression and encryption scheme to be used for the data blocks read from the ECU A value of 0 means no compression no encryption Nonzero values are not standardized and implementation dependent diag ref in specifies the handle for the diagnostic session This is obtaine
27. 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 ndStatusToString function to obtain a descriptive string for the return value Description This function executes the ReportDTCBySeverityMaskRecord subfunction of the UDS ReadDiagnosticTroubleCodeInformation service and reads the selected DTCs For further details about this service refer to the ISO 15765 3 standard National Instruments 6 119 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C ndUDSReportDTCByStatusMask Purpose Executes the ReportDTCByStatusMask subfunction of the UDS ReadDiagnosticTroubleCodeInformation service Reads selected Diagnostic Trouble Codes DTCs Format long ndUDSReportDTCByStatusMask TD1 diagRef unsigned char statusMask TD3 DTCDescriptor unsigned char statusAvailMask TD4 DTCs long len LVBoolean success Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic or ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct statusMask Defines the status of DTCs to be read The values are application specific DTCDesc
28. ndDiagnosticService Purpose Executes a generic diagnostic service If a special service is not available through the KWpP2000 UDS or OBD service functions you can build it using this function Format long ndDiagnosticService TD1 diagRef LVBoolean requireResponse unsigned char dataIn long len unsigned char dataOut long len2 Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct requireResponse Indicates whether a response to this service is required If requireResponse is FALSE dataOut returns no values and 1en2 returns 0 This parameter is passed by reference dataIn Contains the request message byte sequence for the diagnostic service sent to the ECU len Must contain the number of valid data bytes in dataIn Output dataOut Contains the response message byte sequence of the diagnostic service returned from the ECU len2 On input 1en2 must contain the number of bytes provided for the dataOut buffer On output it returns the number of valid data bytes in dataOut National Instruments 6 23 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C Return Value The return value indicates the function call status as a signed 32 bit integer Zero means the function executed successfully A negativ
29. subnet to identify themselves ndDolIPSendVehicleIdentReqEID Sends a UDP request to all DoIP capable vehicles with a certain EID MAC address in the local subnet to identify themselves Automotive Diagnostic Command Set User Manual 6 4 ni com Chapter 6 Automotive Diagnostic Command Set API for C Table 6 2 Functions for the Automotive Diagnostic Command Set for C Continued Function Purpose ndDoIPSendVehicleIdentReqVIN Sends a UDP request to all DoIP capable vehicles with a certain VIN Vehicle Identification Number in the local subnet to identify themselves ndDTCToString Returns a string representation such as P1234 for a 2 byte diagnostic trouble code DTC ndECUReset Executes the ECUReset service Resets the ECU ndEnableNormalMessageTransmission Executes the EnableNormalMessage Transmission service The ECU starts transmitting its regular communication messages usually CAN messages ndGet Property Gets a diagnostic global internal parameter ndGetTimeStamp Gets timestamp information about the first last send received frame of the ISO TP for CAN and LIN ndInputOutputControlByLocaliIdentifier Executes the InputOutputControlBy Localldentifier service Modifies the ECU I O port behavior ndOBDClearEmissionRelatedDiagnosticInformation Executes the OBD Clear Emission Related Diagnostic Information service Clears emission related diagnostic troubl
30. 0 means success A negative value means error the VI did not execute the intended operation A positive value means warning the 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 This VI requests memory data from the ECU identified by the address and size parameters The data out format and definition are vehicle manufacturer specific data out includes analog input and output signals digital input and output signals internal data and system status information if the ECU supports them For further details about this service refer to the ISO 14230 3 standard Automotive Diagnostic Command Set User Manual 5 92 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW ReadStatusOfDTC vi Purpose Executes the ReadStatusOfDiagnosticTroubleCodes service Reads selected Diagnostic Trouble Codes DTCs Format DTG descriptor rann diag ref in MAI a diag ref out group of DTC DTCs error in no erro O Sea pS SUCCESS w error out Input National Instruments DTC descriptor is a cluster that describes the DTC records the ECU delivers DTC Byte Length indicates the number of bytes the ECU sends for each DTC The default is 2 Status Byte Length indicates the number of byte
31. 1 6 UDS DiagOnCAN services C API 6 103 LabVIEW API 5 116 UDS ClearDiagnosticInformation vi 5 116 UDS CommunicationControl vi 5 119 UDS ControlDTCSetting vi 5 121 UDS DiagnosticSessionControl vi 5 123 UDS ECUReset vi 5 125 UDS InputOutputControlBy Identifier vi 5 127 UDS ReadDataByldentifier vi 5 129 UDS ReadMemoryByAddress vi 5 131 UDS ReportDTCBySeverityMask Record vi 5 133 UDS ReportDTCByStatusMask vi 5 136 UDS ReportSeverityInformationOf DTC vi 5 139 UDS ReportSupportedDTCs vi 5 142 UDS RequestDownload vi 5 145 UDS RequestSeed vi 5 147 UDS RequestTransferExit vi 5 149 UDS RequestUpload vi 5 151 ni com UDS RoutineControl vi 5 153 UDS SendKey vi 5 155 UDS TesterPresent vi 5 157 UDS TransferData vi 5 159 UDS WriteDataB yIdentifier vi 5 162 UDS WriteMemoryByAddress vi 5 164 UDS06 ReadMemoryByAddress vi 5 166 UDS06 WriteMemoryByAddress vi 5 168 Unified Diagnostic Services 1 5 V Visual C 6 using with Automotive Diagnostic Command Set 3 2 VWTP Connect vi 5 45 VWTP Connection Test vi 5 47 VWTP Disconnect vi 5 49 W Web resources A 1 Windows Guest accounts xix National Instruments Index WriteDataB yLocalldentifier vi 5 112 WriteMemoryByAddress vi 5 114 WWH OBD World Wide Harmonized On Board Diagnostics services C API 6 170 LabVIEW API 5 193 WWH OBD Clear Emission Related DTCs vi 5 193 WWH OBD Convert DTCs to J1939 vi 5 195 WWH OBD Convert DTCs to J2012
32. 5 Automotive Diagnostic Command Set API for LabVIEW VWTP Disconnect vi Purpose Terminates a connection channel to an ECU using the VW TP 2 0 Format diag ref in diag ref out error in error out diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster error in is a cluster that 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 TE status is TRUE code is the error code number identifying an error A value of 0 means success A negative value means error the VI did not execute the intended operation A positive value means warning the VI executed intended operation but an informational warning is returned For a description of the code wire the error cluster to a LabVIEW error handling VI such as the Simple Error Handler source identifies the VI where the error occurred National Instruments 5 49 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Output diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs error out describes error conditions If the error in cluster indicate
33. 7 warningIndicatorRequested AddData contains optional additional data for this DTC Usually this does not contain valid information refer to DTCDescriptor FMI contains the failure mode identifier lenDTCsJ1939 On input lenDTCsJ1939 must contain the DTCsJ1939 array length On return it contains the number of valid data bytes in the DTCsJ1939 array Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value Automotive Diagnostic Command Set User Manual 6 172 ni com Chapter 6 Automotive Diagnostic Command Set API for C ndWWHOBDConvertDTCsToJ2012 Purpose Converts DTCs to the J2012 DTC format Format long ndWWHOBDConvertDTCsToJ2012 TD4 DTCcs long lenDTCs TD5 DTCsJ2012 long lenDTCsJ2012 Input DTCs The DTC to convert as an array of structs typedef struct unsigned long DTC unsigned long Status unsigned long AddData TD4 lenDTCs Must contain the number of valid data bytes in DTCs Output DTCsJ2012 Returns the converted DTCs to the J2012 format as an array of structs typedef struct unsi
34. ByteOrder indicates the byte ordering for multibyte items 0 MSB_FIRST Motorola default 1 LSB_FIRST Intel The response byte stream is interpreted according to this description and the resulting DTC records are returned in the DTCs struct array For this service DTCByteLength and ByteOrder are used to format the groupO DTC parameter correctly into the request message Output Success Indicates successful receipt of a positive response message for this diagnostic service Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value Automotive Diagnostic Command Set User Manual 6 66 ni com Chapter 6 Automotive Diagnostic Command Set API for C ndDisableNormalMessageTransmission Purpose Executes the DisableNormalMessageTransmission service The ECU no longer transmits its regular communication messages usually CAN messages Format long ndDisableNormalMessageTransmission TD1 diagRef LVBoolean requireResponse LVBoolean success Input diagRef Specifies the diagnostic session handle obtained from ndOpenDi
35. Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C ndDolPSendVehicleldentReqVIN Purpose Sends a UDP request to all DoIP capable vehicles with a certain VIN Vehicle Identification Number in the local subnet to identify themselves Format long ndDoIPSendVehicleIdentReqVIN TD1 diagRef ession obtained from ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually The 17 character Vehicle Identification Number of the DoIP entity that is assumed to char VIN Input diagRef Specifies the handle for the diagnostic s manipulate the elements of this struct VIN respond zero terminated string Output Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value Description ndDoIPSendVehicleIdentReqVIN sends a Vehicle Identification Request to all DoIP entities in the local subnet identified by the Usually this is done as part of ndDoIPGet separately given VIN Entities and does not need to be executed Automotive
36. Connect vi After that you can execute diagnostic services on the TCP IP connection This VI replaces the standard CAN based Open Diagnostic vi because the CAN parameters are no longer relevant for IP based diagnostics In general you do not need to manipulate the Diag reference out cluster contents National Instruments 5 41 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Open Diagnostic on LIN vi Purpose Opens a diagnostic session on an NI XNET LIN port Communication to the ECU is not yet p 8 P y started Format NAD Interface Diag Ref Out Baud Rate error in no error rae MasterReqFrame SlaveRespFrame Input Interface specifies the LIN interface on which the diagnostic communication should take place and points to the corresponding database cluster The values for the XNET hardware interface names are LIN1 LIN2 and so on The Automotive Diagnostic Command Set supports NI XNET LIN devices for LIN communication only To use your NI XNET interface define your interface under NI XNET Devices in MAX and pass the NI XNET interface name that the Automotive Diagnostic Command Set will use To do this add nixnet to the protocol string for example LINI nixnet The interface name is related to the NI XNET hardware naming under Devices and Interfaces in MAX The Automotive Diagnostic Command Set requires valid assignments to a LIN database such
37. Defines the identifier of the routine to be started The values are application specific Output dataOut Returns application specific output parameters from the routine len On input len must contain the dataOut array length On return it contains the number of valid data bytes in the dataOut array success Indicates successful receipt of a positive response message for this diagnostic service Automotive Diagnostic Command Set User Manual 6 184 ni com Chapter 6 Automotive Diagnostic Command Set API for C Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value Description The WWH OBD RoutineControl service is based on the UDS RoutineControl service ISO 14229 1 National Instruments 6 185 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C ndWWHOBDRequestSupportedDIDs Purpose Executes the WWH OBD ReadDataByldentifier service to retrieve the valid DID values for this service Format long ndWWHOBDRequestSupportedDIDs TD1 diagRef unsigned short DID
38. Definition Negative Error Function did not perform the expected behavior Positive Warning Function performed as expected but a condition arose that may require attention Zero Success Function completed successfully The application code should check the status returned from every Automotive Diagnostic Command Set function If an error is detected close all Automotive Diagnostic Command Set handles and exit the application If a warning is detected you can display a message for debugging purposes or simply ignore the warning The following code shows an example of handling Automotive Diagnostic Command Set status during application debugging Status ndOpenDiagnostic CANO 500000 0 Ox7EO Ox7E8 amp MyDiagHandle PrintStat status ndOpenDiagnostic where the function Print Stat has been defined at the top of the program as void PrintStat mcTypeStatus status char source char statusString 1024 long len sizeof statusString if status 0 ndStatusToString status statusString amp len printf n s nSource s n statusString source if status lt 0 ndCloseDiagnostic amp MyDiagHandle exit 1 National Instruments 6 45 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C ndVWTPConnect Purpose Establishes a connection channel to an ECU using the VW TP 2 0 Format long ndVwTPConnect TD1 diag
39. Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW WriteMemoryByAddress vi Purpose Executes the WriteMemoryByAddress service Writes data to the ECU memory Format data in diag ref in diag ref out address success size error out error in no error Input data in defines the memory block to be written to the ECU diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi or Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster Ae address defines the memory address to which data are written Notice that only three bytes are sent to the ECU so the address must be in the range O FFFFFF hex size defines the length of the memory block to be written error in is a cluster that 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 We B 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 the VI did not execute the intended operation A positive value means warning the VI executed intended operation but an informational warning is returned For a description of the code wire the error cluster to a
40. Diagnostic on IP vi 5 40 Open Diagnostic on LIN vi 5 42 Open Diagnostic vi 5 36 ReadDataByLocalldentifier vi 5 84 ReadDTCByStatus vi 5 86 ReadECUIdentification vi 5 89 ReadMemoryByAddress vi 5 91 ReadStatusOfDTC vi 5 93 RequestRoutineResultsByLocal Identifier vi 5 96 National Instruments l 5 Index RequestSeed vi 5 98 SendKey vi 5 100 StartDiagnosticSession vi 5 102 StartRoutineB yLocalldentifier vi 5 104 StopDiagnosticSession vi 5 106 StopRoutineByLocalldentifier vi 5 108 TesterPresent vi 5 110 UDS DiagOnCAN services 5 116 UDS ClearDiagnostic Information vi 5 116 DS CommunicationControl vi 5 119 JDS ControlDTCSetting vi 5 121 DS DiagnosticSessionControl vi 5 123 DS ECUReset vi 5 125 DS InputOutputControlBy Identifier vi 5 127 JDS ReadDataByldentifier vi 5 129 DS ReadMemoryByAddress vi 5 131 JDS ReportDTCBySeverityMask Record vi 5 133 JDS ReportDTCByStatusMask vi 5 136 DS ReportSeverityInformationOf DTC vi 5 139 DS ReportSupportedDTCs vi 5 142 DS RequestDownload vi 5 145 DS RequestSeed vi 5 147 DS RequestTransferExit vi 5 149 DS RequestUpload vi 5 151 DS RoutineControl vi 5 153 DS SendKey vi 5 155 DS TesterPresent vi 5 157 DS TransferData vi 5 159 DS WriteDataBylIdentifier vi 5 162 DS WriteMemoryByAddress vi 5 164 DS06 ReadMemoryBy Address vi 5 166 UDS06 WriteMemoryBy Address vi 5 168 VWTP Connect vi 5 45 VWTP Connection Test vi 5 47 VWITP Disconnect vi 5 49
41. ECU data record stored while a diagnostic trouble code occurred Automotive Diagnostic Command Set User Manual 6 6 ni com Chapter 6 Automotive Diagnostic Command Set API for C Table 6 2 Functions for the Automotive Diagnostic Command Set for C Continued Function Purpose ndOBDRequestVehicleInformation Executes the OBD Request Vehicle Information service Reads a set of information data from the ECU ndOpenDiagnostic Opens a diagnostic session on a CAN port Communication to the ECU is not yet started ndOpenDiagnosticOnIP Opens a diagnostic session on an IP port Communication to the ECU is not yet started ndOpenDiagnosticOnLIN Opens a diagnostic session on an NI XNET LIN port Communication to the ECU is not yet started ndReadDataByLocaliIdentifier Executes the ReadDataByLocal Identifier service Reads an ECU data record ndReadDTCByStatus Executes the ReadDiagnosticTrouble CodesByStatus service Reads selected Diagnostic Trouble Codes DTCs ndReadECUIdentification Executes the ReadECUIdentification service Returns ECU identification data from the ECU ndReadMemoryByAddress Executes the ReadMemoryByAddress service Reads data from the ECU memory ndReadStatusO DTC Executes the ReadStatusOfDiagnostic TroubleCodes service Reads selected Diagnostic Trouble Codes DTCs National Instruments 6 7 Automotive Diagnostic Command Set User
42. Executes the WWH OBD ClearDiagnosticInformation service Clears selected Diagnostic Trouble Codes DTCs WWH OBD Convert DTCs to J1939 vi Converts DTCs to the J1939 DTC format WWH OBD Convert DTCs to J2012 vi Converts DTCs to the J2012 DTC format WWH OBD Request DID vi Executes the WWH OBD ReadDataB yldentifier service Reads a data record from the ECU WWH OBD Request DTC Extended Data Record vi Executes the WWH OBD ReadDTCInformation service Reads selected Diagnostic Trouble Codes DTCs WWH OBD Request Emission Related DTCs vi Executes the WWH OBD ReadDTCInformation service Reads selected Diagnostic Trouble Codes DTCs WWH OBD Request Freeze Frame Information vi Executes the WWH OBD ReadDTCInformation service Reads selected Diagnostic Trouble Codes DTCs WWH OBD Request RID vi Executes the WWH OBD RoutineControl service Reads a data record from the ECU WWH OBD Request Supported DIDs vi Executes the WWH OBD ReadDataByldentifier service to retrieve the valid DID values for this service WWH OBD Request Supported RIDs vi Executes the WWH OBD RoutineControl service to retrieve the valid RID values for this service National Instruments 5 9 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW General Functions Close Diagnostic vi Purpose Closes a diagnostic ses
43. Flow Control frame A value of 0 default means all Consecutive Frames are sent in one run without interruption Wait Time CF STmin defines the minimum time for the slave to wait between sending two Consecutive Frames of a block Values from 0 to 127 are wait times in milliseconds Values 241 to 249 Hex F1 to F9 mean wait times of 100 us to 900 us respectively All other values are reserved The default is 5 ms Max Wait Frames N_WFTmax is the maximum number of WAIT frames the master accepts before terminating the connection The default is 10 Wait Frames to Send N_WAIT is the number of WAIT frames the master sends every time before a CTS frame is sent If you set this value to a negative number for example OXFFFFFFFF 1 the master sends an OVERLOAD frame instead of a WAIT and reception is aborted The default is 0 for maximum speed Time between Waits T_W is the number of milliseconds the master waits after sending a WAIT frame The default is 25 Automotive Diagnostic Command Set User Manual 6 26 ni com 10 11 12 13 14 15 National Instruments Chapter 6 Automotive Diagnostic Command Set API for C Fill CAN Frames returns whether a CAN frame is transmitted with 8 bytes or less 0 Short CAN frames are sent with DLC lt 8 1 Short CAN frames are filled to 8 bytes with Fill Byte default Fill Byte returns the CAN frame content if filled with defined data or random data bytes 0 255 Byt
44. Handler source identifies the VI where the error occurred 5 173 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW OBD Request Current Powertrain Diagnostic Data vi Purpose Executes the OBD Request Current Powertrain Diagnostic Data service Reads a data record from the ECU Format diag ref in diag ref out PID data out error in no error SUCCESS error out Input diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster PID defines the parameter identifier of the data to be read The SAE J1979 standard defines the values error in is a cluster that describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out EE B 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 the VI did not execute the intended operation A positive value means warning the 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
45. LabVIEW error handling VI such as the Simple Error Handler source identifies the VI where the error occurred Automotive Diagnostic Command Set User Manual 5 114 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Output diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs success indicates successful receipt of a positive response message for TE ee this diagnostic 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 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 the VI did not execute the intended operation A positive value means warning the 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 This VI performs the KWP2000 WriteDataBy Address service and writes RecordValues data values to the ECU address and size identify the data The vehicle manufacturer must ensure the ECU conditions are met when performing this service Typical use cases are clearing nonvolatile memory resetting learned values setting option content
46. Ls a e Format saseta ei tas di asta Ao eea eet E Lent E E E eam A ES Input and Qutp t ie aen a iin tase eked ea a DESCHiptiOnis enen eee r a a aa e e eorr a eT Eistof VIS anae a e E E T GO A a a General Function Speisen aa a n a a apeedeeet Close Diagnostic Vior kk tae ite A O a Convert from PAYS Vi kereken oer arnir shee ET E E EA RR En Convert to Phys Vieicrenne enn a E A E leslie Create Extended CAN TIDS Vienn n AE A E RE Diag Get Property Vipero aeaa EE E et eo ER Diag Set Property Vise wacverss test sescentes es endua eiere a e a Aera Diagnostic Frame Rec Vierer e aE E a TEE E Automotive Diagnostic Command Set User Manual viii ni com Contents Diagnostic Frame Send vi s csschseisccespeeadscoede wis eseeseends cote ved ety reeegseeteee aoe 5 25 Did BNOStic SOrviCe Visine reiissi cede tesestabes es aisian cases idges ovdended excuses seeseadeeeed 5 27 DTC to Stone Vis irc che aide hate hand Maeve ahs ie Malate ee dee 5 29 Get Time Stamp Vi sessssedsesticicsuspeyeadeasestescsaeiaeadsais hase dees thdeeesedemeeyeele 5 30 OBD Open Vinnan MAHER ie E A nanan 5 32 Open Dia ghost O Vi e ai orrat eal ea Ra OA aia 5 36 Open Diagnostic on IP VI niisiis potini o ne E E EEE EEK 5 40 Open Diagnostic on LIN Vi psspenininsiisna ina a a 5 42 VWTP COMM Yi enrera ita aae ai ei aae 5 45 VWTP Connection Test Yl oisiiiesis ricer isinen aaiae aaora iin 5 47 VWTP Disconnect Viessussenienienninan renia ene iaiia 5 49 DolP PUNCHIONS cenian aaa i e
47. Purpose Format Input Initiates a download of data to the ECU long ndUDSRequestDownload TD1 diagRef unsigned long memoryAddress unsigned long memorySize unsigned char memoryAddressLength unsigned char memorySizeLength unsigned char dataFormatIdentifier unsigned long blockSize LVBoolean success diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic or ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct memoryAddress Defines the memory address to which data are to be written memorySize Defines the size of the data to be written memoryAddressLength Defines the number of bytes of the memoryAddress parameter that are written to the ECU This value is implementation dependent and must be in the range of 1 4 For example if this value is 2 only the two lowest bytes of the address are written to the ECU memorySizeLength Defines the number of bytes of the memorySize parameter that are written to the ECU This value is implementation dependent and must be in the range of 1 4 For example if this value is 2 only the two lowest bytes of the size are written to the ECU dataFormatIdentifier Defines the compression and encryption scheme for the data blocks written to the ECU A value of 0 means no compression no encryption Nonzero values are not standardized and implementation
48. SAE J1979DA standard defines the values error in is a cluster that 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 TE status is TRUE code is the error code number identifying an error A value of 0 means success A negative value means error the VI did not execute the intended operation A positive value means warning the VI executed intended operation but an informational warning is returned For a description of the code wire the error cluster to a LabVIEW error handling VI such as the Simple Error Handler source identifies the VI where the error occurred National Instruments 5 199 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Output diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs data out returns the ECU data record If you know the record data description you can use Convert from Phys vi to interpret this record You can obtain the description from the SAE J1979DA standard success indicates successful receipt of a positive response message for this diagnostic service F 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 t
49. Set User Manual 5 4 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Table 5 1 Automotive Diagnostic Command Set API VIs for LabVIEW Continued Function Purpose OBD Request Permanent Fault Codes vi Executes the OBD Request Permanent Fault Codes service All permanent Diagnostic Trouble Codes DTCs are read OBD Request Powertrain Freeze Frame Data vi Executes the OBD Request Powertrain Freeze Frame Data service Reads a data record from the ECU that has been stored while a Diagnostic Trouble Code occurred OBD Request Supported PIDs vi Executes the OBD Request Current Powertrain Diagnostic Data service to retrieve the valid PID values for this service OBD Request Vehicle Information vi Executes the OBD Request Vehicle Information service Reads a set of information data from the ECU Open Diagnostic vi Opens a diagnostic session on a CAN port Communication to the ECU is not yet started Open Diagnostic on IP vi Opens a diagnostic session on an IP port Communication to the ECU is not yet started Open Diagnostic on LIN vi Opens a diagnostic session on an NI XNET LIN port Communication to the ECU is not yet started ReadDataByLocalldentifier vi Executes the ReadDataByLocalldentifier service Reads a data record from the ECU ReadDTCByStatus vi Executes the ReadDiagnosticTroubleCodesByStatus service Reads selected Diagnostic Tro
50. Set User Manual 6 102 ni com Chapter 6 Automotive Diagnostic Command Set API for C UDS DiagOnCAN Services ndUDSClearDiagnosticInformation Purpose Executes the UDS ClearDiagnosticInformation service Clears selected Diagnostic Trouble Codes DTCs Format long ndUDSClearDiagnosticInformation TD1 diagRef unsigned long groupOfDTC TD3 DTCDescriptor LVBoolean success Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic or ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct groupOfDTC Specifies the group of diagnostic trouble codes to be cleared The values are application specific The following value has a special meaning OxFFFFFF All DTCs DTCDescriptor A struct that describes the DTC records the ECU delivers typedef struct long DTCByteLength long StatusByteLength long AddDataByteLength unsigned short ByteOrder TDs DTCByteLength indicates the number of bytes the ECU sends for each DTC The default is 2 StatusByteLength indicates the number of bytes the ECU sends for each DTC s status The default is 1 AddDataByteLength indicates the number of bytes the ECU sends for each DTC s additional data Usually there are no additional data so the default is 0 National Instruments 6 103 Automotive Diagnostic Command Set User Manual
51. User Manual 5 120 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW UDS ControlDTCSetting vi Purpose Executes the UDS ControlDTCSetting service Modifies Diagnostic Trouble Code DTC generation behavior Format diag ref in diag ref out data in success type error out error in no error Input El BE a National Instruments diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi or Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster data in specifies application specific data that control DTC generation type specifies the control mode 1 on 2 off error in is a cluster that 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 the VI did not execute the intended operation A positive value means warning the 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
52. Usually this is a bit field with following Bit Meaning 0 testFailed 1 testFailedThisMonitoringCycle 2 pendingDTC 3 confirmedDTC 4 testNotCompletedSinceLastClear 5 testFailedSinceLastClear 6 testNotCompletedThisMonitoringCycle 7 warningIndicatorRequested Automotive Diagnostic Command Set User Manual 5 140 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Add Data contains optional additional data for this DTC success indicates successful receipt of a positive response message for this diagnostic 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 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 the VI did not execute the intended operation A positive value means warning the VI executed intended operation but an informational warning is returned For a description of the code wire the error cluster to a LabVIEW error handling VI such as the Simple Error Handler source identifies the VI where the error occurred status avail mask is an application specific value returned for all DTCs Description This VI executes the ReportSeverityInformationOfDTC subfunction of the UDS ReadDiagnosticTroubleCodeInformation service and reads the selected DTCs fr
53. X RPM in Motorola representation you can use Convert to Phys vi to extract the physical value from the byte stream by filling an appropriate type descriptor cluster National Instruments 5 15 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Create Extended CAN IDs vi Purpose Creates diagnostic CAN IDs according to ISO 15765 2 Format transmit ID receive ID addressing mode transport protocol source address target address Input addressing mode specifies whether the ECU is physically or functionally addressed transport protocol specifies whether normal or mixed mode addressing is used source address is the logical address of the host diagnostic tester target address is the ECU logical address Output TFA transmit ID is the generated CAN identifier for sending diagnostic request messages from the host to the ECU TEA receive ID is the generated CAN identifier for sending diagnostic response messages from the ECU to the host Description ISO 15765 2 specifies a method extended 29 bit of creating CAN identifiers for diagnostic applications given the addressing mode physical functional the transport protocol normal mixed and the 8 bit source and target addresses This VI implements the construction of these CAN identifiers You can use them directly in Open Diagnostic vi Automotive Diagnostic Command Set User Manual 5 16 ni com Diag Get Prope
54. about other technical support options in your area visit ni com services or contact your local office at ni com contact You also can visit the Worldwide Offices section of ni com niglobal to access the branch office websites which provide up to date contact information support phone numbers email addresses and current events A 3 Automotive Diagnostic Command Set User Manual Index A activating your software xvii application development 3 1 on CompactRIO or R Series using NI 985x or NI 986x C Series module 3 4 Automotive Diagnostic Command Set API C 6 1 LabVIEW 5 1 API structure 4 2 application development 3 1 available diagnostic services 4 4 choosing a programming language 3 1 configuration 2 1 general programming model figure 4 3 hardware requirements 2 3 installation 2 1 introduction 1 1 KWP2000 1 1 connect disconnect 1 3 diagnostic service format 1 2 diagnostic services 1 2 Diagnostic Trouble Codes 1 4 external references 1 4 GetSeed Unlock 1 3 input output control 1 4 measurements 1 4 read write memory 1 3 remote activation of a routine 1 4 transport protocol 1 2 LabVIEW RT configuration 2 2 OBD 1 6 software requirements 2 3 structure figure 4 1 tweaking the transport protocol 4 4 National Instruments l 1 UDS 1 5 diagnostic service format 1 6 diagnostic services 1 5 external references 1 6 using 4 1 using with LabVIEW 3 1 using with LabWindows CVI 3
55. as LDF or FIBEX To communicate with hardware products on the external network applications must understand how that hardware communicates in the actual embedded system such as the vehicle This embedded communication is described within a standardized file such as FIBEX xm1 or LDF 1d for LIN Within NI XNET this file is referred to as a database The database contains many object classes each of which describes a distinct entity in the embedded system For LIN select a LIN database and cluster to assign all settings from the selected cluster automatically such as the LIN Baudrate Master Request Frame Slave Response Frame or LIN Diagnostic Schedule Automotive Diagnostic Command Set User Manual 5 42 ni com H E H e E National Instruments Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Using NI XNET hardware the Interface string should look like the following examples e LIN1 nixnet XNET_LIN_Database Uses LIN interface 1 of an NI XNET device and assigns properties such as baudrate automatically from the XNET alias XNET_LIN_Database LIN2 nixnet XNET_LIN_Database Uses LIN interface 2 of an NI XNET device and so on with the form LINx Refer to the NI XNET Hardware and Software Manual to assign a database cluster alias MasterReqFrame selects the Master Request Frame from an LDF or FIBEX database If you assign an empty string default as MasterReqFrame the name as defined in the LIN M
56. clusters DTC is the resulting Diagnostic Trouble Code You can use WWH OBD Convert DTCs to J1939 vi or WWH OBD Convert DTCs to J2012 vi to convert this to readable format as SAE J1939 and SAE J2012 define Status is the DTC status Usually this is a bit field with the following meaning Bit Meaning 0 testFailed 1 testFailedThisOperationCycle 2 pendingDTC 3 confirmedDTC Automotive Diagnostic Command Set User Manual 5 204 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW 4 testNotCompletedSinceLastClear 5 testFailedSinceLastClear 6 testNotCompletedThisOperationCycle warningIndicatorRequested For OBD this field usually does not contain valid information Add Data contains optional additional data for this DTC Usually this does not contain valid information refer to DTC descriptor diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs DTC status availability mask is an application specific value returned for all DTCs DTC severity availability mask is an application specific value returned for all DTCs DTC format identifier is an application specific value returned for all DTCs success indicates successful receipt of a positive response message for this diagnostic 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 sta
57. dependent National Instruments 6 129 Automotive Diagnostic Command Set User Manual Chapter 6 Output Automotive Diagnostic Command Set API for C blockSize Returns the number of data bytes to be transferred to the ECU in subsequent ndUDSTransferData requests success Indicates successful receipt of a positive response message for this diagnostic service Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value Description ndUDSRequestDown1oad initiates the download of a data block to the ECU This is required to set up the download process the actual data transfer occurs with subsequent ndUDSTransferData requests The transfer must occur in blocks of the size this service returns the blockSize parameter After the download completes use the ndUDSRequestTransferExit service to terminate the process Automotive Diagnostic Command Set User Manual 6 130 ni com Chapter 6 Automotive Diagnostic Command Set API for C ndUDSRequestSeed Purpose Executes the UDS SecurityAccess service to retrieve a seed from the
58. execute the intended operation A positive value means warning the 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 DolIP Get Diagnostic Power Mode vi retrieves the Diagnostic Power Mode of a vehicle For example test equipment can use this information to verify whether the vehicle is in Diagnostic Power Mode which allows for performing reliable diagnostics on the vehicle s components Automotive Diagnostic Command Set User Manual 5 58 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW DoIP Get DolP Entity Status vi Purpose Gets status information from a DolP entity Format Diag reference in E Diag reference out Lae eee node type error in no error ok error out max sockets cur sockets Input Diag reference in specifies the diagnostic session handle obtained from Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster error in is a cluster that 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 TE statu
59. for LabVIEW Convert to Phys vi Purpose Converts a binary representation of a value into its physical value using a type descriptor Format type descriptor j value data in Input type descriptor is a cluster that specifies the conversion of the binary representation to its physical value Start Byte gives the binary representation start byte in the data in record Byte Length is the binary representation byte length Byte Order is the byte ordering of the data in the binary representation EE E 0 MSB_FIRST Motorola 1 LSB_FIRST Intel Data Type is the binary representation format l 0 Unsigned Only byte lengths of 1 4 are allowed 1 Signed Only byte lengths of 1 4 are allowed 2 Float Only byte lengths of 4 or 8 are allowed Scale Factor defines the physical value scaling Phys Scale Factor binary representation Scale Offset Scale Offset refer to Scale Factor B E data in is the data record from which physical values are to be extracted Automotive Diagnostic Command Set User Manual 5 14 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Output value is the physical value extracted from the record Description Data output from diagnostic services for example ReadDataByLocalldentifier vi is usually a byte stream of binary data If you have a description of the data output for example byte 3 and 4 are engine RPM scaled as 25
60. for LabVIEW Diagnostic Service vi Purpose Executes a generic diagnostic service If a special service is not available through the KWP2000 UDS or OBD service functions you can build it using this VI Format diag ref in EEE diag ref out require response error code data in pmm aaae 3 data out error in no error S lt lt eerror out Input diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster require response indicates whether a diagnostic service expects a response TRUE or not FALSE In the latter case error code is returned as 0 and data out as an empty array T data in defines the diagnostic service request message sent to the ECU as a stream of bytes error in is a cluster that 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 Ho H 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 the VI did not execute the intended operation A positive value means warning the VI executed intended operation but an informational warning is returned For a description of the code wire
61. handle obtained from Open Diagnostic vi or Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster mode indicates the diagnostic mode into which the ECU is brought The values are application specific The usual values are 01 defaultSession 02 ECUProgrammingSession 03 ECUExtendedDiagnosticSession error in is a cluster that 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 the VI did not execute the intended operation A positive value means warning the VI executed intended operation but an informational warning is returned For a description of the code wire the error cluster to a LabVIEW error handling VI such as the Simple Error Handler source identifies the VI where the error occurred 5 123 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Output diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs session parameter record returns implementation dependent data from the ECU success indicates successful receipt of a positive response m
62. implementation dependent For an upload this is a memory data block uploaded from the ECU len2 Must be set to the buffer size for the dataOut parameter On return it contains the actual data size returned in dataOut Success Indicates successful receipt of a positive response message for this diagnostic service Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value Description ndUDSTransferData executes the data transfer of a download process initiated with a previous ndUDSRequestDown1oad request or an upload process initiated with a previous ndUDSRequestUpload request The data transfer must occur in blocks of the size that has been returned in the block size parameter of the respective request service After the data transfer completes terminate the operation by calling the ndUDSRequestTransferExit service Automotive Diagnostic Command Set User Manual 6 144 ni com Chapter 6 Automotive Diagnostic Command Set API for C ndUDSWriteDataByldentifier Purpose Executes the UDS WriteDataBylIdentifier service Writ
63. 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 the VI did not execute the intended operation A positive value means warning the VI executed intended operation but an informational warning is returned For a description of the code wire the error cluster to a LabVIEW error handling VI such as the Simple Error Handler source identifies the VI where the error occurred 5 117 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Description This VI clears the diagnostic information on the ECU memory If the group of DTC parameter is present the ECU is requested to clear all memory including the DTCs For further details about this service refer to the ISO 15765 3 standard Automotive Diagnostic Command Set User Manual 5 118 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW UDS CommunicationControl vi Purpose Executes the UDS CommunicationControl service Use this VI to switch transmission and or reception of the normal communication messages usually CAN messages on or off Format diag ref in diag ref out type success communication type lo error out error in no error Input diag ref in specifies the d
64. is returned For a description of the code wire the error cluster to a LabVIEW error handling VI such as the Simple Error Handler source identifies the VI where the error occurred Description The WWH OBD RoutineControl service is based on the UDS RoutineControl service ISO 14229 1 National Instruments 5 209 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW WWH OBD Request Supported DIDs vi Purpose Executes the WWH OBD ReadDataByldentifier service to retrieve the valid DID values for this service Format diag ref in TE diag ref out DID f DIDs out error in no error i SUCCESS error out diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi or Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster DID specifies the diagnostic data identifier for this service The following values are valid and can be obtained through an enum control 0 PID parameter identifier 1 MID monitor identifier 2 ITID info type identifier error in is a cluster that 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 c
65. is the error code number identifying an error A value of 0 means success A negative value means error the VI did not execute the intended operation A positive value means warning the 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 rce identifies the VI where the error occurred National Instruments 5 191 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Output diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs data out returns the vehicle information from the ECU You can obtain the description from the SAE J1979 standard success indicates successful receipt of a positive response message for F ae f this diagnostic 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 H A E 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 the VI did not execute the intended operation A positive value means warning the VI executed intended operation but an informational warning is returned For a description of the code wire the error cluster to a L
66. logo WEDO and MINDSTORMS are trademarks of the LEGO Group TETRIX by Pitsco is a trademark of Pitsco Inc FIELDBUS FOUNDATION and FOUNDATION are trademarks of the Fieldbus Foundation EtherCAT is a registered trademark of and licensed by Beckhoff Automation GmbH CANopen is a registered Community Trademark of CAN in Automation e V DeviceNet and EtherNet IP are trademarks of ODVA Go SensorDAQ and Vernier are registered trademarks of Vernier Software amp Technology Vernier Software amp Technology and vernier com are trademarks or trade dress Xilinx is the registered trademark of Xilinx Inc Taptite and Trilobular are registered trademarks of Research Engineering amp Manufacturing Inc FireWire is the registered trademark of Apple Inc Linux is the registered trademark of Linus Torvalds in the U S and other countries Handle Graphics MATLAB Real Time Workshop Simulink Stateflow and xPC TargetBox are registered trademarks and TargetBox and Target Language Compiler are trademarks of The MathWorks Inc Tektronix Tek and Tektronix Enabling Technology are registered trademarks of Tektronix Inc The Bluetooth word mark is a registered trademark owned by the Bluetooth SIG Inc The ExpressCard word mark and logos are owned by PCMCIA and any use of such marks by National Instruments is under license The mark LabWindows is used under a license from Microsoft Corporation Windows i
67. 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 ndStatusToString function to obtain a descriptive string for the return value National Instruments 6 109 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C Description This function requests the ECU to perform an ECU reset effectively based on the mode parameter value content The vehicle manufacturer determines when the positive response message is sent Depending the value of mode the corresponding ECU reset event is executed as a hard reset key off on reset soft reset or other reset For further details about this service refer to the ISO 15765 3 standard Automotive Diagnostic Command Set User Manual 6 110 ni com Chapter 6 Automotive Diagnostic Command Set API for C ndUDSInputOutputControlByldentifier Purpose Executes the UDS InputOutputControlBylIdentifier service Modifies ECU I O port behavior Format long ndUDSInputOutputControlByIdenti fier TD1 diagRef unsigned short ID unsigned char mode unsigned char dataIn long len unsigned char dataOut long len2 LVBoolean success Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic or ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally i
68. ndWriteMemoryByAddress 6 101 ndWWHOBDClearEmissionRelated DTCs 6 170 ndWWHOBDConvertDTCsTo J1939 6 171 ndWWHOBDConvertDTCsTo J2012 6 173 ndWWHOBDRequestDID 6 175 ndWWHOBDRequestDTCExtendedData Record 6 177 ndW WHOBDRequestEmissionRelated DTCs 6 179 ndWWHOBDRequestFreezeFrame Information 6 182 ndWWHOBDRequestRID 6 184 ndWWHOBDRequestSupported DIDs 6 186 ndWWHOBDRequestSupported RIDs 6 188 OBD On Board Diagnostics services 6 153 UDS DiagOnCAN services 6 103 WWH OBD World Wide Harmonized On Board Diagnostics services 6 170 ClearDiagnosticInformation vi 5 70 Close Diagnostic vi 5 10 CompactRIO application development on using NI 985x or NI 986x C Series module 3 4 computer ID xviii configuration 2 1 connect disconnect KWP2000 1 3 ControlDTCSetting vi 5 73 Convert from Phys vi 5 12 Convert to Phys vi 5 14 Create Extended CAN IDs vi 5 16 National Instruments l 3 Index D deactivating a product xix Diag Get Property vi 5 17 Diag Set Property vi 5 20 Diagnostic Frame Recv vi 5 23 Diagnostic Frame Send vi 5 25 diagnostic service format KWP2000 1 2 UDS 1 6 Diagnostic Service vi 5 27 diagnostic services available 4 4 KWP2000 1 2 UDS 1 5 Diagnostic Trouble Codes KWP2000 1 4 DisableNormalMessageTransmission vi 5 76 documentation NI resources A 1 related documentation xv DoIP Activate Routing vi 5 51 DoIP Connect vi 5 53 DoIP Disconnect vi 5 55 DolP functions C API 6
69. negative value means error the VI did not execute the intended operation A positive value means warning the 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 This VI requests data record values from the ECU identified by the local ID parameter For further details about this service refer to the ISO 14230 3 standard National Instruments 5 85 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW ReadDTCByStatus vi Purpose Executes the ReadDiagnosticTroubleCodesByStatus service Reads selected Diagnostic Trouble Codes DTCs Format DTC descriptor Sessscessescsccsessccsseses diag ref in m a diag ref out mode DTCs group of DTC ee success error in no error i t error out Input DTC descriptor is a cluster that describes the DTC records the ECU delivers DTC Byte Length indicates the number of bytes the ECU sends for each DTC The default is 2 Status Byte Length indicates the number of bytes the ECU sends for each DTC s status The default is 1 Add Data Byte Length indicates the number of bytes the ECU sends for each DTC s additional data Usually there is no additional data so the default is 0 Byte Order indicates the byte orde
70. number of bytes the ECU sends for each DTC s status The default is 1 Add Data Byte Length indicates the number of bytes the ECU sends for each DTC s additional data For this subfunction the default is 2 Byte Order indicates the byte ordering for multibyte items 0 MSB_FIRST Motorola default 1 LSB_FIRST Intel This VI interprets the response byte stream according to this description and returns the resulting DTC records in the DTCs cluster array diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi or Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster 5 133 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW severity mask defines the status of DTCs to be read The values are application specific specific error in is a cluster that 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 defines the status of DTCs to be read The values are application status is TRUE if an error occurred This VI is not executed when TE status is TRUE code is the error code number identifying an error A value of 0 means success A negative value means error the VI did not execute the intended operation A positive value means
71. occurred Description DoIP Get Entities vi uses a UDP broadcast to identify all DoIP entities in the local subnet matching a certain condition The entities responding are returned in the DoIP Entities cluster array The conditions are either a common VIN or EID or simply all entities connected Refer to the DoIP Open Type and VIN or EID descriptions National Instruments 5 63 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW DoIP Send Vehicle Identification Request vi Purpose Sends a UDP request to all DoIP capable vehicles in the local subnet to identify themselves Format Diag reference in Diag reference out error in no error error out Input Diag reference in specifies the diagnostic session handle obtained from Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster error in is a cluster that 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 TF status is TRUE code is the error code number identifying an error A value of 0 means success A negative value means error the VI did not execute the intended operation A positive value means warning the VI executed intended oper
72. occurred The WWH OBD ReadDataByldentifier service is based on the UDS ReadDataByldentifier service ISO 14229 1 National Instruments 5 211 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW WWH OBD Request Supported RIDs vi Purpose Executes the WWH OBD RoutineControl service to retrieve the valid RID values for this service Format diag ref in M diag ref out error in no error Ecu RIDs SUCCESS error out Input diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi or Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster El error in is a cluster that describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out a status is TRUE if an error occurred This VI is not executed when status is TRUE code is the error code number identifying an error A value of 0 means success A negative value means error the VI did not execute the intended operation A positive value means warning the 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 wh
73. of the memory size parameter that are written to the ECU This value is implementation dependent and must be in the range of 1 4 For example if this value is 2 only the two lowest bytes of the size are written to the ECU diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs in subsequent UDS TransferData vi requests TE success indicates successful receipt of a positive response message for this diagnostic 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 block size returns the number of data bytes to be transferred from the ECU PTF 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 the VI did not execute the intended operation A positive value means warning the 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 UDS RequestUpload vi initiates the upload of a data block from the ECU This is required to set up the upload process the actual data transfer occurs with subsequent UDS TransferData vi requests The transfer must occur in blocks
74. of the size that this service returns the block size parameter After the upload completes use the UDS RequestTransferExit vi service to terminate the process Automotive Diagnostic Command Set User Manual 5 152 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW UDS RoutineControl vi Purpose Executes the UDS RoutineControl service Executes a routine on the ECU Format mode diag ref in UDS aaa diag ref out ID Erl l wo data out data in pm p SUCCESS error in no error error out Input mode defines the service operation mode You can obtain the values from a ring control A 1 Start Routine 2 Stop Routine 3 Request Routine Results Other values are application specific diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi or Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster EI ID defines the identifier of the routine to be started The values are application specific data in defines application specific input parameters for the routine error in is a cluster that 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 E status is TRUE if an error occurred This VI is not executed when status is TRUE Nation
75. on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster response required indicates whether the ECU answers this service TRUE default or not FALSE In the latter case success is TRUE error in is a cluster that 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 the VI did not execute the intended operation A positive value means warning the 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 Automotive Diagnostic Command Set User Manual 5 80 ni com Output National Instruments Chapter 5 Automotive Diagnostic Command Set API for LabVIEW diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs success indicates successful receipt of a positive response message for this diagnostic service error out describes error conditions If the error in cluster indicated an error the error out cluster contains the same information
76. or similar verification instrument the meaning is implementation dependent For an upload this is a memory data block uploaded from the ECU success indicates successful receipt of a positive response message for this diagnostic 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 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 the VI did not execute the intended operation A positive value means warning the 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 Automotive Diagnostic Command Set User Manual 5 160 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Description UDS TransferData vi executes the data transfer of a download process initiated with a previous UDS RequestDownload vi request or an upload process initiated with a previous UDS RequestUpload vi request The data transfer must occur in blocks of the size returned in the block size parameter of the respective request service After the data transfer has completed terminate the operation by calling the UDS R
77. ref in You can wire it to subsequent diagnostic VIs TE success indicates successful receipt of a positive response message for this diagnostic 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 AA 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 the VI did not execute the intended operation A positive value means warning the 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 This VI executes the UDS CommunicationControl service and switches transmission and or reception of the normal communication messages usually CAN messages on or off The type and communication type parameters are vehicle manufacturer specific one OEM may disable the transmission only while another OEM may disable the transmission and the reception based on vehicle manufacturer specific needs The request is either transmitted functionally addressed to all ECUs with a single request message or transmitted physically addressed to each ECU in a separate request message Automotive Diagnostic Command Set
78. ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs data out returns the ECU data record If you know the record data description you can use Convert from Phys vi to interpret this record You can obtain the description from the SAE J1979 standard success indicates successful receipt of a positive response message for this diagnostic service F 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 HH 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 the VI did not execute the intended operation A positive value means warning the 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 Automotive Diagnostic Command Set User Manual 5 188 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW OBD Request Supported PIDs vi Purpose Executes the OBD Request Current Powertrain Diagnostic Data service to retrieve the valid PID values for this service Format diag ref in diag ref out PIDs out error in no error error out Input diag
79. results from the ECU For further details about this service refer to the ISO 15765 3 standard Automotive Diagnostic Command Set User Manual 6 138 ni com Chapter 6 Automotive Diagnostic Command Set API for C ndUDSSendKey Purpose Executes the UDS SecurityAccess service to send a key to the ECU Format long ndUDSSendKey TD1 diagRef unsigned char accessMode unsigned char keyIn long len LVBoolean success Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic or ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct accessMode Indicates the security level to be granted The values are application specific This is an even number usually 2 keyIn Defines the key data to be sent to the ECU len Must contain the number of valid data bytes in keyIn Output success Indicates successful receipt of a positive response message for this diagnostic service Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a de
80. 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 the VI did not execute the intended operation A positive value means warning the 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 This VI disables the current ECU diagnostic mode A diagnostic session stops only if communication is established with the ECU and a diagnostic session is running If no diagnostic session is running the default session is active StopDiagnosticSession vi cannot disable the default session If the ECU has stopped the current diagnostic session it performs the necessary action to restore its normal operating conditions Restoring the normal operating conditions of the ECU may include resetting all controlled actuators if they were activated during the diagnostic session being stopped and resuming all normal ECU algorithms You should call StopDiagnosticSession vi before disabling communication with Close Diagnostic vi but only if you previously used StartDiagnosticSession vi National Instruments 5 107 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnost
81. setting the Vehicle Identification Number or changing calibration values For further details about this service refer to the ISO 14230 3 standard National Instruments 5 115 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW UDS DiagOnCAN Services UDS ClearDiagnosticInformation vi Purpose Executes the UDS ClearDiagnosticInformation service Clears selected Diagnostic Trouble Codes DTCs Format DTC descriptor COI diag ref in diag ref out group of DTC EF fer SUCCESS error in no error error out Input DTC descriptor is a cluster that describes the DTC records the ECU delivers DTC Byte Length indicates the number of bytes the ECU sends for each DTC The default is 2 Status Byte Length indicates the number of bytes the ECU sends for each DTC s status The default is 1 Add Data Byte Length indicates the number of bytes the ECU sends for each DTC s additional data Usually there is no additional data so the default is 0 Byte Order indicates the byte ordering for multibyte items 0 MSB_FIRST Motorola default 1 LSB_FIRST Intel The DTC descriptor is given here as a parameter basically to convert the group of DTC parameter to a binary representation according to DTC Byte Length and Byte Order diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi or Open Diagnostic on IP vi and w
82. specific ay Note The Automotive Diagnostic Command Set supports single point measurements Diagnostic Trouble Codes A major diagnostic feature is the readout of Diagnostic Trouble Codes DTCs KWP2000 defines several services that access DTCs based on their group or status Input Output Control KWP2000 defines services to modify internal or external ECU signals One example is redirecting ECU sensor inputs to stimulated signals The control parameters of these commands are manufacturer specific and not defined in the standard Remote Activation of a Routine These services are similar to the ActionService and DiagService functions of CCP You can invoke an ECU internal routine identified by a Local Commonldentifier or a memory address Contrary to the CCP case execution of this routine can be asynchronous that is there are separate Start Stop and RequestResult services The control parameters of these commands are manufacturer specific and not defined in the standard External References For more information about the KWP2000 Standard refer to the ISO 14230 3 standard Automotive Diagnostic Command Set User Manual 1 4 ni com Chapter 1 Introduction UDS Unified Diagnostic Services The UDS protocol has become a de facto standard in automotive diagnostic applications It is standardized as ISO 14229 UDS describes the implementation of various diagnostic services you can access through the protocol As UDS us
83. success Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic or ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct blockSequenceCounter Used to number the data blocks to be transferred to from the ECU The block sequence counter value starts at 01 hex with the first ndUDSTransferData request that follows the ndUDSRequestDownload or ndUDSRequestUpload service Its value is incremented by 1 for each subsequent ndUDSTransferData request At the value of FF hex the block sequence counter rolls over and starts at 00 hex with the next ndUDSTransferData request The block sequence counter is updated automatically and the updated value is returned dataIn Defines the data block to be written to the ECU For a download this is a memory data block to be downloaded to the ECU For an upload the meaning is implementation dependent len Must be set to the buffer size for the dataIn parameter National Instruments 6 143 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C Output blockSequenceCounter Returns the updated value of the block sequence counter refer to the description in the Input section dataOut Returns the memory data from the ECU For a download this may contain a checksum or similar verification instrument the meaning is
84. the CAN or LIN port For the VW TP 2 0 you should disconnect the communication channel established before closing Available Diagnostic Services The standards on automotive diagnostic define many different services for many purposes Unfortunately most services leave a large amount of room for manufacturer specific variants and extensions National Instruments implemented the most used variants while trying not to overload them with optional parameters However all services are implemented in LabVIEW and open to the user If you are missing a service or variant of an existing service you can easily add or modify it on your own In the C API you can also implement your own diagnostic services using the ndDiagnosticService routine However the templates from the existing services are not available Tweaking the Transport Protocol A set of global constants controls transport protocol behavior These constants default to maximum performance To check the properties of an implementation of a transport protocol in an ECU for example you may want to change the constants to nonstandard values using the Get Set Property routines Automotive Diagnostic Command Set User Manual 4 4 ni com Automotive Diagnostic Command Set API for LabVIEW This chapter lists the LabVIEW VIs for the Automotive Diagnostic Command Set API and describes the format purpose and parameters for each VI The VIs are listed alphabetically in four catego
85. the J2012 DTC format ndWWHOBDRequestDID Executes the WWH OBD ReadDataByldentifier service Reads a data record from the ECU ndWWHOBDRequestDTCExtendedDataRecord Executes the WWH OBD ReadDTCInformation service Reads selected Diagnostic Trouble Codes DTCs ndWWHOBDRequest EmissionRelatedDTCs Executes the WWH OBD ReadDTCInformation service Reads selected Diagnostic Trouble Codes DTCs ndWWHOBDRequestFreezeFrameInformation Executes the WWH OBD ReadDTCInformation service Reads selected Diagnostic Trouble Codes DTCs ndWWHOBDRequestRID Executes the WWH OBD RoutineControl service Reads a data record from the ECU ndWWHOBDRequestSupportedDIDs Executes the WWH OBD ReadDataByldentifier service to retrieve the valid DID values for this service ndWWHOBDRequestSupportedRIDs Executes the WWH OBD RoutineControl service to retrieve the valid RID values for this service Automotive Diagnostic Com mand Set User Manual 6 12 ni com Chapter 6 Automotive Diagnostic Command Set API for C General Functions ndCloseDiagnostic Purpose Closes a diagnostic session Format long ndCloseDiagnostic TD1 diagRefIn Input diagRefiIn Specifies the diagnostic session handle obtained from ndOpenDiagnostic and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct Output Retur
86. the error cluster to a LabVIEW error handling VI such as the Simple Error Handler source identifies the VI where the error occurred National Instruments 5 27 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Output diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs error code is the error code sent with a negative response message In addition the error cluster indicates an error and gives a more detailed description If no negative response message occurred 0 is returned data out returns the diagnostic service response message positive or negative the ECU sends as a stream of bytes 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 fe 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 the VI did not execute the intended operation A positive value means warning the 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 Diagnostic Service vi is a generic routine to execute any diag
87. the identifier of the I O to be manipulated The values are application specific mode defines the I O control type The values are application specific The usual values are B E 0 ReturnControlToECU 1 ResetToDefault 2 FreezeCurrentState 3 ShortTermAdjustment error in is a cluster that 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 B status is TRUE if an error occurred This VI is not executed when status is TRUE National Instruments 5 127 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Output m Description code is the error code number identifying an error A value of 0 means success A negative value means error the VI did not execute the intended operation A positive value means warning the 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 diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs data out returns application specific data for this service success indicates successful receipt of a positive response message for this diagnostic service error out describes error conditions If the error in
88. this input unwired if you are activating a route through DoIP Activate Routing vi Diag reference out is a copy of Diag reference in You can wire it to subsequent diagnostic 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 the VI did not execute the intended operation A positive value means warning the 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 DoIP Connect vi creates a unique TCP IP data connection to a certain DoIP entity identified by its IP address The IP address might be retrieved from DoIP Get Entities vi The TCP IP data connection is needed to exchange diagnostic service requests You can specify Source Address and Target Address at this point or leave them blank if a routing activation is executed later using DoIP Activate Routing vi Automotive Diagnostic Command Set User Manual 5 54 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW DolP Disconnect vi Purpose Disconnects the TCP IP conne
89. to 127 are wait times in milliseconds Values 241 to 249 Hex F1 to F9 mean wait times of 100 us to 900 us respectively All other values are reserved The default is 5 ms for CAN 5 17 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW 5 Max Wait Frames N_WF Tmax is the maximum number of WAIT frames the master accepts before terminating the connection The default is 10 6 Wait Frames to Send N_WAIT is the number of WAIT frames the master sends every time before a CTS frame is sent If this value is set to a negative number for example OxFFFFFFFF 1 the master sends an OVERLOAD frame instead of a WAIT and reception is aborted The default is 0 for maximum speed 7 Time between Waits T_W is the number of milliseconds the master waits after sending a WAIT frame The default is 25 8 Fill CAN Frames returns whether a CAN frame is transmitted with 8 bytes or less 0 Short CAN frames are sent with DLC lt 8 1 Short CAN frames are filled to 8 bytes with Fill Byte default 9 Fill Byte returns the CAN frame content if filled with defined data or random data bytes 0 255 Byte is used optionally to fill short CAN frames 256 Short CAN frames are filled optionally with random bytes The default is 255 OXFF 10 Invalid Response as Error returns how the toolkit handles an invalid ECU response 0 Invalid response is indicated by success FALSE only default
90. to a binary representation according to DTC Byte Length and Byte Order National Instruments 5 203 Automotive Diagnostic Command Set User Manual Chapter 5 Output Automotive Diagnostic Command Set API for LabVIEW El HEE TE E E Eo E E diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi or Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster DTC status mask defines the status of DTCs to be read The values are application specific DTC severity mask defines the severity information of DTCs to be read The values are application specific error in is a cluster that 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 the VI did not execute the intended operation A positive value means warning the 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 DTCs returns the resulting DTCs as an array of
91. unsigned char DIDsOut long len LVBoolean success Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct DID Specifies the diagnostic data identifier for this service The following values are valid and can be obtained through an enum control 0 PID parameter identifier 1 MID monitor identifier 2 ITID info type identifier Output DIDsOut Returns an array of valid DIDs len On input len must contain the DIDsOut array length On return it contains the number of valid data bytes in the DIDsOut array Success Indicates successful receipt of a positive response message for this diagnostic service Automotive Diagnostic Command Set User Manual 6 186 ni com Chapter 6 Automotive Diagnostic Command Set API for C Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value Description The WWH OBD ReadDataByldentifier service is based on the UDS ReadData
92. value means error the VI did not execute the intended operation A positive value means warning the 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 Automotive Diagnostic Command Set User Manual 5 164 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Output diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs success indicates successful receipt of a positive response message for this diagnostic service TE 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 the VI did not execute the intended operation A positive value means warning the 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 This VI performs the UDS service WriteMemoryByAddress and writes Record Values data values to the
93. vi 5 197 WWH OBD Request DID vi 5 199 WWH OBD Request DTC Extended Data Record vi 5 201 WWH OBD Request Emission Related DTCs vi 5 203 WWH OBD Request Freeze Frame Information vi 5 206 WWH OBD Request RID vi 5 208 WWH OBD Request Supported DIDs vi 5 210 WWH OBD Request Supported RIDs vii 5 212 Automotive Diagnostic Command Set User Manual
94. you can use error in is a cluster that describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out H E status is TRUE if an error occurred This VI is not executed when TF status is TRUE code is the error code number identifying an error A value of 0 means success A negative value means error the VI did not execute the intended operation A positive value means warning the 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 Automotive Diagnostic Command Set User Manual 5 166 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW source identifies the VI where the error occurred memory address length specifies how many bytes of the address are sent to the ECU The default is 4 memory size length specifies how many bytes of the size are sent to the ECU The default is 4 Eo Output diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs data out returns the memory data from the ECU success indicates successful receipt of a positive response message for this diagnostic 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
95. 0 National Instruments Timeout Diag Command is the timeout in milliseconds the master waits for the response to a diagnostic request message The default is 1000 ms Timeout FC Bs is the timeout in milliseconds the master waits for a Flow Control frame after sending a First Frame or the last Consecutive Frame of a block The default is 250 ms Timeout CF Cr is the timeout in milliseconds the master waits for a Consecutive Frame in a multiframe response The default is 250 ms for CAN and 1000 ms for LIN Receive Block Size BS is the number of Consecutive Frames the slave sends in one block before waiting for the next Flow Control frame A value of 0 default means all Consecutive Frames are sent in one run without interruption Wait Time CF STmin defines the minimum time for the slave to wait between sending two Consecutive Frames of a block Values from 0 to 127 are wait times in milliseconds Values 241 to 249 Hex F1 to F9 mean wait times of 100 us to 900 us respectively All other values are reserved The default is 5 ms Max Wait Frames N_WFTmax is the maximum number of WAIT frames the master accepts before terminating the connection The default is 10 Wait Frames to Send N_WAIT is the number of WAIT frames the master sends every time before a CTS frame is sent If you set this value to a negative number for example OxFFFFFFFF 1 the master sends an OVERLOAD frame instead of a WAIT and reception is aborted
96. 1 using with other programming languages 3 3 using with Visual C 6 3 2 available diagnostic services 4 4 C C API DolIP functions 6 50 general functions 6 13 KWP2000 services 6 63 list of data types 6 2 list of functions 6 3 ndClearDiagnosticInformation 6 63 ndCloseDiagnostic 6 13 ndControlDTCSetting 6 65 ndConvertFromPhys 6 14 ndConvertToPhys 6 16 ndCreateExtendedCANIds 6 18 ndDiagFrameRecv 6 20 ndDiagFrameSend 6 22 ndDiagnosticService 6 23 ndDisableNormalMessage Transmission 6 67 ndDoIPActivateRouting 6 50 ndDoIPConnect 6 52 ndDoIPDisconnect 6 54 ndDoIPEntityStatus 6 55 ndDoIPGetDiagPowerMode 6 57 ndDoIPGetEntities 6 58 Automotive Diagnostic Command Set User Manual Index ndDoIPSendVehicleIdentReqEID 6 61 ndDoIPSendVehicleIdentRequest 6 60 ndDoIPSendVehicleIdentReqVIN 6 62 ndDTCToString 6 25 ndECUReset 6 68 ndEnableNormalMessage Transmission 6 70 ndGetProperty 6 26 ndGetTimeStamp 6 29 ndInputOutputControlByLocal Identifier 6 71 ndOBDClearEmissionRelatedDiagnostic Information 6 153 ndOBDOpen 6 30 ndOBDRequestControlOfOnBoard Device 6 154 ndOBDRequestCurrentPowertrain DiagnosticData 6 156 ndOBDRequestEmissionRelated DTCs 6 158 ndOBDRequestEmissionRelatedDTCs DuringCurrentDriveCycle 6 160 ndOBDRequestOnBoardMonitoringTest Results 6 162 ndOBDRequestPermanentFault Codes 6 164 ndOBDRequestPowertrainFreezeFrame Data 6 166 ndOBDRequestVehicle Information 6 168 ndOpe
97. 17 character Vehicle Identification Number of the DolP entity It can be blank if the DoIP entity does not yet belong to a vehicle Source Address is the 16 bit DoIP address of this entity This address can distinguish multiple DoIP entities within a vehicle EID is a 6 byte array of the Entity ID which is usually the DoIP device MAC address amp i a GID is a unique 6 byte group identification of DoIP entities that belong to the same vehicle It is used as long as a VIN is not yet defined IP Address is the IP Address of this DoIP entity in a b c d notation Use this IP address to connect to the DoIP entity using DoIP Connect vi 7 amp ba Ll 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 the VI did not execute the intended operation A positive value means warning the 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 Automotive Diagnostic Command Set User Manual 5 62 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW source identifies the VI where the error
98. 1en2 must contain the dataOut array length On return it contains the number of valid data bytes in the dataOut array Success Indicates successful receipt of a positive response message for this diagnostic service Automotive Diagnostic Command Set User Manual 6 92 ni com Chapter 6 Automotive Diagnostic Command Set API for C Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value Description This function starts a routine in the ECU memory The ECU routine starts after the positive response message is sent The routine stops until the ndStopRoutineByLocalIdentifier function and corresponding service are issued The routines could be either tests that run instead of normal operating code or routines enabled and executed with the normal operating code running In the first case you may need to switch the ECU to a specific diagnostic mode using ndOpenDiagnostic or unlock the ECU using the SecurityAccess service prior to using ndStartRoutineByLocalldentifier For further details about this service refer to the ISO 14230 3 standard
99. 29 set are given communication is tried on these identifiers If that fails an error is returned In general it is not necessary to manipulate the diagRefOut struct contents Possible examples of selections for the interface parameter for the various hardware targets are as follows Using NI CAN hardware e CANO uses CAN interface 0 e CAN1 uses CAN interface 1 and so on with the form CANx e CAN256 uses virtual NI CAN interface 256 Using NI XNET hardware with NI XNET Frame Input Output based sessions e CAN1 nixnet uses CAN interface 1 of an NI XNET device e CAN2 nixnet uses CAN interface 2 of an NI XNET device and so on with the form CANx Using NI XNET hardware with NI XNET Stream Input Output based sessions e CAN1 ni_genie_nixnet uses CAN interface 1 of an NI XNET device e CAN2 ni_genie_nixnet uses CAN interface 2 of an NI XNET device and so on with the form CANx Using R Series e CAN1 RIOI1 c temp MyFpgaBitfile lvbitx uses a named target RIO1 as compiled into the bitfile at location c temp MyFpgaBitfile lvbitx Using CompactRIO e CAN1 MyFpgaBitfile lvbitx uses compiled bitfile MyFpgaBitfile lvbitx which must be FTP copied to the root of the CompactRIO target Automotive Diagnostic Command Set User Manual 6 32 ni com Chapter 6 Automotive Diagnostic Command Set API for C ndOpenDiagnostic Purpose Opens a diagnostic session on a CAN port Communication to the ECU is not yet sta
100. 50 LabVIEW API 5 51 DoIP Get Diagnostic Power Mode vi 5 57 DoIP Get DolIP Entity Status vi 5 59 DolIP Get Entities vi 5 61 DoIP Send Vehicle Identification Request w EID vi 5 66 DoIP Send Vehicle Identification Request w VIN vi 5 68 DoIP Send Vehicle Identification Request vi 5 64 DTC to String vi 5 29 Automotive Diagnostic Command Set User Manual Index E ECUReset vi 5 78 EnableNormalMessageTransmission vi 5 80 external references KWP2000 1 4 UDS 1 6 G general functions C API 6 13 LabVIEW API 5 10 general programming model figure 4 3 Get Time Stamp vi 5 30 GetSeed Unlock 1 3 H hardware requirements 2 3 help technical support A 1 input output control 1 4 InputOutputControlByLocalldentifier vi 5 82 installation 2 1 introduction 1 1 K Key Word Protocol 2000 1 1 KWP2000 connect disconnect 1 3 definition 1 1 diagnostic service format 1 2 diagnostic services 1 2 Diagnostic Trouble Codes 1 4 external references 1 4 GetSeed Unlock 1 3 input output control 1 4 measurements 1 4 Automotive Diagnostic Command Set User Manual l 4 read write memory 1 3 remote activation of a routine 1 4 transport protocol 1 2 KWP2000 services C API 6 63 LabVIEW API 5 70 L LabVIEW using with Automotive Diagnostic Command Set 3 1 LabVIEW API ClearDiagnosticInformation vi 5 70 Close Diagnostic vi 5 10 ControlDTCSetting vi 5 73 Convert from Phys vi 5 12 Convert t
101. 5765 2 as the ISO TP does not use a special communication link National Instruments 6 49 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C DolP Functions ndDolPActivateRouting Purpose Defines the source and target address for a DoIP TCP IP connection Format long ndDoIPActivateRouting TD1 diagRef unsigned char ActivationType unsigned short SourceAddress unsigned short TargetAddress Input diagRef Specifies the handle for the diagnostic session obtained from ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct ActivationType Indicates the specific type of routing activation that may require different types of authentication and or confirmation Defined values are 0 Default 1 WWH OBD worldwide harmonized onboard diagnostic OxEO Use OEM specific central security approach Values 2 to OxDF are reserved Values OxEO to OxFF are OEM specific SourceAddress The DolIP source address of the tester that starts the communication Automotive Diagnostic Command Set User Manual 6 50 ni com Chapter 6 Automotive Diagnostic Command Set API for C Output TargetAddress The logical address of the responding DolP entity Return Value The return value indicates the function call status as a signed 32 bit integer Zero means the function execut
102. 84 ni com Chapter 6 Automotive Diagnostic Command Set API for C ndRequestRoutineResultsByLocalldentifier Purpose Executes the RequestRoutineResultsByLocalldentifier service Returns results from an ECU routine Format long ndRequestRoutineResultsByLocalIdenti fier TD1 diagRef unsigned char localID unsigned char dataOut long len LVBoolean success Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic or ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct localID Defines the local identifier of the routine from which this function retrieves results The values are application specific Output dataOut Returns application specific output parameters from the routine len On input len must contain the dataOut array length On return it contains the number of valid data bytes in the dataOut array success Indicates successful receipt of a positive response message for this diagnostic service Return Value The return value indicates the function call status 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 ndSt
103. API for C ByteOrder indicates the byte ordering for multibyte items 0 MSB_FIRST Motorola default 1 LSB_FIRST Intel This function interprets the response byte stream according to this description and returns the resulting DTC records in the DTCs struct array Output statusAvailMask An application specific value returned for all DTCs DTCs Returns the resulting DTCs as an array of structs typedef struct unsigned long DTC unsigned long Status unsigned long AddData TDA DTC is the resulting Diagnostic Trouble Code For the default 2 byte DTCs use ndDTCToString to convert this code to readable format as defined by SAE J2012 Status is the DTC status Usually this is a bit field with following meaning Bit Meaning testFailed testFailedThisMonitoringCycle pendingDTC confirmedDTC testNotCompletedSinceLastClear testFailedSinceLastClear nn BW NY KF CO testNotCompletedThisMonitoringCycle 7 warningIndicatorRequested AddData contains optional additional data for this DTC len On input len must contain the DTCs array length in elements On return it contains the number of valid elements in the DTCs array Success Indicates successful receipt of a positive response message for this diagnostic service Automotive Diagnostic Command Set User Manual 6 124 ni com Chapter 6 Automotive Diagnostic Command Set API for C Return Value The return value indicates the function call status as a sig
104. Byldentifier service ISO 14229 1 National Instruments 6 187 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C ndWWHOBDRequestSupportedRIDs Purpose Executes the WWH OBD RoutineControl service to retrieve the valid RID values for this service Format long ndWWHOBDRequestSupportedRIDs TD1 diagRef unsigned char RIDsOut long len LVBoolean success Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct Output RIDsOut Returns an array of valid RIDs len On input 1en must contain the RIDsOut array length On return it contains the number of valid data bytes in the RIDsOut array success Indicates successful receipt of a positive response message for this diagnostic service Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value Description The WWH OBD RoutineControl service is based on the UDS RoutineCon
105. CAN 985x modules on your FPGA you need to duplicate and rename all controls and indicators accordingly e Do not modify the CAN read and write code except to filter CAN IDs on the receiving side to minimize the amount of CAN data transfers to the host e As you create controls or indicators ensure that each control name is unique within the VI Refer to the LabVIEW FPGA Module documentation for more information about creating FPGA VIs and bitfiles for an FPGA target When using ADCS on CompactRIO with an NI 985x C Series module the interface name is based on the bitfile you use and the interface name you set For example MyInterface MyBitfile lvbitx CAN lvbitfile lvbitx or CANO mybitfile lvbitx Automotive Diagnostic Command Set User Manual 3 4 ni com Chapter 3 Application Development The interface name you use must be part of all parameters in the FPGA code for the CAN communication Also the ADCS needs the interface name for correct functionality If you define the interface name to be CANO you must name the parameters as follows e _ CANO Rx Data e __CANO Rx Ready e __CANO Tx Data Frame e __CANO Tx Ready e __CANDO Bit Timing e __CANO FPGA Is Running e _ CANDO Start e __CANO FIFO Full e __CANO FIFO Ready In addition you need to set the name of the internally used FIFO to __CAN0 FIFO the FIFO is set to U32 1029 elements target scoped and block memory After recompiling your FPGA VI copy the bi
106. CAN and LIN Automotive Diagnostic Command Set User Manual July 2014 7 NATIONAL 372139G 01 INSTRUMENTS Worldwide Technical Support and Product Information ni com Worldwide Offices Visit ni com niglobal to access the branch office websites which provide up to date contact information support phone numbers email addresses and current events National Instruments Corporate Headquarters 11500 North Mopac Expressway Austin Texas 78759 3504 USA Tel 512 683 0100 For further support information refer to the NJ Services appendix To comment on National Instruments documentation refer to the National Instruments website at ni com info and enter the Info Code feedback 2007 2014 National Instruments All rights reserved Legal Information Limited Warranty This document is provided as is and is subject to being changed without notice in future editions For the latest version refer to ni com manuals NI reviews this document carefully for technical accuracy however NI MAKES NO EXPRESS OR IMPLIED WARRANTIES AS TO THE ACCURACY OF THE INFORMATION CONTAINED HEREIN AND SHALL NOT BE LIABLE FOR ANY ERRORS NI warrants that its hardware products will be free of defects in materials and workmanship that cause the product to fail to substantially conform to the applicable NI published specifications for one 1 year from the date of invoice For a period of ninety 90 days from the date of invoice NI warrants that i
107. CLUSIVE AND THE CUSTOMER S SOLE REMEDIES AND SHALL APPLY EVEN IF SUCH REMEDIES FAIL OF THEIR ESSENTIAL PURPOSE EXCEPT AS EXPRESSLY SET FORTH HEREIN PRODUCTS ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND AND NI DISCLAIMS ALL WARRANTIES EXPRESSED OR IMPLIED WITH RESPECT TO THE PRODUCTS INCLUDING ANY IMPLIED WARRANTIES OF MERCHANTABILITY FITNESS FOR A PARTICULAR PURPOSE TITLE OR NON INFRINGEMENT AND ANY WARRANTIES THAT MAY ARISE FROM USAGE OF TRADE OR COURSE OF DEALING NI DOES NOT WARRANT GUARANTEE OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF OR THE RESULTS OF THE USE OF THE PRODUCTS IN TERMS OF CORRECTNESS ACCURACY RELIABILITY OR OTHERWISE NI DOES NOT WARRANT THAT THE OPERATION OF THE PRODUCTS WILL BE UNINTERRUPTED OR ERROR FREE In the event that you and NI have a separate signed written agreement with warranty terms covering the products then the warranty terms in the separate agreement shall control Copyright Under the copyright laws this publication may not be reproduced or transmitted in any form electronic or mechanical including photocopying recording storing in an information retrieval system or translating in whole or in part without the prior written consent of National Instruments Corporation National Instruments respects the intellectual property of others and we ask our users to do the same NI software is protected by copyright and other intellectual property laws Where NI software may be used to repr
108. Chapter 6 Automotive Diagnostic Command Set API for C ByteOrder indicates the byte ordering for multibyte items 0 MSB_FIRST Motorola default 1 LSB_FIRST Intel This function interprets the response byte stream according to this description and returns the resulting DTC records in the DTCs struct array Output Success Indicates successful receipt of a positive response message for this diagnostic service Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value Description This function clears the diagnostic information on the ECU memory Depending on the value of groupO DTC the ECU is requested to clear the corresponding DTCs The groupofDTC values are application specific For further details about this service refer to the ISO 15765 3 standard Automotive Diagnostic Command Set User Manual 6 104 ni com Chapter 6 Automotive Diagnostic Command Set API for C ndUDSCommunicationControl Purpose Executes the UDS CommunicationControl service Switches transmission and or reception of the normal communication mess
109. DTCs to J1939 Vi ooo eeeeeeeseeeeeeaeeeeeeaeeneeeaeenaes 5 195 WWH OBD Convert DTCs to J2012 vi oe eee esseeseeeeeeseeneeeneeneeeaeenees 5 197 WWH OBD Request DID vi oe eee eeceeseeseeeeeseeeseceeeeseeseeeaeeesnsesseeeaeeaees 5 199 WWH OBD Request DTC Extended Data Record vi eee eeeeeeees 5 201 WWH OBD Request Emission Related DTCS Vi w eee eee eseeeeeeeeeeeees 5 203 WWH OBD Request Freeze Frame Information vi 0 0 0 0 cece eee eeeeeneeeees 5 206 Automotive Diagnostic Command Set User Manual X ni com Contents WWH OBD Request RID Vin ee eee eee eseceseeseeeseeeeeseeseeeaeceeeeeetaeseaeeaeeaee 5 208 WWH OBD Request Supported DIDS Vi cece eeeeeee eee ceeeeeeeseeeeeteeeeeees 5 210 WWH OBD Request Supported RIDS Vi ue eee eceeeeeeeeeseceeeeeeeeenseteeeeaees 5 212 Chapter 6 Automotive Diagnostic Command Set API for C Section Headings sis ssretbestesiadgossevehet a a a a E Ea ai 6 1 PULPOSC nin i AA WA AAMAS RG AAS a e E 6 1 Jao aa E ERETT TT 6 1 Input and Outputs eire const cctestevss tee E EE EE A tivenioantes 6 1 De SCrIPHOM sisp ea A ee theta aaa ie ds Selene eee she eal eas 6 1 List of Data TYPES eeii ra a seus Aba ri aa R a de sober Ged nv a a 6 2 List of FUNCH ONS onanere ra erare aaaea aa a E Sa ait E ee his ede IEEE 6 3 General Functions srne ie aa ats pE E E E EEE AE EAEE ove 6 13 NAC OSeDiaQNOStiC issoria sea anioni eaa eaa Ea a A a Ei 6 13 ndCotiverthromPhys psies iaaii eai a Ans 6 14 DAC OnVert TOPNYS cas ss sa5e
110. Data contains optional additional data for this DTC Usually this does not contain valid information refer to DTC descriptor 5 143 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW success indicates successful receipt of a positive response message for this diagnostic 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 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 the VI did not execute the intended operation A positive value means warning the VI executed intended operation but an informational warning is returned For a description of the code wire the error cluster to a LabVIEW error handling VI such as the Simple Error Handler source identifies the VI where the error occurred status avail mask is an application specific value returned for all DTCs Description This VI executes the ReportSupportedDTCs subfunction of the UDS ReadDiagnosticTroubleCodeInformation service and reads all supported DTCs from the ECU memory For further details about this service refer to the ISO 15765 3 standard Automotive Diagnostic Command Set User Manual 5 144 ni com Chapter 5 Automotive Diagnostic Command Set API for Lab
111. Diagnostic Command Set API for C ndDiagFrameSend Purpose Sends a raw CAN frame on the diagnostic CAN ID to check for errors in the transport protocol implementation of an ECU Format long ndDiagFrameSend TD1 diagRef unsigned char dataIn long len Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct dataiIn An array of up to 8 bytes sent as a CAN payload on the diagnostic identifier len Must contain the number of valid data bytes in dataIn Output Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value Description ndDiagFrameSend transmits an arbitrary raw CAN frame on the diagnostic CAN identifier For example you can check the transport protocol implementation of an ECU for robustness if erroneous protocol requests are issued Automotive Diagnostic Command Set User Manual 6 22 ni com Chapter 6 Automotive Diagnostic Command Set API for C
112. Diagnostic Command Set User Manual 6 62 ni com Chapter 6 Automotive Diagnostic Command Set API for C KWP2000 Services ndClearDiagnosticlnformation Purpose Executes the ClearDiagnosticInformation service Clears selected Diagnostic Trouble Codes DTCs Format long ndClearDiagnosticInformation TD1 diagRef unsigned short groupOfDTC TD3 DTCDescriptor LVBoolean success Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic or ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct groupOfDTC Specifies the group of diagnostic trouble codes to be cleared The following values have a special meaning 0x0000 All powertrain DTCs 0x4000 All chassis DTCs 0x8000 All body DTCs OxC000 All network related DTCs OxFFOO All DTCs DTCDescriptor A struct that describes the DTC records the ECU delivers typedef struct long DTCByteLength long StatusByteLength long AddDataByteLength unsigned short ByteOrder TD3 National Instruments 6 63 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C DTCByteLength indicates the number of bytes the ECU sends for each DTC The default is 2 StatusByteLength indicates the number of bytes the ECU sends for each DTC s status The default is 1 AddDataByteLength indicates the n
113. Diagnostic and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct timeout Specifies the time to wait for the arrival of a message If no message arrives within this time a timeout error is returned Output dataOut Returns up to 8 bytes of payload data from a CAN frame received on the diagnostic identifier len On input 1en must contain the number of bytes provided for the dataOut buffer On output it returns the number of valid data bytes in dataOut Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value Automotive Diagnostic Command Set User Manual 6 20 ni com Chapter 6 Automotive Diagnostic Command Set API for C Description ndDiagFrameRecv receives an arbitrary raw CAN frame on the diagnostic CAN identifier For example you can check the transport protocol implementation of an ECU for correct responses if erroneous protocol requests are issued National Instruments 6 21 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive
114. Ds vi Creates diagnostic CAN IDs according to ISO 15765 2 Diag Get Property vi Gets a diagnostic global internal parameter Diag Set Property vi Sets a diagnostic global internal parameter Diagnostic Frame Recv vi Receives a raw CAN frame on the diagnostic CAN ID to check for errors in the transport protocol implementation of an ECU Diagnostic Frame Send vi Sends a raw CAN frame on the diagnostic CAN ID to check for errors in the transport protocol implementation of an ECU Diagnostic Service vi Executes a generic diagnostic service If a special service is not available through the KWP2000 UDS or OBD service functions you can build it using this VI Automotive Diagnostic Command Set User Manual 5 2 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Table 5 1 Automotive Diagnostic Command Set API VIs for LabVIEW Continued Function Purpose DisableNormalMessageTransmission vi Executes the DisableNormalMessageTransmission service The ECU no longer transmits its regular communication messages usually CAN messages DoIP Activate Routing vi Defines the source and target addresses for a DoIP TCP IP connection DoIP Connect vi DolIP Disconnect vi Creates a TCP IP connection to a DoIP entity identified by its IP address Disconnects the TCP IP connection to a DolP entity DoIP Get Diagnostic Power Mode vi Gets infor
115. E code is the error code number identifying an error A value of 0 means success A negative value means error the VI did not execute the intended operation A positive value means warning the VI executed intended operation but an informational warning is returned For a description of the code wire the error cluster to a LabVIEW error handling VI such as the Simple Error Handler source identifies the VI where the error occurred 5 45 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Output diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic 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 the VI did not execute the intended operation A positive value means warning the 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 For the VW TP 2 0 you must establish a connection to the ECU before any diagnostic communication can occur This VI s
116. E status is TRUE code is the error code number identifying an error A value of 0 means success A negative value means error the VI did not execute the intended operation A positive value means warning the VI executed intended operation but an informational warning is returned For a description of the code wire the error cluster to a LabVIEW error handling VI such as the Simple Error Handler source identifies the VI where the error occurred National Instruments 5 23 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Output diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs on the diagnostic identifier error out describes error conditions If the error in cluster indicated an error the error out cluster contains the same information Otherwise error out describes the error status of this VI data out returns up to 8 bytes of payload data from a CAN frame received 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 the VI did not execute the intended operation A positive value means warning the 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
117. 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 the VI did not execute the intended operation A positive value means warning the 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 Automotive Diagnostic Command Set User Manual 5 190 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW OBD Request Vehicle Information vi Purpose Executes the OBD Request Vehicle Information service Reads a set of information data from the ECU Format diag ref in info type error in no error diag ref out data out success error out items diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster info type defines the type of information to be read The values are defined in the SAE J1979 standard error in is a cluster that 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
118. ECU Format long ndUDSRequest Seed TD1 diagRef unsigned char accessMode unsigned char seedOut long len LVBoolean success Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic or ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct accessMode Indicates the security level to be granted The values are application specific This is an odd number usually 1 Output seedoOut Returns the seed from the ECU len On input 1en must contain the seedOut array length On return it contains the number of valid data bytes in the seedOut array success Indicates successful receipt of a positive response message for this diagnostic service Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value National Instruments 6 131 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C Description The usual procedure for getting a security access to t
119. ECU address and size identify the data The vehicle manufacturer must ensure the ECU conditions are met when performing this service Typical use cases are clearing nonvolatile memory resetting learned values setting option content setting the Vehicle Identification Number or changing calibration values For further details about this service refer to the ISO 15765 3 standard National Instruments 5 165 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW UDS06 ReadMemoryByAddress vi Purpose Executes the UDS ReadMemoryByAddress service Reads data from the ECU memory Format diag ref in diag ref out memory address data out memory size success error in no error error out memory address length memory size length Input diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi or Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster El memory address defines the memory address from which data are to be read Note that memory address length specifies how many bytes of the address are sent to the ECU This defines the maximum address you can use A memory size defines the length of the memory block to be read Note that memory size length specifies how many bytes of the size are sent to the ECU This defines the maximum size
120. FFIC CONTROL SYSTEMS LIFE SAVING OR LIFE SUSTAINING SYSTEMS OR SUCH OTHER MEDICAL DEVICES OR ANY OTHER APPLICATION IN WHICH THE FAILURE OF THE PRODUCT OR SERVICE COULD LEAD TO DEATH PERSONAL INJURY SEVERE PROPERTY DAMAGE OR ENVIRONMENTAL HARM COLLECTIVELY HIGH RISK USES FURTHER PRUDENT STEPS MUST BE TAKEN TO PROTECT AGAINST FAILURES INCLUDING PROVIDING BACK UP AND SHUT DOWN MECHANISMS NI EXPRESSLY DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY OF FITNESS OF THE PRODUCTS OR SERVICES FOR HIGH RISK USES Contents About This Manual Related DoCUuMentatiOn cccccccccccececessssssesssessscscesescececcecccecesessesessssncncneseesssesssceeeess XV Activating Your Software How Do I Activate My Software 0 essesssessssssssscoeeseesscesscessesseecesseonessnsseessernsnees xvii Wha tis Activa ON re er ra a ana e r E E E E A A a Ra xvii What is the NI Activation Wizard cccccccscccccesssssccceecsssecececessseeccecesssseeeceessaeeeeeessas xvii What Information Do I Need to Activate ccccccccccccssssssccceessssceeceesessseeceeeessseeeeeens xviii How Do I Find My Product Serial Number sssssseesseeeseesseesseesesesrsresresresesresrsresresrsres xviii Whatas a Computer ID iraire an caved eae R E eas cela ed load asasendeedescandels xviii How Can I Evaluate NI Software cccccsccccccessssscccccssssececeesssseeeceesesseeceeeesstseeeeees XIX Moving Software After Activation 0 ce ceeeeeseeesece
121. 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 diag ref out is a cluster containing all necessary diagnostic session information Wire this cluster as a handle to all subsequent diagnostic VIs and close it using Close Diagnostic 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 the VI did not execute the intended operation A positive value means warning the 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 Open Diagnostic vi opens a diagnostic communication channel to an ECU The CAN port specified as input is initialized and a handle to it is stored among other internal data in the diag ref out cluster which serves as reference for further diagnostic functions Possible examples of selections for the interface parameter for the various hardware targets are as follows Automotive Diagnostic Command S
122. Format long ndOBDRequestPowertrainFreezeFrameData TD1 diagRef unsigned char PID unsigned char nFrame unsigned char dataOut long len LVBoolean success Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic or ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct PID Defines the parameter identifier of the data to be read The SAE J1979 standard defines the values nFrame The number of the freeze frame from which the data are to be retrieved Output dataOut Returns the ECU data record If you know the record data description use ndConvertToPhys to interpret this record You can obtain the description from the SAE J1979 standard len On input len must contain the dataOut array length On return it contains the number of valid data bytes in the dataOut array Success Indicates successful receipt of a positive response message for this diagnostic service Automotive Diagnostic Command Set User Manual 6 166 ni com Chapter 6 Automotive Diagnostic Command Set API for C Return Value The return value indicates the function call status 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 perfo
123. G qa aqcgeg qq acd qaaaqqqqqqcqaqaq Automotive Diagnostic Command Set User Manual Index WriteDataByLocalldentifier vi 5 112 WriteMemoryByAddress vi 5 114 WWH OBD World Wide Harmonized On Board Diagnostics services 5 193 WWH OBD Clear Emission Related DTCs vi 5 193 WWH OBD Convert DTCs to J1939 vi 5 195 WWH OBD Convert DTCs to J2012 vi 5 197 WWH OBD Request DID vi 5 199 WWH OBD Request DTC Extended Data Record vi 5 201 WWH OBD Request Emission Related DTCs vi 5 203 WWH OBD Request Freeze Frame Information vi 5 206 WWH OBD Request RID vi 5 208 WWH OBD Request Supported DIDs vi 5 210 WWH OBD Request Supported RIDs vi 5 212 LabVIEW RT configuration 2 2 LabWindows CVI using with Automotive Diagnostic Command Set 3 1 list of C functions 6 3 list of data types 6 2 list of LabVIEW VIs 5 2 ndClearDiagnosticInformation 6 63 ndCloseDiagnostic 6 13 ndControlDTCSetting 6 65 ndConvertFromPhys 6 14 ndConvertToPhys 6 16 ndCreateExtendedCANIds 6 18 ndDiagFrameRecv 6 20 ndDiagFrameSend 6 22 ndDiagnosticService 6 23 Automotive Diagnostic Command Set User Manual l 6 ndDisableNormalMessageTransmission 6 67 ndDolPActivateRouting 6 50 ndDoIPConnect 6 52 ndDoIPDisconnect 6 54 ndDoIPEntityStatus 6 55 ndDoIPGetDiagPowerMode 6 57 ndDoIPGetEntities 6 58 ndDoIPSendVehicleIdentReqEID 6 61 ndDoIPSendVehicleIdentRequest 6 60 ndDoIPSendVehicleIdentReqVIN 6 62 ndDTCToString 6 25 ndECURes
124. H 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 the VI did not execute the intended operation A positive value means warning the 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 Automotive Diagnostic Command Set User Manual 5 102 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Output diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs success indicates successful receipt of a positive response message for this diagnostic service TE 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 the VI did not execute the intended operation A positive value means warning the VI executed intended operation but an informational warning is returned For
125. I returns the value of the error in cluster to error out HE status is TRUE if an error occurred This VI is not executed when status is TRUE code is the error code number identifying an error A value of 0 means success A negative value means error the VI did not execute the intended operation A positive value means warning the VI executed intended operation but an informational warning is returned For a description of the code wire the error cluster to a LabVIEW error handling VI such as the Simple Error Handler source identifies the VI where the error occurred National Instruments 5 201 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Output diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs data out returns the ECU data record success indicates successful receipt of a positive response message for this diagnostic 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 BE 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 the VI did not execute the intended operation A positive value means warning the VI executed intended operation but an informational warning is r
126. ID or simply all entities connected Refer to the description of DoIPOpenType and VINOrEID National Instruments 6 59 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C ndDolPSendVehicleldentRequest Purpose Sends a UDP request to all DoIP capable vehicles in the local subnet to identify themselves Format long ndDoIPSendVehicleIdentRequest TD1 diagRef Input diagRef Specifies the handle for the diagnostic session obtained from ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct Output Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value Description ndDoIPSendVehicleIdentRequest sends a Vehicle Identification Request to all DoIP entities in the local subnet Usually this is done as part of ndDoIPGetEntities and does not need to be executed separately Automotive Diagnostic Command Set User Manual 6 60 ni com Chapter 6 Automotive Diagnostic Command Set API f
127. 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 the VI did not execute the intended operation A positive value means warning the 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 DolIP Send Vehicle Identification Request w VIN vi sends a Vehicle Identification Request to all DoIP entities in the local subnet identified by the given VIN Usually this is done as part of DoIP Get Entities vi and does not need to be executed separately National Instruments 5 69 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW KWP2000 Services ClearDiagnosticInformation vi Purpose Executes the ClearDiagnosticInformation service and clears selected Diagnostic Trouble Codes DTCs Format DTC descriptor diag ref in group of DTC error in no error diag ref out success error out Input AE EEE DTC descriptor is a cluster that describes the DTC records the ECU delivers DTC Byte
128. Length indicates the number of bytes the ECU sends for each DTC The default is 2 Status Byte Length indicates the number of bytes the ECU sends for each DTC s status The default is 1 Add Data Byte Length indicates the number of bytes the ECU sends for each DTC s additional data Usually there is no additional data so the default is 0 Byte Order indicates the byte ordering for multibyte items 0 MSB_FIRST Motorola default 1 LSB_FIRST Intel The DTC descriptor is given here as a parameter basically to convert the group of DTC parameter to a binary representation according to DTC Byte Length and Byte Order diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi or Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster Automotive Diagnostic Command Set User Manual 5 70 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW group of DTC specifies the group of Diagnostic Trouble Codes to be cleared The following values have a special meaning and you can specify them through a ring control 0x0000 All powertrain DTCs 0x4000 All chassis DTCs 0x8000 All body DTCs OxC000 All network related DTCs OxFFOO All DTCs error in is a cluster that describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in clu
129. Manual Chapter 6 Automotive Diagnostic Command Set API for C Table 6 2 Functions for the Automotive Diagnostic Command Set for C Continued Function Purpose ndRequestRoutineResultsByLocalidentifier Executes the RequestRoutineResultsB yLocall dentifier service Returns results from an ECU routine ndRequestSeed Executes the SecurityAccess service to retrieve a seed from the ECU ndSendKey Executes the SecurityAccess service to send a key to the ECU ndSetProperty Set a diagnostic global internal parameter ndStartDiagnosticSession Executes the StartDiagnosticSession service The ECU is set up in a specific diagnostic mode ndStartRoutineByLocallIdentifier Executes the StartRoutineByLocal Identifier service Executes a routine on the ECU ndStatusToString Returns a description for an error code ndStopDiagnosticSession Executes the StopDiagnosticSession service Returns the ECU to normal mode ndStopRoutineByLocaliIdentifier Executes the StopRoutineByLocal Identifier service Stops a routine on the ECU ndTesterPresent Executes the TesterPresent service Keeps the ECU in diagnostic mode ndUDS06ReadMemoryByAddress Executes the UDS ReadMemoryByAddress service Reads data from the ECU memory Automotive Diagnostic Command Set User Manual 6 8 ni com Chapter 6 Automotive Diagnostic Command Set API for C Table 6 2 Functions for the Automotive Diagnostic Co
130. National Instruments 6 57 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C ndDolPGetEntities Purpose Returns a table of all DoIP entities vehicles on the local subnet possibly restricted to EID or VIN Format long ndDoIPGetEntities TD1 diagRef unsigned short DoIPOpenType char VINOrEID unsigned char DoIPEntities unsigned long len Input diagRef Specifies the handle for the diagnostic session obtained from ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct DoIPOpenType Defines which DolIP entities this command queries and lists Allowed values are 0 VIN VIN is specified in VINorEID 1 EID EID is specified in VINorEID 2 All VINorEID is ignored Other values are reserved VINOrEID Depends on DoT POpenType DolIPOpenType VINOrEID Value 0 A 17 character Vehicle Identification Number Only DoIP entities for this VIN are listed 1 An Entity ID usually a MAC address Only the DoIP entity with this ID is listed Specify the EID as xx xx xx xx xx xx where each x stands for a hexadecimal digit 2 Ignored Automotive Diagnostic Command Set User Manual 6 58 ni com Chapter 6 Automotive Diagnostic Command Set API for C Output DoIPEntities Returns an array of C structs each of which describe a DoIP entity
131. NotCompletedSinceLastClear 5 testFailedSinceLastClear 6 testNotCompletedThisMonitoringCycle 7 warningIndicatorRequested For OBD this field usually does not contain valid information Add Data contains optional additional data for this DTC Usually this does not contain valid information refer to DTC descriptor 5 185 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW success indicates successful receipt of a positive response message for this diagnostic 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 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 the VI did not execute the intended operation A positive value means warning the 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 Automotive Diagnostic Command Set User Manual 5 186 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW OBD Request Powertrain Freeze Frame Data vi Purpose Executes the OBD Request Powertrain Freeze Frame Data service Read
132. Ref unsigned long channelID unsigned char applicationType Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct channelID Defines the CAN identifier on which the ECU responds for this connection The ECU defines the ID on which the host transmits applicationType Specifies the communication type that takes place on the communication channel For diagnostic applications specify KWP2000 1 The other values are for manufacturer specific purposes Output Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value Automotive Diagnostic Command Set User Manual 6 46 ni com Chapter 6 Automotive Diagnostic Command Set API for C Description For the VW TP 2 0 you must establish a connection to the ECU before any diagnostic communication can occur This function sets up a unique communication channel to an ECU that you can use in subsequent diagnostic service requests You must m
133. Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value National Instruments 6 141 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C Description To ensure proper ECU operation you may need to keep the ECU informed that a diagnostic session is still in progress If you do not send this information for example because the communication is broken the ECU returns to normal mode from diagnostic mode after a while The TesterPresent service is this keep alive signal It does not affect any other ECU operation Keep calling nduDSTesterPresent within the ECU timeout period if no other service is executed Automotive Diagnostic Command Set User Manual 6 142 ni com Chapter 6 Automotive Diagnostic Command Set API for C ndUDSTransferData Purpose Transfers data to from the ECU in a download upload process Format long ndUDSTransferData TD1 diagRef unsigned char blockSequenceCounter unsigned char dataIn long len unsigned char dataOut long len2 LVBoolean
134. String function to obtain a descriptive string for the return value Description The WWH OBD ReadDTCInformation service is based on the UDS ReaDTCInformation service ISO 14229 1 National Instruments 6 181 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C ndWWHOBDRequestFreezeFramelnformation Purpose Executes the WWH OBD ReadDTCInformation service Reads selected Diagnostic Trouble Codes DTCs Format long ndWWHOBDRequestFreezeFrameInformation TD1 diagRef unsigned char DTCMaskRecord long lenDTCMaskRecord unsigned char DTCRecordNumber unsigned char dataOut long len LVBoolean success Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct DTCMaskRecord Specifies the DTC mask record lenDTCMaskRecord Contains the number of valid data bytes in the DTCMaskRecord array DTCRecordNumber Specifies the snapshot record number Output dataOut Returns the ECU data record len On input 1en must contain the dataOut array length On return it contains the number of valid data bytes in the dataOut array Success Indicates successful receipt of a positive response message for this diagnostic service Automotive Diagnostic Command Set User Manual 6 182 ni com Chapter 6 Auto
135. T is the number of WAIT frames the master sends every time before a CTS frame is sent If this value is set to a negative number for example OxFFFFFFFF 1 the master sends an OVERLOAD frame instead of a WAIT and reception is aborted The default is 0 for maximum speed Time between Waits T_W is the number of milliseconds the master waits after sending a WAIT frame The default is 25 Fill CAN Frames specifies whether a CAN frame is transmitted with 8 bytes or less 0 Short CAN frames are sent with DLC lt 8 1 Short CAN frames are filled to 8 bytes with Fill Byte default Fill Byte specifies the CAN frame content filled with defined data or random data 0 255 Byte is used optionally to fill short CAN frames 256 Short CAN frames are filled optionally with random bytes The default is 255 OxFF Invalid Response as Error specifies how the toolkit handles an invalid ECU response 0 Invalid response is indicated by success FALSE only default 1 Invalid response is returned as an error in addition Max RspPending Count defines the number of times a ReqCorrectlyRcvd RspPending 0x78 Negative Response Message will be accepted to extend the command timeout default 5 If this message is sent more often in response to a request an error 8120 is returned If the ECU implements commands with a long duration for example flash commands you may need to extend this number VWTP Command Time Out sets the time
136. To change the interface name select a new one from the Interface Name box in the middle pane When installation is complete you can access the Automotive Diagnostic Command Set functions in your application development environment LabVIEW Real Time RT Configuration LabVIEW Real Time RT combines easy to use Lab VIEW 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 or NI XNET APIs to develop real time applications As with any NI software library for LabVIEW RT you must install the Automotive Diagnostic Command Set software to the LabVIEW RT target using the Remote Systems branch in MAX For more information refer to the LabVIEW RT documentation After you install the PXI CAN cards and download the Automotive Diagnostic Command Set software to the LabVIEW RT system you must verify the installation Automotive Diagnostic Command Set User Manual 2 2 ni com Chapter 2 Installation and Configuration Hardware and Software Requirements You can use the Automotive Diagnostic Command Set on the following hardware National Instruments NI CAN hardware Series 1 or 2 with the NI CAN driver software version 2 3 or later installed National Instruments NI XNET hardware with the NI XNET driver software version 1 0 or later installed National Instruments CompactRIO or R Series Multifunction RIO hardware and
137. VI executed intended operation but an informational warning is returned For a description of the code wire the error cluster to a LabVIEW error handling VI such as the Simple Error Handler source identifies the VI where the error occurred 5 183 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW OBD Request Permanent Fault Codes vi Purpose Executes the OBD Request Permanent Fault Codes service All permanent Diagnostic Trouble Codes DTCs are read Format DTC descriptor diag ref in diag ref out DTCs error in no error success error out Input DTC descriptor is a cluster that describes the DTC records the ECU delivers DTC Byte Length indicates the number of bytes the ECU sends for each DTC The default is 2 Status Byte Length indicates the number of bytes the ECU sends for each DTC s status The default is 0 for OBD Add Data Byte Length indicates the number of bytes the ECU sends for each DTC s additional data Usually there is no additional data so the default is 0 Byte Order indicates the byte ordering for multibyte items d EEE 0 MSB_FIRST Motorola default 1 LSB_FIRST Intel This VI interprets the response byte stream according to this description and returns the resulting DTC records in the DTCs cluster array diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi and wired throug
138. VI where the error occurred Automotive Diagnostic Command Set User Manual 5 174 ni com Output TE HA EE National Instruments Chapter 5 Automotive Diagnostic Command Set API for LabVIEW diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs data out returns the ECU data record If you know the record data description you can use Convert from Phys vi to interpret this record You can obtain the description from the SAE J1979 standard success indicates successful receipt of a positive response message for this diagnostic 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 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 the VI did not execute the intended operation A positive value means warning the VI executed intended operation but an informational warning is returned For a description of the code wire the error cluster to a LabVIEW error handling VI such as the Simple Error Handler source identifies the VI where the error occurred 5 175 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW OBD Request Emission Related DTCs vi Purpose Executes the OBD Request Emiss
139. VIEW UDS RequestDownload vi Purpose Initiates a download of data to the ECU Format data Format identifier diag ref in diag ref out memory address block size memory size success error in no error error out memory address length memory size length Input A EI BEE National Instruments data format identifier defines the compression and encryption scheme to be used for the data blocks written to the ECU A value of 0 means no compression no encryption Nonzero values are not standardized and implementation dependent diag ref in specifies the handle for the diagnostic session This is obtained from Open Diagnostic vi or Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster memory address defines the memory address to which data are written memory size defines the size of the data to be written error in is a cluster that 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 the VI did not execute the intended operation A positive value means warning the VI executed intended operation but an informational warni
140. a a a A e aee 5 51 DolIP Activate Routing Vi eseesesseesesesssrsreresresrerrsresrsresrsresresenresrerest 5 51 DOIP Comme ct Vissiin areia n a or sian TiS 5 53 DolP Disconnect Vi siioni ieas aer EE EER EE KEA 5 55 DoIP Get Diagnostic Power Mode vi eessseesseeeseeeeseerrersrsersrrerseeerse 5 57 DoIP Get DoIP Entity Status vi oe ee eeeeseceeceeeeeeeeeteeeeaees 5 59 DOIP Get Entities Yi seseccecscsssscssesescases sacicdees Savesidpeseebiabegsscaseesigezes ines 5 61 DoIP Send Vehicle Identification Request Vi 0 00 eeeeeee eens 5 64 DoIP Send Vehicle Identification Request w EID Vi 0 ee 5 66 DoIP Send Vehicle Identification Request w VIN Vi eee 5 68 KWP2000 Services inaina osnan earo eTEN A NE EE oa R EIES E EEES 5 70 ClearDiagnosticInformation Vi e ssessssesseeesseersreserresrertsrestrstsrerresesresrsresrestee 5 70 ControlDTCSetting Vi noenee irio a i a Ea R Ea 5 73 DisableNormalMessageTransmission Vi esssssesseeeseeresrsrsresreresresrsrrsrsresrseees 5 76 ECUReset Viterra araara A a a ET EEEa E EI OE rR Ee AERIS 5 78 EnableNormalMessageTransmission Vi ssesseessseesseerrereresrsrrsrssrerrsrsresrseese 5 80 InputOutputControlByLocalldentifier View eee eee eeeeseceeeeseeeeeeeteeeeaees 5 82 ReadDataByLocalldentifier Vi ie eee cece eseeeseeneceeeeeeeseceeneeseseaeseeeeaees 5 84 Read DTCByStatus viis iasesi sects lea da seettscssthescages cssesisces ara aaea SEEE EREDETI 5 86 ReadECUlIdentifi
141. 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 This VI enables different diagnostic modes in the ECU The possible diagnostic modes are not defined in the ISO 14230 standard and are application specific A diagnostic session starts only if communication with the ECU is established For more details about starting communication refer to the ISO 14230 2 standard If no diagnostic session has been requested after Open Diagnostic vi a default session is automatically enabled in the ECU The default session supports at least the following services e The StopCommunication service refer to Close Diagnostic vi and the ISO 14230 2 standard The TesterPresent service refer to TesterPresent vi and the ISO 14230 3 standard National Instruments 5 103 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW StartRoutineByLocalldentifier vi Purpose Executes the StartRoutineByLocalldentifier service Executes a routine on the ECU Format diag ref in diag ref out local ID data out data in success error in no error error out Input diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi or Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually man
142. aByteLength indicates the number of bytes the ECU sends for each DTC s additional data Usually there are no additional data so the default is 0 ByteOrder indicates the byte ordering for multibyte items 0 MSB_FIRST Motorola default 1 LSB_FIRST Intel This function interprets the response byte stream according to this description and returns the resulting DTC records in the DTCs struct array Automotive Diagnostic Command Set User Manual 6 160 ni com Chapter 6 Automotive Diagnostic Command Set API for C Output DTCs Returns the resulting DTCs as an array of structs typedef struct unsigned long DTC unsigned long Status unsigned long AddData TD4 DTC is the resulting Diagnostic Trouble Code For the default 2 byte DTCs use ndDTCToString to convert this code to readable format as defined by SAE J2012 Status is the DTC status Usually this is a bit field with following meaning Bit Meaning testFailed testFailedThisMonitoringCycle pendingDTC confirmedDTC testNotCompletedSinceLastClear testFailedSinceLastClear nn A WN KF CO testNotCompletedThisMonitoringCycle 7 warningIndicatorRequested For OBD this field usually does not contain valid information AddData contains optional additional data for this DTC Usually this does not contain valid information refer to DTCDescriptor len On input len must contain the DTCs array length in elements On return it contains the number of valid elem
143. abVIEW error handling VI such as the Simple Error Handler source identifies the VI where the error occurred F E items is the number of data items not bytes this service returns Automotive Diagnostic Command Set User Manual 5 192 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW WWH OBD World Wide Harmonized On Board Diagnostics Services WWH OBD Clear Emission Related DTCs vi Purpose Executes the WWH OBD ClearDiagnosticInformation service Clears selected Diagnostic Trouble Codes DTCs Format diag ref out success error out diag ref in error in no error diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi or Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster error in is a cluster that describes error conditions occurring before the VI EH 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 the VI did not execute the intended operation A positive value means warning the VI executed intended operation but an informational warning is returned For a description of the code wire the e
144. according to DTC Byte Length and Byte Order diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi or Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster data in specifies application specific data that control DTC generation 5 73 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW group of DTC specifies the group of Diagnostic Trouble Codes to be controlled The following values have a special meaning and you can specify them through a ring control 0x0000 All powertrain DTCs 0x4000 All chassis DTCs 0x8000 All body DTCs 0xC000 All network related DTCs OxFFOO All DTCs error in is a cluster that describes error conditions occurring before the VI EH 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 the VI did not execute the intended operation A positive value means warning the 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
145. ag reference in specifies the diagnostic session handle obtained from Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster address is the IP address of the DoIP entity to connect to a string in a b c d notation error in is a cluster that describes error conditions occurring before the VI Eh 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 the VI did not execute the intended operation A positive value means warning the 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 Source Address is the DoIP source address of the tester that starts the communication You can leave this input unwired if you are activating a route through DoIP Activate Routing vi National Instruments 5 53 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Target Address is the DoIP target address of the device under test that should be connected to You can leave
146. ages usually CAN messages on or off Format long ndUDSCommunicationControl TD1 diagRef unsigned char type unsigned char communicationType LVBoolean success Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic or ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct type Indicates whether transmission reception is to be switched on off The usual values are 00 enableRxAndTx 01 enableRxAndDisableTx 02 disableRxAndEnableTx 03 disableRxAndTx communicationType A bitfield indicating which application level is to be changed The usual values are 01 application 02 networkManagement You can change more than one level at a time National Instruments 6 105 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C Output Success Indicates successful receipt of a positive response message for this diagnostic service Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a desc
147. agnostic Command Set API for C dataiIn Points to the byte array that contains the binary representation of value len Must contain the dataIn array length Output value The physical value converted from the binary representation Description Data output from diagnostic services for example ndReadDataByLocallIdentifier is usually a byte stream of binary data If you have a description of the data output for example byte 3 and 4 are engine RPM scaled as 25 x RPM in Motorola representation you can use ndConvertToPhys to extract the physical value from the byte stream by filling an appropriate typeDescriptor struct National Instruments 6 17 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C ndCreateExtendedCANIds Purpose Creates diagnostic CAN identifiers according to ISO 15765 2 Format void ndCreateExtendedCANIds unsigned short addressingMode unsigned short transportProtocol unsigned char sourceAddress unsigned char targetAddress unsigned long transmitID unsigned long receivelID Input addressingMode Specifies whether the ECU is physically or functionally addressed 0 physical addressing 1 functional addressing transportProtocol Specifies whether normal or mixed mode addressing is used The following values are valid 0 ISO TP Normal Mode The ISO TP as specified in ISO 15765 2 is used all eight data bytes of the CAN messa
148. agnostic Command Set User Manual 5 36 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Session and one Frame Output Stream Session at a time so use the default name nixnet as the interface string so that multiple NI XNET Frame Queued Sessions can coexist on a single interface and the Frame Input and Output Stream Sessions may be used for example for a Frame logging replay use case BE National Instruments CompactRIO or R Series If using CompactRIO or R Series hardware you must provide a bitfile that handles the CAN communication between the host system and FPGA To access the CAN module on the FPGA you must specify the bitfile name after the for example CAN MyBitfile lvbitx To specify a special RIO target you can specify that target by its name followed by the bitfile name for example CAN RIO1 MyBitfile lvbitx Currently only a single CAN interface is supported RIO1 defines the RIO target name as defined in your LabVIEW Project definition The vbitx filename represents the filename and location of the bitfile on the host if using RIO or on a CompactRIO target This implies that you must download the bitfile to the CompactRIO target before you can run your application You may specify an absolute path or a path relative to the root of your target for the bitfile baudrate is the diagnostic communication baud rate transport protocol specifies the transport protocol for transferring the diagnost
149. agnostic or ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct requireResponse Indicates whether a response to this service is required If requireResponse is FALSE no response is evaluated and success is always returned TRUE This parameter is passed by reference Output success Indicates successful receipt of a positive response message for this diagnostic service Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value National Instruments 6 67 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C ndECUReset Purpose Executes the ECUReset service Resets the ECU Format long ndECUReset Input diagRef TD1 diagRef unsigned char mode LVBoolean success Specifies the diagnostic session handle obtained from ndOpenDiagnostic or ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate t
150. agnostic session handle obtained from ndOpenDiagnostic or ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct Output success Indicates successful receipt of a positive response message for this diagnostic service Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value National Instruments 6 153 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C ndOBDRequestControlOfOnBoardDevice Purpose Executes the OBD Request Control Of On Board Device service Modifies ECU I O port behavior Format long ndOBDRequestControlOfOnBoardDevice TD1 diagRef unsigned char TID unsigned char dataIn long len unsigned char dataOut long len2 LVBoolean success Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic or ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the element
151. aintain the communication link thus created by periodically at least once a second calling ndvwTPConnectionTest No equivalent exists for the ISO TP ISO 15765 2 as the ISO TP does not use a special communication link National Instruments 6 47 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C ndVWTPConnectionTest Purpose Maintains a connection channel to an ECU using the VW TP 2 0 Format long ndvWTPConnectiontTest TD1 diagRef Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct Output Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value Description For the VW TP 2 0 you must periodically maintain the connection link to the ECU so that the ECU does not terminate it You must execute this periodic refresh at least once per second This function sends a Connection Test message to the ECU and ev
152. al Instruments 5 153 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Output 7 Description code is the error code number identifying an error A value of 0 means success A negative value means error the VI did not execute the intended operation A positive value means warning the 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 diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs data out returns application specific output parameters from the routine success indicates successful receipt of a positive response message for this diagnostic 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 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 the VI did not execute the intended operation A positive value means warning the VI executed intended operation but an informational warning is returned For a description of the code wire the error cluster to a LabVIEW error handling VI such as the Sim
153. aluates its response performing the necessary steps to maintain the connection There is no equivalent for the ISO TP ISO 15765 2 as the ISO TP does not use a special communication link Automotive Diagnostic Command Set User Manual 6 48 ni com Chapter 6 Automotive Diagnostic Command Set API for C ndVWTPDisconnect Purpose Terminates a connection channel to an ECU using the VW TP 2 0 Format long ndVWTPDisconnect TD1 diagRef Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct Output Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value Description For the VW TP 2 0 you must disconnect the ECU connection link to properly terminate communication to the ECU This function sends the proper disconnect messages and unlinks the communication Use ndvwTPConnect the create a new connection to the same ECU There is no equivalent for the ISO TP ISO 1
154. alue of the error in cluster to error out status is TRUE if an error occurred This VI is not executed when TE status is TRUE code is the error code number identifying an error A value of 0 means success A negative value means error the VI did not execute the intended operation A positive value means warning the VI executed intended operation but an informational warning is returned For a description of the code wire the error cluster to a LabVIEW error handling VI such as the Simple Error Handler source identifies the VI where the error occurred National Instruments 5 57 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Output Diag reference out is a copy of Diag reference in You can wire it to subsequent diagnostic VIs power mode identifies whether the vehicle is in Diagnostic Power Mode and ready to perform reliable diagnostics Possible values are 0 Not ready 1 Ready All other values are reserved ok indicates successful receipt of a positive response message for this diagnostic 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 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 the VI did not
155. ans warning the VI executed intended operation but an informational warning is returned For a description of the code wire the error cluster to a LabVIEW error handling VI such as the Simple Error Handler source identifies the VI where the error occurred Description The usual procedure for getting a security access to the ECU is as follows 1 2 3 4 Request a seed from the ECU using RequestSeed vi with access mode n From the seed compute a key for the ECU on the host Send the key to the ECU using SendKey vi with access mode n 1 The security access is granted if the ECU validates the key sent Otherwise an error is returned National Instruments 5 101 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW StartDiagnosticSession vi Purpose Executes the StartDiagnosticSession service Sets up the ECU in a specific diagnostic mode Format diag ref in diag ref out mode SUCCESS error in no error t error out diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi or Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster mode indicates the diagnostic mode into which the ECU is brought The values are application specific error in is a cluster that describes error conditions occurring before the VI E
156. ansferred over the CAN or LIN bus and reassembles them on the receiver side Several transport protocols accomplish this task The Automotive Diagnostic Command Set implements the ISO TP standardized in ISO 15765 2 for CAN and LIN based diagnostics the manufacturer specific VW TP 2 0 for CAN based diagnostics and the Diagnostics on IP DoIP transport protocol standardized as ISO 13400 for Ethernet based diagnostics 3 Note The Automotive Diagnostic Command Set is designed for CAN LIN or Ethernet based diagnostics only Diagnostics on serial lines K line and L line or FlexRay are not in the scope of the Automotive Diagnostic Command Set KWP2000 Key Word Protocol 2000 National Instruments The KWP2000 protocol has become a de facto standard in automotive diagnostic applications It is standardized as ISO 14230 3 KWP2000 describes the implementation of various diagnostic services you can access through the protocol You can run KWP2000 on several transport layers such as K line serial or CAN 1 1 Automotive Diagnostic Command Set User Manual Chapter 1 Introduction Transport Protocol As KWP2000 uses messages of variable byte lengths a transport protocol is necessary on layers with only a well defined short message length such as CAN The transport protocol splits a long KWP2000 message into pieces that can be transferred over the network and reassembles those pieces to recover the original message KWP2000 run
157. anual 5 108 ni com Output BE E Description Chapter 5 Automotive Diagnostic Command Set API for LabVIEW diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs data out returns application specific output parameters from the routine success indicates successful receipt of a positive response message for this diagnostic 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 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 the VI did not execute the intended operation A positive value means warning the 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 This VI stops a routine in the ECU memory referenced by the local ID parameter For further details about this service refer to the ISO 14230 3 standard National Instruments 5 109 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW TesterPresent vi Purpose Executes the TesterPresent service Keeps the ECU in diagnostic mode
158. application specific data for this service len2 On input 1en2 must contain the dataOut array length On return it contains the number of valid data bytes in the dataOut array success Indicates successful receipt of a positive response message for this diagnostic service Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value Description This function substitutes a value for an input signal or internal ECU function It also controls an output actuator of an electronic system referenced by LocalID For further details about this service refer to the ISO 14230 3 standard Automotive Diagnostic Command Set User Manual 6 72 ni com Chapter 6 Automotive Diagnostic Command Set API for C ndReadDataByLocallidentifier Purpose Executes the ReadDataByLocalldentifier service Reads an ECU data record Format long ndReadDataByLocalIdentifier TD1 diagRef unsigned char localID unsigned char dataOut long len LVBoolean success Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiag
159. asterReq standard is used SlaveRespFrame selects the Slave Response Frame from an LDF or FIBEX database If you assign an empty string default as SlaveRespFrame the name as defined in the LIN SlaveResp standard is used Baud Rate is the diagnostic communication baud rate The default is 1 which reuses the baudrate of the selected LIN cluster from the assigned FIBEX or LDF database To change the baudrate from the database select a valid LIN baudrate NAD is the address of the slave node being addressed in a request NAD also indicates the source of a response NAD values are 1 127 0x7F while 0 zero and 128 Ox80 255 OxFF are reserved for other purposes error in is a cluster that 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 the VI did not execute the intended operation A positive value means warning the VI executed intended operation but an informational warning is returned For a description of the code wire the error cluster to a LabVIEW error handling VI such as the Simple Error Handler source identifies the VI where the error occurred 5 43 Automotive Diagnostic Command Set User Manual Chapter 5 Automoti
160. ates the byte ordering for multibyte items 0 MSB_FIRST Motorola default 1 LSB_FIRST Intel This function interprets the response byte stream according to this description and returns the resulting DTC records in the DTCs struct array Output statusAvailMask An application specific value returned for all DTCs DTCs Returns the resulting DTCs as an array of structs typedef struct unsigned long DTC unsigned long Status unsigned long AddData TD4 DTC is the resulting Diagnostic Trouble Code For the default 2 byte DTCs use ndDTCToString to convert this code to readable format as defined by SAE J2012 Status is the DTC status Usually this is a bit field with following meaning Bit Meaning 0 testFailed 1 testFailedThisMonitoringCycle 2 pendingDTC 3 confirmedDTC 4 testNotCompletedSinceLastClear 5 testFailedSinceLastClear 6 testNotCompletedThisMonitoringCycle 7 warningIndicatorRequested AddData contains optional additional data for this DTC Automotive Diagnostic Command Set User Manual 6 118 ni com Chapter 6 Automotive Diagnostic Command Set API for C len On input len must contain the DTCs array length in elements On return it contains the number of valid elements in the DTCs array Success Indicates successful receipt of a positive response message for this diagnostic service Return Value The return value indicates the function call status as a signed 32 bit integer Zero means the
161. ation 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 Automotive Diagnostic Command Set User Manual 5 64 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Diag reference out is a copy of Diag reference in You can wire it to subsequent diagnostic 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 the VI did not execute the intended operation A positive value means warning the 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 DoIP Send Vehicle Identification Request vi sends a Vehicle Identification Request to all DolP entities in the local subnet Usually this is done as part of DoIP Get Entities vi and does not need to be executed separately National Instruments 5 65 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diag
162. ation specific This is an odd number usually 1 error in is a cluster that 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 the VI did not execute the intended operation A positive value means warning the 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 rce identifies the VI where the error occurred National Instruments 5 147 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Output diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs seed out returns the seed from the ECU success indicates successful receipt of a positive response message for this diagnostic 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 BE E status is TRUE if an error occurred code is the error code number identifying an error A value of 0 means success A nega
163. ation to the ECU takes place at this point To open a diagnostic session on the ECU call StartDiagnosticSession vi or UDS DiagnosticSessionControl vi Open Diagnostic on LIN vi supports only NI XNET LIN hardware A valid LIN cluster of a LDF or FIBEX database must be assigned also Automotive Diagnostic Command Set User Manual 5 44 ni com VWTP Connect vi Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Purpose Establishes a connection channel to an ECU using the VW TP 2 0 Format diag ref in diag ref out channel ID application type error out error in Input Ho oe E National Instruments diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster channel ID defines the CAN identifier on which the ECU responds for this connection The ECU defines the ID on which the host transmits application type specifies the type of communication that takes place on the communication channel For diagnostic applications specify KWP2000 1 The other values are for manufacturer specific purposes error in is a cluster that 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 TRU
164. ational warning is returned For a description of the code wire the error cluster to a LabVIEW error handling VI such as the Simple Error Handler source identifies the VI where the error occurred National Instruments 5 25 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Output diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic 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 the VI did not execute the intended operation A positive value means warning the 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 Diagnostic Frame Send vi transmits an arbitrary raw CAN frame on the diagnostic CAN identifier For example you can check the transport protocol implementation of an ECU for robustness if erroneous protocol requests are issued Automotive Diagnostic Command Set User Manual 5 26 ni com Chapter 5 Automotive Diagnostic Command Set API
165. atusToString function to obtain a descriptive string for the return value National Instruments 6 85 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C Description This function requests results for example exit status information referenced by LocalID and generated by the routine executed in the ECU memory For further details about this service refer to the ISO 14230 3 standard Automotive Diagnostic Command Set User Manual 6 86 ni com Chapter 6 Automotive Diagnostic Command Set API for C ndRequestSeed Purpose Executes the SecurityAccess service to retrieve a seed from the ECU Format long ndRequestSeed TD1 diagRef unsigned char accessMode unsigned char seedOut long len LVBoolean success Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic or ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct accessMode Indicates the security level to be granted The values are application specific This is an odd number usually 1 Output seedoOut Returns the seed from the ECU len On input 1en must contain the seedOut array length On return it contains the number of valid data bytes in the seedOut array success Indicates successful receipt of a positive response message for this diagnostic service Return Value
166. automatically from the selected cluster such as the LIN Baudrate Using NI XNET hardware the Interface string should look like the following examples e LIN1 nixnet XNET_LIN_Database Uses LIN interface 1 of an NI XNET device and assigns the properties such as baudrate automatically from the XNET alias XNET_LIN_ Database National Instruments 6 39 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C LIN2 nixnet XNET_LIN_Database Uses LIN interface 2 of an NI XNET device and so on with the form LINx Refer to the NI XNET Hardware and Software Manual to assign a database cluster alias baudrate The diagnostic communication baud rate Default is 1 which reuses the baudrate of the selected LIN cluster from the assigned FIBEX or LDF database MasterRegqFrame Selects the Master Request Frame from an LDF or FIBEX database If you assign an empty string default as MasterReqFrame the name as defined in the LIN MasterReq standard is used NAD NAD is the address of the slave node being addressed in a request NAD also is used to indicate the source of a response NAD values are 1 127 Ox7F while 0 zero and 128 Ox80 255 OxFF are reserved for other purposes SlaveRespFrame Selects the Slave Response Frame from an LDF or FIBEX database If you assign an empty string default as SlaveRespFrame the name as defined in the LIN SlaveResp standard is used Output
167. bsequent diagnostic VIs this diagnostic 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 success indicates successful receipt of a positive response message for 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 the VI did not execute the intended operation A positive value means warning the 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 Similar to UDS WriteMemoryByAddress vi You can define the size in bytes of the address and size parameters the default is 4 National Instruments 5 169 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW OBD On Board Diagnostics Services OBD Clear Emission Related Diagnostic Information vi Purpose Executes the OBD Clear Emission Related Diagnostic Information service Clears emission related Diagnostic Trouble Codes DTCs in the ECU Format diag ref in error in no error Input Diagnostic vi and wired through subsequent diagnostic VIs No
168. c Command Set API for C ndDolPGetDiagPowerMode Purpose Gets information on the DoIP entity power state Format long ndDoIPGetDiagPowerMode TD1 diagRef unsigned char powerMode LVBoolean ok Input diagRef Specifies the handle for the diagnostic session obtained from ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct Output powerMode Identifies whether the vehicle is in Diagnostic Power Mode and ready to perform reliable diagnostics Possible values are 0 Not ready 1 Ready All other values are reserved ok Indicates successful receipt of a positive response message for this diagnostic service Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value Description ndDoIPGetDiagPowerMode retrieves a vehicle s Diagnostic Power Mode For example test equipment can use this information to verify whether the vehicle is in Diagnostic Power Mode which allows for performing reliable diagnostics on the vehicle s components
169. cation vi oo e eee aveni a E A 5 89 ReadMemoryByAddress Vi ce eecceeeecessecesceseeseeeseeseeeseeeeesecsecesesaeenseseseeee 5 91 ReadStatusOfDT C view ccscie cassis nade ccesetuaci hte Deasasvev ste dstbea teed suavecvscgavivadeesies 5 93 RequestRoutineResultsByLocalldentifier vVi oe eee eee ee eee ceeeeeeeeeeteeeeeees 5 96 RequestS ed Viisin iieis rat aa wisi is A E EAER EEE 5 98 SedKeEy Vi enren o i R AE T ia a E E ages 5 100 StartDiagnosticSession Vi s eseseessesessessreseersrestsresteststerestestrrrstesrsrenreseseesrset 5 102 StartRoutineByLocalldentifier Vi seseseeesseesseeesesessestsrestssesrssrsresreresresesresrsee 5 104 StopDiagnosticSession Vi oe seeeseeseesecesecsseesecseeesececeseesessaessessseeaeesseess 5 106 StopRoutineByLocalldentifier vi 0 ee ee eeeeseeeeceeeseeeseceeceeeeeseaeeaeeeeees 5 108 POStELPLeSeMteVi a issseueitevet oiii enia eA E E E E EA RNA 5 110 WriteDataByLocalIdentifier vi eseesesseeseeeseeessesesresreserrstesesrrsresrsresrsresresrse 5 112 WriteMemoryByAddress vi ssseesssesssessesesresrsresteresterrsresresrsrerestentnrrsrereseeet 5 114 National Instruments ix Automotive Diagnostic Command Set User Manual Contents UDS DiagOnCAN Services iiss neiii esii acd ae p i eE A a E a A REEE REEE 5 116 UDS ClearDiagnosticInformation Vi ssesseeesseesssesrsersreersrtsrrsrsrrsesresresrsresrset 5 116 UDS CommunicationControl Vvi essseesseessseessesresresesirsterest
170. ceLastClear nn BP WN KF O testNotCompletedThisMonitoringCycle 7 warningIndicatorRequested AddData contains optional additional data for this DTC Usually this does not contain valid information refer to DTCDescriptor len On input len must contain the DTCs array length in elements On return it contains the number of valid elements in the DTCs array success Indicates successful receipt of a positive response message for this diagnostic service Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value National Instruments 6 127 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C Description This function executes the ReportSupportedDTCs subfunction of the UDS ReadDiagnosticTroubleCodeInformation service and reads all supported DTCs from the ECU memory For further details about this service refer to the ISO 15765 3 standard Automotive Diagnostic Command Set User Manual 6 128 ni com Chapter 6 Automotive Diagnostic Command Set API for C ndUDSRequestDownload
171. 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 the VI did not execute the intended operation A positive value means warning the 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 This VI substitutes a value for an input signal or internal ECU function It also controls an output actuator of an electronic system referenced by the local ID parameter For further details about this service refer to the ISO 15765 3 standard Automotive Diagnostic Command Set User Manual 5 128 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW UDS ReadDataByldentifier vi Purpose Executes the UDS ReadDataByldentifier service Reads a data record from the ECU Format diag ref in nnn diag ref out ID data out error in no error j success error out Input diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi or Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elemen
172. copy of diag ref in You can wire it to subsequent diagnostic VIs DTCs returns the resulting DTCs as an array of clusters DTC is the resulting Diagnostic Trouble Code Status is the DTC status Usually this is a bit field with following meaning Bit Meaning 0 testFailed 1 testFailedThisMonitoringCycle 2 pendingDTC 3 confirmedDTC testNotCompletedSinceLastClear testFailedSinceLastClear testNotCompletedThisMonitoringCycle NY Dn WN A warningIndicatorRequested 5 137 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Add Data contains optional additional data for this DTC Usually this does not contain valid information refer to DTC descriptor success indicates successful receipt of a positive response message for this diagnostic 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 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 the VI did not execute the intended operation A positive value means warning the 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 iden
173. ction to a DolP entity Format Diag reference in Diag reference out error in no error error out Diag reference in specifies the diagnostic session handle obtained from Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster error in is a cluster that describes error conditions occurring before the VI EH 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 TF status is TRUE code is the error code number identifying an error A value of 0 means success A negative value means error the VI did not execute the intended operation A positive value means warning the VI executed intended operation but an informational warning is returned For a description of the code wire the error cluster to a LabVIEW error handling VI such as the Simple Error Handler source identifies the VI where the error occurred National Instruments 5 55 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Output Diag reference out is a copy of Diag reference in You can wire it to subsequent diagnostic VIs error out describes error conditions If the error in cluster indicated an error the error out cluster contains the same information Otherwise
174. d from Open Diagnostic vi or Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster memory address defines the memory address from which data are read memory size defines the size of the data to be read error in is a cluster that 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 the VI did not execute the intended operation A positive value means warning the 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 151 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW source identifies the VI where the error occurred memory address length defines the number of bytes of the memory address parameter that are written to the ECU This value is implementation dependent and must be in the range of 1 4 For example if this value is 2 only the two lowest bytes of the address are written to the ECU El memory size length defines the number of bytes
175. d 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 the VI did not execute the intended operation A positive value means warning the 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 For the VW TP 2 0 you must disconnect the connection link to the ECU to properly terminate communication to the ECU This VI sends the proper disconnect messages and unlinks the communication You can create a new connection to the same ECU using VWTP Connect vi again There is no equivalent for the ISO TP ISO 15765 2 as the ISO TP does not use a special communication link Automotive Diagnostic Command Set User Manual 5 50 ni com DolP Functions Chapter 5 Automotive Diagnostic Command Set API for LabVIEW DolP Activate Routing vi Purpose Defines the source and target addresses for a DoIP TCP IP connection Format Diag reference in Diag reference out Source Address Target Address Activation Type error out error in no error Input National Instruments Diag reference in specifies the diagno
176. d operation A positive value means warning the VI executed intended operation but an informational warning is returned For a description of the code wire the error cluster to a LabVIEW error handling VI such as the Simple Error Handler source identifies the VI where the error occurred Description The usual procedure for getting a security access to the ECU is as follows 1 Request a seed from the ECU using RequestSeed vi with access mode n 2 From the seed compute a key for the ECU on the host 3 Send the key to the ECU using SendKey vi with access mode n 1 4 The security access is granted if the ECU validates the key sent Otherwise an error is returned National Instruments 5 99 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW SendKey vi Purpose Executes the SecurityAccess service to send a key to the ECU Format diag ref in diag ref out access mode success key in error in no error error out Input diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi or Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster El access mode indicates the security level to be granted The values are application specific This is an even number usually 2 key in defines the key data to be sent to
177. definition The vbitx filename represents the filename and location of the bitfile on the host if using RIO or on a CompactRIO target This implies that you must download the bitfile to the CompactRIO target before you can run your application You may specify an absolute path or a path relative to the root of your target for the bitfile baudrate is the diagnostic communication baud rate error in is a cluster that 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 the VI did not execute the intended operation A positive value means warning the 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 diag ref out is a cluster containing all necessary diagnostic session information Wire this cluster as a handle to all subsequent diagnostic VIs and close it using Close Diagnostic 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 s
178. describes the error status of this VI m 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 the VI did not execute the intended operation A positive value means warning the 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 Similar to UDS ReadMemoryByAddress vi You can define the size in bytes of the address and size parameters the default is 4 National Instruments 5 167 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW UDS06 WriteMemoryByAddress vi Purpose Executes the UDS WriteMemoryByAddress service Writes data to the ECU memory Format data in diag ref in diag ref out memory address success memory size error out error in no error memory address length memory size length Input data in defines the memory block to be written to the ECU diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi or Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster HE memory address defines the memory address to which da
179. e Codes DTCs Format long ndControlDTCSetting TD1 diagRef unsigned short groupOfDTC unsigned char dataIn long len TD3 DTCDescriptor LVBoolean success Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic and passed to subsequent diagnostic functions Normally it is not necessary to manipulate the elements of this struct manually groupOfDTC Specifies the group of diagnostic trouble codes to be controlled The following values have a special meaning 0x0000 All powertrain DTCs 0x4000 All chassis DTCs 0x8000 All body DTCs OxC000 All network related DTCs OxFFOO All DTCs dataiIn Specifies application specific data that control DTC generation len Must contain the number of valid data bytes in dataIn National Instruments 6 65 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C DTCDescriptor A struct that describes the DTC records the ECU delivers typedef struct long DTCByteLength long StatusByteLength long AddDataByteLength unsigned short ByteOrder TDS DTCByteLength indicates the number of bytes the ECU sends for each DTC Default is 2 StatusByteLength indicates the number of bytes the ECU sends for each DTC s status Default is 1 AddDataByteLength indicates the number of bytes the ECU sends for each DTC s additional data Usually there are no additional data so the default is 0
180. e Diagnostic Command Set API for LabVIEW 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 the VI did not execute the intended operation A positive value means warning the 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 diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs DTCs returns the resulting DTCs as an array of clusters DTC is the resulting Diagnostic Trouble Code For the default 2 byte DTCs you can use DTC to String vi to convert this to readable format as defined by SAE J2012 Status is the DTC status Usually this is a bit field with the following meaning Bit Meaning 0 testFailed 1 testFailedThisMonitoringCycle 2 pendingDTC 3 confirmedDTC testNotCompletedSinceLastClear testFailedSinceLastClear testNotCompletedThisMonitoringCycle a AO WwW A warningIndicatorRequested For OBD this field usually does not contain valid information Add Data contains optional additional data for this DTC Usually this does not contain valid information refer to DTC descriptor 5 177 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive D
181. e ECU starts transmitting its regular communication messages usually CAN messages InputOutputControlByLocalldentifier vi Executes the InputOutputControlB yLocalldentifier service Modifies the ECU I O port behavior OBD Clear Emission Related Diagnostic Information vi Executes the OBD Clear Emission Related Diagnostic Information service Clears emission related Diagnostic Trouble Codes DTCs in the ECU Get Time Stamp vi Opens an OBD II diagnostic session on a CAN port OBD Request Control Of On Board Device vi Executes the OBD Request Control Of On Board Device service Use this VI to modify ECU I O port behavior OBD Request Current Powertrain Diagnostic Data vi Executes the OBD Request Current Powertrain Diagnostic Data service Reads a data record from the ECU OBD Request Emission Related DTCs vi Executes the OBD Request Emission Related DTCs service Reads all emission related Diagnostic Trouble Codes DTCs OBD Request Emission Related DTCs During Current Drive Cycle vi Executes the OBD Request Emission Related DTCs During Current Drive Cycle service Reads the emission related Diagnostic Trouble Codes DTCs that occurred during the current or last completed drive cycle OBD Request On Board Monitoring Test Results vi Executes the OBD Request On Board Monitoring Test Results service Reads a test data record from the ECU Automotive Diagnostic Command
182. e Object to configure This name uses the syntax CANx where x is a decimal number starting at 0 that indicates the CAN network interface CANO CAN1 up to CAN63 CAN network interface names are associated with physical CAN ports using Measurement and Automation Explorer MAX NI XNET By default the Automotive Diagnostic Command Set uses NI CAN for CAN communication This means you must define an NI CAN interface for your NI XNET hardware NI CAN compatibility mode to use your XNET hardware for CAN communication However to use your NI XNET interface in the native NI XNET mode meaning it does not use the NI XNET Compatibility Layer you must define your interface under NI XNET Devices in MAX and pass the NI XNET interface name that the Automotive Diagnostic Command Set will use To do this add nixnet to the protocol string for example CAN nixnet The interface name is related to the NI XNET hardware naming under Devices and Interfaces in MAX 3 Note By selecting nixnet as the interface string the Automotive Diagnostic Command Set uses the Frame Input and Output Queued sessions To force the use of Frame Input and Output Stream sessions instead select ni_genie_nixnet as the interface string for example CANI ni_genie_nixnet An application instance can use only one Frame Input Stream Session and one Frame Output Stream Session at a time so use the default name nixnet as the interface string so that multiple NI XNET Frame Queued S
183. e VI did not execute the intended operation A positive value means warning the 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 This VI requests identification data from the ECU The mode parameter identifies the type of identification data requested The ECU returns identification data that the data out parameter can access The data out format and definition are vehicle manufacturer specific For further details about this service refer to the ISO 14230 3 standard Automotive Diagnostic Command Set User Manual 5 90 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW ReadMemoryByAddress vi Purpose Executes the ReadMemoryBy Address service Reads data from the ECU memory Format diag ref in diag ref out address data out size success error in no error error out Input EI WE E National Instruments diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi or Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster address defines the memory address from which data are to be read Notice that only three bytes are sent to the ECU so the address must b
184. e attention Use the ndStatusToString function to obtain a descriptive string for the return value Description ndOpenDiagnostic opens a diagnostic communication channel to an ECU This function initializes the CAN port specified as input and stores a handle to it among other internal data into diagRefOut which serves as reference for further diagnostic functions No communication to the ECU takes place at this point To open a diagnostic session on the ECU call ndStartDiagnosticSession or ndUDSDiagnosticSessionControl In general you do not need to manipulate the diagRefOut struct contents except if you use the ISO TP Mixed Mode transport protocol in which case you must store the address extensions for transmit and receive in the appropriate members of that struct Possible examples of selections for the interface parameter for the various hardware targets are as follows Using NI CAN hardware e CANO uses CAN interface 0 e CAN1 uses CAN interface 1 and so on with the form CANx e CAN256 uses virtual NI CAN interface 256 Using NI XNET hardware with NI XNET Frame Input Output based sessions e CAN1 nixnet uses CAN interface 1 of an NI XNET device e CAN2 nixnet uses CAN interface 2 of an NI XNET device and so on with the form CANx Using NI XNET hardware with NI XNET Stream Input Output based sessions e CAN1 ni_genie_nixnet uses CAN interface 1 of an NI XNET device e CAN2 ni_genie_nixnet uses CAN int
185. e codes DTCs in the ECU ndOBDOpen Opens a diagnostic session on a CAN port for OBD II National Instruments 6 5 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C Table 6 2 Functions for the Automotive Diagnostic Command Set for C Continued Function Purpose ndOBDRequestControlOfOnBoardDevice Executes the OBD Request Control Of On Board Device service Modifies ECU I O port behavior ndOBDRequestCurrentPowertrainDiagnosticData Executes the OBD Request Current Powertrain Diagnostic Data service Reads an ECU data record ndOBDRequestEmissionRelatedDTCs Executes the OBD Request Emission Related DTCs service Reads all emission related Diagnostic Trouble Codes DTCs ndOBDRequestEmissionRelatedDTCsDuringCurrent Executes the OBD Request DriveCycle Emission Related DTCs During Current Drive Cycle service Reads the emission related Diagnostic Trouble Codes DTCs that occurred during the current or last completed drive cycle ndOBDRequestOnBoardMonitoringTestResults Executes the OBD Request On Board Monitoring Test Results service Reads an ECU test data record ndOBDRequest PermanentFaultCodes Executes the OBD Request Permanent Fault Codes service All permanent Diagnostic Trouble Codes DTCs are read ndOBDRequestPowertrainFreezeFrameData Executes the OBD Request Powertrain Freeze Frame Data service Reads an
186. e in the range O FFFFFF hex size defines the length of the memory block to be read error in is a cluster that 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 the VI did not execute the intended operation A positive value means warning the VI executed intended operation but an informational warning is returned For a description of the code wire the error cluster to a LabVIEW error handling VI such as the Simple Error Handler source identifies the VI where the error occurred 5 91 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Output diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs Data out returns the memory data from the ECU success indicates successful receipt of a positive response message for this diagnostic 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 E HE E status is TRUE if an error occurred code is the error code number identifying an error A value of
187. e is used optionally to fill short CAN frames 256 Short CAN frames are filled optionally with random bytes The default is 255 OXFF Invalid Response as Error returns how the toolkit handles an invalid ECU response 0 Invalid response is indicated by success FALSE only default 1 Invalid response is returned as an error in addition Max RspPending Count is the number of times a ReqCorrectlyRcvd RspPending 0x78 Negative Response Message will be accepted to extend the command timeout default 5 If this message is sent more often in response to a request an error 8120 is returned If the ECU implements commands with a long duration for example flash commands you may need to extend this number VWTP Command Time Out is the time in milliseconds the host waits for a VWTP 2 0 command to be executed default 50 ms The specification states this as 50 ms plus the network latency but some ECUs may require higher values STmin is the minimum time in seconds between the end of transmission of a frame in a diagnostic request message and the start of transmission of the next frame in the diagnostic request message for LIN based diagnostic communication The default is 0 P2min is the minimum time in seconds between reception of the last frame of the diagnostic request and the response sent by the node for LIN based diagnostic communication The default is 0 05 Termination reads the NI XNET Termination property Reflections on t
188. e of 0 means success A negative value means error the VI did not execute the intended operation A positive value means warning the VI executed intended operation but an informational warning is returned For a description of the code wire the error cluster to a LabVIEW error handling VI such as the Simple Error Handler source identifies the VI where the error occurred National Instruments 5 171 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW OBD Request Control Of On Board Device vi Purpose Executes the OBD Request Control Of On Board Device service Modifies ECU I O port behavior Format data in diag ref in diag ref out TID data out error in no error SUCCESS error out Input data in defines application specific data for this service diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster TID defines the test identifier of the I O to be manipulated The values are application specific error in is a cluster that 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 Ea BE status is TRUE if an error occurred This VI is not executed when status is TRUE code is
189. e the values using an Enum control diag ref in specifies the diagnostic session handle obtained from Open 0 Timeout Diag Command is the timeout in milliseconds the master waits for the response to a diagnostic request message The default is 1000 ms 1 Timeout FC Bs is the timeout in milliseconds the master waits for a Flow Control frame after sending a First Frame or the last Consecutive Frame of a block The default is 250 ms 2 Timeout CF Cr is the timeout in milliseconds the master waits for a Consecutive Frame in a multiframe response The default is 250 ms for CAN and 1000 ms for LIN 3 Receive Block Size BS is the number of Consecutive Frames the slave sends in one block before waiting for the next Flow Control frame A value of 0 default means all Consecutive Frames are sent in one run without interruption 4 Wait Time CF STmin defines the minimum time for the slave to wait between sending two Consecutive Frames of a block Values from 0 to 127 are wait times in milliseconds Values 241 to 249 Hex F1 to F9 mean wait times of 100 us to 900 us respectively All other values are reserved The default is 5 ms Automotive Diagnostic Command Set User Manual 5 20 ni com National Instruments Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Max Wait Frames N_WFTmax is the maximum number of WAIT frames the master accepts before terminating the connection The default is 10 Wait Frames to Send N_WAI
190. e 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 ndStatusToString function to obtain a descriptive string for the return value Description ndDiagnosticService is a generic routine to execute any diagnostic service The request and response messages are fed unmodified to the dataIn input and retrieved from the dataOut output respectively No interpretation of the contents is done with one exception The error number is retrieved from a negative response if one occurs In this case an error is communicated through the return value All specialized diagnostic services call ndDiagnosticService internally Automotive Diagnostic Command Set User Manual 6 24 ni com Chapter 6 Automotive Diagnostic Command Set API for C ndDTCToString Purpose Returns a string representation such as P1234 for a 2 byte diagnostic trouble code DTC Format void ndDTCToString unsigned long DTCNum char DTCString long len Input DTCNum The DTC number as returned in the DTCs structs of ndReadDTCByStatus ndReadStatusOf DTC ndUDSReportDTCBySeverityMaskRecord ndUDSReportDTCByStatusMask ndUDSReportSeverityInformationO DTC ndUDSReportSupportedDTCs ndOBDRequestEmissionRelatedDTCs or ndOBDRequestEmissionRelatedDTCsDuringCurrentDriveCycle 3 Note Th
191. eceive in the appropriate cluster members National Instruments 5 39 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Open Diagnostic on IP vi Purpose Opens a diagnostic session on an IP port Communication to the ECU is not yet started Format dynamic port Diag reference out error in no error error out Input dynamic port defines whether the standard UDP port 13401 UDP_TEST_EQUIPMENT_LISTEN is used for communication FALSE or a dynamically assigned UDP port UDP_TEST_EQUIPMENT_REQUEST is opened TRUE Default is TRUE error in is a cluster that 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 the VI did not execute the intended operation A positive value means warning the 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 Automotive Diagnostic Command Set User Manual 5 40 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Diag ref
192. ected behavior A positive value specifies a warning which means the function performed as expected but a condition arose that may require attention Use the ndStatusToString function to obtain a descriptive string for the return value National Instruments 6 159 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C ndOBDRequestEmissionRelatedDTCsDuringCurrentDriveCycle Purpose Executes the OBD Request Emission Related DTCs During Current Drive Cycle service Reads the emission related Diagnostic Trouble Codes DTCs that occurred during the current or last completed drive cycle Format long ndOBDRequestEmissionRelatedDTCsDuringCurrentDriveCycle TD1 diagRef TD3 DTCDescriptor TD4 DTCs long len LVBoolean success Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic or ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct DTCDescriptor A struct that describes the DTC records the ECU delivers typedef struct long DTCByteLength long StatusByteLength long AddDataByteLength unsigned short ByteOrder TD3 DTCByteLength indicates the number of bytes the ECU sends for each DTC The default is 2 StatusByteLength indicates the number of bytes the ECU sends for each DTC s status The default is 0 for OBD AddDat
193. ed 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 ndStatusToString function to obtain a descriptive string for the return value Description ndDoIPActivateRouting establishes a route for the DoIP messages and assigns an endpoint TargetAddress After successfully establishing a route diagnostic messages can be exchanged with the target DoIP entity using any of the diagnostic service functions National Instruments 6 51 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C ndDolPConnect Purpose Creates a TCP IP connection to a DoIP entity identified by its IP address Format long ndDoIPConnect TD1 diagRef char address unsigned short SourceAddress unsigned short TargetAddress Input diagRef Specifies the handle for the diagnostic session obtained from ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct address The IP address of the DoIP entity to connect to zero terminated string in a b c d notation SourceAddress The DoIP source address of the tester that starts the communication You can set this input to 0 if you are activating a route through ndDoIPAct
194. ed vi with access mode n 2 From the seed compute a key for the ECU on the host 3 Send the key to the ECU using UDS SendKey vi with access mode n 1 4 The security access is granted if the ECU validates the key sent Otherwise an error is returned Automotive Diagnostic Command Set User Manual 5 156 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW UDS TesterPresent vi Purpose Executes the UDS TesterPresent service Keeps the ECU in diagnostic mode Format diag ref in EEE diag ref out response required success error in no error error out diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi or Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster response required indicates whether the ECU answers this service TRUE default or not FALSE In the latter case success is TRUE error in is a cluster that describes error conditions occurring before the VI Eh 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 TE status is TRUE code is the error code number identifying an error A value of 0 means success A negative value means error the VI did not execute the intended operation A positive value means wa
195. edef struct long DTCByteLength long StatusByteLength long AddDataByteLength unsigned short ByteOrder TD3 DTCByteLength indicates the number of bytes the ECU sends for each DTC The default is 3 for UDS StatusByteLength indicates the number of bytes the ECU sends for each DTC s status The default is 1 AddDataByteLength indicates the number of bytes the ECU sends for each DTC s additional data Usually there are no additional data so the default is 0 ByteOrder indicates the byte ordering for multibyte items 0 MSB_FIRST Motorola default 1 LSB_FIRST Intel This function interprets the response byte stream according to this description and returns the resulting DTC records in the DTCs struct array Automotive Diagnostic Command Set User Manual 6 126 ni com Chapter 6 Automotive Diagnostic Command Set API for C Output statusAvailMask An application specific value returned for all DTCs DTCs Returns the resulting DTCs as an array of structs typedef struct unsigned long DTC unsigned long Status unsigned long AddData TD4 DTC is the resulting Diagnostic Trouble Code For the default 2 byte DTCs use ndDTCToString to convert this code to readable format as defined by SAE J2012 Status is the DTC status Usually this is a bit field with following meaning Bit Meaning testFailed testFailedThisMonitoringCycle pendingDTC confirmedDTC testNotCompletedSinceLastClear testFailedSin
196. eeeaeeseeeaecneeeaeseseaesseeeaee 6 184 ndWWHOBDReduestSupportedDIDs 00 eee eee eeceeeeeeeeeseeeeseeeneeaeeeeees 6 186 ndWWHOBDReduestSupportedRIDS 00 eee eee eeeeesceseceeeeseseeeeseeeneeeeeseees 6 188 Appendix A NI Services Index National Instruments xiii Automotive Diagnostic Command Set User Manual About This Manual This manual provides instructions for using the Automotive Diagnostic Command Set It contains information about installation configuration and troubleshooting and also contains Automotive Diagnostic Command Set function reference for Lab VIEW based and C based APIs Related Documentation The following documents contain information that you might find helpful as you read this manual National Instruments 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 LIN Specification Package Revision 2 2 ISO 14230 1999 E Road Vehicles Diagnostic Systems Keyword Protocol 2000 ISO 14229 1998 E Road Vehicles Diagnostic Systems Diagnostic Services Specification ISO 157651 2004 E Road Vehicles Diagnostics on Controller Area Networks CAN ISO 15031 5 2006 E Road Vehicles Communication Between Vehicle and External E
197. eeeeesaeeeeeeceseaeeeeeeaees 6 153 ndOBDClearEmissionRelatedDiagnosticInformation eee eee eeees 6 153 ndOBDRequestControlOfOnBoardDevice eee eseeeeeeecseeeseceeeeseeeees 6 154 ndOBDRequestCurrentPowertrainDiagnosticData 0 0 eee eee eects eeeeeeees 6 156 ndOBDRequestEmissionRelatedDTCs 00 esse eeeeceeseeseeeeeeeeeeeeeeneeeseeeeees 6 158 ndOBDRequestEmissionRelatedDTCsDuringCurrentDriveCycle 6 160 ndOBDRequestOnBoardMonitoringTestResults 0 0 eee eee eeeeeseceeeeeeeees 6 162 ndOBDRequestPermanentFaultCodes 00 eee eeeeseeseeeeeeseeeeeeeeeeeeseseeeeeees 6 164 ndOBDRequestPowertrainFreezeFrameData eee eeeeseeeeeseeseeeseeseeeseenees 6 166 ndOBDRequestVehicleInformation eee eee eeceesceseeeseeeeeeeeseeesesseeeeeeaees 6 168 WWH OBD World Wide Harmonized On Board Diagnostics Services 6 170 ndWWHOBDClearEmissionRelatedDTCs 00 eeeeseeeeceeeeeeeeeeeeeeeees 6 170 ndWWHOBDConvertDTCsT0J1939 ooo eee ceeceeeseeeseceenseeseseneeseeeees 6 171 ndWWHOBDConvertDTCsTo0J2012 00 eect ceeeeeseeeseceeeeeeseeeneeseeeees 6 173 ndWWHOBDRequestDID 0 0 eee eee cecceseeseeeseeseceeeeaeeseeeaecnsesseeesecesseeeaees 6 175 ndWWHOBDRequestDTCExtendedDataRecord eee ee eeeeseeseeeeeeeeeeees 6 177 ndWWHOBDRequestEmissionRelatedDTCS 0 eee eee eeeeseeeeeeseteeeeaees 6 179 ndW WHOBDRequestFreezeFrameInformation 0 0 0 eee eeeeeeeeeeeseeeeenees 6 182 ndWWHOBDReduestRID siipii eeeceeeeseeseeesees
198. end a key to the ECU UDS TesterPresent vi Executes the UDS TesterPresent service Keeps the ECU in diagnostic mode UDS TransferData vi Transfers data to from the ECU ina download upload process UDS WriteDataBylIdentifier vi Executes the UDS WriteDataByIdentifier service Writes a data record to the ECU UDS WriteMemoryByAddress vi Executes the UDS WriteMemoryBy Address service Writes data to the ECU memory UDS06 ReadMemoryByAddress vi Executes the UDS ReadMemoryByAddress service Reads data from the ECU memory UDS06 WriteMemoryByAddress vi Executes the UDS WriteMemoryBy Address service Writes data to the ECU memory VWTP Connect vi Establishes a connection channel to an ECU using the VW TP 2 0 VWTP Connection Test vi Maintains a connection channel to an ECU using the VW TP 2 0 VWTP Disconnect vi Terminates a connection channel to an ECU using the VW TP 2 0 WriteDataByLocalldentifier vi Executes the WriteDataByLocalldentifier service Writes a data record to the ECU WriteMemoryByAddress vi Executes the WriteMemoryByAddress service Writes data to the ECU memory Automotive Diagnostic Command Set User Manual 5 8 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Table 5 1 Automotive Diagnostic Command Set API VIs for LabVIEW Continued Function Purpose WWH OBD Clear Emission Related DTCs vi
199. endessessssesccdsssaedasneedbeaessvasads 6 87 NOSENAK CY iscsi etiveiseaies eg hagiendanead E ele EE ETE 6 89 NAStartDiagnosticSession ee eeeceeesseesecseceeceseeseeesecsseeeeeseceeseeesesseeeaeeaes 6 91 ndStartRoutineByLocalldentifier eee eee eseceeeseeeseeseeeseceecesesseeeaeesees 6 92 NAStopDiagnosticSession sceseseesseeccseseeesecesersscesesessesersnsesseeeessneeseseees 6 94 ndStopRoutineByLocalldentifier 0 0 ee eee eeseeseceeeeeeeeeeseesesesesseeeaeenees 6 95 NA TesterPresent issena ai e E E EE eke 6 97 ndWriteDataByLocalldentifier 0 0 0 eee cece eeeeeeeeeeeseeseeseeeaeceseesesseseaeesees 6 99 ndWriteMemoryByAddress 0 eee eee eeeeseeeeceseeseeesecseeeseeseeesecseseeeeseseaeesees 6 101 UDS DiagOnCAN Servicesin e oeni iae aeae a E EA a aR EEE 6 103 ndUDSClearDiagnosticInformation sssesseesesseeseessertsrrstsrrsreresresrrrrsrseeseee 6 103 ndUDSCommiunicationControl oo eee eee eeeeseeeeeeseeseeeseeseeeaeceeesesseeeaeeaees 6 105 nNdUDSControlDTCSettiing siisii eeecceeceeeeeceserssceneessceseesesseessneseeesesnees 6 107 ndUDSDiagnosticSessionControl 0 cee eee eee seeeeseeeeeeseeseeeseesecneeesesseeeaeesees 6 108 NAW DSECUReSet iis ccssseeescessceb a e R E ETT EE eehads 6 109 ndUDSInputOutputControlByldentifier sseeseeesseeeseesseeeeersresesrrsresrsresreee 6 111 ndUDSReadDataByIdentifier eee cee eeeeeeeeeeceseeeeeeeseceeeeaesneeeaeesees 6 113 ndUDSReadMemoryByAddress 000 eee eececc
200. ent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster Automotive Diagnostic Command Set User Manual 5 142 ni com National Instruments Chapter 5 Automotive Diagnostic Command Set API for LabVIEW error in is a cluster that 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 the VI did not execute the intended operation A positive value means warning the 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 diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs DTCs returns the resulting DTCs as an array of clusters DTC is the resulting Diagnostic Trouble Code Status is the DTC status Usually this is a bit field with following meaning Bit Meaning 0 testFailed 1 testFailedThisMonitoringCycle 2 pendingDTC 3 confirmedDTC 4 testNotCompletedSinceLastClear 5 testFailedSinceLastClear 6 testNotCompletedThisMonitoringCycle 7 warningIndicatorRequested Add
201. ents in the DTCs array success Indicates successful receipt of a positive response message for this diagnostic service Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value National Instruments 6 161 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C ndOBDRequestOnBoardMonitoringTestResults Purpose Executes the OBD Request On Board Monitoring Test Results service Reads an ECU test data record Format long ndOBDRequestOnBoardMonitoringTestResults TD1 diagRef unsigned char OBDMID unsigned char dataOut long len LVBoolean success Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic or ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct OBDMID Defines the parameter identifier of the data to be read The SAE J1979 standard defines the values Output dataOut Returns the ECU test data record If you know the record data descr
202. equestTransferExit vi service National Instruments 5 161 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW UDS WriteDataByldentifier vi Purpose Executes the UDS WriteDataByldentifier service Writes a data record to the ECU Format data in diag ref in diag ref out ID success error in no error ks error out Input data in defines the data record to be written to the ECU If you know the the data description record you can use Convert from Phys vi to generate this record diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi or Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster HE ID defines the identifier of the data to be written The values are application specific error in is a cluster that 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 do 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 the VI did not execute the intended operation A positive value means warning the VI executed intended operation but an informational warning is returned For a descrip
203. er Manual Chapter 6 Automotive Diagnostic Command Set API for C Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value Description The WWH OBD ReadDTCInformation service is based on the UDS ReaDTCInformation service ISO 14229 1 Automotive Diagnostic Command Set User Manual 6 178 ni com Chapter 6 Automotive Diagnostic Command Set API for C ndWWHOBDReguestEmissionRelatedDTCs Purpose Executes the WWH OBD ReadDTCInformation service Reads selected Diagnostic Trouble Codes DTCs Format long ndWWHOBDRequestEmissionRelatedDTCS TD1 diagRef unsigned char DTCSeverityMask unsigned char DTCStatusMask TD3 DTCDescriptor unsigned char severityAvailabilityMask unsigned char statusAvailabilityMask unsigned char DTCFormatIdentifier TD4 DTCs long len LVBoolean success Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct DTCSe
204. er service Writes a data record to the ECU Format data in diag ref in diag ref out local ID SUCCESS error in no error ks error out Input data in defines the data record written to the ECU If you know the record data description you can use Convert from Phys vi to generate this record diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi or Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster H k local ID defines the local identifier of the data to be written The values are application specific error in is a cluster that describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out E B status is TRUE if an error occurred This VI is not executed when TF status is TRUE code is the error code number identifying an error A value of 0 means success A negative value means error the VI did not execute the intended operation A positive value means warning the 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 rce identifies the VI where the error occurred Automotive Diagnostic Command Set User Manual 5 112 ni com Output TE Desc
205. er vi ssssesseessssseeesrsresreresrrsteresresrsestsrenrsresrentrees 5 162 UDS WriteMemoryByAddress Vvi sseeseeeesseesseesssesreresrrersresrsrsresrsrerrsresrrees 5 164 UDS06 ReadMemoryByAddress Vi eessessseessseesesesreseeersresersesresrsrsersrenrres 5 166 UDS06 WriteMemoryByAddress Vi sssessseeesseessesesresreersresrssrsresreresrsrenrees 5 168 OBD On Board Diagnostics Services eeescescessseceseeeseecescecececeaeecsaeeeeeesaeeeeeeaeers 5 170 OBD Clear Emission Related Diagnostic Information vi eee 5 170 OBD Request Control Of On Board Device vi cee ee eeeeteeeeeeeeseeeeenees 5 172 OBD Request Current Powertrain Diagnostic Data Vi teers 5 174 OBD Request Emission Related DTCS Vi eee eeeeseesceseeeeeeeeteeeeeeeneeenees 5 176 OBD Request Emission Related DTCs During Current Drive Cycle vi 5 179 OBD Request On Board Monitoring Test Results Vi oo eee eeeeeeeteeee 5 182 OBD Request Permanent Fault Codes vin ccc eeceseesceseeeeeeeeeeeeeeeeeeseees 5 184 OBD Request Powertrain Freeze Frame Data vi eee ee eeeeseeeeeereeneees 5 187 OBD Request Supported PIDS Vi eee ce eeeeseeeeeeeceeeeseeeeetseseeeeaeeseeenees 5 189 OBD Request Vehicle Information Vi eee eeteeeeseereceseeeeeeseceeeeseeneeeaees 5 191 WWH OBD World Wide Harmonized On Board Diagnostics Services 60 5 193 WWH OBD Clear Emission Related DTCS Vi eee eeeeeeeseeeeeneeeeesees 5 193 WWH OBD Convert
206. ere the error occurred Output diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs RIDs out returns an array of valid RIDs Automotive Diagnostic Command Set User Manual 5 212 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW success indicates successful receipt of a positive response message for this diagnostic 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 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 the VI did not execute the intended operation A positive value means warning the VI executed intended operation but an informational warning is returned For a description of the code wire the error cluster to a LabVIEW error handling VI such as the Simple Error Handler source identifies the VI where the error occurred Description The WWH OBD RoutineControl service is based on the UDS RoutineControl service ISO 14229 1 National Instruments 5 213 Automotive Diagnostic Command Set User Manual Automotive Diagnostic Command Set API for C This chapter lists the Automotive Diagnostic Command Set API functions and describes their format purpose and parameters Unless otherwise stated each Automotive D
207. erence out is a cluster containing all necessary information about the diagnostic session Wire this output as a handle to all subsequent diagnostic VIs and close it using Close Diagnostic 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 the VI did not execute the intended operation A positive value means warning the 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 Open Diagnostic on IP vi opens a Diagnostic on Internet Protocol DoIP communication channel to an ECU The UDP port specified as input is initialized and a handle to it is stored among other internal data in the Diag reference out cluster which serves as reference for further diagnostic functions Note that no communication to an ECU takes place at this point To open a diagnostic session on an ECU call DoIP Get Entities vi to find out which DoIP entities DoIP capable ECUs exist in the network You need to create a TCP IP connection to the selected DoIP entity using DoIP
208. erface 2 of an NI XNET device and so on with the form CANx Using R Series e CANI RIOI c temp MyFpgaBitfile lvbitx uses a named target RIO1 as compiled into the bitfile at location c temp MyFpgaBitfile 1lvbitx National Instruments 6 35 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C Using CompactRIO e CAN1 MyFpgaBitfile lvbitx uses compiled bitfile MyFpgaBitfile lvbitx which must be FTP copied to the root of the CompactRIO target Automotive Diagnostic Command Set User Manual 6 36 ni com Chapter 6 Automotive Diagnostic Command Set API for C ndOpenDiagnosticOnIP Purpose Opens a diagnostic session on an IP port Communication to the ECU is not yet started Format long ndOpenDiagnosticOnIP LVBoolean dynamicPort TD1 diagRefOut Input dynamicPort Defines whether the standard UDP port 13401 UDP_TEST_EQUIPMENT_LISTEN is used for communication FALSE or a dynamically assigned UDP port UDP_TEST_EQUIPMENT_REQUEST is opened TRUE Output diagRefOut A struct that contains all necessary information about the diagnostic session Pass this struct as a handle to all subsequent diagnostic functions and close it using ndCloseDiagnostic Return Value The return value indicates the function call status as a signed 32 bit integer Zero means the function executed successfully A negative value specifies an error which means the function did not perfor
209. eriod of time the diagnostic session is terminated and the ECU returns to normal operation mode A GetSeed Unlock mechanism may protect some diagnostic services However the applicable services are left to the manufacturer and not defined by the standard You can execute the GetSeed Unlock mechanism through the SecurityAccess service This defines several levels of security but the manufacturer assigns these levels to certain services Read Write Memory National Instruments Use the Read WriteMemoryByAddress services to upload download data to certain memory addresses on an ECU The address is a three byte quantity in KWP2000 and a five byte quantity four byte address and one byte extension in the calibration protocols 1 3 Automotive Diagnostic Command Set User Manual Chapter 1 Introduction The Upload Download functional unit services are highly manufacturer specific and not well defined in the standard so they are not a good way to provide a general upload download mechanism Measurements Use the ReadDataByLocal Commonldentifier services to access ECU data in a way similar to a DAQ list A Local Commonldentifier describes a list of ECU quantities that are then transferred from the ECU to the tester The transfer can be either single value or periodic with a slow medium or fast transfer rate The transfer rates are manufacturer specific you can use the SetDataRates service to set them but this setting is manufacturer
210. ermanent Fault Codes vi 5 184 OBD Request Powertrain Freeze Frame Data vi 5 187 OBD Request Supported PIDs vi 5 189 Automotive Diagnostic Command Set User Manual Index OBD Request Vehicle Information vi 5 191 On Board Diagnostic 1 6 Open Diagnostic on IP vi 5 40 Open Diagnostic on LIN vi 5 42 Open Diagnostic vi 5 36 other programming languages using with Automotive Diagnostic Command Set 3 3 P programming language choosing 3 1 R R Series application development on using NI 985x or NI 986x C Series module 3 4 read write memory 1 3 ReadDataByLocalldentifier vi 5 84 ReadDTCByStatus vi 5 86 ReadECUIdentification vi 5 89 ReadMemoryByAddress vi 5 91 ReadStatusOfDTC vi 5 93 related documentation xv remote action of a routine KWP2000 1 4 RequestRoutineResultsByLocal Identifier vi 5 96 RequestSeed vi 5 98 S SendKey vi 5 100 serial number finding xviii software activating xvii evaluating xix moving after activation xix requirements 2 3 StartDiagnosticSession vi 5 102 StartRoutineByLocalIdentifier vi 5 104 Automotive Diagnostic Command Set User Manual l 8 StopDiagnosticSession vi 5 106 StopRoutineByLocalldentifier vi 5 108 support technical A 1 T technical support A 1 TesterPresent vi 5 110 transport protocol KWP2000 1 2 tweaking 4 4 tweaking the transport protocol 4 4 U UDS 1 5 diagnostic service format 1 6 diagnostic services 1 5 external references
211. 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 the VI did not execute the intended operation A positive value means warning the 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 DolIP Disconnect vi terminates the TCP IP connection to the connected DoIP entity After executing this VI diagnostic services no longer can be executed on that DoIP entity You can reconnect with DoIP Connect vi Automotive Diagnostic Command Set User Manual 5 56 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW DolP Get Diagnostic Power Mode vi Purpose Gets information about the DoIP entity power state Format Diag reference in Diag reference out power mode error in no error ok error out Input Diag reference in specifies the diagnostic session handle obtained from Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster error in is a cluster that describes error conditions occurring before the VI executes If an error has already occurred the VI returns the v
212. ervice WriteDataByldentifier and writes Record Values data values into the ECU datatn identifies the data The vehicle manufacturer must ensure the ECU conditions are met when performing this service Typical use cases are clearing nonvolatile memory resetting learned values setting option content setting the Vehicle Identification Number or changing calibration values For further details about this service refer to the ISO 15765 3 standard Automotive Diagnostic Command Set User Manual 6 146 ni com Chapter 6 Automotive Diagnostic Command Set API for C ndUDSWriteMemoryByAddress Purpose Executes the UDS WriteMemoryByAddress service Writes data to the ECU memory Format long ndUDSWriteMemoryByAddress TD1 diagRef unsigned long address unsigned char size unsigned char dataIn long len LVBoolean success Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic or ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct address Defines the memory address to which data are written Only three bytes are sent to the ECU so the address must be in the range O FFFFFF hex size Defines the length of the memory block to be written dataiIn Defines the memory block to be written to the ECU len Must contain the number of valid data bytes in dataIn National Instruments 6 147 A
213. es a data record to the ECU Format long ndUDSWriteDataByIdenti fier TD1 diagRef unsigned short ID unsigned char dataIn long len LVBoolean success Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic or ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct ID Defines the identifier of the data to be read The values are application specific dataiIn Defines the data record written to the ECU If you know the record data description use ndConvertFromPhys to generate this record len Must contain the number of valid data bytes in dataIn Output success Indicates successful receipt of a positive response message for this diagnostic service Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value National Instruments 6 145 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C Description This function performs the UDS s
214. es messages of variable byte lengths a transport protocol is necessary on layers with only a well defined short message length such as CAN or LIN The transport protocol splits a long UDS message into pieces that can be transferred over the network and reassembles those pieces to recover the original message UDS runs on CAN LIN and Ethernet on various transport protocols 3 Note The Automotive Diagnostic Command Set supports only the ISO TP standardized in ISO 15765 2 manufacturer specific VW TP 2 0 transport protocols and Diagnostic Over IP ISO 13400 Diagnostic Services National Instruments The diagnostic services available in UDS are grouped in functional units and identified by a one byte code Serviceld Not all codes are defined in the standard for some codes the standard refers to other standards and some are reserved for manufacturer specific extensions The Automotive Diagnostic Command Set supports the following services e Diagnostic Management e Data Transmission e Stored Data Transmission Diagnostic Trouble Codes e Input Output Control e Remote Activation of Routine For UDS on LIN a slave node must support a set of ISO 14229 1 diagnostic services such as e Node identification reading hardware and software version hardware part number and diagnostic version e Reading data parameters reading ECU internal values such as oil temperature and vehicle speed e Writing parameter values if app
215. es the number of bytes the ECU sends for each DTC The default is 2 Status Byte Length indicates the number of bytes the ECU sends for each DTC s status The default is 0 for OBD Add Data Byte Length indicates the number of bytes the ECU sends for each DTC s additional data Usually there is no additional data so the default is 0 Byte Order indicates the byte ordering for multibyte items 0 MSB_FIRST Motorola default 1 LSB_FIRST Intel This VI interprets the response byte stream according to this description and returns the resulting DTC records in the DTCs cluster array diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster error in is a cluster that 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 B National Instruments 5 179 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW 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 the VI did not execute the intended operation A positive value means warning the VI executed intended operation but an info
216. escribes 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 HA E status is TRUE if an error occurred This VI is not executed when TF status is TRUE code is the error code number identifying an error A value of 0 means success A negative value means error the VI did not execute the intended operation A positive value means warning the 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 rce identifies the VI where the error occurred Automotive Diagnostic Command Set User Manual 5 206 ni com Output m Description Chapter 5 Automotive Diagnostic Command Set API for LabVIEW diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs data out returns the ECU data record success indicates successful receipt of a positive response message for this diagnostic 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 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 the VI did not execute the intended operation A
217. eseeseeeeeseeeseeseenseceeensesseseneesees 6 115 ndUDSReportDTCBySeverityMaskRecord 0 ei eeeeeeseseeeseeeeceeeeneeeeeeeteees 6 117 ndUDSReportDTCByStatusMask 0 0 eee eeeeseeeeeeeceecsseeeeesecesneeeeseaeesees 6 120 ndUDSReportSeverityInformationOfDTC 0 0 eee cece eseeeeceeceeetseteneenees 6 123 ndUDSReportSupportedDT Cs eee eee ceceseeeeeesecseeeseeeeeseceeesesseseneenees 6 126 NdUDSRequest Download ccsscssssestehessesestevessssestadessavesdioessveasdesescssuavveedsses 6 129 ndUDSR q estSeedrini iieii eeii teie iaeo aiee isena Ee Ea EE Eaa 6 131 ndUDSRequestTransferEXit eee eeeeseceeeseeseeesecseceseeseeeseceensesseseaeesees 6 133 NdUDSRequestUpload oe eee eeeeccesecseeeeceecesecseeesecseeeaeeseeeascnesesesseseaeesees 6 135 ndUDSRo tineControl nennir a e a eves iad 6 137 ndUDSSeEndKEy iritiraa n E EE REEERE LERNE 6 139 NAUUDS TesterPresents siisi anren aai aiiis a oa a ain 6 141 ndUDSTransferData na niiae ates a E E EE EER E 6 143 ndUDS WriteDataByldentifier 0 eee ees eeeeseeeeeneceseeseenseesesneeteeeaeenees 6 145 Automotive Diagnostic Command Set User Manual xii ni com Contents nNdUDS WriteMemoryByAddress 000 eee eeeeseeseeeeceseeseeeaeceeeeeeeeenaeseeeeees 6 147 ndUDSO6ReadMemoryByAddress 0 eee esse ese eseceeeseeeseceeeeeeseeeaeeseeeees 6 149 ndUDSO6WriteMemoryByAddress 0 eee eee eeeeeseeseeeseeeeeseeceeeseesesseeeaees 6 151 OBD On Board Diagnostics Services eseeescesseeesteeesecescecese
218. essage for F bas f this diagnostic 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 H A E 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 the VI did not execute the intended operation A positive value means warning the 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 Automotive Diagnostic Command Set User Manual 5 124 ni com UDS ECUReset vi Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Purpose Executes the UDS ECUReset service Resets the ECU Format diag ref in diag ref out mode power down time error in no error success error out Input National Instruments diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi or Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster mode indicates the reset mode Hex Description 01 02 03 04 05 hardReset keyOffOnReset softReset enableRapidPowerSh
219. essions can coexist on a single interface and the Frame Input and Output Stream Sessions may be used for example for a Frame logging replay use case Automotive Diagnostic Command Set User Manual 6 30 ni com Chapter 6 Automotive Diagnostic Command Set API for C CompactRIO or R Series If using CompactRIO or R Series hardware you must provide a bitfile that handles the CAN communication between the host system and FPGA To access the CAN module on the FPGA you must specify the bitfile name after the for example CAN1 MyBitfile lvbitx To specify a special RIO target you can specify that target by its name followed by the bitfile name for example CAN RIOL MyBitfile lvbitx Currently only a single CAN interface is supported RIO1 defines the RIO target name as defined in your LabVIEW Project definition The vbitx filename represents the filename and location of the bitfile on the host if using RIO or on a CompactRIO target This implies that you must download the bitfile to the CompactRIO target before you can run your application You may specify an absolute path or a path relative to the root of your target for the bitfile baudrate The diagnostic communication baud rate transmitID The CAN identifier for sending diagnostic request messages from the host to the ECU Set to 1 OxFFFFFFFF for the default OBD CAN identifier receivelID The CAN identifier for sending diagnostic response messages from the ECU to the
220. estFailedThisMonitoringCycle 2 pendingDTC 3 confirmedDTC 4 testNotCompletedSinceLastClear 5 testFailedSinceLastClear 6 testNotCompletedThisMonitoringCycle 7 warningIndicatorRequested AddData contains optional additional data for this DTC Usually this does not contain valid information refer to DTCDescriptor len On input len must contain the DTCs array length in elements On return it contains the number of valid elements in the DTCs array success Indicates successful receipt of a positive response message for this diagnostic service National Instruments 6 83 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value Description This function reads diagnostic trouble codes from the ECU memory If you specify groupOfDTC the ECU reports DTCs based only on the functional group selected by groupOfDTC For further details about this service refer to the ISO 14230 3 standard Automotive Diagnostic Command Set User Manual 6
221. estsestesrnresrsreneres 5 119 UDS ControIDT CSettin evi osiccsscci css seeascessascscevesssvest eeseasesddeesssvatadetduatavessesade 5 121 UDS DiagnosticSessionControl Vi eee eseeeseeseeeceeseceeeesesseeeseeseeeseeaeees 5 123 ODRA OA A E ies T ETT 5 125 UDS InputOutputControlByIdentifier vi eee eee eeeereeeeeeeeneeeneees 5 127 UDS ReadDataByldentifier vi oe eseeeseeseeeseeseeeeeeeseaeteeeseeseeeaees 5 129 UDS ReadMemoryByAddress vViuw eee cece eseeseeseeeseeeeceeeesesseeeseeseesseeaeees 5 131 UDS ReportDTCBySeverity MaskRecord vi ee eeceseeeeeseeeeeseeeseeseeseeeaeees 5 133 UDS ReportDTCByStatusMask Vi oo eee eee eeeesecseeeeeceenseeseesaeeseeneeeaeees 5 136 UDS ReportSeverityInformationOfDTC Vi oo eee eee eee cereeseeseeeseeneeeneees 5 139 UDS ReportSupportedDTCs Vin eee eeeeceesecseeeeeeeeeseceeesesseeeaeeeeeseeaeens 5 142 UDS RequestDownload vi c sscessesieseesssesssavesccpestiscsecssscacesesesicaess cubesvacvesses 5 145 UDS RequestS eed yieee i nenie i E EE Has cotbeveesee caus ERE 5 147 UDS RequestTransferEXit vi pisini enini inii 5 149 UDS RequestUpload vio ee cece eniran sir as averi kies antika aika sasesana 5 151 UDS Routine ontrol VI s ie iiris psie siase a i iaaea riia 5 153 UDS Send Key Vikaa atien ea EE EE E RE E E 5 155 UDS Test rPresert Vi scrii satesessascpegoib eset uetavssassestedaadetestenedesnseed aduaesteseansts 5 157 UDS Tr psferData Vi renerne eni aa ik E ema E 5 159 UDS WriteDataByIdentifi
222. et 6 68 ndEnableNormalMessageTransmission 6 70 ndGetProperty 6 26 ndGetTimeStamp 6 29 ndInputOutputControlByLocalldentifier 6 71 ndOBDClearEmissionRelatedDiagnostic Information 6 153 ndOBDOpen 6 30 ndOBDRequestControlOfOnBoard Device 6 154 ndOBDRequestCurrentPowertrainDiagnostic Data 6 156 ndOBDRequestEmissionRelatedDTCs 6 158 ndOBDRequestEmissionRelatedDTCsDuring CurrentDriveCycle 6 160 ndOBDRequestOnBoardMonitoringTest Results 6 162 ndOBDRequestPermanentFaultCodes 6 164 ndOBDRequestPowertrainFreezeFrame Data 6 166 ndOBDRequestVehicleInformation 6 168 ndOpenDiagnostic 6 33 ndOpenDiagnosticOnIP 6 37 ndOpenDiagnosticOnLIN 6 39 ndReadDataB yLocalldentifier 6 73 ndReadDTCByStatus 6 75 ndReadECU Identification 6 78 ndReadMemoryByAddress 6 80 ndReadStatusOfDTC 6 82 ni com ndRequestRoutineResultsByLocal Identifier 6 85 ndRequestSeed 6 87 ndSendKey 6 89 ndSetProperty 6 41 ndStartDiagnosticSession 6 91 ndStartRoutineByLocalldentifier 6 92 ndStatusToString 6 44 ndStopDiagnosticSession 6 94 ndStopRoutineByLocalldentifier 6 95 ndTesterPresent 6 97 ndUDS06ReadMemoryBy Address 6 149 ndUDS06WriteMemoryBy Address 6 151 ndUDSClearDiagnosticInformation 6 103 ndUDSCommunicationControl 6 105 ndUDSControlDTCSetting 6 107 ndUDSDiagnosticSessionControl 6 108 ndUDSECUReset 6 109 ndUDSInputOutputControlBy Identifier 6 111 ndUDSReadDataByldentifier 6 113 ndUDSReadMemoryByAddress 6 115 ndUDSReportDTCBySe
223. et API for C ndWWHOBDReguestDID Purpose Executes the WWH OBD ReadDataByldentifier service Reads a data record from the ECU Format long ndWWHOBDRequestDID TD1 diagRef unsigned short datalIdentifier unsigned char dataOut long len LVBoolean success Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct dataIdentifier Defines the data identifier of the data to be read The SAE J1979DA standard defines the values Output dataOut Returns the ECU data record If you know the record data description you can use ndConvertFromPhys to interpret this record You can obtain the description from the SAE J1979DA standard len On input len must contain the dataOut array length On return it contains the number of valid data bytes in the dataOut array success Indicates successful receipt of a positive response message for this diagnostic service Return Value The return value indicates the function call status 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 6 175 Auto
224. et User Manual 5 38 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Using NI CAN hardware e CANO uses CAN interface 0 e CAN1 uses CAN interface 1 and so on with the form CANx e CAN256 uses virtual NI CAN interface 256 e CAN257 uses virtual NI CAN interface 257 Using NI XNET hardware with NI XNET Frame Input Output based sessions e CAN1 nixnet uses CAN interface 1 of an NI XNET device e CAN2 nixnet uses CAN interface 2 of an NI XNET device and so on with the form CANx Using NI XNET hardware with NI XNET Stream Input Output based sessions e CAN1 ni_genie_nixnet uses CAN interface 1 of an NI XNET device e CAN2 ni_genie_nixnet uses CAN interface 2 of an NI XNET device and so on with the form CANx Using R Series e CAN1 RIOI c temp MyFpgaBitfile lvbitx uses a named target RIO1 as compiled into the bitfile at c temp MyFpgaBitfile lvbitx Using CompactRIO e CANI1 MyFpgaBitfile lvbitx auses compiled bitfile MyFpgaBitfile lvbitx which must be FTP copied to the root of the CompactRIO target 3 Note No communication to the ECU takes place at this point To open a diagnostic session on the ECU call StartDiagnosticSession vi or UDS DiagnosticSessionControl vi In general it is not necessary to manipulate the diag ref out cluster contents with one notable exception If you use the ISO TP Mixed Mode transport protocol you must store the address extensions for transmit and r
225. ets up a unique communication channel to an ECU for subsequent diagnostic service requests 3 Note You must maintain the communication link you created by periodically at least once a second calling VWTP Connection Test vi There is no equivalent for the ISO TP ISO 15765 2 as the ISO TP does not use a special communication link Automotive Diagnostic Command Set User Manual 5 46 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW VWTP Connection Test vi Purpose Maintains a connection channel to an ECU using the VW TP 2 0 Format diag ref in diag ref out error in error out Input diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster error in is a cluster that 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 TE status is TRUE code is the error code number identifying an error A value of 0 means success A negative value means error the VI did not execute the intended operation A positive value means warning the VI executed intended operation but an informational warning is returned For a description of the code wire the error cluster to a LabVIEW error ha
226. eturned For a description of the code wire the error cluster to a LabVIEW error handling VI such as the Simple Error Handler source identifies the VI where the error occurred Description The WWH OBD ReadDTCInformation service is based on the UDS ReaDTCInformation service ISO 14229 1 Automotive Diagnostic Command Set User Manual 5 202 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW WWH OBD Request Emission Related DTCs vi Purpose Executes the WWH OBD ReadDTCInformation service Reads selected Diagnostic Trouble Codes DTCs Format DTC descriptor DTCs diag ref in diag ref out DTC status mask status availability mask DTC severity mask severity availability mask error in no error DTC format identifier i error out BERANA E success Input DTC descriptor is a cluster that describes the DTC records the ECU delivers DTC Byte Length indicates the number of bytes the ECU sends for each DTC The default is 3 Status Byte Length indicates the number of bytes the ECU sends for each DTC s status The default is 1 Add Data Byte Length indicates the number of bytes the ECU sends for each DTC s additional data Usually there is no additional data so the default is 0 Byte Order indicates the byte ordering for multibyte items E HEE 0 MSB_FIRST Motorola default 1 LSB_FIRST Intel The DTC descriptor is given here as a parameter to convert the group of DTC parameters
227. fectively based on the mode value content The vehicle manufacturer determines when the positive response message is sent National Instruments 6 69 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C ndEnableNormalMessageTransmission Purpose Executes the EnableNormalMessageTransmission service The ECU starts transmitting its regular communication messages usually CAN messages Format long ndEnableNormalMessageTransmission TD1 diagRef LVBoolean requireResponse LVBoolean success Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic or ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct requireResponse Indicates whether a response to this service is required If requireResponse is FALSE no response is evaluated and success is always returned TRUE This parameter is passed by reference Output Success Indicates successful receipt of a positive response message for this diagnostic service Return Value The return value indicates the function call status 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 cond
228. 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 ndStatusToString function to obtain a descriptive string for the return value National Instruments 6 113 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C Description This function requests data record values from the ECU identified by the ID parameter For further details about this service refer to the ISO 15765 3 standard Automotive Diagnostic Command Set User Manual 6 114 ni com Chapter 6 Automotive Diagnostic Command Set API for C ndUDSReadMemoryByAddress Purpose Executes the UDS ReadMemoryByAddress service Reads data from the ECU memory Format long ndUDSReadMemoryByAddress TD1 diagRef unsigned long address unsigned char size unsigned char dataOut long len LVBoolean success Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic or ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct address Defines the memory address from which data are read Only three bytes are sent to the ECU so the address must be in the range O FFFFFF hex size Defines the length of the memory block to be read Output dataOut Returns the ECU mem
229. ges are used for data transfer 1 ISO TP Mixed Mode The ISO TP as specified in ISO 15765 2 is used the first data byte is used as address extension sourceAddress The host diagnostic tester logical address targetAddress The ECU logical address Automotive Diagnostic Command Set User Manual 6 18 ni com Chapter 6 Automotive Diagnostic Command Set API for C Output transmitID The generated CAN identifier for sending diagnostic request messages from the host to the ECU receivelID The generated CAN identifier for sending diagnostic response messages from the ECU to the host Description ISO 15765 2 specifies a method for creating extended 29 bit CAN identifiers for diagnostic applications given the addressing mode physical functional the transport protocol normal mixed and the 8 bit source and target addresses This function implements the construction of these CAN identifiers You can use them directly in the ndOpenDiagnostic function National Instruments 6 19 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C ndDiagFrameRecv Purpose Receives a raw CAN frame on the diagnostic CAN ID to check for errors in the transport protocol implementation of an ECU Format long ndDiagFrameRecv TD1 diagRef unsigned long timeout unsigned char dataOut long len Input diagRef Specifies the diagnostic session handle obtained from ndOpen
230. gned short DTC unsigned char FTB unsigned long Status unsigned long AddData TD6 DTC is the resulting Diagnostic Trouble Code FTB contains the failure type byte Status is the DTC status Usually this is a bit field with following meaning Bit Meaning O testFailed testFailedThisOperationCycle 2 pendingDTC National Instruments 6 173 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C 3 confirmedDTC 4 testNotCompletedSinceLastClear 5 testFailedSinceLastClear 6 testNotCompletedThisOperationCycle 7 warningIndicatorRequested AddData contains optional additional data for this DTC Usually this does not contain valid information refer to DTCDescriptor lenDTCsJ2012 On input lenDTCsJ2012 must contain the DTCsJ2012 array length On return it contains the number of valid data bytes in the DTCsJ2012 array Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value Automotive Diagnostic Command Set User Manual 6 174 ni com Chapter 6 Automotive Diagnostic Command S
231. gnostic Command Set API for C ndStatusToString Purpose Returns a description for an error code Format void ndStatusToString long errorCode char message long len Input errorCode The status code return value of any other diagnostic functions Output message Returns a descriptive string for the error code len On input len must contain the mes sage array length On return it contains the number of valid data bytes in the message array Description When the status code returned from an Automotive Diagnostic Command Set function is nonzero an error or warning is indicated This function obtains an error warning description for debugging purposes The return code is passed into the errorCode parameter The len parameter indicates the number of bytes available in the string for the description The description is truncated to size len if needed but a size of 1024 characters is large enough to hold any description The text returned in message is null terminated so you can use it with ANSI C functions such as printf For C or C applications each Automotive Diagnostic Command Set function returns a status code as a signed 32 bit integer The following table summarizes the Automotive Diagnostic Command Set use of this status Automotive Diagnostic Command Set User Manual 6 44 ni com Chapter 6 Automotive Diagnostic Command Set API for C Status Code Use Status Code
232. h as the Simple Error Handler source identifies the VI where the error occurred Description This VI clears the diagnostic information on the ECU memory If the group of DTC parameter is present the ECU is requested to clear all memory including the DTCs For further details about this service refer to the ISO 14230 3 standard Automotive Diagnostic Command Set User Manual 5 72 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW ControlIDTCSetting vi Purpose Executes the ControlDTCSetting service and modifies the generation behavior of selected Diagnostic Trouble Codes DTCs Format DTC descriptor diag ref in diag ref out data in success group of DTC error out error in no error Input National Instruments DTC descriptor is a cluster that describes the DTC records the ECU delivers DTC Byte Length indicates the number of bytes the ECU sends for each DTC The default is 2 Status Byte Length indicates the number of bytes the ECU sends for each DTC s status The default is 1 Add Data Byte Length indicates the number of bytes the ECU sends for each DTC s additional data Usually there is no additional data so the default is 0 Byte Order indicates the byte ordering for multibyte items 0 MSB_FIRST Motorola default 1 LSB_FIRST Intel The DTC descriptor is given here as a parameter basically to convert the group of DTC parameter to a binary representation
233. h subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster error in is a cluster that 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 Automotive Diagnostic Command Set User Manual 5 184 ni com National Instruments Chapter 5 Automotive Diagnostic Command Set API for LabVIEW 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 the VI did not execute the intended operation A positive value means warning the 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 diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs DTCs returns the resulting DTCs as an array of clusters DTC is the resulting Diagnostic Trouble Code For the default 2 byte DTCs you can use DTC to String vi to convert this to readable format as defined by SAE J2012 Status is the DTC status Usually this is a bit field with the following meaning Bit Meaning 0 testFailed 1 testFailedThisMonitoringCycle 2 pendingDTC 3 confirmedDTC 4 test
234. he CAN and LIN bus can cause communication failures To prevent reflections termination can be present as external resistance or resistance the XNET CAN or LIN board applies internally This property determines whether the XNET board uses termination to the bus For further information about appropriate terminations of a CAN or LIN network refer to the NI XNET Hardware and Software Manual The default is 0 6 27 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C Output propertyValue The requested property value Description Use this function to request several internal diagnostic parameters such as timeouts for the transport protocol Use ndSet Property to modify the parameters Automotive Diagnostic Command Set User Manual 6 28 ni com Chapter 6 Automotive Diagnostic Command Set API for C ndGetTimeStamp Purpose Gets timestamp information about the first last send received frame of the ISO TP for CAN and LIN Format void ndGetTimeStamp TD1 diagRef unsigned long long timeStampWriteFirst unsigned long long timeStampWriteLast unsigned long long timeStampReadFirst unsigned long long timeStampReadLast Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic or ndOpenDiagnosticOnLIN and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct Output timeS
235. he ECU is as follows 1 Request a seed from the ECU using ndUDSRequest Seed with access mode n 2 From the seed compute a key for the ECU on the host 3 Send the key to the ECU using ndUDSSendKey with access mode n 1 4 The security access is granted if the ECU validates the key sent Otherwise an error is returned Automotive Diagnostic Command Set User Manual 6 132 ni com Chapter 6 Automotive Diagnostic Command Set API for C ndUDSRequesttTransferExit Purpose Terminates a download upload process Format long ndUDSRequestTransferExit TD1 diagRef unsigned char dataIn long len unsigned char dataOut long len2 LVBoolean success Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic or ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct dataIn Defines a data record to be written to the ECU as part of the termination process The meaning is implementation dependent this may be a checksum or a similar verification instrument len Must be set to the buffer size for the dataIn parameter Output dataOut Returns a memory data block from the ECU as part of the termination process The meaning is implementation dependent this may be a checksum or a similar verification instrument len2 Must be set to the buffer size for the dataOut parameter On return it con
236. he elements of this struct mode Indicates the reset mode Hex 01 02 03 7F 80 FF Description PowerOn This value identifies the PowerOn ResetMode a simulated PowerOn reset that most ECUs perform after the ignition OFF ON cycle When the ECU performs the reset the client tester re establishes communication PowerOnWhileMaintainingCommunication This value identifies the PowerOn ResetMode a simulated PowerOn reset that most ECUs perform after the ignition OFF ON cycle When the ECU performs the reset the server ECU maintains communication with the client tester Reserved ManufacturerSpecific This range of values is reserved for vehicle manufacturer specific use Automotive Diagnostic Command Set User Manual 6 68 ni com Chapter 6 Automotive Diagnostic Command Set API for C Output success Indicates successful receipt of a positive response message for this diagnostic service Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value Description This function requests the ECU to perform an ECU reset ef
237. he error status of this VI HEA 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 the VI did not execute the intended operation A positive value means warning the VI executed intended operation but an informational warning is returned For a description of the code wire the error cluster to a LabVIEW error handling VI such as the Simple Error Handler source identifies the VI where the error occurred Description The WWH OBD ReadDataByldentifier service is based on the UDS ReadDataBylIdentifier service ISO 14229 1 Automotive Diagnostic Command Set User Manual 5 200 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW WWH OBD Request DTC Extended Data Record vi Purpose Executes the WWH OBD ReadDTCInformation service Reads selected Diagnostic Trouble Codes DTCs Format diag ref in diag ref out DTC mask record data out error in no error success error out Input diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi or Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster EI DTC mask record specifies the DTC mask record error in is a cluster that describes error conditions occurring before the VI executes If an error has already occurred the V
238. he responses to their corresponding request External References For more information about the UDS Standard refer to the ISO 15765 3 standard OBD On Board Diagnostic On Board Diagnostic OBD systems are present in most cars and light trucks on the road today On Board Diagnostics refer to the vehicle s self diagnostic and reporting capability which the vehicle owner or a repair technician can use to query status information for various vehicle subsystems The amount of diagnostic information available via OBD has increased since the introduction of on board vehicle computers in the early 1980s Modern OBD implementations use a CAN communication port to provide real time data and a standardized series of diagnostic trouble codes Automotive Diagnostic Command Set User Manual 1 6 ni com Chapter 1 Introduction DTCs which identify and remedy malfunctions within the vehicle In the 1970s and early 1980s manufacturers began using electronic means to control engine functions and diagnose engine problems This was primarily to meet EPA emission standards Through the years on board diagnostic systems have become more sophisticated OBD II a standard introduced in the mid 1990s provides almost complete engine control and also monitors parts of the chassis body and accessory devices as well as the car s diagnostic control network The newest standard was introduced in 2012 as WWH OBD The On Board Diagnostic OBD standa
239. he 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 the VI did not execute the intended operation A positive value means warning the 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 This VI reads diagnostic trouble codes from the ECU memory If you use the optional group of DTC parameter the ECU reports DTCs based only on the functional group selected by group of DTC For further details about this service refer to the ISO 14230 3 standard National Instruments 5 95 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW RequestRoutineResultsByLocalldentifier vi Purpose Executes the RequestRoutineResultsByLocalldentifier service Returns results from a routine on the ECU Format diag ref in diag ref out local ID data out error in no error success error out Input diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi or Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipula
240. here the error occurred Output diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs this diagnostic 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 success indicates successful receipt of a positive response message for status is TRUE if an error occurred Automotive Diagnostic Command Set User Manual 5 74 ni com National Instruments Chapter 5 Automotive Diagnostic Command Set API for LabVIEW code is the error code number identifying an error A value of 0 means success A negative value means error the VI did not execute the intended operation A positive value means warning the VI executed intended operation but an informational warning is returned For a description of the code wire the error cluster to a LabVIEW error handling VI such as the Simple Error Handler source identifies the VI where the error occurred 5 75 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW DisableNormalMessageTransmission vi Purpose Executes the DisableNormalMessageTransmission service The ECU no longer transmits its regular communication messages usually CAN messages Format diag ref in a diag ref out require response SUCCESS error in no error
241. host Set to 1 OxXFFFFFFFF for the default OBD CAN identifier Output diagRefOut A struct containing all necessary information about the diagnostic session This is passed as a handle to all subsequent diagnostic functions and you must close it using ndCloseDiagnostic Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value Description ndOBDOpen opens a diagnostic communication channel to an ECU for OBD II The CAN port specified as input is initialized and a handle to it is stored among other internal data into the diagRefOut struct which serves as reference for further diagnostic functions National Instruments 6 31 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C If the transmit ID and receiveID parameters are set to 1 communication is first tried on the default 11 bit OBD CAN identifiers if that fails the default 29 bit OBD CAN identifiers are tried If that also fails an error is returned If valid transmitID or receiveID parameters 11 bit or 29 bit with bit
242. hrough the process of enabling software to run on your machine National Instruments xvii Automotive Diagnostic Command Set User Manual Activating Your Software What Information Do Need to Activate You need your product serial number user name and organization The NI Activation Wizard determines the rest of the information Certain activation methods may require additional information for delivery This information is used only to activate your product Complete disclosure of the National Instruments software licensing information privacy policy is available at ni com activate privacy If you optionally choose to register your software your information is protected under the National Instruments privacy policy available at ni com privacy How Do Find My Product Serial Number Your serial number uniquely identifies your purchase of NI software You can find your serial number on the Certificate of Ownership included in your software kit If your software kit does not include a Certificate of Ownership you can find your serial number on the product packing slip or on the shipping label If you have installed a previous version using your serial number you can find the serial number by selecting the Help About menu item within the application or by selecting your product within NI License Manager Start All Programs National Instruments NI License Manager You can also contact your local National Instruments b
243. i Executes the TesterPresent service Keeps the ECU in diagnostic mode UDS ClearDiagnosticInformation vi Executes the UDS ClearDiagnosticInformation service Clears selected Diagnostic Trouble Codes DTCs UDS CommunicationControl vi Executes the UDS CommunicationControl service Use this VI to switch on or off transmission and or reception of the normal communication messages usually CAN messages UDS ControlDTCSetting vi Executes the UDS ControlDTCSetting service Modifies Diagnostic Trouble Code DTC generation behavior Automotive Diagnostic Command Set User Manual 5 6 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Table 5 1 Automotive Diagnostic Command Set API VIs for LabVIEW Continued Function Purpose UDS DiagnosticSessionControl vi Executes the UDS DiagnosticSessionControl service Sets up the ECU in a specific diagnostic mode UDS ECUReset vi Executes the UDS ECUReset service Resets the ECU UDS InputOutputControlByIdentifier vi UDS ReadDataByldentifier vi Executes the UDS InputOutputControlByldentifier service Use this VI to modify ECU I O port behavior Executes the UDS ReadDataByldentifier service Reads a data record from the ECU UDS ReadMemoryByAddress vi Executes the UDS ReadMemoryByAddress service Reads data from the ECU memory UDS ReportDTCBySeverityMaskRecord vi Executes the ReportDTCBySeve
244. iagnostic Command Set function suspends execution of the calling thread until it completes The functions are listed alphabetically in four categories general functions KWP2000 services UDS DiagOnCAN services and OBD On Board Diagnostics services Section Headings The following are section headings found in the Automotive Diagnostic Command Set for C functions Purpose Each function description includes a brief statement of the function purpose Format The format section describes the function format for the C programming language Input and Output The input and output sections list the function parameters Description The description section gives details about the function purpose and effect National Instruments 6 1 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C List of Data Types The following data types are used with the Automotive Diagnostic Command Set API for C functions Table 6 1 Data Types for the Automotive Diagnostic Command Set for C Data Type Purpose i8 8 bit signed integer i16 16 bit signed integer i32 32 bit signed integer u8 8 bit unsigned integer u16 16 bit unsigned integer u32 32 bit unsigned integer 32 32 bit floating point number 64 64 bit floating point number str ASCII string represented as an array of characters terminated by null character 0 This type is used
245. iagnostic Command Set API for LabVIEW success indicates successful receipt of a positive response message for this diagnostic 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 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 the VI did not execute the intended operation A positive value means warning the 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 Automotive Diagnostic Command Set User Manual 5 178 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW OBD Request Emission Related DTCs During Current Drive Cycle vi Purpose Executes the OBD Request Emission Related DTCs During Current Drive Cycle service Reads the emission related Diagnostic Trouble Codes DTCs that occurred during the current or last completed drive cycle Format DTC descriptor CONICA diag ref in diag ref out DTCs error in no error success error out Input DTC descriptor is a cluster that describes the DTC records the ECU delivers DTC Byte Length indicat
246. iagnostic identifiers from the logical ECU address Automotive Diagnostic Command Set User Manual 4 2 ni com Chapter 4 Using the Automotive Diagnostic Command Set General Programming Model National Instruments Open Diagnostic VWTP Connect gt Execute a Diagnostic Service Periodically Execute VWTP ConnectionTest wet aes VWTP Disconnect No Close Diagnostic First you must open a diagnostic communication link This involves initializing the CAN LIN port and defining communication parameters such as the baud rate For CAN based diagnostics the CAN identifiers on which the diagnostic communication takes place must be defined also No actual communication to the ECU takes place at this stage For the VW TP 2 0 you then must establish a communication channel to the ECU using the VWTP Connect routine The communication channel properties are negotiated between the host and ECU After these steps the diagnostic communication is established and you can execute diagnostic services of your choice Note that for the VW TP 2 0 4 3 Automotive Diagnostic Command Set User Manual Chapter 4 Using the Automotive Diagnostic Command Set you must execute the VWTP ConnectionTest routine periodically once per second to keep the communication channel open When you finish your diagnostic services you must close the diagnostic communication link This finally closes
247. iagnostic session handle obtained from Open Diagnostic vi or Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster type indicates whether transmission reception is to be switched on off The usual values are 00 enableRxAndTx 01 enableRxAndDisableTx 02 disableRxAndEnableTx 03 disableRxAndTx communication type is a bitfield indicating the application level to change The usual values are 01 application 02 networkManagement You can change more than one level at a time error in is a cluster that 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 National Instruments 5 119 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW code is the error code number identifying an error A value of 0 means success A negative value means error the VI did not execute the intended operation A positive value means warning the 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 diag ref out is a copy of diag
248. ic Command Set API for LabVIEW StopRoutineByLocalldentifier vi Purpose Executes the StopRoutineByLocalldentifier service Stops a routine on the ECU Format diag ref in diag ref out local ID data out data in success error in no error error out Input diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi or Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster El local ID defines the local identifier of the routine to be stopped The values are application specific data in defines application specific input parameters for the routine error in is a cluster that 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 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 the VI did not execute the intended operation A positive value means warning the 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 Automotive Diagnostic Command Set User M
249. ic service messages over the CAN network The following values are valid and can be obtained through an enum control 0 ISO TP Normal Mode The ISO TP as specified in ISO 15765 2 is used all eight data bytes of the CAN messages are used for data transfer 1 ISO TP Mixed Mode The ISO TP as specified in ISO 15765 2 is used the first data byte is used as address extension 2 VW TP 2 0 3 Diagnostic Over IP DoIP The DoIP TP as specified in ISO 13400 is used transmit ID is the CAN identifier for sending diagnostic request messages from the host to the ECU To specify an extended 29 bit ID OR the value with 0x20000000 receive ID is the CAN identifier or sending diagnostic response messages from the ECU to the host To specify an extended 29 bit ID OR the value with 0x20000000 5 37 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW error in is a cluster that 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 the VI did not execute the intended operation A positive value means warning the VI executed intended operation but an informational warning is returned
250. id not execute the intended operation A positive value means warning the VI executed intended operation but an informational warning is returned For a description of the code wire the error cluster to a LabVIEW error handling VI such as the Simple Error Handler source identifies the VI where the error occurred Description The diagnostic session specified by diag ref in is closed and you can no longer use it for communication to an ECU Note that this command does not communicate the closing to the ECU before terminating if this is necessary you must manually do so for example by calling StopDiagnosticSession vi before calling Close Diagnostic vi National Instruments 5 11 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Convert from Phys vi Purpose Converts a physical data value into a binary representation using a type descriptor Format type descriptor data out value Input type descriptor is a cluster that specifies the conversion of the physical value to its binary representation Start Byte gives the start byte of the binary representation For Convert from Phys vi this value is ignored and always assumed to be 0 Byte Length is the binary representation byte length Byte Order is the byte ordering of the data in the binary representation EE E 0 MSB_FIRST Motorola 1 LSB_FIRST Intel Data Type is the bina
251. in milliseconds the host waits fora VWTP 2 0 command to be executed default 50 ms The specification states this as 50 ms plus the network latency but some ECUs may require higher values 5 21 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW 13 STwmin sets the minimum time in seconds between the end of transmission of a frame in a diagnostic request message and the start of transmission of the next frame in the diagnostic request message for LIN based diagnostic communication The default is 0 14 P2min sets the minimum time in seconds between reception of the last frame of the diagnostic request and the response sent by the node for LIN based diagnostic communication The default is 0 05 15 Termination sets the NI XNET Termination property Reflections on the CAN and LIN bus can cause communication failures To prevent reflections termination can be present as external resistance or resistance the XNET CAN or LIN board applies internally This property determines whether the XNET board uses termination to the bus For further information about appropriate terminations of aCAN or LIN network refer to the NI XNET Hardware and Software Manual The default is 0 property value is the value of the property to be set error in is a cluster that describes error conditions occurring before the VI executes It is copied unchanged to error out and has no other effect on the VI It is p
252. ing meaning Bit Meaning testFailed testFailedThisMonitoringCycle pendingDTC confirmedDTC testNotCompletedSinceLastClear testFailedSinceLastClear nn A WN KF CO testNotCompletedThisMonitoringCycle 7 warningIndicatorRequested For OBD this field usually does not contain valid information AddData contains optional additional data for this DTC Usually this does not contain valid information refer to DTCDescriptor len On input len must contain the DTCs array length in elements On return it contains the number of valid elements in the DTCs array success Indicates successful receipt of a positive response message for this diagnostic service Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value National Instruments 6 165 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C ndOBDRequestPowertrainFreezeFrameData Purpose Executes the OBD Request Powertrain Freeze Frame Data service Reads an ECU data record stored while a diagnostic trouble code occurred
253. ion Related DTCs service Reads all emission related Diagnostic Trouble Codes DTCs Format DTC descriptor OIII diag ref in BD diag ref out error in no error E Som SUCCESS Soom error out Input HA DTC descriptor is a cluster that describes the DTC records the ECU delivers DTC Byte Length indicates the number of bytes the ECU sends for each DTC The default is 2 Status Byte Length indicates the number of bytes the ECU sends for each DTC s status The default is 0 for OBD Add Data Byte Length indicates the number of bytes the ECU sends for each DTC s additional data Usually there is no additional data so the default is 0 Byte Order indicates the byte ordering for multibyte items HE EEE 0 MSB_FIRST Motorola default 1 LSB_FIRST Intel This VI interprets the response byte stream according to this description and returns the resulting DTC records in the DTCs cluster array diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster error in is a cluster that describes error conditions occurring before the VI EH executes If an error has already occurred the VI returns the value of the error in cluster to error out Automotive Diagnostic Command Set User Manual 5 176 ni com National Instruments Chapter 5 Automotiv
254. ion states this as 50 ms plus the network latency but some ECUs may require higher values STmin sets the minimum time in seconds between the end of transmission of a frame in a diagnostic request message and the start of transmission of the next frame in the diagnostic request message for LIN based diagnostic communication The default is 0 P2min sets the minimum time in seconds between reception of the last frame of the diagnostic request and the response sent by the node for LIN based diagnostic communication The default is 0 05 Termination sets the NI XNET Termination property Reflections on the CAN and LIN bus can cause communication failures To prevent reflections termination can be present as external resistance or resistance the XNET CAN or LIN board applies internally This property determines whether the XNET board uses termination to the bus For further information about appropriate terminations of a CAN or LIN network refer to the NI XNET Hardware and Software Manual The default is 0 Automotive Diagnostic Command Set User Manual 6 42 ni com Chapter 6 Automotive Diagnostic Command Set API for C propertyValue The requested property value Output None Description Use this function to set several internal diagnostic parameters such as timeouts for the transport protocol Use ndGet Property to read them out National Instruments 6 43 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Dia
255. ion to the ECU is not yet started Format long ndOpenDiagnosticOnLIN char LINInterface unsigned long baudrate uint8_t NAD char MasterReqFrame char SlaveRespFrame TD1 diagRefOut Input LINInterface Specifies the NI XNET LIN interface on which the diagnostic communication should take place and selects the LIN Cluster name of a registered XNET Alias The Automotive Diagnostic Command Set supports NI XNET hardware for LIN communication only To use your NI XNET LIN interface you must define your LIN interface under NI XNET Devices in MAX and pass the NI XNET interface name that the Automotive Diagnostic Command Set will use To do this add nixnet to the interface string for example LIN nixnet The interface name is related to the NI XNET hardware naming under Devices and Interfaces in MAX The Automotive Diagnostic Command Set requires valid assignments to a LIN database such as LDF or FIBEX To communicate with hardware products on the external network applications must understand how that hardware communicates in the actual embedded system such as the vehicle This embedded communication is described within a standardized file such as FIBEX xm1 or LDF 1a for LIN Within NI XNET this file is referred to as a database The database contains many object classes each of which describes a distinct entity in the embedded system For LIN you can select a LIN database and cluster to assign all settings
256. ional Instruments 3 3 Automotive Diagnostic Command Set User Manual Chapter 3 Application Development Application Development on CompactRIO or R Series Using an NI 985x or NI 986x C Series Module To run a project on an FPGA target with an NI 985x C Series module you need an FPGA bitfile lvbitx The FPGA bitfile is downloaded to the FPGA target on the execution host A bitfile is a compiled version of an FPGA VI FPGA VIs and thus bitfiles define the CAN analog digital and pulse width modulation PWM inputs and outputs of an FPGA target The Automotive Diagnostic Command Set does not include FPGA bitfiles for any FPGA target Refer to the LabVIEW FPGA Module documentation for more information about creating FPGA VIs and bitfiles for an FPGA target The default FPGA VI is sufficient for a basic Automotive Diagnostic Command Set application However in some situations you may need to modify the existing FPGA code to create a custom bitfile For example to use additional I O on the FPGA target you must add these I O to the FPGA VI You must install the LabVIEW FPGA Module to create these files Modify the FPGA VI according to the following guidelines e Do not modify remove or rename any block diagram controls and indicators named __CANO Rx Data _ CANO Rx Ready __CANO Tx Data Frame _ CANO Tx Ready _ CANO Bit Timing __CANO FPGA Is Running _ CANO Start _ CANO FIFO Full or __CANO FIFO Empty If you intend to use multiple
257. iption use ndConvertToPhys to interpret this record You can obtain the description from the SAE J1979 standard len On input len must contain the dataOut array length On return it contains the number of valid data bytes in the dataOut array success Indicates successful receipt of a positive response message for this diagnostic service Automotive Diagnostic Command Set User Manual 6 162 ni com Chapter 6 Automotive Diagnostic Command Set API for C Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value National Instruments 6 163 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C ndOBDRequestPermanentFaultCodes Purpose Executes the OBD Request Permanent Fault Codes service All permanent Diagnostic Trouble Codes DTCs are read Format long ndOBDRequestPermanentFaultCodes TD1 diagRef TD3 DTCDescriptor TD4 DTCs long len LVBoolean success Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic or ndOpenDiagn
258. ipulate the elements of this cluster El local ID defines the local identifier of the routine to be started The values are application specific data in defines application specific input parameters for the routine error in is a cluster that 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 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 the VI did not execute the intended operation A positive value means warning the 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 Automotive Diagnostic Command Set User Manual 5 104 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Output diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs data out returns application specific output parameters from the routine success indicates successful receipt of a positive response message for this diagnostic service error out describes error conditions If the error in cluster indicated an error the error out cluster contains the same informati
259. ired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster Automotive Diagnostic Command Set User Manual 5 116 ni com Output National Instruments Chapter 5 Automotive Diagnostic Command Set API for LabVIEW group of DTC specifies the group of Diagnostic Trouble Codes to be cleared The values are application specific The following value has a special meaning and you can specify it through a ring control OxFFFFFF All DTCs error in is a cluster that 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 the VI did not execute the intended operation A positive value means warning the 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 diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs success indicates successful receipt of a positive response message for this diagnostic service error out describes error conditions If the error in cluster
260. is executed Automotive Diagnostic Command Set User Manual 6 98 ni com Chapter 6 Automotive Diagnostic Command Set API for C ndWriteDataByLocalldentifier Purpose Executes the WriteDataByLocalldentifier service Writes a data record to the ECU Format long ndWriteDataByLocalIdenti fier TD1 diagRef unsigned char localID unsigned char dataIn long len LVBoolean success Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic or ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct localID Defines the local identifier of the data to be read The values are application specific dataiIn Defines the data record to be written to the ECU If you know the record data description use ndConvertFromPhys to generate this record len Must contain the number of valid data bytes in dataIn Output success Indicates successful receipt of a positive response message for this diagnostic service Return Value The return value indicates the function call status 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 ndStatusToS
261. is VI E BE 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 the VI did not execute the intended operation A positive value means warning the 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 This VI requests results for example exit status information referenced by local ID and generated by the routine executed in the ECU memory For further details about this service refer to the ISO 14230 3 standard National Instruments 5 97 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW RequestSeed vi Purpose Executes the SecurityAccess service to retrieve a seed from the ECU Format diag ref in diag ref out access mode seed out error in no error SUCCESS error out Input diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi or Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster El access mode indicates the security level to be granted The values are application specific This is an odd number usually 1
262. is function converts only 2 byte DTCs If you feed in larger numbers the function returns garbage Output DTCString The DTC string representation len On input len must contain the DTCString array length at least 6 On return it contains the number of valid data bytes in the DTCString array Description The SAE J2012 standard specifies a naming scheme for 2 byte DTCs consisting of one letter and four digits Use ndDTCToString to convert the DTC numerical representation to this name National Instruments 6 25 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C ndGetProperty Purpose Gets a diagnostic global internal parameter Format uint32_t ndGetProperty uint16_t propertyID Input propertyID Defines the parameter whose value is to be retrieved 0 Timeout Diag Command is the timeout in milliseconds the master waits for the response to a diagnostic request message The default is 1000 ms Timeout FC Bs is the timeout in milliseconds the master waits for a Flow Control frame after sending a First Frame or the last Consecutive Frame of a block The default is 250 ms Timeout CF Cr is the timeout in milliseconds the master waits for a Consecutive Frame in a multiframe response The default is 250 ms for CAN and 1000 ms for LIN Receive Block Size BS is the number of Consecutive Frames the slave sends in one block before waiting for the next
263. is struct ID Defines the identifier of the routine to be started The values are application specific mode Defines the operation mode for this service 1 Start Routine 2 Stop Routine 3 Request Routine Results Other values are application specific dataiIn Defines application specific input parameters for the routine len Must contain the number of valid data bytes in dataIn National Instruments 6 137 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C Output dataOut Returns application specific output parameters from the routine len2 On input 1en2 must contain the dataOut array length On return it contains the number of valid data bytes in the dataOut array success Indicates successful receipt of a positive response message for this diagnostic service Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value Description This function executes the UDS RoutineControl service and launches an ECU routine stops an ECU routine or requests ECU routine
264. isit ni com support for software drivers and updates a searchable KnowledgeBase product manuals step by step troubleshooting wizards thousands of example programs tutorials application notes instrument drivers and so on Registered users also receive access to the NI Discussion Forums at ni com forums NI Applications Engineers make sure every question submitted online receives an answer Software Support Service Membership The Standard Service Program SSP is a renewable one year subscription included with almost every NI software product including NI Developer Suite This program entitles members to direct access to NI Applications Engineers through phone and email for one to one technical support as well as exclusive access to online training modules at ni com self paced training NI also offers flexible extended contract options that guarantee your SSP benefits are available without interruption for as long as you need them Visit ni com ssp for more information Declaration of Conformity DoC A DoC is our claim of compliance with the Council of the European Communities using the manufacturer s declaration of conformity This system affords the user protection for electromagnetic compatibility EMC and product Automotive Diagnostic Command Set User Manual A 2 ni com National Instruments Appendix A NI Services safety You can obtain the DoC for your product by visiting ni com certification For information
265. ition arose that may require attention Use the ndStatusToString function to obtain a descriptive string for the return value Automotive Diagnostic Command Set User Manual 6 70 ni com Chapter 6 Automotive Diagnostic Command Set API for C ndinputOutputControlByLocalldentifier Purpose Executes the InputOutputControlByLocalldentifier service Modifies the ECU I O port behavior Format long ndInputOutputControlByLocalIdenti fier TD1 diagRef unsigned char localID unsigned char mode unsigned char dataIn long len unsigned char dataOut long len2 LVBoolean success Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic or ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct localID Defines the local identifier of the I O to be manipulated The values are application specific mode Defines the I O control type The values are application specific The usual values are 0 ReturnControlToECU 1 ReportCurrentState 4 ResetToDefault 5 FreezeCurrentState 7 ShortTermAdjustment 8 LongTermAdjustment dataiIn Defines application specific data for this service len Must contain the number of valid data bytes in dataIn National Instruments 6 71 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C Output dataOut Returns
266. its software products will perform substantially in accordance with the applicable documentation provided with the software and ii the software media will be free from defects in materials and workmanship If NI receives notice of a defect or non conformance during the applicable warranty period NI will in its discretion i repair or replace the affected product or ii refund the fees paid for the affected product Repaired or replaced Hardware will be warranted for the remainder of the original warranty period or ninety 90 days whichever is longer If NI elects to repair or replace the product NI may use new or refurbished parts or products that are equivalent to new in performance and reliability and are at least functionally equivalent to the original part or product You must obtain an RMA number from NI before returning any product to NI NI reserves the right to charge a fee for examining and testing Hardware not covered by the Limited Warranty This Limited Warranty does not apply if the defect of the product resulted from improper or inadequate maintenance installation repair or calibration performed by a party other than NI unauthorized modification improper environment use of an improper hardware or software key improper use or operation outside of the specification for the product improper voltages accident abuse or neglect or a hazard such as lightning flood or other act of nature THE REMEDIES SET FORTH ABOVE ARE EX
267. ivateRouting TargetAddress The DolP target address of the device under test that should be connected to You can set this input to 0 if you are activating a route through ndDoIPActivateRouting Output Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value Automotive Diagnostic Command Set User Manual 6 52 ni com Chapter 6 Automotive Diagnostic Command Set API for C Description ndDoIPConnect creates a unique TCP IP data connection to a certain DoIP entity identified by its IP address The IP address might be retrieved from ndDoI PGet Entities The TCP IP data connection is needed to exchange diagnostic service requests You can specify SourceAddress and TargetAddress at this point or leave them blank if a routing activation is executed later using ndDoIPActivateRouting National Instruments 6 53 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C ndDolPDisconnect Purpose Disconnects the TCP IP connection to a DoIP entity Format long ndDoIPDisconnect TD1 diagRef
268. licable 1 5 Automotive Diagnostic Command Set User Manual Chapter 1 Introduction 3 Note For more information about the LIN Diagnostic service implementations refer to the LIN Specification Package Revision 2 2 from the LIN Consortium Diagnostic Service Format Diagnostic services have a common message format Each service defines a Request Message a Positive Response Message and a Negative Response Message The general format of the diagnostic services complies with the KWP2000 definition most of the Service Ids also comply with KWP2000 The Request Message has the Serviceld as first byte plus additional service defined parameters The Positive Response Message has an echo of the Serviceld with bit 6 set as first byte plus the service defined response parameters ays Note Some parameters to both the Request and Positive Response Messages are optional Each service defines these parameters Also the standard does not define all parameters The Negative Response Message is usually a three byte message it has the Negative Response Serviceld 0x7F as first byte an echo of the original Serviceld as second byte and a ResponseCode as third byte The UDS standard partly defines the ResponseCodes but there is room left for manufacturer specific extensions For some of the ResponseCodes UDS defines an error handling procedure Because both positive and negative responses have an echo of the requested service you always can assign t
269. ll powertrain DTCs 0x4000 All chassis DTCs 0x8000 All body DTCs 0xC000 All network related DTCs OxFFOO All DTCs DTCDescriptor A struct that describes the DTC records the ECU delivers typedef struct long DTCByteLength long StatusByteLength long AddDataByteLength unsigned short ByteOrder D3 DTCByteLength indicates the number of bytes the ECU sends for each DTC The default is 2 Automotive Diagnostic Command Set User Manual 6 82 ni com Output Chapter 6 Automotive Diagnostic Command Set API for C StatusByteLength indicates the number of bytes the ECU sends for each DTC s status The default is 1 AddDataByteLength indicates the number of bytes the ECU sends for each DTC s additional data Usually there are no additional data so the default is 0 ByteOrder indicates the byte ordering for multibyte items 0 MSB_FIRST Motorola default 1 LSB_FIRST Intel This function interprets the response byte stream according to this description and returns the resulting DTC records in the DTCs struct array DTCs Returns the resulting DTCs as an array of structs typedef struct unsigned long DTC unsigned long Status unsigned long AddData TD4 DTC is the resulting Diagnostic Trouble Code For the default 2 byte DTCs use ndDTCToString to convert this code to readable format as defined by SAE J2012 Status is the DTC status Usually this is a bit field with following meaning Bit Meaning 0 testFailed 1 t
270. lue of the error in cluster to error out H B status is TRUE if an error occurred This VI is not executed when TF status is TRUE code is the error code number identifying an error A value of 0 means success A negative value means error the VI did not execute the intended operation A positive value means warning the VI executed intended operation but an informational warning Automotive Diagnostic Command Set User Manual 5 208 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW 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 diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs data out returns application specific output parameters from the routine success indicates successful receipt of a positive response message for this diagnostic 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 m 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 the VI did not execute the intended operation A positive value means warning the VI executed intended operation but an informational warning
271. ly manipulate the elements of this struct Output nodeType Indicates the type of DoIP entity Possible values are 0 DolP gateway 1 DolIP node All other values are reserved maxSockets Represents the maximum number of concurrent TCP IP sockets allowed with this DoIP entity excluding the reserve socket required for socket handling curSockets The number of currently established TCP IP sockets ok Indicates successful receipt of a positive response message for this diagnostic service National Instruments 6 55 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value Description ndDoIPEntityStatus serves the purpose of identifying certain operating conditions of the responding DolP entity For example this allows for test equipment to detect existing diagnostic communication sessions as well as a DoIP entity s capabilities Automotive Diagnostic Command Set User Manual 6 56 ni com Chapter 6 Automotive Diagnosti
272. ly manipulate the elements of this cluster EI data in defines the data block to be written to the ECU For a download this is a memory data block to be downloaded to the ECU For an upload the meaning is implementation dependent in most cases it is sufficient to leave the parameter empty default error in is a cluster that 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 B status is TRUE if an error occurred This VI is not executed when TF status is TRUE National Instruments 5 159 Automotive Diagnostic Command Set User Manual Chapter 5 Output Automotive Diagnostic Command Set API for LabVIEW TE code is the error code number identifying an error A value of 0 means success A negative value means error the VI did not execute the intended operation A positive value means warning the 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 block sequence counter out returns the updated value of the block sequence counter diag ref out is a copy of diag ref in It can be wired to subsequent diagnostic VIs data out returns the memory data from the ECU For a download this might contain a checksum
273. m Chapter 1 Introduction The Negative Response Message is usually a three byte message it has the Negative Response Serviceld as first byte an echo of the original Serviceld as second byte and a ResponseCode as third byte The only exception to this format is the negative response to an EscapeCode service here the third byte is an echo of the user defined service code and the fourth byte is the ResponseCode The KWP2000 standard partly defines the ResponseCodes but there is room left for manufacturer specific extensions For some of the ResponseCodes KWP2000 defines an error handling procedure Because both positive and negative responses have an echo of the requested service you can always assign the responses to their corresponding request Connect Disconnect GetSeed Unlock KWP2000 expects a diagnostic session to be started with StartDiagnosticSession and terminated with StopDiagnosticSession However StartDiagnosticSession has a DiagnosticMode parameter that determines the diagnostic session type Depending on this type the ECU may or may not support other diagnostic services or operate in a restricted mode where not all ECU functions are available The DiagnosticMode parameter values are manufacturer specific and not defined in the standard For a diagnostic session to remain active it must execute the TesterPresent service periodically if no other service is executed If the TesterPresent service is missing for a certain p
274. m 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 ndStatusToString function to obtain a descriptive string for the return value National Instruments 6 37 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C Description ndOpenDiagnosticOnIP opens a Diagnostic on Internet Protocol DoIP communication channel to an ECU The UDP port specified as input is initialized and a handle to it is stored among other internal data in diagRefOut which serves as reference for further diagnostic functions Note that no communication to an ECU takes place at this point To open a diagnostic session on an ECU call ndDoIPGetEntities to find out which DolP entities DoIP capable ECUs exist in the network You need to create a TCP IP connection to the selected DoIP entity using ndDolIPConnect After that you can execute diagnostic services on the TCP IP connection This VI replaces the standard CAN based ndOpenDiagnostic because the CAN parameters are no longer relevant for IP based diagnostics In general it is not necessary to manipulate the diagRefOut cluster contents Automotive Diagnostic Command Set User Manual 6 38 ni com Chapter 6 Automotive Diagnostic Command Set API for C ndOpenDiagnosticOnLiN Purpose Opens a diagnostic session on an NI XNET LIN port Communicat
275. mation sbout the DoIP entity power state DoIP Get DolIP Entity Status vi Gets status information from a DolP entity DolIP Get Entities vi Returns a table of all DoIP entities vehicles on the local subnet possibly restricted to EID or VIN DolIP Send Vehicle Identification Request vi Sends a UDP request to all DoIP capable vehicles in the local subnet to identify themselves DolIP Send Vehicle Identification Request w EID vi Sends a UDP request to all DoIP capable vehicles with a certain EID MAC address in the local subnet to identify themselves DolIP Send Vehicle Identification Request w VIN vi Sends a UDP request to all DoIP capable vehicles with a certain VIN Vehicle Identification Number in the local subnet to identify themselves DTC to String vi Returns a string representation such as P1234 for a 2 byte Diagnostic Trouble Code DTC Get Time Stamp vi Gets timestamp information about the first last send received frame of the ISO TP for CAN and LIN National Instruments 5 3 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Table 5 1 Automotive Diagnostic Command Set API VIs for LabVIEW Continued Function Purpose ECUReset vi Executes the ECUReset service and resets the ECU EnableNormalMessageTransmission vi Executes the EnableNormalMessageTransmission service Th
276. mber in the local subnet to identify themselves Format Diag reference in Diag reference out VIN error in no error error out Input Diag reference in specifies the diagnostic session handle obtained from Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster El VIN is the 17 character Vehicle Identification Number of the DoIP entity assumed to respond error in is a cluster that describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out H E status is TRUE if an error occurred This VI is not executed when TE status is TRUE code is the error code number identifying an error A value of 0 means success A negative value means error the VI did not execute the intended operation A positive value means warning the 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 Automotive Diagnostic Command Set User Manual 5 68 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Diag reference out is a copy of Diag reference in You can wire it to subsequent diagnostic VIs error out describes error conditions
277. message for this diagnostic 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 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 the VI did not execute the intended operation A positive value means warning the 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 This VI requests the ECU to perform an ECU reset effectively based on the mode parameter value content The vehicle manufacturer determines when the positive response message is sent National Instruments 5 79 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW EnableNormalMessageTransmission vi Purpose Executes the EnableNormalMessageTransmission service The ECU starts transmitting its regular communication messages usually CAN messages Format diag ref in ME diag ref out require response SUCCESS error in no error error out Input diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi or Open Diagnostic
278. mmand Set for C Continued Function Purpose ndUDS06WriteMemoryByAddress Executes the UDS WriteMemoryByAddress service Writes data to the ECU memory ndUDSClearDiagnosticInformation Executes the UDS ClearDiagnosticInformation service Clears selected Diagnostic Trouble Codes DTCs nduDSCommunicationControl Executes the UDS CommunicationControl service Switches transmission and or reception of the normal communication messages usually CAN messages on or off ndUDSControlDTCSetting Executes the UDS ControlDTCSetting service Modifies Diagnostic Trouble Code DTC behavior ndUDSDiagnosticSessionControl Executes the UDS DiagnosticSessionControl service The ECU is set up in a specific diagnostic mode ndUDSECUReset Executes the UDS ECUReset service Resets the ECU ndUDSInputOutputControlBylIdentifier Executes the UDS InputOutputControlByldentifier service Modifies ECU I O port behavior ndUDSReadDataByldentifier Executes the UDS ReadDataB yldentifier service Reads an ECU data record ndUDSReadMemoryByAddress Executes the UDS ReadMemoryByAddress service Reads data from the ECU memory National Instruments 6 9 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C Table 6 2 Functions for the Automotive Diagnostic Command Set for C Continued Function Purpose ndUDSReportDTCBySeverityMaskRecord E
279. motive Diagnostic Command Set API for C Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value Description The WWH OBD ReadDTCInformation service is based on the UDS ReaDTCInformation service ISO 14229 1 National Instruments 6 183 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C ndWWHOBDRequestRID Purpose Executes the WWH OBD RoutineControl service Reads a data record from the ECU Format long ndWWHOBDRequestRID TD1 diagRef unsigned char mode unsigned short routinelIdentifier unsigned char dataOut long len LVBoolean success Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct mode Defines the service operation mode You can obtain the values from a ring control 1 Start Routine 2 Stop Routine 3 Request Routine Results Other values are application specific routinelIdentifier
280. motive Diagnostic Command Set API for LabVIEW Output DTCs J2012 contains the DTCs converted to the J2012 format 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 the VI did not execute the intended operation A positive value means warning the 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 Automotive Diagnostic Command Set User Manual 5 198 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW WWH OBD Request DID vi Purpose Executes the WWH OBD ReadDataByldentifier service Reads a data record from the ECU Format diag ref in diag ref out data identifier data out error in no error success error out Input diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi or Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster data identifier defines the data identifier of the data to be read The
281. motive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C Use the ndStatusToString function to obtain a descriptive string for the return value Description The WWH OBD ReadDataByldentifier service is based on the UDS ReadDataByldentifier service ISO 14229 1 Automotive Diagnostic Command Set User Manual 6 176 ni com Chapter 6 Automotive Diagnostic Command Set API for C ndWWHOBDRequestDTCExtendedDataRecord Purpose Executes the WWH OBD ReadDTCInformation service Reads selected Diagnostic Trouble Codes Format long ndWWHOBDRequestDTCExtendedDataRecord TD1 diagRef unsigned char DTCMaskRecord long lenDTCMaskRecord unsigned char dataOut long len LVBoolean success Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct DTCMaskRecord Specifies the DTC mask record lenDTCMaskRecord Contains the number of valid data bytes in the DT CMaskRecord array Output dataOut Returns the ECU data record len On input 1en must contain the dataOut array length On return it contains the number of valid data bytes in the dataOut array success Indicates successful receipt of a positive response message for this diagnostic service National Instruments 6 177 Automotive Diagnostic Command Set Us
282. munication is broken the ECU returns to normal mode from diagnostic mode after a while The TesterPresent service is this keep alive signal It does not affect any other ECU operation Keep calling UDS TesterPresent vi within the ECU timeout period if no other service is executed Automotive Diagnostic Command Set User Manual 5 158 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW UDS TransferData vi Purpose Transfers data to from the ECU in a download upload process Format block sequence counter in block sequence counter out diag ref in diag ref out data in data out error in no error SUCCESS error out Input block sequence counter in is used to number the data blocks to be transferred to from the ECU The block sequence counter value starts at 01 hex with the first UDS TransferData vi request that follows the UDS RequestDownload vi or UDS RequestUpload vi service Its value is incremented by 1 for each subsequent UDS TransferData vi request At the value of FF hex the block sequence counter rolls over and starts at 00 hex with the next UDS TransferData vi request A The block sequence counter is updated automatically and returned in the block sequence counter out parameter diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi or Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manual
283. n 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 ndStatusToString function to obtain a descriptive string for the return value Description This function requests ECU memory data identified by the address and size parameters The dataOut format and definition are vehicle manufacturer specific dataOut includes analog input and output signals digital input and output signals internal data and system status information if the ECU supports them For further details about this service refer to the ISO 14230 3 standard National Instruments 6 81 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C ndReadStatusOfDTC Purpose Executes the ReadStatusOfDiagnosticTroubleCodes service Reads selected Diagnostic Trouble Codes DTCs Format long ndReadStatusOfDTC TD1 diagRef unsigned short groupOfDTC TD3 DTCDescriptor TD4 DTCs long len LVBoolean success Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic or ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct groupOfDTC Specifies the group of diagnostic trouble codes to be cleared The following values have a special meaning 0x0000 A
284. n Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value Description The diagnostic session diagRefIn specifies is closed and you can no longer use it for communication to an ECU This command does not communicate the closing to the ECU before terminating if this is necessary you must manually do so for example by calling ndStopDiagnosticSession before calling ndcloseDiagnostic National Instruments 6 13 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C ndConvertFromPhys Purpose Converts a physical data value into a binary representation using a type descriptor Format void ndConvertFromPhys TD2 typeDescriptor double value unsigned char dataOut long len Input typeDescriptor A struct that specifies the conversion of the physical value to its binary representation typedef struct long StartByte long ByteLength unsigned short ByteOrder unsigned short DataType double ScaleFactor double ScaleOffset Lo EDD 3 StartByte is ignored by ndConvertFromPh
285. nDiagnostic 6 33 ndOpenDiagnosticOnIP 6 37 ndOpenDiagnosticOnLIN 6 39 ndReadDataByLocalldentifier 6 73 ndReadDTCByStatus 6 75 ndReadECU Identification 6 78 ndReadMemoryBy Address 6 80 ndReadStatusOfDTC 6 82 ndRequestRoutineResultsB yLocal Identifier 6 85 ndRequestSeed 6 87 Automotive Diagnostic Command Set User Manual l 2 ndSendKey 6 89 ndSetProperty 6 41 ndStartDiagnosticSession 6 91 ndStartRoutineByLocalIdentifier 6 92 ndStatusToString 6 44 ndStopDiagnosticSession 6 94 ndStopRoutineByLocalldentifier 6 95 ndTesterPresent 6 97 ndUDS06ReadMemoryBy Address 6 149 ndUDS06WriteMemoryBy Address 6 151 ndUDSClearDiagnostic Information 6 103 ndUDSCommunicationControl 6 105 ndUDSControlDTCSetting 6 107 ndUDSDiagnosticSessionControl 6 108 ndUDSECUReset 6 109 ndUDSInputOutputControlBy Identifier 6 111 ndUDSReadDataByldentifier 6 113 ndUDSReadMemoryBy Address 6 115 ndUDSReportDTCBySeverity Mask Record 6 117 ndUDSReportDTCByStatusMask 6 120 ndUDSReportSeverityInformationOf DTC 6 123 ndUDSReportSupportedDTCs 6 126 ndUDSRequestDownload 6 129 ndUDSRequestSeed 6 131 ndUDSRequestTransferExit 6 133 ndUDSRequestUpload 6 135 ndUDSRoutineControl 6 137 ndUDSSendKey 6 139 ndUDSTesterPresent 6 141 ndUDSTransferData 6 143 ndUDSWriteDataByldentifier 6 145 ndUDSWriteMemoryBy Address 6 147 ndVWTPConnect 6 46 ndVWTPConnectionTest 6 48 ndVWTPDisconnect 6 49 ni com ndWriteDataByLocalldentifier 6 99
286. nDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct mode Indicates the type of identification information to be returned The values are application specific Output dataOut Returns the ECU identification data len On input len must contain the dataOut array length On return it contains the number of valid data bytes in the dataOut array Success Indicates successful receipt of a positive response message for this diagnostic service Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value Automotive Diagnostic Command Set User Manual 6 78 ni com Chapter 6 Automotive Diagnostic Command Set API for C Description This function requests identification data from the ECU mode identifies the type of identification data requested The ECU returns identification data that dataOut can access The dataOut format and definition are vehicle manufacturer specific For further details about this service refer to the ISO 14230 3 standard
287. nd Set User Manual 6 74 ni com Chapter 6 Automotive Diagnostic Command Set API for C ndReadDTCByStatus Purpose Executes the ReadDiagnosticTroubleCodesByStatus service Reads selected Diagnostic Trouble Codes DTCs Format long ndReadDTCByStatus TD1 diagRef unsigned char mode unsigned short groupOfDTC TD3 DTCDescriptor TD4 DTCs long len LVBoolean success Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic or ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct mode Defines the type of DTCs to be read The values are application specific The usual values are 2 Allidentified 3 AllSupported groupOfDTC Specifies the group of diagnostic trouble codes to be cleared The following values have a special meaning 0x0000 All powertrain DTCs 0x4000 All chassis DTCs 0x8000 All body DTCs OxC000 All network related DTCs OxFFOO All DTCs National Instruments 6 75 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C DTCDescriptor A struct that describes the DTC records the ECU delivers typedef struct long DTCByteLength long StatusByteLength long AddDataByteLength unsigned short ByteOrder TD3 DTCByteLength indicates the number of bytes the ECU sends for each DTC The default is 2 Statu
288. nd a key to the ECU ndUDSTesterPresent Executes the UDS TesterPresent service Keeps the ECU in diagnostic mode ndUDSTransferData Transfers data to from the ECU in a download upload process ndUDSWriteDataByIdentifier Executes the UDS WriteDataBylIdentifier service Writes a data record to the ECU ndUDSWriteMemoryByAddress Executes the UDS WriteMemoryByAddress service Writes data to the ECU memory ndvwTPConnect Establishes a connection channel to an ECU using the VW TP 2 0 ndvwTPConnectionTest ndVWTPDisconnect Maintains a connection channel to an ECU using the VW TP 2 0 Terminates a connection channel to an ECU using the VW TP 2 0 ndWriteDataByLocalIdentifier Executes the WriteDataByLocal Identifier service Writes a data record to the ECU ndWriteMemoryByAddress Executes the WriteMemoryByAddress service Writes data to the ECU memory ndWWHOBDClearEmissionRelatedDTCs Executes the WWH OBD ClearDiagnosticInformation service Clears selected Diagnostic Trouble Codes DTCs National Instruments 6 11 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C Table 6 2 Functions for the Automotive Diagnostic Command Set for C Continued Function Purpose ndWWHOBDConvertDTCsToJ1939 Converts DTCs to the J1939 DTC format ndWWHOBDConvertDTCsToJ2012 Converts DTCs to
289. nd passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct memoryAddress Defines the memory address from which data are to be read memorySize Defines the size of the data to be read memoryAddressLength Defines the number of bytes of the memoryAddress parameter that are written to the ECU This value is implementation dependent and must be in the range of 1 4 For example if this value is 2 only the two lowest bytes of the address are written to the ECU memorySizeLength Defines the number of bytes of the memorySize parameter that are written to the ECU This value is implementation dependent and must be in the range of 1 4 For example if this value is 2 only the two lowest bytes of the size are written to the ECU dataFormatIdentifier Defines the compression and encryption scheme used for the data blocks written to the ECU A value of 0 means no compression no encryption Nonzero values are not standardized and implementation dependent National Instruments 6 135 Automotive Diagnostic Command Set User Manual Chapter 6 Output Automotive Diagnostic Command Set API for C blockSize Returns the number of data bytes to be transferred from the ECU in subsequent ndUDSTransferData requests success Indicates successful receipt of a positive response message for this diagnostic service Return Value The return value indicates the functi
290. ndling VI such as the Simple Error Handler source identifies the VI where the error occurred National Instruments 5 47 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Output diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic 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 the VI did not execute the intended operation A positive value means warning the 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 For the VW TP 2 0 you must periodically maintain the connection link to the ECU so that the ECU does not terminate it This VI sends a Connection Test message to the ECU and evaluates its response performing the steps necessary to maintain the connection There is no equivalent for the ISO TP ISO 15765 2 as the ISO TP does not use a special communication link Automotive Diagnostic Command Set User Manual 5 48 ni com Chapter
291. ned 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 ndStatusToString function to obtain a descriptive string for the return value Description This function executes the ReportSeverityInformationOfDTC subfunction of the UDS ReadDiagnosticTroubleCodeInformation service and reads the selected DTCs from the ECU memory For further details about this service refer to the ISO 15765 3 standard National Instruments 6 125 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C ndUDSReportSupportedDTCs Purpose Executes the ReportSupportedDTCs subfunction of the UDS ReadDiagnosticTroubleCodeInformation service Reads all supported Diagnostic Trouble Codes DTCs Format long ndUDSReportSupportedDTCs TD1 diagRef TD3 DTCDescriptor unsigned char statusAvailMask TD4 DTCs long len LVBoolean success Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic or ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct DTCDescriptor A struct that describes the DTC records the ECU delivers typ
292. ng 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 145 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW A Description source identifies the VI where the error occurred memory address length defines the number of bytes of the memory address parameter that are written to the ECU This value is implementation dependent and must be in the range of 1 4 For example if this value is 2 only the two lowest bytes of the address are written to the ECU memory size length defines the number of bytes of the memory size parameter that are written to the ECU This value is implementation dependent and must be in the range of 1 4 For example if this value is 2 only the two lowest bytes of the size are written to the ECU diag ref out is a copy of diag ref in It can be wired to subsequent diagnostic VIs block size returns the number of data bytes to be transferred to the ECU in subsequent UDS TransferData vi requests success indicates successful receipt of a positive response message for this diagnostic 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 status is TRUE if an error occurred code is the error code number identif
293. ng learned values setting option content setting the Vehicle Identification Number or changing calibration values For further details about this service refer to the 15765 3 standard National Instruments 5 163 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW UDS WriteMemoryByAddress vi Purpose Executes the UDS WriteMemoryByAddress service Writes data to the ECU memory Format data in diag ref in diag ref out address success size error out error in no error Input data in defines the memory block to be written to the ECU diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi or Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster Ae address defines the memory address to which data are to be written Only three bytes are sent to the ECU so the address must be in the range O FFFFFF hex size defines the length of the memory block to be written error in is a cluster that 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 WE 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
294. nostic Command Set API for LabVIEW DoIP Send Vehicle Identification Request w EID vi Purpose Sends a UDP request to all DoIP capable vehicles with a certain EID MAC address in the local subnet to identify themselves Format Diag reference in Diag reference out EID error in no error error out Input Diag reference in specifies the diagnostic session handle obtained from Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster El EID is the Entity ID usually the MAC address of the DoIP entity assumed to respond Specify the EID as xx xx xx xx xx xx where each x stands for a hexadecimal digit error in is a cluster that describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out H E status is TRUE if an error occurred This VI is not executed when TE status is TRUE code is the error code number identifying an error A value of 0 means success A negative value means error the VI did not execute the intended operation A positive value means warning the 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 Automo
295. nostic or ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct localID Defines the local identifier of the data to be read The values are application specific Output dataOut Returns the data record from the ECU If you know the record data description you can use the ndConvertToPhys function to interpret it len On input len must contain the dataOut array length On return it contains the number of valid data bytes in the dataOut array success Indicates successful receipt of a positive response message for this diagnostic service Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value National Instruments 6 73 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C Description This function requests data record values from the ECU identified by the LocalID parameter For further details about this service refer to the ISO 14230 3 standard Automotive Diagnostic Comma
296. nostic service The request and response messages are fed unmodified to the data in input and retrieved from the data out output respectively No interpretation of the contents is done with one exception the error number is retrieved from a negative response if one occurs In this case an error also is communicated through the error out cluster All specialized diagnostic services call Diagnostic Service vi internally Automotive Diagnostic Command Set User Manual 5 28 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW DTC to String vi Purpose Returns a string representation such as P1234 for a 2 byte Diagnostic Trouble Code DTC Format DIAG DTC num DTC string Input DTC num is the DTC number as returned in the clusters of ReadDTCByStatus vi ReadStatusOfDTC vi UDS ReportDTCBySeverityMaskRecord vi UDS ReportDTCByStatusMask vi UDS ReportSeverityInformationOfDTC vi UDS ReportSupportedDTCs vi OBD Request Emission Related DTCs vi or OBD Request Emission Related DTCs During Current Drive Cycle vi 3 Note This VI converts only 2 byte DTCs If you feed in larger numbers the VI returns garbage Output DTC string is the DTC string representation Description The SAE J2012 standard specifies a naming scheme for 2 byte DTCs consisting of one letter and four digits Use DTC to String vi to convert a DTC numerical representation to this name National Instruments 5 29 Automoti
297. ns success A negative value means error the VI did not execute the intended operation A positive value means warning the 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 This VI requests ECU memory data identified by the address and size parameters The data out format and definition are vehicle manufacturer specific data out includes analog input and output signals digital input and output signals internal data and system status information if the ECU supports them For further details about this service refer to the ISO 15765 3 standard Automotive Diagnostic Command Set User Manual 5 132 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW UDS ReportDTCBySeverityMaskRecord vi Purpose Executes the ReportDTCBySeverityMaskRecord subfunction of the UDS ReadDiagnosticTroubleCodeInformation service Reads selected Diagnostic Trouble Codes DTCs Format DTC descriptor diag ref in severity mask status error in no error status avail mask National Instruments DTC descriptor is a cluster that describes the DTC records the ECU delivers DTC Byte Length indicates the number of bytes the ECU sends for each DTC The default is 3 for UDS Status Byte Length indicates the
298. ns success A negative value means error the VI did not execute the intended operation A positive value means warning the 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 TA diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs DTCs returns the resulting DTCs as an array of clusters DTC is the resulting Diagnostic Trouble Code For the default 2 byte DTCs you can use DTC to String vi to convert this to readable format as defined by SAE J2012 Status is the DTC status Usually this is a bit field with the following meaning Bit Meaning 0 testFailed 1 testFailedThisMonitoringCycle Automotive Diagnostic Command Set User Manual 5 94 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW 2 pendingDTC 3 confirmedDTC 4 testNotCompletedSinceLastClear 5 testFailedSinceLastClear 6 testNotCompletedThisMonitoringCycle 7 warningIndicatorRequested Add Data contains optional additional data for this DTC Usually this does not contain valid information refer to DTC descriptor success indicates successful receipt of a positive response message for this diagnostic service error out describes error conditions If the error in cluster indicated an error the error out cluster contains t
299. ns warning the VI executed intended operation but an informational warning is returned For a description of the code wire the error cluster to a LabVIEW error handling VI such as the Simple Error Handler source identifies the VI where the error occurred status avail mask is an application specific value returned for all DTCs Description This VI executes the ReportDTCBySeverityMaskRecord subfunction of the UDS ReadDiagnosticTroubleCodeInformation service and reads the selected DTCs For further details about this service refer to the ISO 14229 1 standard National Instruments 5 135 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW UDS ReportDTCByStatusMask vi Purpose Executes the ReportDTCByStatusMask subfunction of the UDS ReadDiagnosticTroubleCodeInformation service Reads selected Diagnostic Trouble Codes DTCs Format DTC descriptor diag ref in status mask error in no error status avail mask Input DTC descriptor is a cluster that describes the DTC records the ECU delivers DTC Byte Length indicates the number of bytes the ECU sends for each DTC The default is 3 for UDS Status Byte Length indicates the number of bytes the ECU sends for each DTC s status The default is 1 Add Data Byte Length indicates the number of bytes the ECU sends for each DTC s additional data Usually there is no additional data so the default is 0
300. ns warning the 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 oH diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs DTCs returns the resulting DTCs as an array of clusters National Instruments DTC is the resulting Diagnostic Trouble Code For the default 2 byte DTCs you can use DTC to String vi to convert this to readable format as defined by SAE J2012 5 87 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Status is the DTC status Usually this is a bit field with the following meaning Bit Meaning 0 testFailed 1 testFailedThisMonitoringCycle 2 pendingDTC 3 confirmedDTC 4 testNotCompletedSinceLastClear 5 testFailedSinceLastClear 6 testNotCompletedThisMonitoringCycle 7 warningIndicatorRequested Add Data contains optional additional data for this DTC Usually this does not contain valid information refer to DTC descriptor success indicates successful receipt of a positive response message for this diagnostic 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 stat
301. nternal ECU function It also controls an output actuator of an electronic system referenced by the ID parameter For further details about this service refer to the ISO 15765 3 standard Automotive Diagnostic Command Set User Manual 6 112 ni com Chapter 6 Automotive Diagnostic Command Set API for C ndUDSReadDataByldentifier Purpose Executes the UDS ReadDataByldentifier service Reads an ECU data record Format long ndUDSReadDataBylIdenti fier TD1 diagRef unsigned short ID unsigned char dataOut long len LVBoolean success Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic or ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct ID Defines the identifier of the data to be read The values are application specific Output dataOut Returns the ECU data record If you know the record data description use ndConvertToPhys to interpret this record len On input 1en must contain the dataOut array length On return it contains the number of valid data bytes in the dataOut array success Indicates successful receipt of a positive response message for this diagnostic service Return Value The return value indicates the function call status as a signed 32 bit integer Zero means the function executed successfully A negative value specifies an error which means the
302. o Phys vi 5 14 Create Extended CAN IDs vi 5 16 Diag Get Property vi 5 17 Diag Set Property vi 5 20 Diagnostic Frame Recv vi 5 23 Diagnostic Frame Send vi 5 25 Diagnostic Service vi 5 27 DisableNormalMessage Transmission vi 5 76 DoIP Activate Routing vi 5 51 DoIP Connect vi 5 53 DoIP Disconnect vi 5 55 DolIP functions 5 51 DoIP Get Diagnostic Power Mode vi 5 57 DoIP Get DolIP Entity Status vi 5 59 DolIP Get Entities vi 5 61 DoIP Send Vehicle Identification Request w EID vi 5 66 DoIP Send Vehicle Identification Request w VIN vi 5 68 DoIP Send Vehicle Identification Request vi 5 64 DTC to String vi 5 29 ni com ECUReset vi 5 78 EnableNormalMessage Transmission vi 5 80 general functions 5 10 Get Time Stamp vi 5 30 InputOutputControlByLocal Identifier vi 5 82 KWP2000 services 5 70 list of VIs 5 2 OBD On Board Diagnostics services 5 170 OBD Clear Emission Related Diagnostic Information vi 5 170 OBD Open vi 5 32 OBD Request Control Of On Board Device vi 5 172 OBD Request Current Powertrain Diagnostic Data vi 5 174 OBD Request Emission Related DTCs During Current Drive Cycle vi 5 179 OBD Request Emission Related DTCs vi 5 176 OBD Request On Board Monitoring Test Results vi 5 182 OBD Request Permanent Fault Codes vi 5 184 OBD Request Powertrain Freeze Frame Data vi 5 187 OBD Request Supported PIDs vi 5 189 OBD Request Vehicle Information vi 5 191 Open
303. o be written dataiIn Defines the memory block to be written to the ECU len Must contain the number of valid data bytes in dataIn National Instruments 6 151 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C Output Success Indicates successful receipt of a positive response message for this diagnostic service Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value Description Similar to the ndUDSWriteMemoryByAddress You can define the address and size parameter sizes in bytes Automotive Diagnostic Command Set User Manual 6 152 ni com Chapter 6 Automotive Diagnostic Command Set API for C OBD On Board Diagnostics Services ndOBDClearEmissionRelatedDiagnosticlnformation Purpose Executes the OBD Clear Emission Related Diagnostic Information service Clears emission related diagnostic trouble codes DTCs in the ECU Format long ndOBDClearEmissionRelatedDiagnosticInformation TD1 diagRef LVBoolean success Input diagRef Specifies the di
304. o 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 ndStatusToString function to obtain a descriptive string for the return value National Instruments 6 169 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C WWH OBD World Wide Harmonized On Board Diagnostics Services ndWWHOBDClearEmissionRelatedDTCs Purpose Executes the WWH OBD ClearDiagnosticInformation service Clears selected Diagnostic Trouble Codes DTCs Format long ndWWHOBDClearEmissionRelatedDTCs TD1 diagRef LVBoolean success Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct Output success Indicates successful receipt of a positive response message for this diagnostic service Return Value The return value indicates the function call status 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
305. occurred Description Diagnostic Frame Recv vi receives an arbitrary raw CAN frame on the diagnostic CAN identifier For example you can check the transport protocol implementation of an ECU for correct responses if erroneous protocol requests are issued Automotive Diagnostic Command Set User Manual 5 24 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Diagnostic Frame Send vi Purpose Sends a raw CAN frame on the diagnostic CAN ID to check for errors in the transport protocol implementation of an ECU Format diag ref in diag ref out data in error in no error error ou Input diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster data in is an array of up to 8 bytes sent as a CAN payload on the diagnostic identifier error in is a cluster that 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 E status is TRUE if an error occurred This VI is not executed when TF status is TRUE code is the error code number identifying an error A value of 0 means success A negative value means error the VI did not execute the intended operation A positive value means warning the VI executed intended operation but an inform
306. ocol implementation of an ECU ndDiagFrameSend Sends a raw CAN frame on the diagnostic CAN ID to check for errors in the transport protocol implementation of an ECU National Instruments 6 3 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C Table 6 2 Functions for the Automotive Diagnostic Command Set for C Continued Function Purpose ndDiagnosticService Executes a generic diagnostic service If a special service is not available through the KWP2000 UDS or OBD service functions you can build it using this function ndDisableNormalMessageTransmission Executes the DisableNormalMessage Transmission service The ECU no longer transmits its regular communication messages usually CAN messages ndDoIPActivateRouting Defines the source and target address for a DoIP TCP IP connection ndDoIPConnect Creates a TCP IP connection to a DolP entity identified by its IP address ndDoIPDisconnect Disconnects the TCP IP connection to a DoIP entity ndDoIPEntityStatus Gets status information from a DolP entity ndDoIPGetDiagPowerMode Gets information on the DoIP entity power state ndDolPGetEntities Returns a table of all DoIP entities vehicles on the local subnet possibly restricted to EID or VIN ndDolPSendVehicleIdentRequest Sends a UDP request to all DoIP capable vehicles in the local
307. ode number identifying an error A value of 0 means success A negative value means error the VI did not execute the intended operation A positive value means warning the 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 Automotive Diagnostic Command Set User Manual 5 210 ni com Output m Description Chapter 5 Automotive Diagnostic Command Set API for LabVIEW source identifies the VI where the error occurred diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs DIDs out returns an array of valid DIDs success indicates successful receipt of a positive response message for this diagnostic 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 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 the VI did not execute the intended operation A positive value means warning the 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
308. oduce software or other materials belonging to others you may use NI software only to reproduce materials that you may reproduce in accordance with the terms of any applicable license or other legal restriction End User License Agreements and Third Party Legal Notices You can find end user license agreements EULAs and third party legal notices in the following locations e Notices are located in the lt National Instruments gt _Legal Information and lt National Instruments gt directories e EULAs are located in the lt National Instruments gt Shared MDF Legal license directory e Review lt National Instruments gt _Legal Information txt for information on including legal information in installers built with NI products U S Government Restricted Rights If you are an agency department or other entity of the United States Government Government the use duplication reproduction release modification disclosure or transfer of the technical data included in this manual is governed by the Restricted Rights provisions under Federal Acquisition Regulation 52 227 14 for civilian agencies and Defense Federal Acquisition Regulation Supplement Section 252 227 7014 and 252 227 7015 for military agencies Trademarks Refer to the NJ Trademarks and Logo Guidelines at ni com trademarks for more information on National Instruments trademarks ARM Keil and Vision are trademarks or registered of ARM Ltd or its subsidiaries LEGO the LEGO
309. om the ECU memory For further details about this service refer to the ISO 15765 3 standard National Instruments 5 141 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW UDS ReportSupportedDTCs vi Purpose Executes the ReportSupportedDTCs subfunction of the UDS ReadDiagnosticTroubleCodeInformation service Reads all supported Diagnostic Trouble Codes DTCs Format DTC descriptor diag ref in DTC mask record error in no error diag ref out DTCs success error out status avail mask Input ena DTC descriptor is a cluster that describes the DTC records the ECU eae delivers DTC Byte Length indicates the number of bytes the ECU sends for each DTC The default is 3 for UDS Status Byte Length indicates the number of bytes the ECU sends for each DTC s status The default is 1 Add Data Byte Length indicates the number of bytes the ECU sends for each DTC s additional data Usually there is no additional data so the default is 0 Byte Order indicates the byte ordering for multibyte items d HEE 0 MSB_FIRST Motorola default 1 LSB_FIRST Intel This VI interprets the response byte stream according to this description and returns the resulting DTC records in the DTCs cluster array diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi or Open Diagnostic on IP vi and wired through subsequ
310. ommand Set API for LabVIEW Output Time Stamp write first contains the timestamp of the first write frame This is usually the FF or SF of the ISO TP diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs Time Stamp write last contains the timestamp of the last write frame This is usually the last CF or SF of the ISO TP Time Stamp read first contains the timestamp of the first read frame This is usually the FF or SF of the ISO TP Time Stamp read last contains the timestamp of the last read frame This is usually the CF or SF of the ISO TP 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 EAH AEE 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 the VI did not execute the intended operation A positive value means warning the 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 Get Time Stamp vi gets the first and last write CAN or LIN frame and the first and last read CAN or LIN frame if the ISO TP transport protocol is used For all other transport p
311. on Otherwise error out describes the error status of this VI BE 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 the VI did not execute the intended operation A positive value means warning the 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 This VI starts a routine in the ECU memory The routine in the ECU starts after the positive response message is sent The routine stops until StopRoutineByLocalldentifier vi is issued The routines could be either tests run instead of normal operating code or routines enabled and executed with the normal operating code running In the first case you may need to switch the ECU to a specific diagnostic mode using StartDiagnosticSession vi or unlock the ECU using the SecurityAccess service prior to using StartRoutineByLocalldentifier vi For further details about this service refer to the ISO 14230 3 standard National Instruments 5 105 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW StopDiagnosticSession vi Purpose Executes the StopDiagnosticSession service Returns the ECU to normal mode Format diag ref ou
312. on call status 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 ndStatusToString function to obtain a descriptive string for the return value Description ndUDSRequestUp1load initiates the upload of a data block from the ECU This is required to set up the upload process the actual data transfer occurs with subsequent ndUDSTransferData requests The transfer must occur in blocks of the size that this service returns the blockSize parameter After the download completes use the ndUDSRequestTransferExit service to terminate the process Automotive Diagnostic Command Set User Manual 6 136 ni com Chapter 6 Automotive Diagnostic Command Set API for C ndUDSRoutineControl Purpose Executes the UDS RoutineControl service Executes a routine on the ECU Format long ndUDSRoutineControli TD1 diagRef unsigned short ID unsigned char mode unsigned char dataIn long len unsigned char dataOut long len2 LVBoolean success Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic or ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of th
313. on 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 max sockets represents the maximum number of concurrent TCP IP sockets allowed with this DoIP entity excluding the reserve socket required for socket handling cur sockets is the number of currently established TCP IP sockets Description DolIP Get DoIP Entity Status vi identifies certain operating conditions of the responding DolP entity For example this allows for test equipment to detect existing diagnostic communication sessions as well as the capabilities of a DoIP entity Automotive Diagnostic Command Set User Manual 5 60 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW DolP Get Entities vi Purpose Returns a table of all DoIP entities vehicles on the local subnet possibly restricted to EID or VIN Format Diag reference in Em Diag reference out DoIP Open Type Lado IP entities VIN or EID error out error in no error Input El Ho National Instruments Diag reference in specifies the diagnostic session handle obtained from Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster DoIP Open Type is a U16 ring It defines which DoIP entities this command queries and lists Allowed values are VIN EID and All
314. ops the current diagnostic session it performs the necessary action to restore its normal operating conditions Restoring the normal ECU operating conditions may include resetting all controlled actuators activated during the diagnostic session being stopped and resuming all normal ECU algorithms You should call ndStopDiagnosticSession before disabling communication with ndCloseDiagnostic but only if you previously used ndStartDiagnosticSession Automotive Diagnostic Command Set User Manual 6 94 ni com Chapter 6 Automotive Diagnostic Command Set API for C ndStopRoutineByLocalldentifier Purpose Executes the StopRoutineByLocalldentifier service Stops a routine on the ECU Format long ndStopRoutineByLocalIdenti fier TD1 diagRef unsigned char localID unsigned char dataIn long len unsigned char dataOut long len2 LVBoolean success Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic or ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct localID Defines the local identifier of the routine to be stopped The values are application specific dataIn Defines application specific input parameters for the routine len Must contain the number of valid data bytes in dataIn Output dataOut Returns application specific output parameters from the routine len2 On inpu
315. or C ndDolPSendVehicleldentReqEID Purpose Sends a UDP request to all DoIP capable vehicles with a certain EID MAC address in the local subnet to identify themselves Format long ndDoIPSendVehicleIdentReqEID TD1 diagRef char EID Input diagRef Specifies the handle for the diagnostic session obtained from ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct EID The Entity ID usually the MAC address of the DoIP entity that is assumed to respond Specify the EID as xx xx xx xx xx xx where each x stands for a hexadecimal digit zero terminated string Output Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value Description ndDoIPSendVehicleIdentReqgEID sends a Vehicle Identification Request to all DoIP entities in the local subnet identified by the given EID Usually this is done as part of ndDoIPGet Entities and does not need to be executed separately National Instruments 6 61 Automotive Diagnostic
316. or the return value National Instruments 6 157 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C ndOBDRequestEmissionRelatedDTCs Purpose Executes the OBD Request Emission Related DTCs service Reads all emission related Diagnostic Trouble Codes DTCs Format long ndOBDRequestEmissionRelatedDTCs TD1 diagRef TD3 DTCDescriptor TD4 DTCs long len LVBoolean success Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic or ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct DTCDescriptor A struct that describes the DTC records the ECU delivers typedef struct long DTCByteLength long StatusByteLength long AddDataByteLength unsigned short ByteOrder TD3 DTCByteLength indicates the number of bytes the ECU sends for each DTC The default is 2 StatusByteLength indicates the number of bytes the ECU sends for each DTC s status The default is 0 for OBD AddDataByteLength indicates the number of bytes the ECU sends for each DTC s additional data Usually there are no additional data so the default is 0 ByteOrder indicates the byte ordering for multibyte items 0 MSB_FIRST Motorola default 1 LSB_FIRST Intel This function interprets the response byte stream according to this description and retu
317. ore details about starting communication refer to ISO 14230 2 If no diagnostic session is requested after ndOpenDiagnostic a default session is enabled automatically in the ECU The default session supports at least the following services e The StopCommunication service refer to ndCloseDiagnostic and the ISO 14230 2 standard e The TesterPresent service refer to ndTesterPresent and the ISO 14230 3 standard National Instruments 6 91 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C ndStartRoutineByLocalldentifier Purpose Executes the StartRoutineByLocalldentifier service Executes a routine on the ECU Format long ndStartRoutineByLocallIdenti fier TD1 diagRef unsigned char localID unsigned char dataIn long len unsigned char dataOut long len2 LVBoolean success Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic or ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct localID Defines the local identifier of the routine to be started The values are application specific dataIn Defines application specific input parameters for the routine len Must contain the number of valid data bytes in dataIn Output dataOut Returns application specific output parameters from the routine len2 On input
318. ory data len On input 1en must contain the dataOut array length On return it contains the number of valid data bytes in the dataOut array success Indicates successful receipt of a positive response message for this diagnostic service National Instruments 6 115 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value Description This function requests memory data from the ECU identified by the address and size parameters The dataOut format and definition are vehicle manufacturer specific dataOut includes analog input and output signals digital input and output signals internal data and system status information if the ECU supports them For further details about this service refer to the ISO 15765 3 standard Automotive Diagnostic Command Set User Manual 6 116 ni com Chapter 6 Automotive Diagnostic Command Set API for C ndUDSReportDTCBySeverityMaskRecord Purpose Executes the ReportDTCBySeverityMaskRecord
319. osticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct DTCDescriptor A struct that describes the DTC records the ECU delivers typedef struct long DTCByteLength long StatusByteLength long AddDataByteLength unsigned short ByteOrder TD3 DTCByteLength indicates the number of bytes the ECU sends for each DTC The default is 2 StatusByteLength indicates the number of bytes the ECU sends for each DTC s status The default is 0 for OBD AddDataByteLength indicates the number of bytes the ECU sends for each DTC s additional data Usually there are no additional data so the default is 0 ByteOrder indicates the byte ordering for multibyte items 0 MSB_FIRST Motorola default 1 LSB_FIRST Intel This function interprets the response byte stream according to this description and returns the resulting DTC records in the DTCs struct array Automotive Diagnostic Command Set User Manual 6 164 ni com Chapter 6 Automotive Diagnostic Command Set API for C Output DTCs Returns the resulting DTCs as an array of structs typedef struct unsigned long DTC unsigned long Status unsigned long AddData TD4 DTC is the resulting Diagnostic Trouble Code For the default 2 byte DTCs use ndDTCToString to convert this code to readable format as defined by SAE J2012 Status is the DTC status Usually this is a bit field with follow
320. otive Diagnostic Command Set The Automotive Diagnostic Command Set is structured into three layers of functionality e The top layer implements three sets of diagnostic services for the diagnostic protocols KWP2000 UDS DiagOnCAN and OBD On Board Diagnostics e The second layer implements general routines involving opening and closing diagnostic communication connections connecting and disconnecting to from an ECU and executing a diagnostic service on byte level The latter routine is the one the top layer uses heavily e The third layer implements the transport protocols needed for diagnostic communication to an ECU The second layer uses these routines to communicate to an ECU All three top layers are fully implemented in LabVIEW The transport protocols then execute CAN LIN Read Write operations through a specialized DLL for streamlining the CAN LIN data flow especially in higher busload situations Automotive Diagnostic Command Set API Structure The top two layer routines are available as API functions Each diagnostic service for KWP2000 UDS and OBD is available as one routine Also available on the top level are auxiliary routines for converting scaled physical data values to and from their binary representations used in the diagnostic services On the second layer are more general routines for opening and closing diagnostic communication channels and executing a diagnostic service Auxiliary routines create the d
321. our data input consists of several values you can use ndConvertFromPhys multiple times on different parts of the byte array National Instruments 6 15 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C ndConvertToPhys Purpose Converts a binary representation of a value into its physical value using a type descriptor Format void ndConvertToPhys TD2 typeDescriptor unsigned char dataIn long len double value Input typeDescriptor A struct that specifies the conversion of the physical value to its binary representation typedef struct long StartByte long ByteLength unsigned short ByteOrder unsigned short DataType double ScaleFactor double ScaleOffset Lo ED Ds StartByte gives the start byte of the binary representation in the dataIn record ByteLength is the number of bytes in the binary representation ByteOrder defines the byte order for multibyte representations The values are 0 MSB_FIRST Motorola 1 LSB_FIRST Intel DataType is the binary representation format 0 Unsigned Only byte lengths of 1 4 are allowed 1 Signed Only byte lengths of 1 4 are allowed 2 Float Only byte lengths 4 or 8 are allowed ScaleFactor defines the physical value scaling Phys ScaleFactor binary representation ScaleOffset ScaleOffset refer to ScaleFactor Automotive Diagnostic Command Set User Manual 6 16 ni com Chapter 6 Automotive Di
322. owertrainDiagnosticData TD1 diagRef unsigned char PID unsigned char dataOut long len LVBoolean success Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic or ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct PID Defines the parameter identifier of the data to be read The SAE J1979 standard defines the values Output dataOut Returns the ECU data record If you know the record data description use ndConvertToPhys to interpret this record You can obtain the description from the SAE J1979 standard len On input len must contain the dataOut array length On return it contains the number of valid data bytes in the dataOut array success Indicates successful receipt of a positive response message for this diagnostic service Automotive Diagnostic Command Set User Manual 6 156 ni com Chapter 6 Automotive Diagnostic Command Set API for C Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string f
323. pecific error in is a cluster that 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 Eo 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 the VI did not execute the intended operation A positive value means warning the VI executed intended operation but an informational warning is returned For a description of the code wire the error cluster to a LabVIEW error handling VI such as the Simple Error Handler source identifies the VI where the error occurred National Instruments 5 89 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Output diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs data out returns the ECU identification data success indicates successful receipt of a positive response message for this diagnostic 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 BE 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 th
324. ple Error Handler source identifies the VI where the error occurred This VI executes the UDS RoutineControl service and launches an ECU routine stops an ECU routine or requests ECU routine results from the ECU For further details about this service refer to the ISO 15765 3 standard Automotive Diagnostic Command Set User Manual 5 154 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW UDS SendKey vi Purpose Executes the SecurityAccess service to send a key to the ECU Format diag ref in diag ref out access mode success key in error out error in no error Input diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi or Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster El access mode indicates the security level to be granted The values are application specific This is an even number usually 2 key in defines the key data to be sent to the ECU error in is a cluster that 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 B 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 the VI did not exec
325. positive value means warning the 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 The WWH OBD ReadDTCInformation service is based on the UDS ReaDTCInformation service ISO 14229 1 National Instruments 5 207 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW WWH OBD Request RID vi Purpose Executes the WWH OBD RoutineControl service Reads a data record from the ECU Format diag ref in diag ref out mode data out routine identifier success error in no error error out Input diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi or Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster mode defines the service operation mode You can obtain the values from a ring control El 1 Start Routine 2 Stop Routine 3 Request Routine Results Other values are application specific routine identifier defines the identifier of the routine to be started The values are application specific error in is a cluster that describes error conditions occurring before the VI executes If an error has already occurred the VI returns the va
326. pt of a positive response message for this diagnostic 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 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 the VI did not execute the intended operation A positive value means warning the 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 To ensure proper ECU operation you may need to keep the ECU informed that a diagnostic session is still in progress If you do not send this information for example because the communication is broken the ECU returns to normal mode from diagnostic mode after a while The TesterPresent service is this keep alive signal It does not affect any other ECU operation Keep calling TesterPresent vi within the ECU timeout period if no other service is executed National Instruments 5 111 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW WriteDataByLocalldentifier vi Purpose Executes the WriteDataByLocalldentifi
327. quipment for Emissions Related Diagnostics ISO 27145 2012 E Road Vehicles Implementation of World Wide Harmonized On Board Diagnostics WWH OBD Communication Requirements NI CAN Hardware and Software Manual XV Automotive Diagnostic Command Set User Manual Activating Your Software This section describes how to use the NI Activation Wizard to activate your software How Do Activate My Software Use the NI Activation Wizard to obtain an activation code for your software You can launch the NI Activation Wizard two ways e Launch the product and choose to activate your software from the list of options presented e Launch NI License Manager by selecting Start All Programs National Instruments NI License Manager Click the Activate button in the toolbar Notes If your software is a part of a Volume License Agreement VLA contact your VLA administrator for installation and activation instructions NI software for Mac OS X and Linux operating systems does not require activation What is Activation Activation is the process of obtaining an activation code to enable your software to run on your computer An activation code is an alphanumeric string that verifies the software version and computer ID to enable features on your computer Activation codes are unique and are valid on only one computer What is the NI Activation Wizard The NI Activation Wizard is a part of NI License Manager that steps you t
328. ranch What is a Computer ID The computer ID contains unique information about your computer National Instruments requires this information to enable your software You can find your computer ID through the NI Activation Wizard or by using NI License Manager as follows 1 Launch NI License Manager by selecting Start All Programs National Instruments NI License Manager 2 Click the Display Computer Information button in the toolbar For more information about product activation and licensing refer to ni com activate Automotive Diagnostic Command Set User Manual xviii ni com Activating Your Software How Can I Evaluate NI Software You can install and run most NI application software in evaluation mode This mode lets you use a product with certain limitations such as reduced functionality or limited execution time Refer to your product documentation for specific information on the product s evaluation mode Moving Software After Activation To transfer your software to another computer install and activate it on the second computer You are not prohibited from transferring your software from one computer to another and you do not need to contact or inform NI of the transfer Because activation codes are unique to each computer you will need a new activation code Refer to How Do I Activate My Software to acquire a new activation code and reactivate your software Deactivating a Product To deactiva
329. rd defines a minimum set of diagnostic information for passenger cars and light and medium duty trucks which must be exchanged with any off board test equipment National Instruments 1 7 Automotive Diagnostic Command Set User Manual Installation and Configuration This chapter explains how to install and configure the Automotive Diagnostic Command Set Installation This section discusses the Automotive Diagnostic Command Set installation for Microsoft Windows 3 Note You need administrator rights to install the Automotive Diagnostic Command Set on your computer Follow these steps to install the Automotive Diagnostic Command Set software 1 ds a od National Instruments Insert the Automotive Diagnostic Command Set CD into the CD ROM drive Open Windows Explorer Access the CD ROM drive Double click on autorun exe to launch the software interface Start the installation The installation program guides you through the rest of the installation process If you have not already installed NI CAN the Automotive Diagnostic Command Set installer automatically installs the NI CAN driver on your computer Within the Devices amp Interfaces branch of the MAX Configuration tree NI CAN hardware is listed along with other hardware in the local computer system If the CAN hardware is not listed here MAX is not configured to search for new devices on startup To search for the new hardware press lt F5 gt To
330. ref in specifies the diagnostic session handle obtained from Open Diagnostic vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster error in is a cluster that 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 the VI did not execute the intended operation A positive value means warning the VI executed intended operation but an informational warning is returned For a description of the code wire the error cluster to a LabVIEW error handling VI such as the Simple Error Handler source identifies the VI where the error occurred National Instruments 5 189 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Output diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs PIDs out returns an array of valid PIDs for the OBD Request Current Powertrain Diagnostic Data 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 status is TRU
331. rform 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 ndStatusToString function to obtain a descriptive string for the return value Description Similar to ndUDSReadMemoryByAddress You can define the address and size parameter sizes in bytes Automotive Diagnostic Command Set User Manual 6 150 ni com Chapter 6 Automotive Diagnostic Command Set API for C ndUDSO6WriteMemoryByAddress Purpose Format Input Executes the UDS WriteMemoryByAddress service Writes data to the ECU memory long ndUDSO6WriteMemoryByAddress TD1 diagRef unsigned char memAddrLen unsigned char memSizeLen unsigned long address unsigned long size unsigned char dataIn long len LVBoolean success diagRef Specifies the handle for the diagnostic session obtained from ndOpenDiagnostic or ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct memAddrLen Defines the number of address bytes transferred to the ECU This implicitly defines the maximum allowed for the address parameter memSizeLen Defines the number of size bytes transferred to the ECU This implicitly defines the maximum allowed for the size parameter address Defines the memory address to which data are written size Defines the length of the memory block t
332. ries general functions KWP2000 services UDS DiagOnCAN services and OBD On Board Diagnostics services Section Headings The following are section headings found in the Automotive Diagnostic Command Set API for LabVIEW VIs Purpose Each VI description briefly describes the VI purpose Format The format section describes the VI format Input and Output The input and output sections list the VI parameters Description The description section gives details about the VI purpose and effect National Instruments 5 1 Automotive Diagnostic Command Set User Manual Chapter 5 List of Vis Automotive Diagnostic Command Set API for LabVIEW The following table is an alphabetical list of the Automotive Diagnostic Command Set VIs Table 5 1 Automotive Diagnostic Command Set API VIs for LabVIEW Function Purpose ClearDiagnosticInformation vi Executes the ClearDiagnosticInformation service and clears selected Diagnostic Trouble Codes DTCs Close Diagnostic vi Closes a diagnostic session ControlDTCSetting vi Executes the ControlDTCSetting service and modifies the generation behavior of selected Diagnostic Trouble Codes DTCs Convert from Phys vi Converts a physical data value into a binary representation using a type descriptor Convert to Phys vi Converts a binary representation of a value into its physical value using a type descriptor Create Extended CAN I
333. ring for multibyte items 0 MSB_FIRST Motorola default 1 LSB_FIRST Intel This VI interprets the response byte stream according to this description and returns the resulting DTC records in the DTCs cluster array diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi or Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster Automotive Diagnostic Command Set User Manual 5 86 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW mode defines the type of DTCs to be read The values are application specific The usual values are 2 Allidentified 3 AllSupported group of DTC specifies the group of Diagnostic Trouble Codes to be read The following values have a special meaning and you can specify them through a ring control 0x0000 All powertrain DTCs 0x4000 All chassis DTCs 0x8000 All body DTCs OxC000 All network related DTCs OxFFOO All DTCs error in is a cluster that 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 the VI did not execute the intended operation A positive value mea
334. ription This VI performs Chapter 5 Automotive Diagnostic Command Set API for LabVIEW diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs success indicates successful receipt of a positive response message for this diagnostic 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 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 the VI did not execute the intended operation A positive value means warning the 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 the KWP2000 WriteDataByLocalldentifier service and writes Record Values data values to the ECU data in identifies the data The vehicle manufacturer must ensure the ECU conditions are met when performing this service Typical use cases are clearing nonvolatile memory resetting learned values setting option content setting the Vehicle Identification Number or changing calibration values For further details about this service refer to the ISO 14230 3 standard National Instruments 5 113 Automotive
335. riptive string for the return value Description This function executes the UDS CommunicationControl service and switches transmission and or reception of the normal communication messages usually CAN messages on or off The type and communication type parameters are vehicle manufacturer specific one OEM may disable the transmission only while another OEM may disable the transmission and reception based on vehicle manufacturer specific needs The request is either transmitted functionally addressed to all ECUs with a single request message or transmitted physically addressed to each ECU in a separate request message Automotive Diagnostic Command Set User Manual 6 106 ni com Chapter 6 Automotive Diagnostic Command Set API for C ndUDSControlDTCSetting Purpose Executes the UDS ControlDTCSetting service Modifies Diagnostic Trouble Code DTC behavior Format long ndUDSControlDTCSetting TD1 diagRef unsigned char type unsigned char dataIn long len LVBoolean success Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic or ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct type Specifies the control mode 1 on 2 off dataIn Specifies application specific data that control DTC generation len Must contain the number of valid data bytes in dataIn Output success Indicates s
336. riptor A struct that describes the DTC records the ECU delivers typedef struct long DTCByteLength long StatusByteLength long AddDataByteLength unsigned short ByteOrder D3 DTCByteLength indicates the number of bytes the ECU sends for each DTC The default is 3 for UDS StatusByteLength indicates the number of bytes the ECU sends for each DTC s status The default is 1 AddDataByteLength indicates the number of bytes the ECU sends for each DTC s additional data Usually there are no additional data so the default is 0 Automotive Diagnostic Command Set User Manual 6 120 ni com Chapter 6 Automotive Diagnostic Command Set API for C ByteOrder indicates the byte ordering for multibyte items 0 MSB_FIRST Motorola default 1 LSB_FIRST intel This function interprets the response byte stream according to this description and returns the resulting DTC records in the DTCs struct array Output statusAvailMask An application specific value returned for all DTCs DTCs Returns the resulting DTCs as an array of structs typedef struct unsigned long DTC unsigned long Status unsigned long AddData TD4 DTC is the resulting Diagnostic Trouble Code For the default 2 byte DTCs use ndDTCToString to convert this code to readable format as defined by SAE J2012 Status is the DTC status Usually this is a bit field with following meaning Bit Meaning testFailed testFailedThisMonitoringCycle pendingDTC
337. rityMaskRecord subfunction of the UDS ReadDiagnosticTroubleCodeInformation service Reads selected Diagnostic Trouble Codes DTCs UDS ReportDTCByStatusMask vi Executes the ReportDTCByStatusMask subfunction of the UDS ReadDiagnosticTroubleCodeInformation service Reads selected Diagnostic Trouble Codes DTCs UDS ReportSeverityInformationOfDTC vi Executes the ReportSeverityInformationOfDTC subfunction of the UDS ReadDiagnosticTroubleCodeInformation service Reads selected Diagnostic Trouble Codes DTCs UDS ReportSupportedDTCs vi Executes the ReportSupportedDTCs subfunction of the UDS ReadDiagnosticTroubleCodeInformation service Reads all supported Diagnostic Trouble Codes DTCs National Instruments 5 7 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Table 5 1 Automotive Diagnostic Command Set API VIs for LabVIEW Continued Function Purpose UDS RequestDownload vi Initiates a download of data to the ECU Cc JDS RequestSeed vi Executes the UDS SecurityAccess service to retrieve a seed from the ECU UDS RequestTransferExit vi Terminates a download upload process UDS RequestUpload vi Initiates an upload of data from the ECU UDS RoutineControl vi Executes the UDS RoutineControl service Executes a routine on the ECU UDS SendKey vi Executes the SecurityAccess service to s
338. rmally it is not necessary to manually manipulate the elements of this struct requireResponse Indicates whether a response to this service is required If requireResponse is FALSE no response is evaluated and success is always returned TRUE This parameter is passed by reference Output success Indicates successful receipt of a positive response message for this diagnostic service Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value National Instruments 6 97 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C Description To ensure proper ECU operation you may need to keep the ECU informed that a diagnostic session is still in progress If you do not send this information for example because the communication is broken the ECU returns to normal mode from diagnostic mode after a while The TesterPresent service is this keep alive signal It does not affect any other ECU operation Keep calling ndTesterPresent within the ECU timeout period if no other service
339. rmally it is not necessary to manually manipulate the elements of this cluster error in is a cluster that 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 diag ref in specifies the diagnostic session handle obtained from Open 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 the VI did not execute the intended operation A positive value means warning the 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 diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs success indicates successful receipt of a positive response message for this diagnostic service Automotive Diagnostic Command Set User Manual 5 170 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW 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 valu
340. rmational warning is returned For a description of the code wire the error cluster to a LabVIEW error handling VI such as the Simple Error Handler source identifies the VI where the error occurred diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs DTCs returns the resulting DTCs as an array of clusters DTC is the resulting Diagnostic Trouble Code For the default 2 byte DTCs you can use DTC to String vi to convert this to readable format as defined by SAE J2012 Status is the DTC status Usually this is a bit field with the following meaning Bit Meaning 0 testFailed 1 testFailedThisMonitoringCycle 2 pendingDTC 3 confirmedDTC 4 testNotCompletedSinceLastClear 5 testFailedSinceLastClear 6 testNotCompletedThisMonitoringCycle 7 warningIndicatorRequested For OBD this field usually does not contain valid information Add Data contains optional additional data for this DTC Usually this does not contain valid information refer to DTC descriptor Automotive Diagnostic Command Set User Manual 5 180 ni com National Instruments Chapter 5 Automotive Diagnostic Command Set API for LabVIEW success indicates successful receipt of a positive response message for this diagnostic 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 thi
341. rmed as expected but a condition arose that may require attention Use the ndStatusToString function to obtain a descriptive string for the return value National Instruments 6 167 Automotive Diagnostic Command Set User Manual ndOBDRequestVehiclelnformation Purpose Executes the OBD Request Vehicle Information service Reads a set of information data from the ECU Format long ndOBDRequestVehicleInformation TD1 diagRef unsigned char infoType unsigned char nItems unsigned char dataOut long len LVBoolean success Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic or ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct infoType Defines the type of information to be read The SAE J1979 standard defines the values Output nitems The number of data items not bytes this service returns dataOut Returns the ECU vehicle information You can obtain the description from the SAE J1979 standard len On input len must contain the dataOut array length On return it contains the number of valid data bytes in the dataOut array success Indicates successful receipt of a positive response message for this diagnostic service Chapter 6 Automotive Diagnostic Command Set API for C Return Value The return value indicates the function call status as a signed 32 bit integer Zer
342. rning the VI executed intended operation but an informational warning is returned For a description of the code wire the error cluster to a LabVIEW error handling VI such as the Simple Error Handler source identifies the VI where the error occurred National Instruments 5 157 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Output diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs success indicates successful receipt of a positive response message for this diagnostic 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 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 the VI did not execute the intended operation A positive value means warning the 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 To ensure proper ECU operation you may need to keep the ECU informed that a diagnostic session is still in progress If you do not send this information for example because the com
343. rns the resulting DTC records in the DTCs struct array Automotive Diagnostic Command Set User Manual 6 158 ni com Chapter 6 Automotive Diagnostic Command Set API for C Output DTCs Returns the resulting DTCs as an array of structs typedef struct unsigned long DTC unsigned long Status unsigned long AddData TD4 DTC is the resulting Diagnostic Trouble Code For the default 2 byte DTCs use ndDTCToString to convert this code to readable format as defined by SAE J2012 Status is the DTC status Usually this is a bit field with following meaning Bit Meaning testFailed testFailedThisMonitoringCycle pendingDTC confirmedDTC testNotCompletedSinceLastClear testFailedSinceLastClear nn FW NY KF CO testNotCompletedThisMonitoringCycle 7 warningIndicatorRequested For OBD this field usually does not contain valid information AddData contains optional additional data for this DTC Usually this does not contain valid information refer to DTCDescriptor len On input len must contain the DTCs array length in elements On return it contains the number of valid elements in the DTCs array success Indicates successful receipt of a positive response message for this diagnostic service Return Value The return value indicates the function call status 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 exp
344. ror 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 the VI did not execute the intended operation A positive value means warning the 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 Automotive Diagnostic Command Set User Manual 5 84 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Output diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs data out returns the data record from the ECU If you know the record data description you can interpret this record using Convert from Phys vi success indicates successful receipt of a positive response message for this diagnostic service TE 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 E A eE status is TRUE if an error occurred code is the error code number identifying an error A value of 0 means success A
345. ror occurred code is the error code number identifying an error A value of 0 means success A negative value means error the VI did not execute the intended operation A positive value means warning the 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 This VI requests the ECU to perform an ECU reset effectively based on the mode parameter value content The vehicle manufacturer determines when the positive response message is sent For further details about this service refer to the ISO 15765 3 standard Automotive Diagnostic Command Set User Manual 5 126 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW UDS InputOutputControlByldentifier vi Purpose Executes the UDS InputOutputControlBylIdentifier service Modifies ECU I O port behavior Format data in diag ref in JOS a diag ref out ID data out mode Yh SUCCESS error in no error error out Input data in defines application specific data for this service diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi or Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster HE ID defines
346. rotocols the timestamps are always 0 The UDS Read ECU Information example includes an example for getting the timestamp National Instruments 5 31 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW OBD Open vi Purpose Opens an OBD II diagnostic session on a CAN port Format CAN interface diag ref out baudrate error in no error error out Input CAN interface specifies the CAN interface on which the diagnostic a et communication should take place NI CAN The CAN interface is the name of the NI CAN Network Interface Object to configure This name uses the syntax CANx where x is a decimal number starting at 0 that indicates the CAN network interface CANO CAN1 up to CAN63 CAN network interface names are associated with physical CAN ports using Measurement and Automation Explorer MAX NI XNET By default the Automotive Diagnostic Command Set uses NI CAN for CAN communication This means you must define an NI CAN interface for your NI XNET hardware NI CAN compatibility mode to use your XNET hardware for CAN communication However to use your NI XNET interface in the native NI XNET mode meaning it does not use the NI XNET Compatibility Layer you must define your interface under NI XNET Devices in MAX and pass the NI XNET interface name that the Automotive Diagnostic Command Set will use To do this add nixnet to the protocol string for example
347. rovided for sequencing purposes only ER Output diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs error out describes error conditions It is copied unchanged from the error in cluster It is provided for sequencing purposes only B E Description Use this VI to set several internal diagnostic parameters such as timeouts for the transport protocol Use Diag Get Property vi to read them out Automotive Diagnostic Command Set User Manual 5 22 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Diagnostic Frame Recv vi Purpose Receives a raw CAN frame on the diagnostic CAN ID to check for errors in the transport protocol implementation of an ECU Format timeout diag ref in diag ref out i data out error in no error rer ce Input timeout specifies the time in milliseconds to wait for a frame on the diagnostic identifier If no frame arrives within this time a timeout error is returned Diagnostic vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster error in is a cluster that 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 diag ref in specifies the diagnostic session handle obtained from Open status is TRUE if an error occurred This VI is not executed when T
348. rror cluster to a LabVIEW error handling VI such as the Simple Error Handler source identifies the VI where the error occurred National Instruments 5 193 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Output diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs this diagnostic 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 success indicates successful receipt of a positive response message for 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 the VI did not execute the intended operation A positive value means warning the VI executed intended operation but an informational warning is returned For a description of the code wire the error cluster to a LabVIEW error handling VI such as the Simple Error Handler source identifies the VI where the error occurred Description The WWH OBD ClearDiagnosticInformation service is based on the UDS ClearDiagnosticInformation service ISO 14229 1 Automotive Diagnostic Command Set User Manual 5 194 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW WWH OBD Convert DTCs to J1939 vi Purpo
349. rted Format long ndOpenDiagnostic Input char CANInterface unsigned long baudrate unsigned short transportProtocol unsigned long transmitID unsigned long receivelID TD1 diagRefOut CANInterface Specifies the CAN interface on which the diagnostic communication should take place NI CAN The CAN interface is the name of the NI CAN Network Interface Object to configure This name uses the syntax CANx where x is a decimal number starting at 0 that indicates the CAN network interface CANO CAN1 up to CAN63 CAN network interface names are associated with physical CAN ports using Measurement and Automation Explorer MAX NI XNET By default the Automotive Diagnostic Command Set uses NI CAN for CAN communication This means you must define an NI CAN interface for your NI XNET hardware NI CAN compatibility mode to use your XNET hardware for CAN communication However to use your NI XNET interface in the native NI XNET mode meaning it does not use the NI XNET Compatibility Layer you must define your interface under NI XNET Devices in MAX and pass the NI XNET interface name that the Automotive Diagnostic Command Set will use To do this add nixnet to the Protocol string for example CAN nixnet The interface name is related to the NI XNET hardware naming under Devices and Interfaces in MAX Note By selecting nixnet as the interface string the Automotive Diagnostic Command Set uses the Frame Input and Outpu
350. rty vi Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Purpose Gets a diagnostic global internal parameter Format diag ref in diag ref out property ID property value error in no error error out Input diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster property ID defines the parameter whose value is to be retrieved You can create the values using an Enum control 0 Timeout Diag Command is the timeout in milliseconds the master waits for the response to a diagnostic request message The default is 1000 ms 1 Timeout FC Bs is the timeout in milliseconds the master waits for a Flow Control frame after sending a First Frame or the last Consecutive Frame of a block The default is 250 ms 2 Timeout CF Cr is the timeout in milliseconds the master waits for a Consecutive Frame in a multiframe response The default is 250 ms for CAN and 1000 ms for LIN 3 Receive Block Size BS is the number of Consecutive Frames the slave sends in one block before waiting for the next Flow Control frame A value of 0 default means all Consecutive Frames are sent in one run without interruption 4 Wait Time CF STmin defines the minimum time for the slave to National Instruments wait between sending two Consecutive Frames of a block Values from 0
351. ruments service center Calibration Through regular calibration you can quantify and improve the measurement performance of an instrument NI provides state of the art calibration services If your product supports calibration you can obtain the calibration certificate for your product at ni com calibration A 1 Automotive Diagnostic Command Set User Manual Appendix A NI Services 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 Training and Certification The NI training and certification program is the most effective way to increase application development proficiency and productivity Visit ni com training for more information The Skills Guide assists you in identifying the proficiency requirements of your current application and gives you options for obtaining those skills consistent with your time and budget constraints and personal learning preferences Visit ni com skills guide to see these custom paths Nl offers courses in several languages and formats including instructor led classes at facilities worldwide courses on site at your facility and online courses to serve your individual needs Technical Support Support at ni com support includes the following resources Self Help Technical Resources V
352. ry representation format A 0 Unsigned Only byte lengths of 1 4 are allowed 1 Signed Only byte lengths of 1 4 are allowed 2 Float Only byte lengths of 4 or 8 are allowed Scale Factor defines the physical value scaling Phys Scale Factor binary representation Scale Offset Scale Offset refer to Scale Factor value is the physical value to be converted EE Automotive Diagnostic Command Set User Manual 5 12 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Output data out is the binary representation of the physical value If you build a record of multiple values you can concatenate the outputs of several instances of Convert from Phys vi Description Data input to diagnostic services for example WriteDataByLocalldentifier vi is usually a byte stream of binary data If you have a description of the data input for example byte 3 and 4 are engine RPM scaled as 25 x RPM in Motorola representation you can use Convert from Phys vi to convert the physical value to the byte stream by filling an appropriate type descriptor cluster Convert from Phys vi converts only the portion specified by one type descriptor to a binary representation If your data input consists of several values you can use Convert from Phys vi multiple times and concatenate their outputs National Instruments 5 13 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API
353. s files with a c extension include the header file by adding a include to the beginning of the code as follows include nidiagcs h For C applications files with a cpp extension define __cplusplus before including the header as follows define _ cplusplus include nidiagcs h The _ cplusplus define enables the transition from C to the C language functions Chapter 6 Automotive Diagnostic Command Set API for C describes each function On Windows Vista with Standard User Account the typical path to the C examples folder is Users Public Documents National Instruments Automotive Diagnostic Command Set Examples MS Visual C On Windows XP 2000 the typical path to the C examples folder is Documents and Settings All Users Documents National Instruments Automotive Diagnostic Command Set Examples MS Visual C Automotive Diagnostic Command Set User Manual 3 2 ni com Chapter 3 Application Development Each example is in a separate folder The example description is in comments at the top of the c file At the command prompt after setting MSVC environment variables such as with MS vevars32 bat you can build each example using a command such as cl I lt HDir gt GetDTCs c lt LibDir gt nidiagcs lib lt HDir gt is the folder where nidiagcs h can be found lt LibDir gt is the folder where nidiagcs 1ib can be found Other Programming Languages The Automotive Diagnostic Command Se
354. s 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 the VI did not execute the intended operation A positive value means warning the VI executed intended operation but an informational warning is returned For a description of the code wire the error cluster to a LabVIEW error handling VI such as the Simple Error Handler source identifies the VI where the error occurred 5 181 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW OBD Request On Board Monitoring Test Results vi Purpose Executes the OBD Request On Board Monitoring Test Results service Reads a test data record from the ECU Format diag ref in diag ref out OBDMID ae data out error in no error J success error out Input diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster OBDMID defines the parameter identifier of the data to be read The SAE J1979 standard defines the values error in is a cluster that 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 HH E status is TRUE if an error occurred This VI i
355. s a registered trademark of Microsoft Corporation in the United States and other countries Other product and company names mentioned herein are trademarks or trade names of their respective companies Members of the National Instruments Alliance Partner Program are business entities independent from National Instruments and have no agency partnership or joint venture relationship with National Instruments Patents For patents covering National Instruments products technology refer to the appropriate location Help Patents in your software the patents txt file on your media or the National Instruments Patent Notice at ni com patents Export Compliance Information Refer to the Export Compliance Information at ni com legal export compliance for the National Instruments global trade compliance policy and how to obtain relevant HTS codes ECCNs and other import export data WARNING REGARDING USE OF NATIONAL INSTRUMENTS PRODUCTS YOU ARE ULTIMATELY RESPONSIBLE FOR VERIFYING AND VALIDATING THE SUITABILITY AND RELIABILITY OF THE PRODUCTS WHENEVER THE PRODUCTS ARE INCORPORATED IN YOUR SYSTEM OR APPLICATION INCLUDING THE APPROPRIATE DESIGN PROCESS AND SAFETY LEVEL OF SUCH SYSTEM OR APPLICATION PRODUCTS ARE NOT DESIGNED MANUFACTURED OR TESTED FOR USE IN LIFE OR SAFETY CRITICAL SYSTEMS HAZARDOUS ENVIRONMENTS OR ANY OTHER ENVIRONMENTS REQUIRING FAIL SAFE PERFORMANCE INCLUDING IN THE OPERATION OF NUCLEAR FACILITIES AIRCRAFT NAVIGATION AIR TRA
356. s an ECU data record stored while a Diagnostic Trouble Code occurred Format diag ref in diag ref out PID data out Frame SUCCESS error in no error error out Input diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster PID defines the parameter identifier of the data to be read The SAE J1979 standard defines the values frame is the number of the freeze frame from which the data are to be retrieved error in is a cluster that 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 HAE 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 the VI did not execute the intended operation A positive value means warning the VI executed intended operation but an informational warning is returned For a description of the code wire the error cluster to a LabVIEW error handling VI such as the Simple Error Handler source identifies the VI where the error occurred National Instruments 5 187 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Output diag
357. s is TRUE code is the error code number identifying an error A value of 0 means success A negative value means error the VI did not execute the intended operation A positive value means warning the 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 rce identifies the VI where the error occurred source e V National Instruments 5 59 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Output Diag reference out is a copy of Diag reference in You can wire it to subsequent diagnostic VIs node type is a U8 ring that indicates the type of DoIP entity Possible values are 0 DoIP gateway 1 DolIP node All other values are reserved ok indicates successful receipt of a positive response message for this diagnostic 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 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 the VI did not execute the intended operation A positive value means warning the VI executed intended operation but an informational warning is returned For a descripti
358. s 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 the VI did not execute the intended operation A positive value means warning the 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 rce identifies the VI where the error occurred Automotive Diagnostic Command Set User Manual 5 182 ni com Output TE if EE National Instruments Chapter 5 Automotive Diagnostic Command Set API for LabVIEW diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs data out returns the ECU data record If you know the record data description you can use Convert from Phys vi to interpret this record You can obtain the description from the SAE J1979 standard success indicates successful receipt of a positive response message for this diagnostic 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 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 the VI did not execute the intended operation A positive value means warning the
359. s of this struct TID Defines the test identifier of the I O to be manipulated The values are application specific dataIn Defines application specific data for this service len Must contain the number of valid data bytes in dataIn Output dataOut Returns application specific data for this service len2 On input 1en2 must contain the dataOut array length On return it contains the number of valid data bytes in the dataOut array Success Indicates successful receipt of a positive response message for this diagnostic service Automotive Diagnostic Command Set User Manual 6 154 ni com Chapter 6 Automotive Diagnostic Command Set API for C Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value National Instruments 6 155 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C ndOBDRequestCurrentPowertrainDiagnosticData Purpose Executes the OBD Request Current Powertrain Diagnostic Data service Reads an ECU data record Format long ndOBDRequestCurrentP
360. s on CAN on various transport protocols such as ISO TP SO 15765 2 TP 1 6 TP 2 0 Volkswagen SAE J1939 21 and Diagnostic Over IP ISO 13400 3 Note For KWP2000 the Automotive Diagnostic Command Set supports only the ISO TP standardized in ISO 15765 2 manufacturer specific VW TP 2 0 transport protocols and Diagnostic Over IP ISO 13400 Diagnostic Services The diagnostic services available in KWP2000 are grouped in functional units and identified by a one byte code Serviceld The standard does not define all codes for some codes the standard refers to other SAE or ISO standards and some are reserved for manufacturer specific extensions The Automotive Diagnostic Command Set supports the following services e Diagnostic Management e Data Transmission e Stored Data Transmission Diagnostic Trouble Codes e Input Output Control e Remote Activation of Routine ay Note Upload Download and Extended services are not part of the Automotive Diagnostic Command Set Diagnostic Service Format Diagnostic services have a common message format Each service defines a Request Message Positive Response Message and Negative Response Message The Request Message has the Serviceld as first byte plus additional service defined parameters The Positive Response Message has an echo of the Serviceld with bit 6 set as first byte plus the service defined response parameters Automotive Diagnostic Command Set User Manual 1 2 ni co
361. s the ECU sends for each DTC s status The default is 1 Add Data Byte Length indicates the number of bytes the ECU sends for each DTC s additional data Usually there is no additional data so the default is 0 Byte Order indicates the byte ordering for multibyte items 0 MSB_FIRST Motorola default 1 LSB_FIRST Intel This VI interprets the response byte stream according to this description and returns the resulting DTC records in the DTCs cluster array diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi or Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster 5 93 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW group of DTC specifies the group of Diagnostic Trouble Codes to be read The following values have a special meaning and you can specify them through a ring control 0x0000 All powertrain DTCs 0x4000 All chassis DTCs 0x8000 All body DTCs 0xC000 All network related DTCs OxFFOO All DTCs error in is a cluster that 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 mea
362. sByteLength indicates the number of bytes the ECU sends for each DTC s status The default is 1 AddDataByteLength indicates the number of bytes the ECU sends for each DTC s additional data Usually there are no additional data so the default is 0 ByteOrder indicates the byte ordering for multibyte items 0 MSB_FIRST Motorola default 1 LSB_FIRST Intel This function interprets the response byte stream according to this description and returns the resulting DTC records in the DTCs struct array Output DTCs Returns the resulting DTCs as an array of structs typedef struct unsigned long DTC unsigned long Status unsigned long AddData TD4 DTC is the resulting Diagnostic Trouble Code For the default 2 byte DTCs use ndDTCToString to convert this code to readable format as defined by SAE J2012 Status is the DTC status Usually this is a bit field with following meaning Bit Meaning testNotCompletedSinceLastClear 0 testFailed 1 testFailedThisMonitoringCycle 2 pendingDTC 3 confirmedDTC 4 5 testFailedSinceLastClear Automotive Diagnostic Command Set User Manual 6 76 ni com Chapter 6 Automotive Diagnostic Command Set API for C 6 testNotCompletedThisMonitoringCycle 7 warningIndicatorRequested AddData contains optional additional data for this DTC Usually this does not contain valid information refer to DTCDescriptor len On input len must contain the DTCs array length in elements
363. scriptive string for the return value National Instruments 6 139 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C Description The usual procedure for getting a security access to the ECU is as follows 1 Request a seed from the ECU using ndUDSRequest Seed with access mode n 2 From the seed compute a key for the ECU on the host 3 Send the key to the ECU using ndUDSSendKey with access mode n 1 4 The security access is granted if the ECU validates the key sent Otherwise an error is returned Automotive Diagnostic Command Set User Manual 6 140 ni com Chapter 6 Automotive Diagnostic Command Set API for C ndUDSTesterPresent Purpose Executes the UDS TesterPresent service Keeps the ECU in diagnostic mode Format long ndUDSTesterPresent TD1 diagRef LVBoolean requireResponse LVBoolean success Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic or ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct requireResponse Indicates whether a response to this service is required If requireResponse is FALSE no response is evaluated and success is always returned TRUE This parameter is passed by reference Output success Indicates successful receipt of a positive response message for this diagnostic service
364. scsseete de hisses toa ss sad sochevseusesehbeb cave tsa ed covadscsadsensetecerasaciay 6 16 ndCreateExtendedCANlds iiini aias 6 18 ndDiagFrameRECV arssinat nia E TARN a 6 20 dDiagFr meSend sai seccc cases e2ese ek intei iaaea eien aiea eera os aasa 6 22 DADIASNOStICSELVICE siii irrisica a e aa aaie a iei a isip 6 23 NID TCT OSting aii sin Sena eee E EEE he ee AE EA 6 25 nAGetPrOperty ss ias roosi aeaa a a Gast e EEEE E OAT a 6 26 ndGetTimMeStamp siie aiiis tannine eiss a aeeai aR EE a EEN EREA SSA 6 29 DAOBDO pen ERRE E E 6 30 NAO pen Diagnostic vii scessss vises abenss E r EAE LEASE AEE EEE ER 6 33 ndOpenDiagn sticOnI P si eiin ii sinia irah i 6 37 ndOpenDiagnosticOnLIN s ssesssseesesresesseresresrsrestsresteresresesresteersreersresreeeseeet 6 39 DOS EtPLOPerty serea rae ase aa E T AE 6 41 DGS tats TOS tig coia ci ase is eienaar aaee E Era NEn EE a EE E a 6 44 nd V WIPCONNeC nein ore e Ena E i E E AEE EEA 6 46 NAVWTPConnectionTest 0 0 ee eee eeceeseceeeeseeeseesecseceaeeseeeaeceeseseseseaeseeeeaee 6 48 DAV WTPDISCODMECCE iseis anasaidia iaasa 6 49 DoIP PUNCHONS ea n at EEEE E R ARAG 6 50 dDolPActivateROUtiNg sscan iii 6 50 NADOIPCOMNECE eneseiroonia 6 52 NGDOIPDiSCOMMEC siirron psss iniri opipa eaii inise 6 54 ndDolPEntityStatuS snesena a a an 6 55 ndDoIPGetDiagPowerMode sssssesesseresesreresreresrrsrsresreresrrsrsresrerese 6 57 ndPolPGetENtItIES siensia teehee ie 6 58 ndDolPSendVehicleldentRequest sesesseessseee
365. se Converts DTCs to the J1939 DTC format Format DTCs error in no error Input DTCs is a cluster that contains diagnostic trouble codes DTCs error in is a cluster that 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 TE status is TRUE code is the error code number identifying an error A value of 0 means success A negative value means error the VI did not execute the intended operation A positive value means warning the VI executed intended operation but an informational warning is returned For a description of the code wire the error cluster to a LabVIEW error handling VI such as the Simple Error Handler source identifies the VI where the error occurred National Instruments 5 195 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Output DTCs J1939 contains the DTCs converted to the J1939 format 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 the VI did not execute the intended opera
366. seeeeeesresesersrrersreerse 6 60 ndDoIPSendVehicleIdentReqEID ss sssssesesseesseesresreersrrsrsresrrersreerse 6 61 ndDoIPSendVehicleIdentReqVIN sssssssssesesseeesesrsrrsrsresrrsrsrrsrsresreeres 6 62 National Instruments xi Automotive Diagnostic Command Set User Manual Contents KWP2000 Services sii cs ccs eiiean iena sutea cee Sestiedis Meus adua iia Ei 6 63 ndClearDiagnosticInformation cece eee eseeeseeseeeseeseeeseeseesseceeceseeseeeaeesees 6 63 ndControlDTCSettang iein ni oeka he ited E sh ease ede aetna 6 65 ndDisableNormalMessageTransmission c eseeseessceseeseeeseeeeeeseeseeeseesees 6 67 ndECURE E orrie aia A eis Revd Atti ease Naa Raa aba 6 68 ndEnableNormalMessageTransmission cseeseeseceeeseeseeeseceeeeseeseeeaeesees 6 70 ndInputOutputControlByLocalldentifier 2 0 eee eeeeeeseeeeeeeeeetseeeseeeees 6 71 ndReadDataByLocalldentifier eee eee cece eeeeeeceseeseeseeeaeeneeeaeseeeeaeesees 6 73 ndReadDTCByStatus sinia Sadsastescoes caus cosvadeculeceuss cans A E EEE 6 75 ndReadECUldentification 0 eee eeeeseceeeeseeeeeesesseeeseeseeeaeeeeessesseseaeesees 6 78 ndReadMemoryByAddress 0 eee eeceeeseeeeseseeeeseeseeeseceeeeseeeeesesesesesseseaeeaees 6 80 ndReadStattisOPD TC tecsscsiesssescssscheedesagessoevesateaieasesheseseseiesbes SadeesUesebadees s 6 82 ndRequestRoutineResultsByLocalldentifier eee eeeeeeceeeeseeeeeeeeees 6 85 NGAREQUEStSCEM enisi Saseteves ci scdessensdestsdsest
367. should take place The values are CANO CAN1 and so on NI CAN The CAN interface is the name of the NI CAN Network Interface Object to configure This name uses the syntax CANx where x is a decimal number starting at 0 that indicates the CAN network interface CANO CAN 1 up to CAN63 CAN network interface names are associated with physical CAN ports using Measurement and Automation Explorer MAX NI XNET By default the Automotive Diagnostic Command Set uses NI CAN for CAN communication This means you must define an NI CAN interface for your NI XNET hardware NI CAN compatibility mode to use your XNET hardware for CAN communication However to use your NI XNET interface in the native NI XNET mode meaning it does not use the NI XNET Compatibility Layer you must define your interface under NI XNET Devices in MAX and pass the NI XNET interface name that the Automotive Diagnostic Command Set will use To do this add nixnet to the protocol string for example CAN nixnet The interface name is related to the NI XNET hardware naming under Devices and Interfaces in MAX 3 Note By selecting nixnet as the interface string the Automotive Diagnostic Command Set uses the Frame Input and Output Queued sessions To force the use of Frame Input and Output Stream sessions instead select ni_genie_nixnet as the interface string for example CANI ni_genie_nixnet An application instance can use only one Frame Input Stream Automotive Di
368. sion Format diag ref in error in no error error out Input diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster error in is a cluster that 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 the VI did not execute the intended operation A positive value means warning the 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 Automotive Diagnostic Command Set User Manual 5 10 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW 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 the VI d
369. specify an absolute path or a path relative to the root of your target for the bitfile baudrate The diagnostic communication baud rate transportProtocol Specifies the transport protocol for transferring the diagnostic service messages over the CAN network The following values are valid 0 ISO TP Normal Mode The ISO TP as specified in ISO 15765 2 is used all eight data bytes of the CAN messages are used for data transfer 1 ISO TP Mixed Mode The ISO TP as specified in ISO 15765 2 is used the first data byte is used as address extension 2 VW TP 2 0 transmitID The CAN identifier for sending diagnostic request messages from the host to the ECU receivelID The CAN identifier for sending diagnostic response messages from the ECU to the host Output diagRefOut A struct containing all necessary information about the diagnostic session This is passed as a handle to all subsequent diagnostic functions and you must close it using ndCloseDiagnostic Automotive Diagnostic Command Set User Manual 6 34 ni com Chapter 6 Automotive Diagnostic Command Set API for C Return Value The return value indicates the function call status 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 requir
370. ss chevsee ss E E A A TO E E nates aaa LabVIEW Real Time RT Configuration ec eeeescceseeesneeeseeeeeceaeeeseeceaeeeneeeeaeeeaes Hardware and Software Requirement eee ceeceseeseeeseeseceseeeeesecseeesecaeenseeaeenaes Chapter 3 Application Development Choosing the Programming Language 0 eee eeeeseeseeseceseesceeseesecnsesaeeseeeseeseeeaeeseens Tab VIEW meena dees SR A ee tested itil ek eth lal eee LabWindows C V Terrori ingen cogs at veestue tree ingen E E E Vaistial D E E EE E AE ivtaeeeialn aetette ei T Other Programming Languages esseesssseesesrssrsresestesrsresrerestesrsresrsrestssenrees Application Development on CompactRIO or R Series Using an NI 985x or NI 986 C Seres Mod lerrrnis ennn aE E heat ales Seg E ee eae Chapter 4 Using the Automotive Diagnostic Command Set Structure of the Automotive Diagnostic Command Set sseesseessseeseesrerrsresrsrerereeseeee Automotive Diagnostic Command Set API Structure eee eeeeseceeeeseteeeeneeees General Programming Model 00 eee eeeeeceesecseceseeseeesecseeeseeseeesecaecnsesseseaessesseeeaeesaees Avatlable Diagnostic Services cs scctecseestesstycass sovstveesstevees A EE deste gescbbersseaen Ses Tweaking the Transport Protocol 0 eeceesesscceseeceseeeeeeceaeceaeceseeeseeceaeeeeeceaeceneeeeeesaee Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Section Headings orrera SG a E cease ate E E dete AE EEN REES PULpOSe e a ae ee a ae etn
371. ssecececeeessneceseeeaeessneceaeeeseecsaeeeaeersaee XIX Deactivatinis a Product oiiaee ne E E R EEEE testeselaavestowuat dees XIX Using Windows Guest Accounts cccescesecsteesseceseeceneceseecseeceaeeeaeersaeeeaeeeeecsaeeeseeesase XIX Chapter 1 Introduction KWP2000 Key Word Protocol 2000 cescesscescecsseeeseeceeeesseeeseceseeceaeeeeessaeeeseeenaes 1 1 Transport Protocol arene a ces avec AE EE A LE EAE 1 2 DidSnOStic Service S v 55 ci siete ded E E A ETOR AOR sont avests 1 2 Diagnostic Service Formateo ae an aas 1 2 C nnect DisconneC trener Aea n u deste eaae e i TAr 1 3 G tSeed Unlocka n innana aa a a a RA Ak 1 3 Read Write Memory eissien ei ERE sete AEE EEE EEE 1 3 IMEASUTEMMENES a A r A ae 1 4 Diagnostic Tro ble Codes oieee e E AE Ea EEES E 1 4 Input Output Control nnise nna e E a teed 1 4 Remote Activation of a Routine s essssssesssseoeesesesoeessseoressssseresssnresrssserrssse 1 4 Ext rmaliReferencesy s re ae ar ar Ar 1 4 UDS Unified Diagnostic Services cee eecceeeecsseeeseeesneceseeesseceseeeseeceaeeeeeeceaeeeseeesaeeesees 1 5 Diagnostic Services annone a n See ie ete 1 5 Diagnostic S rvice Formatieren E EE 1 6 External References or ronn renn enar ar AE TE aAA 1 6 OBD On Board Diagnostic deena hoere a erer eaae o LT A EAO A TRTE E 1 6 National Instruments vij Automotive Diagnostic Command Set User Manual Contents Chapter 2 Installation and Configuration Installations v csecssstevdasi
372. ster 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 the VI did not execute the intended operation A positive value means warning the 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 diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs this diagnostic 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 success indicates successful receipt of a positive response message for status is TRUE if an error occurred National Instruments 5 71 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW code is the error code number identifying an error A value of 0 means success A negative value means error the VI did not execute the intended operation A positive value means warning the VI executed intended operation but an informational warning is returned For a description of the code wire the error cluster to a LabVIEW error handling VI suc
373. stic Command Set API for C ndUDSReportSeverityInformationOfDTC Purpose Executes the ReportSeverityInformationOfDTC subfunction of the UDS ReadDiagnosticTroubleCodeInformation service Reads selected Diagnostic Trouble Codes DTCs are read Format long ndUDSReportSeverityInformationOfDTC TD1 diagRef unsigned long DTCMaskRecord TD3 DTCDescriptor unsigned char statusAvailMask D4 DTCs long len LVBoolean success a Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic or ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct DTCMaskRecord Defines the status of DTCs to be read The values are application specific DTCDescriptor A struct that describes the DTC records the ECU delivers typedef struct long DTCByteLength long StatusByteLength long AddDataByteLength unsigned short ByteOrder TD3 DTCByteLength indicates the number of bytes the ECU sends for each DTC The default is 3 for UDS StatusByteLength indicates the number of bytes the ECU sends for each DTC s status The default is 1 AddDataByteLength indicates the number of bytes the ECU sends for each DTC s additional data For this subfunction the default is 2 National Instruments 6 123 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set
374. stic session handle obtained from Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster Source Address is the DoIP source address of the tester that starts the communication Activation Type indicates the specific type of routing activation that may require different types of authentication and or confirmation Defined values are 0 Default 1 WWH OBD worldwide harmonized onboard diagnostic OxEO Use an OEM pecific central security approach Values 2 to OxDF are reserved Values OxEO to OxFF are OEM specific error in is a cluster that 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 the VI did not execute the intended operation A positive value means warning 5 51 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Description the 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
375. struct unsigned long DTC unsigned long Status unsigned long AddData TD4 DTC is the resulting Diagnostic Trouble Code You can use ndWWHOBDConvertDTCsToJ1939 or ndWWHOBDConvertDTCsToJ2012 to convert this to readable format as defined by SAE J1939 and SAE J2012 Status is the DTC status Usually this is a bit field with following meaning Bit Meaning testNotCompletedSinceLastClear 0 testFailed 1 testFailedThisOperationCycle 2 pendingDTC 3 confirmedDTC 4 5 testFailedSinceLastClear Automotive Diagnostic Command Set User Manual 6 180 ni com Chapter 6 Automotive Diagnostic Command Set API for C 6 testNotCompletedThisOperationCycle 7 warningIndicatorRequested AddData contains optional additional data for this DTC Usually this does not contain valid information refer to DTCDescriptor len On input len must contain the DTCs array length in elements On return it contains the number of valid elements in the DTCs array success Indicates successful receipt of a positive response message for this diagnostic service Return Value The return value indicates the function call status 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 ndStatusTo
376. subfunction of the UDS ReadDiagnosticTroubleCodeInformation service Reads selected Diagnostic Trouble Codes DTCs Format long ndUDSReportDTCBySeverityMaskRecord TD1 diagRef unsigned char severityMask unsigned char status TD3 DTCDescriptor unsigned char statusAvailMask D4 DTCs long len LVBoolean success Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic or ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct severityMask Defines the status of DTCs to be read The values are application specific status Defines the status of DTCs to be read The values are application specific DTCDescriptor A struct that describes the DTC records the ECU delivers typedef struct long DTCByteLength long StatusByteLength long AddDataByteLength unsigned short ByteOrder TD3 s DTCByteLength indicates the number of bytes the ECU sends for each DTC The default is 3 for UDS National Instruments 6 117 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C StatusByteLength indicates the number of bytes the ECU sends for each DTC s status The default is 1 AddDataByteLength indicates the number of bytes the ECU sends for each DTC s additional data For this subfunction the default is 2 ByteOrder indic
377. t SUCCESS error out diag ref in error in no error Input diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi or Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster error in is a cluster that 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 the VI did not execute the intended operation A positive value means warning the 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 Automotive Diagnostic Command Set User Manual 5 106 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs success indicates successful receipt of a positive response message for this diagnostic service error out describes error conditions If the error in cluster indicated an error the error out cluster contains the
378. t 1en2 must contain the dataOut array length On return it contains the number of valid data bytes in the dataOut array success Indicates successful receipt of a positive response message for this diagnostic service National Instruments 6 95 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value Description This function stops a routine in the ECU memory referenced by local ID For further details about this service refer to the ISO 14230 3 standard Automotive Diagnostic Command Set User Manual 6 96 ni com Chapter 6 Automotive Diagnostic Command Set API for C ndTesterPresent Purpose Executes the TesterPresent service Keeps the ECU in diagnostic mode Format long ndTesterPresent TD1 diagRef LVBoolean requireResponse LVBoolean success Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic or ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions No
379. t is not necessary to manually manipulate the elements of this struct ID Defines the identifier of the I O to be manipulated The values are application specific mode Defines the I O control type The values are application specific The usual values are 0 ReturnControlToECU 1 ResetToDefault 2 FreezeCurrentState 3 ShortTermAdjustment dataiIn Defines application specific data for this service len Must contain the number of valid data bytes in dataIn National Instruments 6 111 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C Output dataOut Returns application specific data for this service len2 On input 1en2 must contain the dataOut array length On return it contains the number of valid data bytes in the dataOut array success Indicates successful receipt of a positive response message for this diagnostic service Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value Description This function substitutes a value for an input signal or i
380. t Queued sessions To force the use of Frame Input and Output Stream sessions instead select ni_genie_nixnet as the interface string for example CANI ni_genie_nixnet An application instance can use only one Frame Input Stream Session and one Frame Output Stream Session at a time so use the default name nixnet as the interface string so that multiple NI XNET Frame Queued Sessions can coexist on a National Instruments 6 33 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C single interface and the Frame Input and Output Stream Sessions may be used for example for a Frame logging replay use case CompactRIO or R Series If using CompactRIO or R Series hardware you must provide a bitfile that handles the CAN communication between the host system and FPGA To access the CAN module on the FPGA you must specify the bitfile name after the for example CANI1 MyBitfile lvbitx To specify a special RIO target you can specify that target by its name followed by the bitfile name for example CAN RIO1 MyBitfile lvbitx Currently only a single CAN interface is supported RIO1 defines the RIO target name as defined in your LabVIEW Project definition The vbitx filename represents the filename and location of the bitfile on the host if using RIO or on a CompactRIO target This implies that you must download the bitfile to the CompactRIO target before you can run your application You may
381. t User Manual 6 90 ni com Chapter 6 Automotive Diagnostic Command Set API for C ndStartDiagnosticSession Purpose Executes the StartDiagnosticSession service The ECU is set up in a specific diagnostic mode Format long ndStartDiagnosticSession TD1 diagRef unsigned char mode LVBoolean success Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic or ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct mode Indicates the diagnostic mode into which the ECU is brought The values are application specific Output success Indicates successful receipt of a positive response message for this diagnostic service Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value Description This function enables different ECU diagnostic modes The possible diagnostic modes are not defined in ISO 14230 and are application specific A diagnostic session starts only if communication with the ECU is established For m
382. t software does not provide formal support for programming languages other than those described in the preceding sections If the programming language includes a mechanism to call a Dynamic Link Library DLL you can create code to call Automotive Diagnostic Command Set functions All functions for the Automotive Diagnostic Command Set API are in nidiagcs d11 If the programming language supports the Microsoft Win32 APIs you can load pointers to Automotive Diagnostic Command Set functions in the application The following section describes how to use 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 shows how to call Win32 LoadLibrary to load the Automotive Diagnostic Command Set API DLL include lt windows h gt include nidiagcs h HINSTANCE NiDiagCSLib NULL NiMcLib LoadLibrary nidiages dll Next the application must call the Win32 Get ProcAddress function to obtain a pointer to each Automotive Diagnostic Command Set function the application uses For each function you must declare a pointer variable using the prototype of the function For the Automotive Diagnostic Command Set function prototypes refer to Chapter 6 Automotive Diagnostic Command Set API for C Before exiting the application you must unload the Automotive Diagnostic Command Set DLL as follows FreeLibrary NiDiagCSLib Nat
383. ta are to be sent Note that memory address length specifies how many bytes of the address are sent to the ECU This defines the maximum address you can use memory size defines the length of the memory block to be sent Note that memory size length specifies how many bytes of the size are sent to the ECU This defines the maximum size you can use error in is a cluster that 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 B E status is TRUE if an error occurred This VI is not executed when TF status is TRUE code is the error code number identifying an error A value of 0 means success A negative value means error the VI did not execute the intended operation A positive value means warning the VI executed intended operation but an informational warning is returned For a description of the code wire the error cluster to Automotive Diagnostic Command Set User Manual 5 168 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW a LabVIEW error handling VI such as the Simple Error Handler source identifies the VI where the error occurred memory address length specifies how many bytes of the address are sent to the ECU The default is 4 memory size length specifies how many bytes of the size are sent to the ECU The default is 4 diag ref out is a copy of diag ref in You can wire it to su
384. tains the actual data size returned in dataOut success Indicates successful receipt of a positive response message for this diagnostic service National Instruments 6 133 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value Description ndUDSRequestTransferExit terminates a download or upload process initialized with ndUDSRequestDownload or ndUDSRequestUpload Automotive Diagnostic Command Set User Manual 6 134 ni com Chapter 6 Automotive Diagnostic Command Set API for C ndUDSRequestUpload Purpose Format Input Initiates an upload of data from the ECU long ndUDSRequestUpload TD1 diagRef unsigned long memoryAddress unsigned long memorySize unsigned char memoryAddressLength unsigned char memorySizeLength unsigned char dataFormatIdentifier unsigned long blockSize LVBoolean success diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic or ndOpenDiagnosticOnIP a
385. tampWriteFirst Contains the timestamp of the first write frame This is usually the FF or SF of the ISO TP timeStampWriteLast Contains the timestamp of the last write frame This is usually the CF or SF of the ISO TP timeStampReadFirst Contains the timestamp of the first read frame This is usually the FF or SF of the ISO TP timeStampReadLast Contains the timestamp of the last read frame This is usually the CF or SF of the ISO TP Description Use this function to get the first and last write CAN or LIN frame and the first and last read CAN or LIN frame if the ISO TP transport protocol is used For all other transport protocols the timestamps are always 0 The received timestamps should be converted to system time using the FileTimeToLocalFileTime and FileTimeToSystemTime functions Add lt windows h gt to your project for this The UDS Get DTCs example includes an example for getting the timestamp National Instruments 6 29 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C ndOBDOpen Purpose Opens a diagnostic session on a CAN port for OBD II Format long ndOBDOpen char CANInterface unsigned long baudrate unsigned long transmitID unsigned long receiveID TD1 diagRefOut Input CANInterface Specifies the CAN interface on which the diagnostic communication should take place NI CAN The CAN interface is the name of the NI CAN Network Interfac
386. tatus of this VI 5 33 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set 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 the VI did not execute the intended operation A positive value means warning the VI executed intended operation but an informational warning is returned For a description of the code wire the error cluster to a LabVIEW error handling VI such as the Simple Error Handler source identifies the VI where the error occurred Description Use this VI to open a diagnostic communication channel to an ECU for OBD II The CAN port specified as input is initialized and a handle to it is stored among other internal data in the diag ref out cluster which serves as reference for further diagnostic functions Possible examples of selections for the interface parameter for the various hardware targets are as follows Using NI CAN hardware e CANO uses CAN interface 0 e CAN1 uses CAN interface 1 and so on with the form CANx e CAN256 uses virtual NI CAN interface 256 Using NI XNET hardware with NI XNET Frame Input Output based sessions e CAN1 nixnet uses CAN interface 1 of an NI XNET device e CAN2 nixnet uses CAN interface 2 of an NI XNET device and so on with the form CANx Using NI XNET hardware with NI XNET Stream Input Output based sessions
387. te a product and return the product to the state it was in before you activated it right click the product in the NI License Manager tree and select Deactivate If the product was in evaluation mode before you activated it the properties of the evaluation mode may not be restored Using Windows Guest Accounts National Instruments NI License Manager does not support Microsoft Windows Guest accounts You must log in to a non Guest account to run licensed NI application software Xix Automotive Diagnostic Command Set User Manual Introduction Diagnostics involve remote execution of routines or services on ECUs To execute a routine you send a byte string as a request to an ECU and the ECU usually answers with a response byte string Several diagnostic protocols such as KWP2000 and UDS standardize the format of the services to be executed but those standards leave a large amount of room for manufacturer specific extensions A newer trend is the emission related legislated OnBoard Diagnostics OBD which is manufacturer independent and standardized in SAE J1979 and ISO 15031 5 This standard adds another set of services that follow the same scheme Because diagnostics were traditionally executed on serial communication links the byte string length is not limited For newer CAN LIN or Ethernet based diagnostics this involves using a transport protocol that segments the arbitrarily long byte strings into pieces that can be tr
388. te the elements of this cluster El local ID defines the local identifier of the routine from which this VI retrieves results The values are application specific error in is a cluster that describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out E 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 the VI did not execute the intended operation A positive value means warning the 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 Automotive Diagnostic Command Set User Manual 5 96 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Output diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs data out returns application specific output parameters from the routine success indicates successful receipt of a positive response message for this diagnostic 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 th
389. tfile to the root directory of your CompactRIO controller and specify the bitfile in the interface name Or copy the file to any location on the CompactRIO controller and specify an absolute path or path relative to the root for the bitfile If you are using an NI XNET 986x C Series module on your CompactRIO target you need to start an FPGA VI on the target before accessing the port with ADCS Refer to the Getting Started with CompactRIO section in the NI XNET Hardware and Software Manual for more information about compiling the FPGA VI When the VI is running you can access the NI 986x module as you would program on a Windows or PXI LabVIEW Real Time target National Instruments 3 5 Automotive Diagnostic Command Set User Manual Using the Automotive Diagnostic Command Set Structure of the Automotive Diagnostic Command Set Diagnostic Services Layer Auxiliary KWP2000 UDS DiagOnCAN OBD OnBoard Routines Services Services Diag Services Diagnostic Transport Layer Auxiliary Connection Service Routines Management Execution Transport Protocols ISO TP Diag Over IP ISO 15765 2 etre ISO 13400 Vv CAN Layer C DLL y Base Driver NI CAN NI XNET NI RIO Ethernet National Instruments 4 1 Automotive Diagnostic Command Set User Manual Chapter 4 Using the Autom
390. the ECU error in is a cluster that 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 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 the VI did not execute the intended operation A positive value means warning the 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 Automotive Diagnostic Command Set User Manual 5 100 ni com Output T Chapter 5 Automotive Diagnostic Command Set API for LabVIEW diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs success indicates successful receipt of a positive response message for this diagnostic service F 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 the VI did not execute the intended operation A positive value me
391. the NI 9853 or NI 9852 CompactRIO CAN modules ay Note You can use the Automotive Diagnostic Command Set with LabVIEW 2009 or newer on CompactRIO systems or National Instruments R Series Multifunction RIO hardware National Instruments 2 3 Automotive Diagnostic Command Set User Manual Application Development This chapter explains how to develop an application using the Automotive Diagnostic Command Set API Choosing the Programming Language LabVIEW LabWindows CVI National Instruments The programming language you use for application development determines how to access the Automotive Diagnostic Command Set APIs Automotive Diagnostic Command Set functions and controls are in the LabVIEW palettes In LabVIEW the Automotive Diagnostic Command Set palette is in the top level NI Measurements palette Chapter 5 Automotive Diagnostic Command Set API for LabVIEW describes each LabVIEW VI for the Automotive Diagnostic Command Set API To access the VI reference from within LabVIEW press lt Ctrl H gt to open the Help window click the appropriate Automotive Diagnostic Command Set VI and follow the link The Automotive Diagnostic Command Set software includes a full set of LabVIEW examples These examples teach programming basics as well as advanced topics The example help describes each example and includes a link you can use to open the VI Within LabWindows CVI the Automotive Diagnostic Command Set f
392. the error code number identifying an error A value of 0 means success A negative value means error the VI did not execute the intended operation A positive value means warning the 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 Automotive Diagnostic Command Set User Manual 5 172 ni com Output E Be E National Instruments Chapter 5 Automotive Diagnostic Command Set API for LabVIEW diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs data out returns application specific data for this service success indicates successful receipt of a positive response message for this diagnostic 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 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 the VI did not execute the intended operation A positive value means warning the 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
393. this diagnostic service Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value Automotive Diagnostic Command Set User Manual 6 108 ni com Chapter 6 Automotive Diagnostic Command Set API for C ndUDSECUReset Purpose Executes the UDS ECUReset service Resets the ECU Format long ndUDSECUReset TD1 diagRef unsigned char mode LVBoolean success Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic or ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct mode Indicates the reset mode Hex Description 01 hardReset 02 keyOffOnReset 03 softReset 04 enableRapidPowerShutDown 05 disableRapidPowerShutDown Output success Indicates successful receipt of a positive response message for this diagnostic service Return Value The return value indicates the function call status as a signed 32 bit integer Zero means the function executed successfully A negative value specifies an error which
394. tifies the VI where the error occurred status avail mask is an application specific value returned for all DTCs Description This VI executes the ReportDTCByStatusMask subfunction of the UDS ReadDiagnosticTroubleCodeInformation service and reads the selected DTCs from the ECU For further details about this service refer to the ISO 15765 3 standard Automotive Diagnostic Command Set User Manual 5 138 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW UDS ReportSeverityInformationOfDTC vi Purpose Executes the ReportSeverityInformationOfDTC subfunction of the UDS ReadDiagnosticTroubleCodeInformation service Reads selected Diagnostic Trouble Codes DTCs Format DTC descriptor diag ref in DTC mask record error in no error success error out status avail mask National Instruments DTC descriptor is a cluster that describes the DTC records the ECU delivers DTC Byte Length indicates the number of bytes the ECU sends for each DTC The default is 3 for UDS Status Byte Length indicates the number of bytes the ECU sends for each DTC s status The default is 1 Add Data Byte Length indicates the number of bytes the ECU sends for each DTC s additional data For this subfunction the default is 2 Byte Order indicates the byte ordering for multibyte items 0 MSB_FIRST Motorola default 1 LSB_FIRST Intel This VI interprets the response byte stream according
395. tion A positive value means warning the 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 Automotive Diagnostic Command Set User Manual 5 196 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW WWH OBD Convert DTCs to J2012 vi Purpose Converts DTCs to the J2012 DTC format Format DTCs DTCs J2012 error in no error error out DTCs is a cluster that contains diagnostic trouble codes DTCs error in is a cluster that describes error conditions occurring before the VI EH 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 TE status is TRUE code is the error code number identifying an error A value of 0 means success A negative value means error the VI did not execute the intended operation A positive value means warning the 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 rce identifies the VI where the error occurred source e V National Instruments 5 197 Automotive Diagnostic Command Set User Manual Chapter 5 Auto
396. tion dependent this might be a checksum or a similar verification instrument error in is a cluster that describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out H E status is TRUE if an error occurred This VI 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 the VI did not execute the intended operation A positive value means warning the 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 rce identifies the VI where the error occurred National Instruments 5 149 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Output diag ref out is a copy of diag ref in It can be wired to subsequent diagnostic VIs data out returns a memory data block from the ECU as part of the termination process The meaning is implementation dependent this might be a checksum or a similar verification instrument success indicates successful receipt of a positive response message for this diagnostic service F error out describes error conditions If the error in cluster indicated an error the error out cluster contains the same information Otherwise
397. tion 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 Automotive Diagnostic Command Set User Manual 5 162 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Output diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs this diagnostic 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 PTF success indicates successful receipt of a positive response message for 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 the VI did not execute the intended operation A positive value means warning the 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 This VI performs the UDS service WriteDataByldentifier and writes Record Values data values to the ECU data in identifies the data The vehicle manufacturer must ensure the ECU conditions are met when performing this service Typical use cases are clearing nonvolatile memory resetti
398. tive Diagnostic Command Set User Manual 5 66 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Diag reference out is a copy of Diag reference in You can wire it to subsequent diagnostic 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 the VI did not execute the intended operation A positive value means warning the 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 DolIP Send Vehicle Identification Request w EID vi sends a Vehicle Identification Request to all DoIP entities in the local subnet identified by the given EID Usually this is done as part of DoIP Get Entities vi and does not need to be executed separately National Instruments 5 67 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW DoIP Send Vehicle Identification Request w VIN vi Purpose Sends a UDP request to all DoIP capable vehicles with a certain VIN Vehicle Identification Nu
399. tive value means error the VI did not execute the intended operation A positive value means warning the VI executed intended operation but an informational warning is returned For a description of the code wire the error cluster to a LabVIEW error handling VI such as the Simple Error Handler source identifies the VI where the error occurred Description The usual procedure for getting a security access to the ECU is as follows 1 Request a seed from the ECU using UDS RequestSeed vi with access mode n 2 From the seed compute a key for the ECU on the host 3 Send the key to the ECU using UDS SendKey vi with access mode n 1 4 The security access is granted if the ECU validates the key sent Otherwise an error is returned Automotive Diagnostic Command Set User Manual 5 148 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW UDS RequesttTransferExit vi Purpose Terminates a download upload process Format diag ref in m diag ref out data in a kia data out error in no error m a J SUCCESS error out Input diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi or Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster EI data in defines a data record to be written to the ECU as part of the termination process The meaning is implementa
400. to this description and returns the resulting DTC records in the DTCs cluster array diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi or Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster 5 139 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW DTC mask record defines the status of DTCs to be read The values are application specific error in is a cluster that describes error conditions occurring before the VI executes If an error has already occurred the VI returns the value of the error in cluster to error out E 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 the VI did not execute the intended operation A positive value means warning the 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 diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs DTCs returns the resulting DTCs as an array of clusters DTC is the resulting Diagnostic Trouble Code ae the DTC status
401. tring function to obtain a descriptive string for the return value National Instruments 6 99 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C Description This function performs the WriteDataByLocalldentifier service and writes RecordValues data values to the ECU datatn identifies the data values to be transmitted The vehicle manufacturer must ensure the ECU conditions are met when performing this service Typical use cases are clearing nonvolatile memory resetting learned values setting option content setting the Vehicle Identification Number or changing calibration values For further details about this service refer to the ISO 14230 3 standard Automotive Diagnostic Command Set User Manual 6 100 ni com Chapter 6 Automotive Diagnostic Command Set API for C ndWriteMemoryByAddress Purpose Executes the WriteMemoryByAddress service Writes data to the ECU memory Format long ndWriteMemoryByAddress TD1 diagRef unsigned long address unsigned char size unsigned char dataIn long len LVBoolean success Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic or ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct address Defines the memory address to which data are written Only three bytes are sent to the ECU so the address m
402. trol service ISO 14229 1 Automotive Diagnostic Command Set User Manual 6 188 ni com NI Services National Instruments provides global services and support as part of our commitment to your success Take advantage of product services in addition to training and certification programs that meet your needs during each phase of the application life cycle from planning and development through deployment and ongoing maintenance To get started register your product at ni com myproducts As a registered NI product user you are entitled to the following benefits e Access to applicable product services e Easier product management with an online account e Receive critical part notifications software updates and service expirations Log in to your National Instruments ni com User Profile to get personalized access to your services Services and Resources National Instruments e Maintenance and Hardware Services NI helps you identify your systems accuracy and reliability requirements and provides warranty sparing and calibration services to help you maintain accuracy and minimize downtime over the life of your system Visit ni com services for more information Warranty and Repair All NI hardware features a one year standard warranty that is extendable up to five years NI offers repair services performed in a timely manner by highly trained factory technicians using only original parts at a National Inst
403. ts of this cluster ID defines the identifier of the data to be read The values are application specific error in is a cluster that 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 the VI did not execute the intended operation A positive value means warning the VI executed intended operation but an informational warning is returned For a description of the code wire the error cluster to a LabVIEW error handling VI such as the Simple Error Handler source identifies the VI where the error occurred National Instruments 5 129 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Output diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs data out returns the data record from the ECU If you know the record data description you can use Convert to Phys vi to interpret this record success indicates successful receipt of a positive response message for F ae this diagnostic service error out describes error conditions If the error in cluster indicated an error the error out cluster contains the same information Otherwise error o
404. turnControlToECU 1 ReportCurrentState 4 ResetToDefault 5 FreezeCurrentState 7 ShortTermAdjustment 8 LongTermAdjustment error in is a cluster that 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 Automotive Diagnostic Command Set User Manual 5 82 ni com Output 7 Description Chapter 5 Automotive Diagnostic Command Set API for LabVIEW code is the error code number identifying an error A value of 0 means success A negative value means error the VI did not execute the intended operation A positive value means warning the 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 diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs data out returns application specific data for this service success indicates successful receipt of a positive response message for this diagnostic 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 status is TRUE if an error occ
405. tus 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 the VI did not execute the intended operation A positive value means warning the VI executed intended operation but an informational warning is returned For a description of the code wire the error cluster to a LabVIEW error handling VI such as the Simple Error Handler source identifies the VI where the error occurred Description The WWH OBD ReadDTCInformation service is based on the UDS ReaDTCInformation service ISO 14229 1 National Instruments 5 205 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW WWH OBD Request Freeze Frame Information vi Purpose Executes the WWH OBD ReadDTCInformation service Reads selected Diagnostic Trouble Codes DTCs Format diag ref in diag ref out DTC mask record data out DTC record number success error in no error error out Input diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi or Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster El DTC mask record defines the DTC to be read The values are application specific DTC record number specifies the snapshot record number error in is a cluster that d
406. uble Codes DTCs ReadECUlIdentification vi Executes the ReadECUIdentification service Returns ECU identification data from the ECU ReadMemoryByAddress vi Executes the ReadMemoryByAddress service Reads data from the ECU memory National Instruments 5 5 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Table 5 1 Automotive Diagnostic Command Set API VIs for LabVIEW Continued Function Purpose ReadStatusOfDTC vi Executes the ReadStatusOfDiagnosticTroubleCodes service Reads selected Diagnostic Trouble Codes DTCs RequestRoutineResultsByLocalldentifier vi Executes the RequestRoutineResultsB yLocalldentifier service Returns results from a routine on the ECU RequestSeed vi Executes the SecurityAccess service to retrieve a seed from the ECU SendKey vi Executes the SecurityAccess service to send a key to the ECU StartDiagnosticSession vi Executes the StartDiagnosticSession service Sets up the ECU in a specific diagnostic mode StartRoutineByLocalldentifier vi Executes the StartRoutineByLocalldentifier service Executes a routine on the ECU StopDiagnosticSession vi Executes the StopDiagnosticSession service Brings the ECU back in normal mode StopRoutineByLocalldentifier vi Executes the StopRoutineByLocalldentifier service Stops a routine on the ECU TesterPresent v
407. uccessful receipt of a positive response message for this diagnostic service Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value National Instruments 6 107 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C ndUDSDiagnosticSessionControl Purpose Executes the UDS DiagnosticSessionControl service The ECU is set up in a specific diagnostic mode Format long ndUDSDiagnosticSessionControli TD1 diagRef unsigned char mode LVBoolean success Input diagRef Specifies the diagnostic session handle obtained from ndOpenDiagnostic or ndOpenDiagnosticOnIP and passed to subsequent diagnostic functions Normally it is not necessary to manually manipulate the elements of this struct mode Indicates the diagnostic mode into which the ECU is brought The values are application specific The usual values are 01 defaultSession 02 ECUProgrammingSession 03 ECUExtendedDiagnosticSession Output Success Indicates successful receipt of a positive response message for
408. umber of bytes the ECU sends for each DTC s additional data Usually there are no additional data so the default is 0 ByteOrder indicates the byte ordering for multibyte items 0 MSB_FIRST Motorola default 1 LSB_FIRST Intel This function interprets the response byte stream according to this description and returns the resulting DTC records in the DTCs struct array Output Success Indicates successful receipt of a positive response message for this diagnostic service Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value Description This function clears the diagnostic information on the ECU memory groupOf DTC specifies the type of diagnostic trouble codes to be cleared on the ECU memory For further details about this service refer to the ISO 14230 3 standard Automotive Diagnostic Command Set User Manual 6 64 ni com Chapter 6 Automotive Diagnostic Command Set API for C ndControlDTCSetting Purpose Executes the ControlDTCSetting service Modifies the generation behavior of selected Diagnostic Troubl
409. unction panel is in Libraries Automotive Diagnostic Command Set As with other LabWindows CVI function panels the Automotive Diagnostic Command Set function panel provides help for each function and the ability to generate code Chapter 6 Automotive Diagnostic Command Set API for C describes each Automotive Diagnostic Command Set API function You can access the reference for each function directly from within the function panel The Automotive Diagnostic Command Set API header file is nidiagcs h The Automotive Diagnostic Command Set API library is nidiagcs 1ib The toolkit software includes a full set of 3 1 Automotive Diagnostic Command Set User Manual Chapter 3 Application Development LabWindows CVI examples The examples are in the LabWindows CVI samples Automotive Diagnostic Command Set directory Each example includes a complete LabWindows CVI project prj file The example description is in comments at the top of the c file Visual C 6 The Automotive Diagnostic Command Set software supports Microsoft Visual C C 6 The header file for Visual C C 6 is in the Program Files National Instruments Shared ExternalCompilerSupport C include folder To use the Automotive Diagnostic Command Set API include the nidiagcs h header file in the code then link with the nidiagcs 1lib library file The library file is in the Program Files National Instruments Shared ExternalCompilerSupport C 11ib32 msve folder For C application
410. urred code is the error code number identifying an error A value of 0 means success A negative value means error the VI did not execute the intended operation A positive value means warning the 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 This VI substitutes a value for an input signal or internal ECU function It also controls an output actuator of an electronic system referenced by the local ID parameter For further details about this service refer to the ISO 14230 3 standard National Instruments 5 83 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW ReadDataByLocalldentifier vi Purpose Executes the ReadDataByLocalldentifier service Reads a data record from the ECU Format diag ref in diag ref out local ID data out error in no error success error out Input diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi or Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster local ID defines the local identifier of the data to be read The values are application specific error in is a cluster that describes er
411. us 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 the VI did not execute the intended operation A positive value means warning the 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 This VI reads DTCs by status from the ECU memory If you use the optional group of DTC parameter the ECU reports DTCs only with status information based on the functional group selected by group of DTC For further details about this service refer to the ISO 14230 3 standard Automotive Diagnostic Command Set User Manual 5 88 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW ReadECUldentification vi Purpose Executes the ReadECUlIdentification service Returns ECU identification data Format diag ref in diag ref out mode data out error in no error success error out Input diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi or Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster El mode indicates the type of identification information to be returned The values are application s
412. ust be in the range O FFFFFF hex size Defines the length of the memory block to be written dataiIn Defines the memory block to be written to the ECU len Must contain the number of valid data bytes in dataIn National Instruments 6 101 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C Output Success Indicates successful receipt of a positive response message for this diagnostic service Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value Description This VI performs the KWP2000 WriteDataBy Address service and writes RecordValues data values to the ECU address and size identify the data The vehicle manufacturer must ensure the ECU conditions are met when performing this service Typical use cases are clearing nonvolatile memory resetting learned values setting option content setting the Vehicle Identification Number or changing calibration values For further details about this service refer to the ISO 14230 3 standard Automotive Diagnostic Command
413. ut describes the error status of this VI H AEE 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 the VI did not execute the intended operation A positive value means warning the 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 This VI requests data record values from the ECU identified by the ID parameter For further details about this service refer to the ISO 15765 3 standard Automotive Diagnostic Command Set User Manual 5 130 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW UDS ReadMemoryByAddress vi Purpose Executes the UDS ReadMemoryByAddress service Reads data from the ECU memory Format diag ref in diag ref out address data out size success error in no error error out Input diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi or Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster EI address defines the memory address from which data are to be read Only three bytes are sent to the ECU so the address must be in the range O FFFFFF he
414. utDown disableRapidPowerShutDown error in is a cluster that 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 the VI did not execute the intended operation A positive value means warning the VI executed intended operation but an informational warning is returned For a description of the code wire the error cluster to 5 125 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW a LabVIEW error handling VI such as the Simple Error Handler source identifies the VI where the error occurred Output diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs power down time returns the minimum standby sequence time that the server remains in the power down sequence in seconds A value of FF hex indicates a failure or time not available success indicates successful receipt of a positive response message for this diagnostic service TF 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 er
415. ute the intended operation A positive value means warning the 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 rce identifies the VI where the error occurred National Instruments 5 155 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Output diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs this diagnostic 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 success indicates successful receipt of a positive response message for 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 the VI did not execute the intended operation A positive value means warning the VI executed intended operation but an informational warning is returned For a description of the code wire the error cluster to a LabVIEW error handling VI such as the Simple Error Handler source identifies the VI where the error occurred Description The usual procedure for getting a security access to the ECU is as follows 1 Request a seed from the ECU using UDS RequestSe
416. utomotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C Output Success Indicates successful receipt of a positive response message for this diagnostic service Return Value The return value indicates the function call status 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 ndStatusToString function to obtain a descriptive string for the return value Description This function performs the UDS service WriteMemoryByAddress and writes RecordValues data values into the ECU address and size identify the data The vehicle manufacturer must ensure the ECU conditions are met when performing this service Typical use cases are clearing nonvolatile memory resetting learned values setting option content setting the Vehicle Identification Number or changing calibration values For further details about this service refer to the ISO 15765 3 standard Automotive Diagnostic Command Set User Manual 6 148 ni com Chapter 6 Automotive Diagnostic Command Set API for C ndUDSO6ReadMemoryByAddress Executes the UDS ReadMemoryByAddress service Reads data from the ECU memory Format long ndUDS06ReadMemoryByAddress TD1 diagRef
417. ve Diagnostic Command Set API for LabVIEW Output Diag Ref Out is a cluster containing all necessary information about the diagnostic session Wire this output as a handle to all subsequent diagnostic VIs and close it using Close Diagnostic 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 the VI did not execute the intended operation A positive value means warning the 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 Open Diagnostic on LIN vi opens a diagnostic LIN communication channel to an ECU The LIN port specified as input is initialized and a handle to it is stored among other internal data in the diag ref out cluster which serves as reference for further diagnostic functions A possible example of selections for the interface parameter for the NI XNET hardware targets is LIN1 nixnet LIN Cluster Uses LIN interface 1 of an NI XNET device and settings of the LIN database of LIN Cluster alias as defined by NI XNET y s Note Nocommunic
418. ve Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Get Time Stamp vi Purpose Gets timestamp information about the first last send received frame of the ISO TP for CAN and LIN Format ae Time Stamp write first diag ref in i diag ref out warnka m Time Stamp write last t Time Stamp read first error out a Time Stamp read last Input diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi or Open Diagnostic on LIN vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster error in is a cluster that 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 the VI did not execute the intended operation A positive value means warning the 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 Automotive Diagnostic Command Set User Manual 5 30 ni com Chapter 5 Automotive Diagnostic C
419. verify installation of the CAN hardware right click the CAN device then select Self test If the self test passes the card icon shows a checkmark If the self test fails the card icon shows an X mark and the Test Status in the right pane describes the problem 2 1 Automotive Diagnostic Command Set User Manual Chapter 2 Installation and Configuration Refer to Appendix A Troubleshooting and Common Questions of the NI CAN User Manual for information about resolving hardware installation problems If you are using the Automotive Diagnostic Command Set on an NI XNET device install the NI XNET driver 1 0 or higher NI CAN 2 7 or higher and the NI CAN Compatibility Library on your computer The MAX Configuration tree Devices and Interfaces branch lists NI XNET hardware along with other local computer system hardware If the NI XNET hardware is not listed there MAX is not configured to search for new devices on startup To search for the new hardware press lt F5 gt To verify CAN hardware installation right click the CAN device and select Self Test If the self test passes the card icon shows a checkmark If the self test fails the card icon shows an X mark and the Test Status in the right pane describes the problem Refer to Chapter 6 Troubleshooting and Common Questions of the NI XNET User Manual for information about resolving hardware installation problems The NI XNET CAN hardware interfaces are listed under the device name
420. verity Mask Record 6 117 ndUDSReportDTCByStatusMask 6 120 ndUDSReportSeverityInformationOf DTC 6 123 ndUDSReportSupportedDTCs 6 126 ndUDSRequestDownload 6 129 ndUDSRequestSeed 6 131 ndUDSRequestTransferExit 6 133 ndUDSRequestUpload 6 135 ndUDSRoutineControl 6 137 ndUDSSendKey 6 139 ndUDSTesterPresent 6 141 ndUDSTransferData 6 143 ndUDSWriteDataByldentifier 6 145 ndUDSWriteMemoryBy Address 6 147 ndVWTPConnect 6 46 ndVWTPConnectionTest 6 48 ndVWTPDisconnect 6 49 National Instruments l 7 Index ndWriteDataByLocalIdentifier 6 99 ndWriteMemoryByAddress 6 101 ndWWHOBDClearEmissionRelated DTCs 6 170 ndWWHOBDConvertDTCsToJ1939 6 171 ndWWHOBDConvertDTCsToJ2012 6 173 ndWWHOBDRequestDID 6 175 ndWWHOBDRequestDTCExtendedData Record 6 177 ndW WHOBDRequestEmissionRelated DTCs 6 179 ndWWHOBDRequestFreezeFrame Information 6 182 ndWWHOBDRequestRID 6 184 ndWWHOBDRequestSupportedDIDs 6 186 ndWWHOBDRequestSupportedRIDs 6 188 NI Activation Wizard xvii 0 OBD 1 6 OBD On Board Diagnostics services C API 6 153 LabVIEW API 5 170 OBD Clear Emission Related Diagnostic Information vi 5 170 OBD Open vi 5 32 OBD Request Control Of On Board Device vi 5 172 OBD Request Current Powertrain Diagnostic Data vi 5 174 OBD Request Emission Related DTCs During Current Drive Cycle vi 5 179 OBD Request Emission Related DTCs vi 5 176 OBD Request On Board Monitoring Test Results vi 5 182 OBD Request P
421. verityMask Defines the severity information of DTCs to be read The values are application specific DTCStatusMask Defines the status of DTCs to be read The values are application specific DTCDescriptor A struct that describes the DTC records the ECU delivers typedef struct long DTCByteLength long StatusByteLength long AddDataByteLength unsigned short ByteOrder TD3 DTCByteLength indicates the number of bytes the ECU sends for each DTC The default is 3 National Instruments 6 179 Automotive Diagnostic Command Set User Manual Chapter 6 Automotive Diagnostic Command Set API for C StatusByteLength indicates the number of bytes the ECU sends for each DTC s status The default is 1 AddDataByteLength indicates the number of bytes the ECU sends for each DTC s additional data Usually there are no additional data so the default is 0 ByteOrder indicates the byte ordering for multibyte items 0 MSB_FIRST Motorola default 1 LSB_FIRST Intel This function interprets the response byte stream according to this description and returns the resulting DTC records in the DTCs struct array Output severityAvailabilityMask An application specific value returned for all DTCs statusAvailabilityMask An application specific value returned for all DTCs DTCFormatIdentifier An application specific value returned for all DTCs DTCs Returns the resulting DTCs as an array of structs typedef
422. warning the 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 diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs DTCs returns the resulting DTCs as an array of clusters DTC is the resulting Diagnostic Trouble Code Status is the DTC status Usually this is a bit field with followin i meaning Bit Meaning 0 testFailed 1 testFailedThisMonitoringCycle 2 pendingDTC 3 confirmedDTC 4 testNotCompletedSinceLastClear 5 testFailedSinceLastClear Automotive Diagnostic Command Set User Manual 5 134 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW 6 testNotCompletedThisMonitoringCycle 7 warningIndicatorRequested Add Data contains optional additional data for this DTC success indicates successful receipt of a positive response message for peer ay P g this diagnostic 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 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 the VI did not execute the intended operation A positive value mea
423. with output strings str is typically used in the Automotive Diagnostic Command Set 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 cstr is typically used in the Automotive Diagnostic Command Set as a pointer to a string as const char Automotive Diagnostic Command Set User Manual 6 2 ni com Chapter 6 Automotive Diagnostic Command Set API for C List of Functions The following table contains an alphabetical list of the Automotive Diagnostic Command Set API functions Table 6 2 Functions for the Automotive Diagnostic Command Set for C Function Purpose ndClearDiagnosticInformation Executes the ClearDiagnostic Information service Clears selected Diagnostic Trouble Codes DTCs ndCloseDiagnostic Closes a diagnostic session ndControlDTCSetting Executes the ControlDTCSetting service Modifies the generation behavior of selected Diagnostic Trouble Codes DTCs ndConvertFromPhys Converts a physical data value into a binary representation using a type descriptor ndConvertToPhys Converts a binary representation of a value into its physical value using a type descriptor ndCreateExtendedCANIds Creates diagnostic CAN identifiers according to ISO 15765 2 ndDiagFrameRecv Receives araw CAN frame on the diagnostic CAN ID to check for errors in the transport prot
424. x size defines the length of the memory block to be read error in is a cluster that 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 EH 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 the VI did not execute the intended operation A positive value means warning the 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 rce identifies the VI where the error occurred National Instruments 5 131 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Output diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs data out returns the ECU memory data success indicates successful receipt of a positive response message for this diagnostic 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 E BE E status is TRUE if an error occurred code is the error code number identifying an error A value of 0 mea
425. xecutes the ReportDTCBySeverity MaskRecord subfunction of the UDS ReadDiagnosticTrouble CodeInformation service Reads selected Diagnostic Trouble Codes DTCs ndUDSReportDTCByStatusMask Executes the ReportDTCByStatusMask subfunction of the UDS ReadDiagnosticTrouble CodeInformation service Reads selected Diagnostic Trouble Codes DTCs ndUDSReportSeverityInformationOf DTC Executes the ReportSeverity InformationOfDTC subfunction of the UDS ReadDiagnosticTrouble CodeInformation service Reads selected Diagnostic Trouble Codes DTCs are read ndUDSReportSupportedDTCs Executes the ReportSupportedDTCs subfunction of the UDS ReadDiagnosticTrouble CodeInformation service Reads all supported Diagnostic Trouble Codes DTCs ndUDSRequestDownload Initiates a download of data to the ECU ndUDSRequestSeed Executes the UDS Security Access service to retrieve a seed from the ECU ndUDSRequestTransferExit Terminates a download upload process ndUDSRequestUpload Initiates an upload of data from the ECU Automotive Diagnostic Command Set User Manual 6 10 ni com Chapter 6 Automotive Diagnostic Command Set API for C Table 6 2 Functions for the Automotive Diagnostic Command Set for C Continued Function Purpose ndUDSRoutineControl Executes the UDS RoutineControl service Executes a routine on the ECU ndUDSSendKey Executes the UDS SecurityAccess service to se
426. xternal resistance or resistance the XNET CAN or LIN board applies internally This property determines whether the XNET board uses termination to the bus For further information about appropriate terminations of aCAN or LIN network refer to the NI XNET Hardware and Software Manual The default is 0 error in is a cluster that describes error conditions occurring before the VI executes It is copied unchanged to error out and has no other effect on the VI It is provided for sequencing purposes only diag ref out is a copy of diag ref in You can wire it to subsequent diagnostic VIs property value is the requested property value error out describes error conditions It is copied unchanged from the error in cluster It is provided for sequencing purposes only Use this VI to request several internal diagnostic parameters such as timeouts for the transport protocol Use Diag Set Property vi to modify them National Instruments 5 19 Automotive Diagnostic Command Set User Manual Chapter 5 Automotive Diagnostic Command Set API for LabVIEW Diag Set Property vi Purpose Sets a diagnostic global internal parameter Format diag ref in property ID property value error in no error Input Diagnostic vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster property ID defines the parameter whose value is to be retrieved You can creat
427. ying an error A value of 0 means success A negative value means error the VI did not execute the intended operation A positive value means warning the 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 UDS RequestDownload vi initiates the download of a data block to the ECU This is required to set up the download process the actual data transfer occurs with subsequent UDS TransferData vi requests The transfer must occur in blocks of the size that this service returns the block size parameter After the download completes use the UDS RequestTransferExit vi service to terminate the process Automotive Diagnostic Command Set User Manual 5 146 ni com Chapter 5 Automotive Diagnostic Command Set API for LabVIEW UDS RequestSeed vi Purpose Executes the UDS SecurityAccess service to retrieve a seed from the ECU Format diag ref in diag ref out access mode seed out error in no error success error out Input diag ref in specifies the diagnostic session handle obtained from Open Diagnostic vi or Open Diagnostic on IP vi and wired through subsequent diagnostic VIs Normally it is not necessary to manually manipulate the elements of this cluster access mode indicates the security level to be granted The values are applic
428. ys ByteLength is the number of bytes in the binary representation ByteOrder defines the byte order for multibyte representations The values are 0 MSB_FIRST Motorola 1 LSB_FIRST Intel DataType is the binary representation format 0 Unsigned Only byte lengths of 1 4 are allowed 1 Signed Only byte lengths of 1 4 are allowed 2 Float Only byte lengths 4 or 8 are allowed ScaleFactor defines the physical value scaling Phys ScaleFactor binary representation ScaleOffset ScaleOffset refer to ScaleFactor value The physical value to be converted to a binary representation Automotive Diagnostic Command Set User Manual 6 14 ni com Chapter 6 Automotive Diagnostic Command Set API for C Output dataOut Points to the byte array to be filled with the binary representation of value len On input len must contain the dataOut array length On return it contains the number of valid data bytes in the dataOut array Description Data input to diagnostic services for example ndWriteDataByLocaliIdentifier is usually a byte array of binary data If you have the data input description for example byte 3 and 4 are engine RPM scaled as 25 x RPM in Motorola representation you can use ndConvertFromPhys to convert the physical value to the byte stream by filling an appropriate typeDescriptor struct ndConvertFromPhys converts only the portion specified by one type descriptor to a binary representation If y
Download Pdf Manuals
Related Search
Related Contents
Audiovox PG300 User's Manual Cisco UCS-EZ7-C220-E server J.R. Simplot Innate™ Screening Test SERVICE MANUAL 取扱説明書 Canon Digital Rebel XT Instruction Manual for Macintosh PDFファイル 1 scarica il manuale Copyright © All rights reserved.
Failed to retrieve file