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.

[参考译文] MSP430F5418A:如何计算 MSP430 UART BSL 的 CRC 校验和?

Guru**** 2589275 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/949609/msp430f5418a-how-to-calculate-the-crc-checksum-for-msp430-uart-bsl

器件型号:MSP430F5418A

根据 BSL Scripter、CRC 可通过以下函数计算:

uint16_t 计算校验和(uint8_t data[]、uint16_t length)
{
uint16_t CRC = 0xFFFF;
uint8_t x;
uint16_t i=0;

对于(i= 0;i < length;i++){
X =((CRC >> 8)^ DATA[i])& 0xFF;
x ^= x >> 4;
CRC =(CRC << 8)^(x << 12)^(x << 5)^ x;
}

返回 CRC;
} 

将其应用于 TX BSL 版本命令、 完整命令为 :80 01 00 19 D0 ED

但文档中显示的正确命令是 :80 01 00 19 E8 62

您能否共享 MSP430F5xx UART BSL 主机的 CRC 计算代码?

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    你(们)好

    您可能使用了错误长度的 CRC 数据。 CRC 数据是从不是0x80形式的命令字节开始计算的。 对于 TXBSL 版本命令、用于计算 CRC 的数据仅为一个字节数据0x19。 您将得到 E8 62的 CRC 值  

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Gary、

    感谢您的澄清、它现在起作用了。