cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H7 Flash-embedded CRC HW calculation

Michel Solecki
Associate II

We are using a STM32H7 microcontroller for our project ans would like to use the HW CRC embedded in the Flash module.

We are designing a custom bootloader that will calculate the CRC and then write it in a reserved section of the flash. Since the device operates in a noisy environment, a lot of error can be introduced on the communication line and we need to make sure that the data written is valid before writing the CRC.

This means that we need to calculate the CRC ahead of time at build time. I have tried multiple variations of the algorithm and have not been able to figure out which algorithm or initial values are used to calculate the CRC.

I have tried using the HW CRC to try to determine which settings and initial values the CRC algorithm uses, however, I had no success;

As a starting point I have tried calculating the CRC on 4 bytes, however, the burst size is larger than this size. Is it okay to compute the CRC on a data sample smaller than the smalled burst size?

Is there any way I can find the algorithm used by the Flash CRC?

The reference manual states that the polynomial used is the Ethernet polynomial: 0x4C11DB7

If it's a standard algorithm, which initial value should I use?

Should I be performing byte, half-word or word operations?

Should I be using bit invesion?

All help is very appreciated.

Regards,

Michel

0 REPLIES 0