Modbus master driver or code example

Hi,

Greetings of the day!!

I am using Colibri T20 module with colibri evaluation V3.1 board. I am looking for modbus implementation (both modbus master and master slave) as a part of project. Is there any library or code example available to get start. I did some searching for the same but didn’t found anything specific.
Please advice.

Thanks,
Paddy

Hi,

You could use libmodbus available under LPGL licence. Both master and slave are implemented, both RTU and TCP too.
The only missing file is stdint.h but you are able to include it in the SDK : everything is noticed in the git repository.

A while ago we wrote a small modbusTCP library for an internal WinCE demo. It is not production quality, but hopefully helps you to get a quick start.
You can download the source here:

Romain’s answer seems to be about a Linux based implementation.

Excuse the dumb question, but is libmodbus something that you have to cross-compile to get running on the imx7? I can obviously compile on the linux host machine, but think I’d need to cross-compile it. I’d like to use the module as either a master or slave.

thanks,
Dave

Dear @buchmeister
The modbusTCP library I posted is a VisualStudio project to be compiled on a Windows PC, therefore it needs cross compiling.
Please note you’re in the “WinCe” space of the community.
Regards, Andy