"Operation now in progress" error

790 views
Skip to first unread message

Daniel Moreau

unread,
Oct 7, 2020, 3:57:37 PM10/7/20
to libmodbus
Hello,

I'm trying to implement libmodbus on a raspberry pi to act as a client. Currently, I'm having some difficulty with establishing a TCP connection. I have Kepware running on a Windows 10 laptop which continuously polls for data from the Pi's IP address. They are both connected wirelessly to a router.

The line of code I have to connect to the laptop is:
modbus_t *mbp = modbus_new_tcp("<IP address of Laptop>", 502);

I have a few lines of error handling code after this, and I get the error:
Connection failed: Operation now in progress

What does this error mean, and how can I fix it?

Regards,


Daniel

Chuck Watson

unread,
Oct 7, 2020, 4:15:00 PM10/7/20
to libm...@googlegroups.com

First, in the situation you describe in code, you have both the laptop (Kepware) and Pi(Client??) as MASTER devices. One of them needs to be a SLAVE device.

 

The SLAVE does not need the address of the MASTER as you show in your code snippet.

 

If you are just starting with libmodbus, I suggest you start by programming a MASTER to a known SLAVE device and get that working. Jumping to programing a SLAVE device is a big jump in complexity.

 

Unintuitively, programming a MASTER is a LOT simpler than programming a SLAVE device. Also, the SLAVE examples are overly complex in my opinion so you need some libmodbus experience first.

 

Chuck Watson BS, CEM, CMVP

Direct USA 724-799-1529

--
Vous recevez ce message, car vous êtes abonné au groupe Google Groupes "libmodbus".
Pour vous désabonner de ce groupe et ne plus recevoir d'e-mails le concernant, envoyez un e-mail à l'adresse libmodbus+...@googlegroups.com.
Cette discussion peut être lue sur le Web à l'adresse https://groups.google.com/d/msgid/libmodbus/6db56607-18a6-4a08-9fd0-9c85fde942edn%40googlegroups.com.

image001.gif

Daniel Moreau

unread,
Oct 7, 2020, 4:42:58 PM10/7/20
to libmodbus
I see, thank you for clarifying that. I'll try to configure the setup to make it so that Kepware is the slave and the Pi is the master. Hopefully that will make the programming easier and quicker, which is very important as I try to get going on this senior project.

Also, I noticed that in Kepware you configure the slave ID, does this require any configuration on the Pi side? Perhaps the modbus_set_slave() command?


Daniel

Reply all
Reply to author
Forward
0 new messages