You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+16-10Lines changed: 16 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,7 +30,8 @@ Change settings of your Arduino-based Modbus RTU to Modbus TCP/UDP gateway via w
30
30
- send Modbus request and recieve Modbus response
31
31
- scan Modbus slaves on RS485 interface
32
32
- queue (buffer) status
33
-
- error counters (stored in EEPROM)
33
+
- counters ("RTU Data", "Ethernet Data", "Modbus Statistics") are periodically saved to EEPROM (every 6 hours)
34
+
- unsigned longs are used, rollover of counters is synchronized
34
35
- content of the Modbus Status page is updated in the background (fetch API), javascript alert is shown if connection is lost
35
36
* optimized TCP socket management (web interface and Modbus TCP):
36
37
- gateway always listens for new web and Modbus TCP connections
@@ -57,6 +58,10 @@ Change settings of your Arduino-based Modbus RTU to Modbus TCP/UDP gateway via w
57
58
58
59
**Reboot**.
59
60
61
+
**EEPROM Health**. Keeps track of EEPROM write cycles (persistent, never cleared during factory resets)
62
+
63
+
**Ethernet Sockets**. Max number of usable sockets. See Limitations bellow. One socket is reserved for Modbus UDP, remaining sockets are shared between Modbus TCP and WebUI.
64
+
60
65
**Generate New MAC**. Generate new MAC address. First 3 bytes are fixed 90:A2:DA, remaining 3 bytes are true random.
@@ -73,7 +78,7 @@ Change settings of your Arduino-based Modbus RTU to Modbus TCP/UDP gateway via w
73
78
74
79
**Requests Queue**. Monitors internal request queue (buffer). The limits for bytes and for the number of requests stored in the queue can be configured in advanced settings.
75
80
76
-
**Modbus Statistics**. Counters for various errors. Counters are periodically saved to EEPROM. Insigned longs are used, rollover of counters is synchronized:
81
+
**Modbus Statistics**.
77
82
***Slave Responded**. Slave responded with a valid Modbus RTU response within response timeout.
78
83
***Slave Responded with Error (Codes 1~8)**. Slave responded, but with an error. For the list of error codes see https://en.wikipedia.org/wiki/Modbus#Exception_responses.
79
84
***Gateway Overloaded (Code 10)**. Request queue is full (either the number of bytes stored or the number of requests stored). Request was dropped and the gateway responded with an error code 10.
@@ -148,14 +153,15 @@ Get the hardware (cheap clones from China are sufficient) and connect together:
148
153
***Arduino Nano, Uno or Mega** (and possibly other). On Mega you have to configure Serial in advanced settings in the sketch.
149
154
***W5100, W5200 or W5500 based Ethernet shield**. The ubiquitous W5100 shield for Uno/Mega is sufficient. If available, I recommend W5500 Ethernet Shield. !!! ENC28J60 will not work !!!
150
155
***TTL to RS485 module**:
151
-
- with hardware automatic flow control (recommended, available on Aliexpress)<br>
152
-
Arduino <-> Module<br>
153
-
Tx1 <-> Tx<br>
154
-
Rx0 <-> Rx
155
-
- with flow controlled by pin (such as MAX485 module)<br>
156
-
Arduino <-> MAX485<br>
157
-
Tx1 <-> DI<br>
158
-
Rx0 <-> RO<br>
156
+
- recommended: TTL to RS485 module with hardware automatic flow control (available on Aliexpress)<br>
157
+
Arduino <-> Module
158
+
Tx1 <-> Tx
159
+
Rx0 <-> Rx<br>
160
+
161
+
- not recommended: MAX485 module with flow controlled by pin (works but is vulnerable to burn outs)<br>
// if (W5100.readSnSR(sock) == SnSR::ESTABLISHED && W5100.readSnDPORT(sock) == myHeader.remPort) { // Check remote port should be enough or check also rem IP?
192
-
if (W5100.readSnSR(sock) == SnSR::ESTABLISHED) { // Check remote port should be enough or check also rem IP?
191
+
if (W5100.readSnSR(sock) == SnSR::ESTABLISHED && W5100.readSnDPORT(sock) == myHeader.remPort) { // Check remote port should be enough or check also rem IP?
193
192
if (localConfig.enableRtuOverTcp) client.write(PDU, pduLength);
194
193
else {
195
194
client.write(MBAP, 6);
196
195
client.write(PDU, pduLength - 2); //send without CRC
197
196
}
198
197
#ifdef ENABLE_EXTRA_DIAG
199
-
ethTxCount += pduLength;
200
-
if (!localConfig.enableRtuOverTcp) ethTxCount += 4;
198
+
ethCount[DATA_TX] += pduLength;
199
+
if (!localConfig.enableRtuOverTcp) ethCount[DATA_TX] += 4;
201
200
#endif/* ENABLE_EXTRA_DIAG */
202
201
} // TODO TCP Connection Error
203
-
} // else SCAN_REQUEST (no ethTxCount, but yes delete request)
202
+
} // else SCAN_REQUEST (no ethCount[DATA_TX], but yes delete request)
0 commit comments