Now I’m trying to send a modbus request through the lib modbus, but then nothing is sent on the RS485 side, and I receive a Connection Reset By Peer error.
This is the shortest C program that trigger the error (I’m omitting error checking for brevity).
#include <modbus/modbus-tcp.h>
int main(int argc, char** argv) {
uint16_t buf[256];
modbus_t *ctx;
Output:
$ ./mdb_test
Connecting to 192.168.11.100:5000
[00][01][00][00][00][06][02][03][00][01][00][01]
Waiting for a confirmation…
ERROR Connection reset by peer: read
With Wireshark I noticed a Malformed Packet Error, but I don’t know if it’s the cause. (I can’t include a screenshot because new users are allowed to send only one image)
I can’t figure out if there is something wrong on the configuration, on the C program or on the expectations.
Hi Mason, I’m working on the same project as Emanuele.
We don’t understand why the WIX550 is resetting the communication.
As you see we tested the Master you suggested (Modbus Poll) and also another Master we’re using successfully with a different adapter (Moxa Modbus Gateway MGate MBxxxx).
Probably there is a configuration that we overlooked. Is there any difference we should consider while moving from Moxa to WIX?
We did some progress, doing multiple testing, we found out there is a critical timing between the connection and the sending of the first Modbus request.
If we send the request right after the connection, we get the “malformed packet”
If we connect, and do nothing afterwards, the WIZ keeps the connection alive for 5", and then disconnects
If we connect, wait 1" and send a Modbus request, Wiz disconnects right after the request
The Modbus request is well formed, we sniffed it with Wireshark
We keep track of connection/disconnection by looking at the green LED.
Is this the expected behavior? I would say no, since Wiz is a Modbus slave (AKA Server) and therefore it’s connection must be kept alive forever and listening for incoming requests.
Maybe we have to configure some timeout/keepalive parameter?