cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 MODBUS

rtek
Associate II

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

7 REPLIES 7
AFras
Associate II

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
Lead

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.

>>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 Venmo Up vote any posts that you find helpful, it shows what's working..
edugodori
Associate

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

SSing.10
Associate II

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
Senior

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

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 ?