This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430FR2476: MSP430FR2476 BSL CRC calculation

Part Number: MSP430FR2476

Good morning,
I'm looking for how CHK and CHL are calculated in BSL commands?
In SLAU319AF, it is specified:
CHECKSUM = INV [ (B1 + 256 × B2) XOR (B3 + 256 × B4) XOR … XOR (Bn–1 + 256 × Bn) ]
gold
CKL = INV [ B1 XOR B3 XOR … XOR Bn–1 ]
CKH = INV [ B2 XOR B4 XOR … XOR Bn ].
For the order:
TX_BSL_VERSION
[80] [01] [00] [19] [e8] [62]
<80> <05> <00> <3a> <00> <09> <36> <b5> <90> <9d>
Vendor:[TI] CI:[09] API:[36] PI:[B5]
The calculation gives:
CKL = NOT(0x80 XOR 0x00 XOR 0x00 XOR 0X36) = NOT(0XB6) = 0x49.
And
CKH = NOT(0x05 XOR 0x3A XOR 0x09 XOR 0XB5) = NOT(0X83) = 0x7C.
The BSL Scripter gives for this command CKL = 0x90 and CKH = 0x9D.
What is the explanation?
Thanks in advance.

  • If you are using an FRAM device, you're referring to the incorrect User Guide. It's not clearly stated, but you need to be referencing the BSL User's Guide for FRAM devices (SLAU550).

    See this thread for calculating the checksum.

  • Hi Seth,

    thank you for your reply.
    The CRC should be calculated only with the grayed data for each order.


    In this case (TX BSL Version):
    TX_BSL_VERSION
        [80] [01] [00] [19] [e8] [62]
        <80> <05> <00> <3a> <00> <09> <36> <b5> <90> <9d>
        Vendor:[TI] CI:[09] API:[36] PI:[B5]

    unsigned char StingTest[] = {0x3A,0x00,0x09,0x36,0xB5};

    uint16_t calculateCRC16CCITTFALSEChecksum(unsigned char *byteBuffer, unsigned int numChars)
    {
        int i = 0;
        int j = 0;
        uint16_t checksum = 0xFFFF;    
        
        for(i = 0; i < numChars; i++)
        {        
            checksum ^= (byteBuffer[i] << 8);
            for(j = 0; j < 8; j++)
            {
                if(checksum & 0x8000)
                {
                    checksum <<= 1;
                    checksum ^= 0x1021;//Represents the x^15 + x^12 + x^5 + 1 polynomial
                }
                else
                    checksum <<= 1;
            }
        }

    }

    CRC = calculateCRC16CCITTFALSEChecksum(StingTest, 5) = 0x9D90
    For each order, the data to be used for the CRC calculation are grayed out in the SLAU550AB guide.
    thank

**Attention** This is a public forum