Skip to main content
rtek
Associate II
September 6, 2018
Question

STM32 MODBUS

  • September 6, 2018
  • 6 replies
  • 35386 views

Im using nucleo stm32f103. Does a modbus library exist or how would one go on with using modbus? Could not find any tutorials online.

This topic has been closed for replies.

6 replies

AFras
Visitor II
September 6, 2018

MODBUS is a protocol over a physical layer be it Ethernet or a serial port. You need to handle that protocol. See the MODBUS protocol reference guide found here: http://modbus.org/docs/PI_MBUS_300.pdf

Andy

AvaTar
Senior III
September 6, 2018

I don't know of any free implementation for STM32 variants.

There are other free libs available though. You only need to write/rewrite the HAL layer (not to be confused with ST's Cube/HAL !!!). There had been requests here (in earlier incarnations of this forum), but I guess they ended up in proprietary implementations.

ASCII is easy, but the inter-character and inter-message timing for RTU needs a few thoughts.

Tesla DeLorean
Guru
September 6, 2018

>>Could not find any tutorials online.

I'll put that down to appallingly poor search skillz.

I was able to find videos and assorted online resources.

https://github.com/urands/stModbus

https://github.com/kiltum/modbus

https://github.com/eziya/STM32_HAL_FREEMODBUS_RTU

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
edugodori
Visitor II
January 31, 2019

Hello,

Modbus is a very simple protocol and the management of a TCP server (Is Modbus TCP what you need?) in embedded systems is tricky enough to bet for not using any standard Modbus library. I strongly recommend you to start with a simple TCP echo server (in the STM32CubeMX repository) and modify it to suit the Modbus specifications. I am using STM32F7+LwIP(Netconn API)+Freertos, so if you need more help let me know.

Best regards,

Eduard

YDrid.1
Visitor II
July 12, 2022

Hello @edugodori​ ,

thank you for sharing this information. In fact, I was able to communicate with my nucleo-f7 board with TCP/IP over ethernet. But now, I'm stuck to how to how to move from this step to a Modbus TCP library. I couldn't find anything helpful yet.

Any ideas ?

SSing.10
Associate III
October 31, 2021

Hi,

I am also working with the same thing - Modbus + TCP IP protocol to communicate and exchange data between the HMI and stm32f7 nucleo board(stm32f767zi).

I have tried many iterations on the example but unable to get it done properly, So I request you please let me know that which example is preferable for this communications processes.

I tried to searched out for the examples documentations for steps for config & usage but it is not available in the repository or on online to perform test with lwip examples.

So, I request you please share any information or document for Modbus Tcp ip communication with the stm32f767zi nucleo board & HMI module. Also which example is used for it - tcp client or tcp server ?

Thanks & Regards

SS

NSing.5
Associate III
November 30, 2021

Dear sir, have you succeeded with MODBUS communication problem. I'm trying to work on it maybe you experience can help to resolve issues