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.

MSPBSL: What is the correct way to determine the CRC checksum

Part Number: MSPBSL

Dear Sir/Madam

I am using the MSPBSL_Scripter (3_04_00_01) together with the Olimex BSL Rocket to program an MSP430F5xx. To verify the download, I would like to execute following command sequence at the end of my script:

CRC_CHECK {ADDRESS} {LENGTH} {EXPECTED}

However I do not know how to correctly determine the CRC checksum of my firmware image. How can calculate the three parameters "address", "length" and "expected" for a firmware image? I assume there is some standard procedure how to do this. Is there a tool which can do this?

Thanks a lot for your help.

Best regards,
Philippe

  • Hello Philippe,
    the "address" is the start address of the section to be programmed, the "length" is the number of bytes of the to be programmed block.
    The CRC algorithm used, is the same as the one of the MSP430 CRC module.

    For CRC module, we have two types of register for the input register:
    • CRCDI as CRC data in and
    • CRCDIRB as CRC Data in Reverse Byte

    In BSL communication we insert the input byte into the CRCDIRB_L instead of the CRCDI_L.

    In PC side CRC is defined as 16bit data and initialized by 0xFFFF:

    void Util::resetCrc()
    {
    crc = 0xFFFF;
    }

    void Util::checkSumCalculate(uint8_t data)
    {
    uint8_t x;
    x = ((crc >> 8) ^ data) & 0xff;
    x ^= x >> 4;
    crc = (crc << 8) ^ (x << 12) ^ (x << 5) ^ x;
    }

    uint16_t Util::retCrc()
    {
    return crc;
    }

    Best regards
    Peter
  • Hi Peter

    Thank you very much for your thorough explanation. However I haven't planed to implement an own PC based program myself. I am just wondering what is the easiest way to determine "address", "length" and "expected checksum" for a give TXT/HEX file so that I can hand over these parameters to the BSL scripter. I am surprise if I would have to implement it myself. I assume some TI tool is able to do this?!

    Thanks a lot for your help and best regards,
    Philippe

  • Hello Philippe,
    my apologies for my late response. I have been sick the last few days.
    Coming back to your question on the tool, which would offer these parameters automatically, up to my information, with IAR, there would be a possibility in combination with the feature of creating a map file, to obtain information like that, but on the details, I would recommend you to a check this with support from IAR.
    On TI side unfortunately we do not have such a feature. Sorry for that inconvenience.

    Best regards
    Peter
  • Hi Peter

    No problem, I hope your are well again. Thanks for the information regarding IAR. I will check with them.

    Best regards,

    Philippe

**Attention** This is a public forum