ECU Measurement and Calibration Toolkit Help

Edition Date: October 2018

Part Number: 371602T-01

»View Product Info
Download Help (Windows Only)


Calculates the checksum of a data block in memory.


mcTypeStatus mcCalculateChecksum(
mcTypeTaskRef ECURefNum,
u32 BlockSize,
u8 *Data,
u8 TypeOfChecksum,
u8 *SizeOfChecksum,
u32 *Checksum);



ECURefNum is the task reference which links to the selected ECU. This reference is originally returned from mcECUSelectEx.


BlockSize determines the size of the block on which the checksum has to be calculated.



TypeOfChecksum specifies the type of the calculated checksum.


Data is a byte array over which the checksum calculation is performed.


SizeofChecksum returns the size in bytes of the calculated checksum.


Checksum is the calculated checksum.

Return Value

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

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


mcCalculateChecksum implements a checksum calculation over a given data block. The checksum algorithm is performed over a dedicated checksum function provided by a specific DLL. The name of the Checksum DLL is defined in the A2L data base and can be changed by the application by the mcSetProperty function using the mcPropECU_Checksum property.

If you are using the CCP protocol, TypeOfChecksum must be set to 0xFFh, since CCP only supports an external checksum DLL. If you are using XCP, the following values for TypeOfChecksum are defined in the XCP specification:

0x01XCP_ADD_11Add BYTE into a BYTE checksum, ignore overflows
0x02XCP_ADD_12Add BYTE into a WORD checksum, ignore overflows
0x03XCP_ADD_14Add BYTE into a DWORD checksum, ignore overflows
0x04XCP_ADD_22Add WORD into a WORD checksum, ignore overflows, blocksize must be modulo 2
0x05XCP_ADD_24Add WORD into a DWORD checksum, ignore overflows, blocksize must be modulo 2
0x06XCP_ADD_44Add DWORD into DWORD, ignore overflows, blocksize must be modulo 4
0x07XCP_CRC_16Refer to CRC error detection algorithms
0x08XCP_CRC_16_CITTRefer to CRC error detection algorithms
0x09XCP_CRC_32Refer to CRC error detection algorithms
0xFFXCP_USER_DEFINEDUser defined algorithm, in externally calculated function

For a detailed description of the checksum algorithm refer to the mcBuildChecksum command or the XCP Part 2 Protocol Layer Specification.

For more detailed information about CRC algorithms, please refer to:


Not Helpful