Part Number: MSP430FR2476
Tool/software: Code Composer Studio
Hello,
I'm trying to verify the TLV CRC on an MSP430FR2476. I found this other thread for the 2422:
It looks like the solution was the CRC end address had to be changed because it was incorrect in the data sheet. Here are the values in the 2476 data sheet:
Which don't match the ones in msp430fr2476.h:
#define TLV_CRC_START (0x1A04) /* Start Address of the CRC protected structure */
#define TLV_CRC_END (0x1A77) /* End Address of the TLV protected structure */
I've tried both values, and others, in my code but get a failure each time:
#define BYTE_SIZE_BITS 8 /**< Number of bits in a byte. */
#define CRC_INIT 0xFFFF
static bool validateTLV(void) {
bool checkRes = false;
UINT16 calculatedCrc = 0;
UINT16 i = 0;
UINT16 readWord = 0;
// Declare pointer to access CRC value
UINT8 * pCrcValueAddr = (UINT8 *)(TLV_CRC_VALUE);
// Get the CRC stored in the TLV register for comparison
UINT16 crcValue = (*pCrcValueAddr << BYTE_SIZE_BITS) |
*(pCrcValueAddr+1);
// Calculate the CRC
CRCINIRES = CRC_INIT; // Init CRC with 0xFFFF
// Go through the TLV CRC address range
for (i = TLV_CRC_START; i < TLV_CRC_END; i += 2)
{
readWord = *(UINT16*) i;
CRCDIRB = readWord;
};
calculatedCrc = CRCINIRES;
if( calculatedCrc == crcValue ) {
checkRes = true;
}
else {
checkRes = false;
}
return checkRes;
}
I've also been checking for bit/byte order mismatches. Here's what my TLV looks like in memory:
Thanks for any help!