Showing results for 
Search instead for 
Did you mean: 

Help with modbus TCP/IP


Hello i'm currently working with the STM32F446RE and i need to implement the modbus tcp/ip protocol, im aware of the freemodbus library but i cant implement this to the stm32cubeide it is always telling me something is missing (like the port.h). It doesnt matter how many things i add to the libraries it always tell me something's missing and i dont know how to solve this.

I tried to implement step by step the modbus functions but i couldnt develop the write coils function so i tried searching for solutions and the freemodbus seemed like one but i have this issue.

Also im using the w5500. I hope someone can help me with this issue. Thank you.

Senior III

Hello CesarFA606

Welcome to the forum.

Are you able to make the W5500 operate over the network, i.e. can you ping your device.

Sometimes it is better to start with a less dificult step and then proceed step by step.

What kind of tools are you using on the PC side?


Chief II

What Pavel basically said - to develop software, one must be capable of... (Surprise, surprise!) understanding the code!

Pavel A.
Evangelist III

I didn't say that)) The OP asks for help, I've just pointed him to couple of places where one can get help. Of course someone on this forum may offer him help via private message.


Of course either one must learn it or pay to someone else. Still someone has to know the code and there is no way around it.

Hi, i can use the W5500 normally, establish connection, write/read data. I was able to make the part of the code that only needs Ethernet to work correctly, the detail is when I want to implement modbus, that is when the problems come when I want to integrate the freemodbus libraries.

To test the ethernet part i used SocketTest and looking for solutions i came across the Modbus Poll/Slave software but but I couldn't even start using it due to the problem of implementing the libraries.

Honestly i don't know why i cant add the libraries to the IDE.

Pavel A.
Evangelist III

Wait, wait. What is your problem? To implement a library or add a (ready, pre-compiled) library or add 3rd party source to the project? Have you found the place in the CubeIDE user manual which explains how to add a library to a project?

Hello CesarFA606

I hope you solved your problem by now.

If not, send me PM and I will share my own lib to do Modbus.

Happy New year.



i have a stm32f407vgt6  with embedded ethernet and chip dp83848cvv 

i can configure lwip and set ip and ping


but i  want to start modbus tcp/ip that control gpio output


but i don,t know what to do


please help me