Part Number: MSPM0L1117
Other Parts Discussed in Thread: SYSCONFIG,
Hi E2E Team,
I am attempting to replicate the following CRCP settings from the MSPM0L1117 SysConfig:

As seen below, when using DL_CRCP_calculateBlock16 with data 0x0002 and size 0x02, the end result is 0x6070:

I need to replicate these results on a host MCU, but so far I have not been able to find the correct function and settings to make this a reality
#include <stdint.h>
#include <stdio.h>
/**
* Calculates the CRC-16/AUG-CCITT checksum for a given data buffer.
*
* Parameters:
* data: Pointer to the input data array.
* len: Length of the input data in bytes.
*
* Returns:
* The calculated 16-bit CRC checksum.
*/
uint16_t crc16_aug_ccitt(const uint8_t *data, size_t len) {
// Parameters for CRC-16/AUG-CCITT:
// Polynomial: 0x1021
// Initial value (seed): 0x0F1D
// Input data not reflected, output CRC not reflected, no final XOR.
uint16_t crc = 0x0F1D;
uint16_t polynomial = 0x1021;
for (size_t i = 0; i < len; ++i) {
crc ^= (uint16_t)(data[i] << 8); // XOR current byte with the high byte of CRC
for (int j = 0; j < 8; ++j) {
if (crc & 0x8000) {
crc = (crc << 1) ^ polynomial;
} else {
crc <<= 1;
}
}
}
return crc; // No final XOR operation
}
int main() {
//...
uint8_t input_data[] = {0x00, 0x02};
size_t data_len = sizeof(input_data);
uint16_t result = crc16_aug_ccitt(input_data, data_len);
//...
}
I have attempted different byte orders for both input_data and crc, but so far I have not been able to replicate a result of 0x6070. Can you please help determine what is incorrect or missing about my algorithm?
Thanks,
Ryan


