-
Notifications
You must be signed in to change notification settings - Fork 201
Description
Hello,
I tried emelianov/modbus-esp8266@4.0.0-DEV and arduino-libraries/Ethernet@2.0.0 on Visual Studio/PlatformIO to program an ESP32 and a W5500 Ethernet module.
If I create an ethernet modbus server, and then try to do singular read/writes from a linux computer (with the command mbpool or modpool), the esp32 only responds to the first 8 queries, and then I get connection refused messages.
mbpoll: Connection failed: Connection refused.
Is it possible that the sockets remain open after the execution of the mbpool command? The only way for the esp32 to respond to modbus queries after the 8th query is to reset it.
minimal example code:
`
#include <SPI.h>
#include <Ethernet.h> // lib_deps = arduino-libraries/Ethernet@^2.0.0
#define SCK 18
#define MISO 19
#define MOSI 23
#define CS 26
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192, 168, 3, 177);
#include <ModbusEthernet.h> // lib_deps += emelianov/modbus-esp8266@^4.0.0-DEV
ModbusEthernet mbTCP;
void setup() {
SPI.begin(SCK, MISO, MOSI, -1);
Ethernet.init(CS);
Ethernet.begin(mac, ip);
delay(1000);
mbTCP.server();
mbTCP.addHreg(400,0);
}
void loop() {
mbTCP.task();
delay(50);
}
`
sample script for the linux computer:
for i in
seq 1 24; do mbpoll -0 192.168.3.177 -t4 -r400 0; echo $i; sleep 1; done
Is this an issue or am I forgeting something?
thank you.