Quantcast
Channel: MSP low-power microcontroller forum - Recent Threads
Viewing all articles
Browse latest Browse all 22002

MSP430F6659: Need help with CRC-16 calculation acc. to CCITT to communicate via TMS3705 to TMS37157

$
0
0

Part Number:MSP430F6659

Hello,

I'd like to calculate the CRC-16 acc. to CCITT to communicate via TMS3705 to TMS37157.

I have a working code just using shift operation.

I adopted this: https://en.wikipedia.org/wiki/Computation_of_cyclic_redundancy_checks, code fragment 5, shift register based division, LSB first and it works perfect.

The MSP430F6659 has a hardware CRC module and I'd like to use this, because it is the faster and more elegant solution.

This is the code I tested so far, but it didn't deliver the correct result in comparison to the software solution:

  unsigned int i, CRC_Result, CRC_Init = 0x3791;
  
  CRCRESR = CRC_Init;  // CRCINIRES = CRC_Init;
  for(i=0; i<length; i++)
  {
    CRCDIRB = string[i];
  }
  CRC_Result = CRCRESR;

  return(CRC_Result);

I try to use the reverse (see above) and the non reverse registers, but non of the version seem to work.

Please help

Kind regards

Gerd


Viewing all articles
Browse latest Browse all 22002

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>