Hi,
I have a function in my application code which calculates the hash of the entire FRAM region of my chip. It is implemented in the code attached. If I were to have the same arguments to the BSL (namely, the start address being 0xf100 and the length being 1920 16bit words), is this an equivalent operation to what I have below?
Also what is the 16 bit polynominal used? I'm using 0x1021 for CRC16 CCITT, but I don't seem to get the same result.
// Address of the first and last word
#define FIRMWARE_START_ADDRESS FRAM_START
#define FIRMWARE_FRAM_SIZE 1920
static void CrcFirmware(void)
{
uint16_t i;
uint16_t* flash_ptr = (uint16_t*)FIRMWARE_START_ADDRESS;
// Write the first word in to initalize crc hardware
CRCINIRES = flash_ptr[0];
for (i = 1; i < FIRMWARE_FRAM_SIZE; i++)
{
CRCDI = flash_ptr[i];
}
// Save the result
firmware_crc = CRCINIRES;
}