Thursday, January 21, 2010

Doing CRC

Some hints to answere the (presently unasked) question of whether the CRC algoritm being used is correct.

This page gives the background, with examples of how to compute CRC using loops (but not lookup tables), and seems to explain differences between three different CRC types, CRC-CCITT, CRC-16 and CRC-32:

http://www.netrino.com/Embedded-Systems/How-To/CRC-Calculation-C-Code

This forum page has discussions of CRC16, something called "Modbus Protocol", and "small table CRC".

http://www.cygnal.org/ubb/Forum1/HTML/002774.html

Here's the example for "small table CRC". Not sure what this means but it's neat:

http://wiki.wxwidgets.org/Development:_Small_Table_CRC

This page shows how to do a lookup-table CRC16 algorithm in the same way that the C program does it, thus at least answering the question the program. It also has a widget on top that will generate CRCs for strings on the fly, and below the CRC16 code it has a lookup-table example for CRC32. I just realized that the conding examples seem to be in VHDL:

http://www.efg2.com/Lab/Mathematics/CRC.htm

Here's some code for a CRC32 algorithm using a lookup table. The table seems to agree with the CRC32 example above:

http://www.naaccr.org/standard/crc32/crc32.c

This page talks about implementing CRC16 using 4-bit processing. Whoa.

http://www.digitalnemesis.com/info/codesamples/embeddedcrc16/