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.

[参考译文] MSP430FR2355:我能否获得一个标准 CRC16 示例、根据特定协议的校验值来验证自身?

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

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/1642029/msp430fr2355-can-i-get-a-standard-crc16-example-that-verifies-itself-against-the-check-value-of-a-specific-protocol

器件型号: MSP430FR2355

我在使 CRC 模块正常工作时遇到问题。 我不需要代码审核、只是 CRC 的一个实际示例、它会为其实现的任何协议返回有效校验值(CRCing “123456789"的“的结果的结果,不带空终止符)。

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

    很久以前,有一次,我创建了三种方式的代码。 借助此实用标题:

    /*
      CRC routines.
    
      Some MSP430 devices have CRC hardware to help. That hardware produces
      results identical to this only if the data is written to the reverse
      bit order input register CRCDIRB. Results are in the normal bit order
      register CRCINIRES. Go figure.
    
      Two versions are available to trade space for time. The iterative and
      slower version is the default but a faster table version is used
      if CRCTABLE is defined. That requires a large (512 bytes) table.
    
      When compiled with "msp430-gcc -c -O2" the code size is:
    
      Table:     592
      Iterative: 120
      Hardware:   44
    
      If the target device has the CRC hardware then that is used. If the
      hardware is used the crc parameteris ignored. When hardware support is
      available all this file provides is the routine to process a string of
      data. If that isn't required, just use crc16.h and the macros will do
      the work.
    
      When tested with the usual test string of "123456789" all versions return
      0x29B1.
    
     */
    
    

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

    有趣的是、我确实发现并实施了小的“双反“要求、但我仍然有问题。 您生成 0x29B1 的协议参数是什么、以便我有一个基线、我可以从中实现 X25。  

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

    只是澄清一下、这是一个完全反射的位流、还是该位反转、但字节顺序相同?

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

    可以将数据一次填充到一个字节的 CRCDIRB_L 中。 订单中的订单。

    Insert:代码编辑器的东西让我再次麻烦所以...

    首先将 CRCINIRES 初始化为 0xFFFF。

    将数据字节写入 CRCDIRB_L  

    从 CRCINIRES 读取结果。

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

    问题已解决、我也在得到校验和的反映、但我假设本模块的怪异性意味着这就是它的样子。  

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

    为了进行记录、Greg Cook 提供了一组 CRC 算法列表、其结果为“123456789",“,因此、因此您可以查看算法基于生成的校验和执行的操作

    https://reveng.sourceforge.io/crc-catalog/16.htm