Skip to main content
mh2
Associate III
August 9, 2021
Question

Modbus RTU crc calculation- STM32F407

  • August 9, 2021
  • 2 replies
  • 1494 views

Hi everybody,

First, I'm sorry for my poor English.

I'm using STM32F407VET6 and I want to calculate 16bit CRC of Modbus RTU. Can anybody help me how I can use hardware CRC of the STM32F407? Is it possible to use hardware crc for modbus rtu? Or should I use software calculation?

Thanks

This topic has been closed for replies.

2 replies

waclawek.jan
Super User
August 9, 2021

> Is it possible to use hardware crc for modbus rtu?

No, the hardware CRC in 'F407 has a fixed 32-bit data width and a fixed polynome. In newer STM32 there is a more flexible CRC unit, but not in the 'F4.

JW

mh2
mh2Author
Associate III
August 10, 2021

Thanks so much

Tesla DeLorean
Guru
August 9, 2021

Needs to be software on the F4, here are some examples of software/hardware implementations I built for the F3 years back.

The software methods can be compact and fast.

https://community.st.com/s/contentdocument/0690X0000060JWXQA2

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
mh2
mh2Author
Associate III
August 10, 2021

Thank you, I investigated your code and I have a few questions:

what is the difference between for example CRC_MODBUS16SlowBlock() and CRC_CRC16SlowBlock?

and the difference between CRC_MODBUS16SlowBlock() and CRC_MODBUS16QuickBlock() for example? Are they have different results? and if the results are different, which one should i use?

Thanks again Tesla DeLorean.