2025-07-10 3:37 AM
Hi,
I am currently working on integrating Modbus RTU communication using the STM32H747I-DISCO board. Unfortunately, I have not been able to find any official example code or reference implementation specific to this board.
I have already attempted to integrate the protocol using a sample code I put together, but it is currently not working as expected. I would greatly appreciate it if you could review the attached code and let me know if there are any issues or missing components.
If you also have a working example or any official reference for implementing Modbus RTU (ideally using UART, FreeRTOS, and the CM4 core), it would be extremely helpful.
Thank you in advance for your support.
Solved! Go to Solution.
2025-07-10 4:51 AM
Download seems not to work, probably an issue of ST's side.
Anyway, the Modbus protocol is not very widespread, except in the PLC niche.
Therefore, and because of limited bandwidth, there are not many implementations and examples.
However, there are quite a few open source implementation you can check out, many of them supporting Cortex M or similiar architectures.
You would only need to implement the HAL layer (UART transmission), the more abstract frame processing should require very little modification, if at all.
In other words, I would recommend to check out implementations not specifically for the STM32.
Somewhat critical is the 3.5 character inter-message break.
The implementation depends on the available features of the UART peripheral.
And, having dealt with Modbus some years ago, I witnessed that several commercial products did not stick to the specs very well. In short, I would tolerate inter-message breaks down to 2.5 characters long.
And second, many devices support baudrates beyond the upper limit of the specification, which is 38400bps.
2025-07-10 4:51 AM
Download seems not to work, probably an issue of ST's side.
Anyway, the Modbus protocol is not very widespread, except in the PLC niche.
Therefore, and because of limited bandwidth, there are not many implementations and examples.
However, there are quite a few open source implementation you can check out, many of them supporting Cortex M or similiar architectures.
You would only need to implement the HAL layer (UART transmission), the more abstract frame processing should require very little modification, if at all.
In other words, I would recommend to check out implementations not specifically for the STM32.
Somewhat critical is the 3.5 character inter-message break.
The implementation depends on the available features of the UART peripheral.
And, having dealt with Modbus some years ago, I witnessed that several commercial products did not stick to the specs very well. In short, I would tolerate inter-message breaks down to 2.5 characters long.
And second, many devices support baudrates beyond the upper limit of the specification, which is 38400bps.