crc_banner

The Cyclic Redundancy Check (CRC) byte in a serial packet is used for error detection. The method covered in this post is identical to the Maxim/Dallas 1-wire devices called Dow CRC. This is done through the following formula:

dow_crc

Lucky for us, this data can be compressed to a simple Look Up Table (LUT) for efficient calculations in firmware. The LUT can be found below.

The C implementation found below uses the pre-calculated LUT above and cycles through the entire package until exhaustion.

References

Leave a Reply

Your email address will not be published. Required fields are marked *