2024-10-22 08:27 AM
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?
2024-10-22 09:27 AM
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
2024-10-22 09:35 AM
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!
2024-10-22 10:47 AM - edited 2024-10-22 11:59 AM
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.
2024-10-22 11:00 AM
Appreciated, I check and let you know. Thanks