HAL library 10- CRC for STM32Fxxx

STM32Fxxx devices have CRC (Cyclic Redundancy Check) module inside. This is small and useful unit when working with communications. It might become very useful to verify if your packet of data is correct.

STM32Fxxx devices uses “Ethernet” CRC with polynomial below:

X32 + X26 + X23 + X22 + X16 + X12 + X11 + X10 +X8 + X7 + X5 + X4 + X2 + X +1

It is quite ugly 😀 Well, using this module is very easy. I’ve made some functions to calculate CRC from block of data.


Read more about new HAL libraries


  • Calculate CRC data from 8-bit data block
  • Calculate CRC data from 16-bit data block
  • Calculate CRC data from 32-bit data block


  • HAL
  • TM
    • STM32Fxxx HAL
    • defines.h

Functions and enumerations


Project is available on my Github, download all libraries below.


Owner of this site. Application engineer, currently employed by STMicroelectronics. Exploring latest technologies and owner of different libraries posted on Github.

You may also like...

Read before commenting!

Before you make a new comment, make sure you agree with things listed below:

  • - Read post to make sure if it is already posted what you are asking for,
  • - Make sure you have the latest version of libraries used in your project,
  • - Make a clean and grammatically correct written message,
  • - Report as many details as possible, including what have you done so far,
  • - Do NOT post any code here. Use Pastebin,
  • - Do NOT post any error codes here. Use Pastebin,
  • - Specify STM32Fxxx family and used Discovery/EVAL/Nucleo or custom made board,
  • - Make sure your clock is set correct for PLL,
  • - If you are using my HAL drivers, please check this post how to start.
Comment will be deleted on breaking these rules without notification!