Comments (2)
Hello @Abolohit, thanks for your comment. I'm not convinced yet that the issues are caused by a bug in this package. Could you provide more info?
-
Are you using Modbus TCP or Modbus RTU? In case of the latter, noise on the serial line could cause the issues you describe.
-
Can you provide a some code that cause issues? And would it be possible to provide logs that show the faulted frames? A pcap file created with Wireshark would be great.
-
Can you verify the behavior with another modbus master? Does the slave receives faulted frames too?
from umodbus.
I am using Modbus TCP.
The slave recieves the faulted frames. I am actually sending a IP address to the slave by taking a ip address string and breaking it into 4 integers, then writing those 4 integers to holding registers on the slave.
If I use the write multiple registers and send the 4 integers, the last integer(4th) becomes a random number.
If I use write multiple registers and send only the first 3 integers and then send the 4th integer separately using write single register, only then I am able to recieve the complete IP Address accurately on my slave.
My goal is to send an IP Address to the slave using Modbus TCP, which then gets stored in the holding registers of the slave for future use.
Here is a part of my code.
sock2 = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock2.settimeout(1)
try:
sock2.connect((ip_addr.value, 502))
override_ip = tcp.write_multiple_registers(slave_id=1, starting_address=30, values=[ip1, ip2, ip3, ip4])
response = tcp.send_message(override_ip, sock2)
sock2.close()
except socket.timeout:
app.error("Timeout", "Check validity of entered IP Address or network connection")
This was my initial attempt at sending the ip address, ip4 fails to be recieved at the slave accurately.
I had to use this work around:
sock2 = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock2.settimeout(1)
try:
sock2.connect((ip_addr.value, 502))
override_ip = tcp.write_multiple_registers(slave_id=1, starting_address=30, values=[ip1, ip2, ip3])
response = tcp.send_message(override_ip, sock2)
sock2.close()
except socket.timeout:
app.error("Timeout", "Check validity of entered IP Address or network connection")
sock3 = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock3.settimeout(1)
try:
sock3.connect((ip_addr.value, 502))
override_ip_last = tcp.write_single_register(slave_id=1, address=33, value=ip4)
response = tcp.send_message(override_ip_last, sock3)
sock3.close()
except socket.timeout:
app.error("Timeout", "Check validity of entered IP Address or network connection")
from umodbus.
Related Issues (20)
- TCP Server Modbus Timeout after disconnect and reconnect after some time. HOT 2
- Read Multiple Hosts HOT 2
- ServerDeviceFailureError: An unrecoverable error occurred. HOT 6
- How do you access the raw (bytes) response for decoding messages that aren't composed of 16-bit integers? HOT 2
- RTU client does not respect inter-frame delay
- uModbus on Raspberry Pi
- Duplicate statement at lines 1519-1520 in functions.py : self._values = values
- Online uModbus tcp server HOT 2
- How to stop server from example code? HOT 2
- Import Error: no module named 'logging' HOT 1
- Possible typo in functions.py HOT 4
- disable all error
- illegalDataAddressError while writing single or multiple registers TCP HOT 1
- Multiple slaves with RTU HOT 8
- Can i control if single or multiple Modbus payloads are in a single TCP frame? HOT 2
- Can this be used for Modbus sniffing? HOT 2
- Redundancy Check issues HOT 4
- Compatiblility with MicroPython HOT 1
- Simple TCP server example does not work, always returns error HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from umodbus.