cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F446RE CRC mismatch

FShah.1
Associate III

Hi, I am following a video to write a bootloader that transfers the application code serially into the STM32F446 controller. The video originally presents the STM32F7xx series controller, but I am applying it to the F4xxx series. I have modified the code as needed, such as assigning the proper flash areas for the bootloader and application code. See the GitHub link for this tutorial.

https://github.com/Embetronicx/STM32-Bootloader/tree/ETX_Bootloader_3.0/Bootloader_Example

This link also provides a PC tool that transfers the code from the host to the controller once the handshaking is complete.

What are the recommendations if I want to calculate the CRC32 on a PC that matches the CRC32 calculated on the STM32F446 using HAL_CRC_Calculate()?

My code gives 0x08b329c8 and host calculated CRC is 0x4e08bfb4?

4 REPLIES 4

So posted three times on this topic.

STM32's standard algo operates on whole 32-bit words, in a right shifting word sense, which is not normative for little-endian platforms. See my code here

https://github.com/cturvey/RandomNinjaChef/blob/main/stm32crc.c

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

@Tesla DeLorean 

Thank you for your response. I appreciate all the work done by community members, when I see a useful and understandable post, I add my question.

Should I use the code you linked on the host to calculate the CRC? Sorry if I'm asking a simple question!

Well, I'd start with your test pattern to affirm the calculation on PC vs the one you've got on the STM32

Most on-line calculators use more normative byte-wise computations.

On the F4 the CRC peripheral has a fixed form, which is 32-bit words. You can use the code to compute the equivalent for word aligned / word length multiples.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Appreciated, I check and let you know. Thanks